1. 16 Feb, 2020 10 commits
    • Brett Creeley's avatar
      ice: Fix virtchnl_queue_select bitmap validation · 24e2e2a0
      Brett Creeley authored
      Currently in ice_vc_ena_qs_msg() we are incorrectly validating the
      virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and
      tx_queue bitmap is being compared against ICE_MAX_BASE_QS_PER_VF, but
      the problem is that these bitmaps can have a value greater than
      ICE_MAX_BASE_QS_PER_VF. Fix this by comparing the bitmaps against
      BIT(ICE_MAX_BASE_QS_PER_VF).
      
      Also, add the function ice_vc_validate_vqs_bitmaps() that checks to see
      if both virtchnl_queue_select bitmaps are empty along with checking that
      the bitmaps only have valid bits set. This function can then be used in
      both the queue enable and disable flows.
      
      Arkady Gilinksky's patch on the intel-wired-lan mailing list
      ("i40e/iavf: Fix msg interface between VF and PF") made me
      aware of this issue.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      24e2e2a0
    • Brett Creeley's avatar
      ice: Fix and refactor Rx queue disable for VFs · e1fe6926
      Brett Creeley authored
      Currently when a VF driver sends the PF a request to disable Rx queues
      we will disable them one at a time, even if the VF driver sent us a
      batch of queues to disable. This is causing issues where the Rx queue
      disable times out with LFC enabled. This can be improved by detecting
      when the VF is trying to disable all of its queues.
      
      Also remove the variable num_qs_ena from the ice_vf structure as it was
      only used to see if there were no Rx and no Tx queues active. Instead
      add a function that checks if both the vf->rxq_ena and vf->txq_ena
      bitmaps are empty.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e1fe6926
    • Brett Creeley's avatar
      ice: Handle LAN overflow event for VF queues · 2309ae38
      Brett Creeley authored
      Currently we are not handling LAN overflow events. There can be cases
      where LAN overflow events occur on VF queues, especially with Link Flow
      Control (LFC) enabled on the controlling PF. In order to recover from
      the LAN overflow event caused by a VF we need to determine if the queue
      belongs to a VF and reset that VF accordingly.
      
      The struct ice_aqc_event_lan_overflow returns a copy of the GLDCB_RTCTQ
      register, which tells us what the queue index is in the global/device
      space. The global queue index needs to first be converted to a PF space
      queue index and then it can be used to find if a VF owns it.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      2309ae38
    • Brett Creeley's avatar
      ice: Fix implicit queue mapping mode in ice_vsi_get_qs · 39066dc5
      Brett Creeley authored
      Currently in ice_vsi_get_qs() we set the mapping_mode for Tx and Rx to
      vsi->[tx|rx]_mapping_mode, but the problem is vsi->[tx|rx]_mapping_mode
      have not been set yet. This was working because ICE_VSI_MAP_CONTIG is
      defined to 0. Fix this by being explicit with our mapping mode by
      initializing the Tx and Rx structure's mapping_mode to
      ICE_VSI_MAP_CONTIG and then setting the vsi->[tx|rx]_mapping_mode to the
      [tx|rx]_qs_cfg.mapping_mode values.
      
      Also, only assign the vsi->[tx|rx]_mapping_mode when the queues are
      successfully mapped to the VSI. With this change there was no longer a
      need to initialize the ret variable to 0 so remove that.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      39066dc5
    • Brett Creeley's avatar
      ice: Add support to enable/disable all Rx queues before waiting · 13a6233b
      Brett Creeley authored
      Currently when we enable/disable all Rx queues we do the following
      sequence for each Rx queue and then move to the next queue.
      
      1. Enable/Disable the Rx queue via register write.
      2. Read the configuration register to determine if the Rx queue was
      enabled/disabled successfully.
      
      In some cases enabling/disabling queue 0 fails because of step 2 above.
      Fix this by doing step 1 for all of the Rx queues and then step 2 for
      all of the Rx queues.
      
      Also, there are cases where we enable/disable a single queue (i.e.
      SR-IOV and XDP) so add a new function that does step 1 and 2 above with
      a read flush in between.
      
      This change also required a single Rx queue to be enabled/disabled with
      and without waiting for the change to propagate through hardware. Fix
      this by adding a boolean wait flag to the necessary functions.
      
      Also, add the keywords "one" and "all" to distinguish between
      enabling/disabling a single Rx queue and all Rx queues respectively.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      13a6233b
    • Brett Creeley's avatar
      ice: Only allow tagged bcast/mcast traffic for VF in port VLAN · 72634bc2
      Brett Creeley authored
      Currently the VF can see other's broadcast and multicast traffic because
      it always has a VLAN filter for VLAN 0. Fix this by removing/adding the
      VF's VLAN 0 filter when a port VLAN is added/removed respectively.
      
      This required a few changes.
      
      1. Move where we add VLAN 0 by default for the VF into
      ice_alloc_vsi_res() because this is when we determine if a port VLAN is
      present for load and reset.
      
      2. Moved where we kill the old port VLAN filter in
      ice_set_vf_port_vlan() to the very end of the function because it allows
      us to save the old port VLAN configuration upon any failure case.
      
      3. During adding/removing of a port VLAN via ice_set_vf_port_vlan() we
      also need to remove/add the VLAN 0 filter rule respectively.
      
      4. Improve log messages.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      72634bc2
    • Brett Creeley's avatar
      ice: Fix Port VLAN priority bits · 61c9ce86
      Brett Creeley authored
      Currently when configuring a port VLAN for a VF we are only shifting the
      QoS bits by 12. This is incorrect. Fix this by getting rid of the ICE
      specific VLAN defines and use the kernel VLAN defines instead.
      
      Also, don't assign a value to vlanprio until the VLAN ID and QoS
      parameters have been validated.
      
      Also, there are many places we do (le16_to_cpu(vsi->info.pvid) &
      VLAN_VID_MASK). Instead do (vf->port_vlan_info & VLAN_VID_MASK) because
      we always save what's stored in vsi->info.pvid to vf->port_vlan_info in
      the CPU's endianness.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      61c9ce86
    • Brett Creeley's avatar
      ice: Add helper to determine if VF link is up · 0b6c6a8b
      Brett Creeley authored
      The check for vf->link_up is incorrect because this field is only valid if
      vf->link_forced is true. Fix this by adding the helper ice_is_vf_link_up()
      to determine if the VF's link is up.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0b6c6a8b
    • Brett Creeley's avatar
      ice: Refactor port vlan configuration for the VF · b093841f
      Brett Creeley authored
      Currently ice_vsi_manage_pvid() calls
      ice_vsi_[set|kill]_pvid_fill_ctxt() when enabling/disabling a port VLAN
      on a VSI respectively. These two functions have some duplication so just
      move their unique pieces inline in ice_vsi_manage_pvid() and then the
      duplicate code can be reused for both the enabling/disabling paths.
      
      Before this patch the info.pvid field was not being written
      correctly via ice_vsi_kill_pvid_fill_ctxt() so it was being hard coded
      to 0 in ice_set_vf_port_vlan(). Fix this by setting the info.pvid field
      to 0 before calling ice_vsi_update() in ice_vsi_manage_pvid().
      
      We currently use vf->port_vlan_id to keep track of the port VLAN
      ID and QoS, which is a bit misleading. Fix this by renaming it to
      vf->port_vlan_info. Also change the name of the argument for
      ice_vsi_manage_pvid() from vid to pvid_info.
      
      In ice_vsi_manage_pvid() only save the fields that were modified
      in the VSI properties structure on success instead of the entire thing.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b093841f
    • Brett Creeley's avatar
      ice: Add initial support for QinQ · 42f3efef
      Brett Creeley authored
      Allow support for S-Tag + C-Tag VLAN traffic by disabling pruning when
      there are no 0x8100 VLAN interfaces currently created on top of the PF.
      When an 0x8100 VLAN interface is configured, enable pruning and only
      support single and double C-Tag VLAN traffic. If all of the 0x8100
      interfaces that were created on top of the PF are removed via
      ethtool -K <iface> rx-vlan-filter off or via ip tools, then disable
      pruning and allow S-Tag + C-Tag traffic again.
      
      Add VLAN 0 filter by default for the PF. This is because a bridge
      sets the default_pvid to 1, sends the request down to
      ice_vlan_rx_add_vid(), and we never get the request to add VLAN 0 via
      the 8021q module which causes all untagged traffic to be dropped.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      42f3efef
  2. 14 Feb, 2020 24 commits
  3. 13 Feb, 2020 6 commits
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · b19e8c68
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "Summary below, but it's all reasonably straightforward. There are some
        more fixes on the horizon, but nothing disastrous yet.
      
        Summary:
      
         - Fix build when KASLR is enabled but CONFIG_ARCH_RANDOM is not set
      
         - Fix context-switching of SSBS state on systems that implement it
      
         - Fix spinlock compiler warning introduced during the merge window
      
         - Fix incorrect header inclusion (linux/clk-provider.h)
      
         - Use SYSCTL_{ZERO,ONE} instead of rolling our own static variables
      
         - Don't scream if optional SMMUv3 PMU irq is missing
      
         - Remove some unused function prototypes"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: time: Replace <linux/clk-provider.h> by <linux/of_clk.h>
        arm64: Fix CONFIG_ARCH_RANDOM=n build
        perf/smmuv3: Use platform_get_irq_optional() for wired interrupt
        arm64/spinlock: fix a -Wunused-function warning
        arm64: ssbs: Fix context-switch when SSBS is present on all CPUs
        arm64: use shared sysctl constants
        arm64: Drop do_el0_ia_bp_hardening() & do_sp_pc_abort() declarations
      b19e8c68
    • Linus Torvalds's avatar
      Merge tag 'gpio-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · 1d40890a
      Linus Torvalds authored
      Pull GPIO fixes from Linus Walleij:
      
       - Revert two patches to gpio_do_set_config() and implement the proper
         solution that works, also drop an unecessary call in set_config()
      
       - Fix up the lockdep class for hierarchical IRQ domains.
      
       - Remove some bridge code for line directions.
      
       - Fix a register access bug in the Xilinx driver.
      
      * tag 'gpio-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        gpio: sifive: fix static checker warning
        spmi: pmic-arb: Set lockdep class for hierarchical irq domains
        gpio: xilinx: Fix bug where the wrong GPIO register is written to
        gpiolib: remove unnecessary argument from set_config call
        gpio: bd71828: Remove unneeded defines for GPIO_LINE_DIRECTION_IN/OUT
        MAINTAINERS: Sort entries in database for GPIO
        gpiolib: fix gpio_do_set_config()
        Revert "gpiolib: remove set but not used variable 'config'"
        Revert "gpiolib: Remove duplicated function gpio_do_set_config()"
      1d40890a
    • David S. Miller's avatar
      Merge branch 'icmp-account-for-NAT-when-sending-icmps-from-ndo-layer' · 803381f9
      David S. Miller authored
      Jason A. Donenfeld says:
      
      ====================
      icmp: account for NAT when sending icmps from ndo layer
      
      The ICMP routines use the source address for two reasons:
      
      1. Rate-limiting ICMP transmissions based on source address, so
         that one source address cannot provoke a flood of replies. If
         the source address is wrong, the rate limiting will be
         incorrectly applied.
      
      2. Choosing the interface and hence new source address of the
         generated ICMP packet. If the original packet source address
         is wrong, ICMP replies will be sent from the wrong source
         address, resulting in either a misdelivery, infoleak, or just
         general network admin confusion.
      
      Most of the time, the icmp_send and icmpv6_send routines can just reach
      down into the skb's IP header to determine the saddr. However, if
      icmp_send or icmpv6_send is being called from a network device driver --
      there are a few in the tree -- then it's possible that by the time
      icmp_send or icmpv6_send looks at the packet, the packet's source
      address has already been transformed by SNAT or MASQUERADE or some other
      transformation that CONNTRACK knows about. In this case, the packet's
      source address is most certainly the *wrong* source address to be used
      for the purpose of ICMP replies.
      
      Rather, the source address we want to use for ICMP replies is the
      original one, from before the transformation occurred.
      
      Fortunately, it's very easy to just ask CONNTRACK if it knows about this
      packet, and if so, how to fix it up. The saddr is the only field in the
      header we need to fix up, for the purposes of the subsequent processing
      in the icmp_send and icmpv6_send functions, so we do the lookup very
      early on, so that the rest of the ICMP machinery can progress as usual.
      
      Changes v3->v4:
      - Add back the skb_shared checking, since the previous assumption isn't
        actually true [Eric]. This implies dropping the additional patches v3 had
        for removing skb_share_check from various drivers. We can revisit that
        general set of ideas later, but that's probably better suited as a net-next
        patchset rather than this stable one which is geared at fixing bugs. So,
        this implements things in the safe conservative way.
      
      Changes v2->v3:
      - Add selftest to ensure this actually does what we want and never regresses.
      - Check the size of the skb header before operating on it.
      - Use skb_ensure_writable to ensure we can modify the cloned skb [Florian].
      - Conditionalize this on IPS_SRC_NAT so we don't do anything unnecessarily
        [Florian].
      - It turns out that since we're calling these from the xmit path,
        skb_share_check isn't required, so remove that [Florian]. This simplifes the
        code a bit too. **The supposition here is that skbs passed to ndo_start_xmit
        are _never_ shared. If this is not correct NOW IS THE TIME TO PIPE UP, for
        doom awaits us later.**
      - While investigating the shared skb business, several drivers appeared to be
        calling it incorrectly in the xmit path, so this series also removes those
        unnecessary calls, based on the supposition mentioned in the previous point.
      
      Changes v1->v2:
      - icmpv6 takes subtly different types than icmpv4, like u32 instead of be32,
        u8 instead of int.
      - Since we're technically writing to the skb, we need to make sure it's not
        a shared one [Dave, 2017].
      - Restore the original skb data after icmp_send returns. All current users
        are freeing the packet right after, so it doesn't matter, but future users
        might not.
      - Remove superfluous route lookup in sunvnet [Dave].
      - Use NF_NAT instead of NF_CONNTRACK for condition [Florian].
      - Include this cover letter [Dave].
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      803381f9
    • Jason A. Donenfeld's avatar
      xfrm: interface: use icmp_ndo_send helper · 45942ba8
      Jason A. Donenfeld authored
      Because xfrmi is calling icmp from network device context, it should use
      the ndo helper so that the rate limiting applies correctly.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45942ba8
    • Jason A. Donenfeld's avatar
      wireguard: device: use icmp_ndo_send helper · a12d7f3c
      Jason A. Donenfeld authored
      Because wireguard is calling icmp from network device context, it should
      use the ndo helper so that the rate limiting applies correctly.  This
      commit adds a small test to the wireguard test suite to ensure that the
      new functions continue doing the right thing in the context of
      wireguard. It does this by setting up a condition that will definately
      evoke an icmp error message from the driver, but along a nat'd path.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a12d7f3c
    • Jason A. Donenfeld's avatar
      sunvnet: use icmp_ndo_send helper · 67c9a7e1
      Jason A. Donenfeld authored
      Because sunvnet is calling icmp from network device context, it should use
      the ndo helper so that the rate limiting applies correctly. While we're
      at it, doing the additional route lookup before calling icmp_ndo_send is
      superfluous, since this is the job of the icmp code in the first place.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Cc: Shannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67c9a7e1