1. 22 11月, 2021 1 次提交
  2. 18 11月, 2021 13 次提交
  3. 17 11月, 2021 1 次提交
  4. 16 11月, 2021 10 次提交
  5. 03 11月, 2021 5 次提交
    • B
      ice: Fix race conditions between virtchnl handling and VF ndo ops · e6ba5273
      Brett Creeley 提交于
      The VF can be configured via the PF's ndo ops at the same time the PF is
      receiving/handling virtchnl messages. This has many issues, with
      one of them being the ndo op could be actively resetting a VF (i.e.
      resetting it to the default state and deleting/re-adding the VF's VSI)
      while a virtchnl message is being handled. The following error was seen
      because a VF ndo op was used to change a VF's trust setting while the
      VIRTCHNL_OP_CONFIG_VSI_QUEUES was ongoing:
      
      [35274.192484] ice 0000:88:00.0: Failed to set LAN Tx queue context, error: ICE_ERR_PARAM
      [35274.193074] ice 0000:88:00.0: VF 0 failed opcode 6, retval: -5
      [35274.193640] iavf 0000:88:01.0: PF returned error -5 (IAVF_ERR_PARAM) to our request 6
      
      Fix this by making sure the virtchnl handling and VF ndo ops that
      trigger VF resets cannot run concurrently. This is done by adding a
      struct mutex cfg_lock to each VF structure. For VF ndo ops, the mutex
      will be locked around the critical operations and VFR. Since the ndo ops
      will trigger a VFR, the virtchnl thread will use mutex_trylock(). This
      is done because if any other thread (i.e. VF ndo op) has the mutex, then
      that means the current VF message being handled is no longer valid, so
      just ignore it.
      
      This issue can be seen using the following commands:
      
      for i in {0..50}; do
              rmmod ice
              modprobe ice
      
              sleep 1
      
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      
              sleep 2
      
              echo 0 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 0 > /sys/class/net/ens785f1/device/sriov_numvfs
              sleep 1
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      done
      
      Fixes: 7c710869 ("ice: Add handlers for VF netdevice operations")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e6ba5273
    • B
      ice: Fix not stopping Tx queues for VFs · b385cca4
      Brett Creeley 提交于
      When a VF is removed and/or reset its Tx queues need to be
      stopped from the PF. This is done by calling the ice_dis_vf_qs()
      function, which calls ice_vsi_stop_lan_tx_rings(). Currently
      ice_dis_vf_qs() is protected by the VF state bit ICE_VF_STATE_QS_ENA.
      Unfortunately, this is causing the Tx queues to not be disabled in some
      cases and when the VF tries to re-enable/reconfigure its Tx queues over
      virtchnl the op is failing. This is because a VF can be reset and/or
      removed before the ICE_VF_STATE_QS_ENA bit is set, but the Tx queues
      were already configured via ice_vsi_cfg_single_txq() in the
      VIRTCHNL_OP_CONFIG_VSI_QUEUES op. However, the ICE_VF_STATE_QS_ENA bit
      is set on a successful VIRTCHNL_OP_ENABLE_QUEUES, which will always
      happen after the VIRTCHNL_OP_CONFIG_VSI_QUEUES op.
      
      This was causing the following error message when loading the ice
      driver, creating VFs, and modifying VF trust in an endless loop:
      
      [35274.192484] ice 0000:88:00.0: Failed to set LAN Tx queue context, error: ICE_ERR_PARAM
      [35274.193074] ice 0000:88:00.0: VF 0 failed opcode 6, retval: -5
      [35274.193640] iavf 0000:88:01.0: PF returned error -5 (IAVF_ERR_PARAM) to our request 6
      
      Fix this by always calling ice_dis_vf_qs() and silencing the error
      message in ice_vsi_stop_tx_ring() since the calling code ignores the
      return anyway. Also, all other places that call ice_vsi_stop_tx_ring()
      catch the error, so this doesn't affect those flows since there was no
      change to the values the function returns.
      
      Other solutions were considered (i.e. tracking which VF queues had been
      "started/configured" in VIRTCHNL_OP_CONFIG_VSI_QUEUES, but it seemed
      more complicated than it was worth. This solution also brings in the
      chance for other unexpected conditions due to invalid state bit checks.
      So, the proposed solution seemed like the best option since there is no
      harm in failing to stop Tx queues that were never started.
      
      This issue can be seen using the following commands:
      
      for i in {0..50}; do
              rmmod ice
              modprobe ice
      
              sleep 1
      
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      
              sleep 2
      
              echo 0 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 0 > /sys/class/net/ens785f1/device/sriov_numvfs
              sleep 1
              echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
              echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
      
              ip link set ens785f1 vf 0 trust on
              ip link set ens785f0 vf 0 trust on
      done
      
      Fixes: 77ca27c4 ("ice: add support for virtchnl_queue_select.[tx|rx]_queues bitmap")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      b385cca4
    • S
      ice: Fix replacing VF hardware MAC to existing MAC filter · ce572a5b
      Sylwester Dziedziuch 提交于
      VF was not able to change its hardware MAC address in case
      the new address was already present in the MAC filter list.
      Change the handling of VF add mac request to not return
      if requested MAC address is already present on the list
      and check if its hardware MAC needs to be updated in this case.
      
      Fixes: ed4c068d ("ice: Enable ip link show on the PF to display VF unicast MAC(s)")
      Signed-off-by: NSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      ce572a5b
    • B
      ice: Remove toggling of antispoof for VF trusted promiscuous mode · 0299faea
      Brett Creeley 提交于
      Currently when a trusted VF enables promiscuous mode spoofchk will be
      disabled. This is wrong and should only be modified from the
      ndo_set_vf_spoofchk callback. Fix this by removing the call to toggle
      spoofchk for trusted VFs.
      
      Fixes: 01b5e89a ("ice: Add VF promiscuous support")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      0299faea
    • B
      ice: Fix VF true promiscuous mode · 1a8c7778
      Brett Creeley 提交于
      When a VF requests promiscuous mode and it's trusted and true promiscuous
      mode is enabled the PF driver attempts to enable unicast and/or
      multicast promiscuous mode filters based on the request. This is fine,
      but there are a couple issues with the current code.
      
      [1] The define to configure the unicast promiscuous mode mask also
          includes bits to configure the multicast promiscuous mode mask, which
          causes multicast to be set/cleared unintentionally.
      [2] All 4 cases for enable/disable unicast/multicast mode are not
          handled in the promiscuous mode message handler, which causes
          unexpected results regarding the current promiscuous mode settings.
      
      To fix [1] make sure any promiscuous mask defines include the correct
      bits for each of the promiscuous modes.
      
      To fix [2] make sure that all 4 cases are handled since there are 2 bits
      (FLAG_VF_UNICAST_PROMISC and FLAG_VF_MULTICAST_PROMISC) that can be
      either set or cleared. Also, since either unicast and/or multicast
      promiscuous configuration can fail, introduce two separate error values
      to handle each of these cases.
      
      Fixes: 01b5e89a ("ice: Add VF promiscuous support")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      1a8c7778
  6. 30 10月, 2021 10 次提交
    • P
      iavf: Fix kernel BUG in free_msi_irqs · 605ca7c5
      Przemyslaw Patynowski 提交于
      Fix driver not freeing VF's traffic irqs, prior to calling
      pci_disable_msix in iavf_remove.
      There were possible 2 erroneous states in which, iavf_close would
      not be called.
      One erroneous state is fixed by allowing netdev to register, when state
      is already running. It was possible for VF adapter to enter state loop
      from running to resetting, where iavf_open would subsequently fail.
      If user would then unload driver/remove VF pci, iavf_close would not be
      called, as the netdev was not registered, leaving traffic pcis still
      allocated.
      Fixed this by breaking loop, allowing netdev to open device when adapter
      state is __IAVF_RUNNING and it is not explicitily downed.
      Other possiblity is entering to iavf_remove from __IAVF_RESETTING state,
      where iavf_close would not free irqs, but just return 0.
      Fixed this by checking for last adapter state and then removing irqs.
      
      Kernel panic:
      [ 2773.628585] kernel BUG at drivers/pci/msi.c:375!
      ...
      [ 2773.631567] RIP: 0010:free_msi_irqs+0x180/0x1b0
      ...
      [ 2773.640939] Call Trace:
      [ 2773.641572]  pci_disable_msix+0xf7/0x120
      [ 2773.642224]  iavf_reset_interrupt_capability.part.41+0x15/0x30 [iavf]
      [ 2773.642897]  iavf_remove+0x12e/0x500 [iavf]
      [ 2773.643578]  pci_device_remove+0x3b/0xc0
      [ 2773.644266]  device_release_driver_internal+0x103/0x1f0
      [ 2773.644948]  pci_stop_bus_device+0x69/0x90
      [ 2773.645576]  pci_stop_and_remove_bus_device+0xe/0x20
      [ 2773.646215]  pci_iov_remove_virtfn+0xba/0x120
      [ 2773.646862]  sriov_disable+0x2f/0xe0
      [ 2773.647531]  ice_free_vfs+0x2f8/0x350 [ice]
      [ 2773.648207]  ice_sriov_configure+0x94/0x960 [ice]
      [ 2773.648883]  ? _kstrtoull+0x3b/0x90
      [ 2773.649560]  sriov_numvfs_store+0x10a/0x190
      [ 2773.650249]  kernfs_fop_write+0x116/0x190
      [ 2773.650948]  vfs_write+0xa5/0x1a0
      [ 2773.651651]  ksys_write+0x4f/0xb0
      [ 2773.652358]  do_syscall_64+0x5b/0x1a0
      [ 2773.653075]  entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Fixes: 22ead37f ("i40evf: Add longer wait after remove module")
      Signed-off-by: NPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Signed-off-by: NMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      605ca7c5
    • K
      iavf: Add helper function to go from pci_dev to adapter · 247aa001
      Karen Sornek 提交于
      Add helper function to go from pci_dev to adapter to make work simple -
      to go from a pci_dev to the adapter structure and make netdev assignment
      instead of having to go to the net_device then the adapter.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: NKaren Sornek <karen.sornek@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      247aa001
    • M
      ice: Hide bus-info in ethtool for PRs in switchdev mode · bfaaba99
      Marcin Szycik 提交于
      Disable showing bus-info information for port representors in switchdev
      mode. This fixes a bug that caused displaying wrong netdev descriptions in
      lshw tool - one port representor displayed PF branding string, and in turn
      one PF displayed a "generic" description. The bug occurs when many devices
      show the same bus-info in ethtool, which was the case in switchdev mode (PF
      and its port representors displayed the same bus-info). The bug occurs only
      if a port representor netdev appears before PF netdev in /proc/net/dev.
      
      In the examples below:
      ens6fX is PF
      ens6fXvY is VF
      ethX is port representor
      One irrelevant column was removed from output
      
      Before:
      $ sudo lshw -c net -businfo
      Bus info          Device      Description
      =========================================
      pci@0000:02:00.0  eth102       Ethernet Controller E810-XXV for SFP
      pci@0000:02:00.1  ens6f1       Ethernet Controller E810-XXV for SFP
      pci@0000:02:01.0  ens6f0v0     Ethernet Adaptive Virtual Function
      pci@0000:02:01.1  ens6f0v1     Ethernet Adaptive Virtual Function
      pci@0000:02:01.2  ens6f0v2     Ethernet Adaptive Virtual Function
      pci@0000:02:00.0  ens6f0       Ethernet interface
      
      Notice that eth102 and ens6f0 have the same bus-info and their descriptions
      are swapped.
      
      After:
      $ sudo lshw -c net -businfo
      Bus info          Device      Description
      =========================================
      pci@0000:02:00.0  ens6f0      Ethernet Controller E810-XXV for SFP
      pci@0000:02:00.1  ens6f1      Ethernet Controller E810-XXV for SFP
      pci@0000:02:01.0  ens6f0v0    Ethernet Adaptive Virtual Function
      pci@0000:02:01.1  ens6f0v1    Ethernet Adaptive Virtual Function
      pci@0000:02:01.2  ens6f0v2    Ethernet Adaptive Virtual Function
      
      Fixes: 7aae80ce ("ice: add port representor ethtool ops and stats")
      Signed-off-by: NMarcin Szycik <marcin.szycik@linux.intel.com>
      Tested-by: NSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      bfaaba99
    • M
      ice: Clear synchronized addrs when adding VFs in switchdev mode · c79bb28e
      Marcin Szycik 提交于
      When spawning VFs in switchdev mode, internal filter list of VSIs is
      cleared, which includes MAC rules. However MAC entries stay on netdev's
      multicast list, which causes error message when bringing link up after
      spawning VFs ("Failed to delete MAC filters"). __dev_mc_sync() is
      called and tries to unsync addresses that were already removed
      internally when adding VFs.
      
      This can be reproduced with:
      1) Load ice driver
      2) Change PF to switchdev mode
      3) Bring PF link up
      4) Bring PF link down
      5) Create a VF on PF
      6) Bring PF link up
      
      Added clearing of netdev's multicast (and also unicast) list when
      spawning VFs in switchdev mode, so the state of internal rule list and
      netdev's MAC list is consistent.
      
      Fixes: 1a1c40df ("ice: set and release switchdev environment")
      Signed-off-by: NMarcin Szycik <marcin.szycik@linux.intel.com>
      Tested-by: NSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      c79bb28e
    • B
      ice: Remove boolean vlan_promisc flag from function · 29e71f41
      Brett Creeley 提交于
      Currently, the vlan_promisc flag is used exclusively by VF VSI to
      determine whether or not to toggle VLAN pruning along with
      trusted/true-promiscuous mode. This is not needed for a couple of
      reasons. First, trusted/true-promiscuous mode is only supposed to allow
      all MAC filters within VLANs that a VF has added filters for, so VLAN
      pruning should not be disabled. Second, the boolean argument makes the
      function confusing and unintuitive. Remove this flag.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      29e71f41
    • S
      igc: Change Device Reset to Port Reset · e377a063
      Sasha Neftin 提交于
      The _reset_hw_base method switched from port reset (CTRL[26]) to device
      reset (CTRL[29]) since the FW was receiving an interrupt on CTRL[29].
      FW code was later modified to also receive an interrupt on CTRL[26].
      Since certain HW values are not reset to default by CTRL[29], we go back
      to CTRL[26] for the HW reset, as it meets all current requirements.
      
      This reverts commit bb4265ec ("igc: Update the MAC reset flow").
      Signed-off-by: NSasha Neftin <sasha.neftin@intel.com>
      Tested-by: NNechama Kraus <nechamax.kraus@linux.intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e377a063
    • S
      igc: Add new device ID · 8f20571d
      Sasha Neftin 提交于
      Add new device ID for the next step of the silicon and
      reflect the I226_LMVP part.
      Signed-off-by: NSasha Neftin <sasha.neftin@intel.com>
      Tested-by: NNechama Kraus <nechamax.kraus@linux.intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      8f20571d
    • S
      igc: Remove media type checking on the PHY initialization · 8643d0b6
      Sasha Neftin 提交于
      i225 devices only have copper phy media type. There is no point in
      checking phy media type during the phy initialization. This patch cleans
      up a pointless check.
      Signed-off-by: NSasha Neftin <sasha.neftin@intel.com>
      Tested-by: NDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      8643d0b6
    • C
      net: ixgbevf: Remove redundant initialization of variable ret_val · 1b9abade
      Colin Ian King 提交于
      The variable ret_val is being initialized with a value that is never
      read, it is being updated later on. The assignment is redundant and
      can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      1b9abade
    • J
      igb: unbreak I2C bit-banging on i350 · a97f8783
      Jan Kundrát 提交于
      The driver tried to use Linux' native software I2C bus master
      (i2c-algo-bits) for exporting the I2C interface that talks to the SFP
      cage(s) towards userspace. As-is, however, the physical SCL/SDA pins
      were not moving at all, staying at logical 1 all the time.
      
      The main culprit was the I2CPARAMS register where igb was not setting
      the I2CBB_EN bit. That meant that all the careful signal bit-banging was
      actually not being propagated to the chip pads (I verified this with a
      scope).
      
      The bit-banging was not correct either, because I2C is supposed to be an
      open-collector bus, and the code was driving both lines via a totem
      pole. The code was also trying to do operations which did not make any
      sense with the i2c-algo-bits, namely manipulating both SDA and SCL from
      igb_set_i2c_data (which is only supposed to set SDA). I'm not sure if
      that was meant as an optimization, or was just flat out wrong, but given
      that the i2c-algo-bits is set up to work with a totally dumb GPIO-ish
      implementation underneath, there's no need for this code to be smart.
      
      The open-drain vs. totem-pole is fixed by the usual trick where the
      logical zero is implemented via regular output mode and outputting a
      logical 0, and the logical high is implemented via the IO pad configured
      as an input (thus floating), and letting the mandatory pull-up resistors
      do the rest. Anything else is actually wrong on I2C where all devices
      are supposed to have open-drain connection to the bus.
      
      The missing I2CBB_EN is set (along with a safe initial value of the
      GPIOs) just before registering this software I2C bus.
      
      The chip datasheet mentions HW-implemented I2C transactions (SFP EEPROM
      reads and writes) as well, but I'm not touching these for simplicity.
      
      Tested on a LR-Link LRES2203PF-2SFP (which is an almost-miniPCIe form
      factor card, a cable, and a module with two SFP cages). There was one
      casualty, an old broken SFP we had laying around, which was used to
      solder some thin wires as a DIY I2C breakout. Thanks for your service.
      With this patch in place, I can `i2cdump -y 3 0x51 c` and read back data
      which make sense. Yay.
      Signed-off-by: NJan Kundrát <jan.kundrat@cesnet.cz>
      See-also: https://www.spinics.net/lists/netdev/msg490554.htmlReviewed-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NTony Brelinski <tony.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      a97f8783