1. 25 1月, 2022 7 次提交
    • S
      ionic: replace set_vf data with union · 36197d82
      Shannon Nelson 提交于
      This (ab)use of a data buffer made some static code checkers
      rather itchy, so we replace the a generic data buffer with
      the union in the struct ionic_vf_setattr_cmd.
      
      Fixes: fbb39807 ("ionic: support sr-iov operations")
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36197d82
    • S
      ionic: stretch heartbeat detection · ec8ee714
      Shannon Nelson 提交于
      The driver can be premature in detecting stalled firmware
      when the heartbeat is not updated because the firmware can
      occasionally take a long time (more than 2 seconds) to service
      a request, and doesn't update the heartbeat during that time.
      
      The firmware heartbeat is not necessarily a steady 1 second
      periodic beat, but better described as something that should
      progress at least once in every DECVMD_TIMEOUT period.
      The single-threaded design in the FW means that if a devcmd
      or adminq request launches a large internal job, it is stuck
      waiting for that job to finish before it can get back to
      updating the heartbeat.  Since all requests are "guaranteed"
      to finish within the DEVCMD_TIMEOUT period, the driver needs
      to less aggressive in checking the heartbeat progress.
      
      We change our current 2 second window to something bigger than
      DEVCMD_TIMEOUT which should take care of most of the issue.
      We stop checking for the heartbeat while waiting for a request,
      as long as we're still watching for the FW status.  Lastly,
      we make sure our FW status is up to date before running a
      devcmd request.
      
      Once we do this, we need to not check the heartbeat on DEV
      commands because it may be stalled while we're on the fw_down
      path.  Instead, we can rely on the is_fw_running check.
      
      Fixes: b2b9a8d7 ("ionic: avoid races in ionic_heartbeat_check")
      Signed-off-by: NBrett Creeley <brett@pensando.io>
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ec8ee714
    • S
      ionic: remove the dbid_inuse bitmap · b1552a4c
      Shannon Nelson 提交于
      The dbid_inuse bitmap is not useful in this driver so remove it.
      
      Fixes: 6461b446 ("ionic: Add interrupts and doorbells")
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b1552a4c
    • B
      ionic: disable napi when ionic_lif_init() fails · 43cfed71
      Brett Creeley 提交于
      When the driver is going through reset, it will eventually call
      ionic_lif_init(), which does a lot of re-initialization. One
      of the re-initialization steps is to setup the adminq and
      enable napi for it.  If something breaks after this point
      we can end up with a kernel NULL pointer dereference through
      ionic_adminq_napi.
      
      Fix this by making sure to call napi_disable() in the cleanup
      path of ionic_lif_init().  This forces any pending napi contexts
      to finish and prevents them from being recalled before deleting
      the napi context.
      
      Fixes: 77ceb68e ("ionic: Add notifyq support")
      Signed-off-by: NBrett Creeley <brett@pensando.io>
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      43cfed71
    • B
      ionic: Query FW when getting VF info via ndo_get_vf_config · f16f5be3
      Brett Creeley 提交于
      Currently when an administrator configures a VF via ndo_set_vf*,
      the driver will send the set command to FW and then update the
      cached value.  The cached value is then used when reporting
      VF info via ndo_get_vf_config.
      
      A problem is that the VF info may have been updated between
      the last ndo_set_vf* and ndo_get_vf_info commands via some
      other method, i.e. a VF changes its MAC address (assuming it's
      allowed to do so) and since this is all managed by the FW,
      this new value won't be reflected in the PF's cache of values.
      
      To fix this, update the driver to always get the latest VF
      information by making use of the IONIC_CMD_VF_GETATTR dev
      command. The FW may not support getting all the attributes for
      IONIC_CMD_VF_GETATTR, so the driver will only update the cached
      VF config members if their associated IONIC_CMD_VF_GETATTR
      was successful. Otherwise the cached VF config members will
      remain the same as what was set in ndo_set_vf*.
      
      Fixes: fbb39807 ("ionic: support sr-iov operations")
      Signed-off-by: NBrett Creeley <brett@pensando.io>
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f16f5be3
    • S
      ionic: better handling of RESET event · abd75d14
      Shannon Nelson 提交于
      When IONIC_EVENT_RESET is received, we only need to start the
      fw_down process if we aren't already down, and we need to be
      sure to set the FW_STOPPING state on the way.
      
      If this is how we noticed that FW was stopped, it is most
      likely from a FW update, and we'll see a new FW generation.
      The update happens quickly enough that we might not see
      fw_status==0, so we need to be sure things get restarted when
      we see the fw_generation change.
      
      Fixes: d2662072 ("ionic: monitor fw status generation")
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      abd75d14
    • S
      ionic: add FW_STOPPING state · 398d1e37
      Shannon Nelson 提交于
      Between fw running and fw actually stopped into reset, we need
      a fw_stopping concept to catch and block some actions while
      we're transitioning to FW_RESET state.  This will help to be
      sure the fw_up task is not scheduled until after the fw_down
      task has completed.
      
      On some rare occasion timing, it is possible for the fw_up task
      to try to run before the fw_down task, then not get run after
      the fw_down task has run, leaving the device in a down state.
      This is possible if the watchdog goes off in between finding the
      down transition and starting the fw_down task, where the later
      watchdog sees the FW is back up and schedules a fw_up task.
      
      Fixes: c672412f ("ionic: remove lifs on fw reset")
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      398d1e37
  2. 29 12月, 2021 1 次提交
  3. 10 10月, 2021 3 次提交
    • S
      ionic: handle vlan id overflow · 9b0b6ba6
      Shannon Nelson 提交于
      Add vlans to the existing rx_filter_sync mechanics currently
      used for managing mac filters.
      
      Older versions of our firmware had no enforced limits on the
      number of vlans that the LIF could request, but requesting large
      numbers of vlans caused issues in FW memory management, so an
      arbitrary limit was added in the FW.  The FW now returns -ENOSPC
      when it hits that limit, which the driver needs to handle.
      
      Unfortunately, the FW doesn't advertise the vlan id limit,
      as it does with mac filters, so the driver won't know the
      limit until it bumps into it.  We'll grab the current vlan id
      count and use that as the limit from there on and thus prevent
      getting any more -ENOSPC errors.
      
      Just as is done for the mac filters, the device puts the device
      into promiscuous mode when -ENOSPC is seen for vlan ids, and
      the driver will track the vlans that aren't synced to the FW.
      When vlans are removed, the driver will retry the un-synced
      vlans.  If all outstanding vlans are synced, the promiscuous
      mode will be disabled.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9b0b6ba6
    • S
      ionic: remove mac overflow flags · 4ed642cc
      Shannon Nelson 提交于
      The overflow flags really aren't useful and we don't need lif
      struct elements to track them.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4ed642cc
    • S
      ionic: move lif mac address functions · 1d4ddc4a
      Shannon Nelson 提交于
      The routines that add and delete mac addresses from the
      firmware really should be in the file with the rest of
      the filter management.  This simply moves the functions
      with no logic changes.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1d4ddc4a
  4. 09 10月, 2021 1 次提交
    • S
      ionic: don't remove netdev->dev_addr when syncing uc list · 5c976a56
      Shannon Nelson 提交于
      Bridging, and possibly other upper stack gizmos, adds the
      lower device's netdev->dev_addr to its own uc list, and
      then requests it be deleted when the upper bridge device is
      removed.  This delete request also happens with the bridging
      vlan_filtering is enabled and then disabled.
      
      Bonding has a similar behavior with the uc list, but since it
      also uses set_mac to manage netdev->dev_addr, it doesn't have
      the same the failure case.
      
      Because we store our netdev->dev_addr in our uc list, we need
      to ignore the delete request from dev_uc_sync so as to not
      lose the address and all hope of communicating.  Note that
      ndo_set_mac_address is expressly changing netdev->dev_addr,
      so no limitation is set there.
      
      Fixes: 2a654540 ("ionic: Add Rx filter and rx_mode ndo support")
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5c976a56
  5. 06 10月, 2021 1 次提交
  6. 02 10月, 2021 4 次提交
  7. 03 9月, 2021 1 次提交
    • S
      ionic: fix double use of queue-lock · 79a58c06
      Shannon Nelson 提交于
      Deadlock seen in an instance where the hwstamp configuration
      is changed while the driver is running:
      
      [ 3988.736671]  schedule_preempt_disabled+0xe/0x10
      [ 3988.736676]  __mutex_lock.isra.5+0x276/0x4e0
      [ 3988.736683]  __mutex_lock_slowpath+0x13/0x20
      [ 3988.736687]  ? __mutex_lock_slowpath+0x13/0x20
      [ 3988.736692]  mutex_lock+0x2f/0x40
      [ 3988.736711]  ionic_stop_queues_reconfig+0x16/0x40 [ionic]
      [ 3988.736726]  ionic_reconfigure_queues+0x43e/0xc90 [ionic]
      [ 3988.736738]  ionic_lif_config_hwstamp_rxq_all+0x85/0x90 [ionic]
      [ 3988.736751]  ionic_lif_hwstamp_set_ts_config+0x29c/0x360 [ionic]
      [ 3988.736763]  ionic_lif_hwstamp_set+0x76/0xf0 [ionic]
      [ 3988.736776]  ionic_eth_ioctl+0x33/0x40 [ionic]
      [ 3988.736781]  dev_ifsioc+0x12c/0x420
      [ 3988.736785]  dev_ioctl+0x316/0x720
      
      This can be demonstrated with "ptp4l -m -i <intf>"
      
      To fix this, we pull the use of the queue_lock further up above the
      callers of ionic_reconfigure_queues() and ionic_stop_queues_reconfig().
      
      Fixes: 7ee99fc5 ("ionic: pull hwstamp queue_lock up a level")
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79a58c06
  8. 28 8月, 2021 5 次提交
  9. 26 8月, 2021 5 次提交
    • S
      ionic: handle mac filter overflow · a0c007b3
      Shannon Nelson 提交于
      Make sure we go into PROMISC mode when we have too many
      filters by specifically counting the filters that successfully
      get saved to the firmware.
      
      The device advertises max_ucast_filters and max_mcast_filters,
      but really only has max_ucast_filters slots available for
      uc and mc filters combined.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0c007b3
    • S
      ionic: refactor ionic_lif_addr to remove a layer · 8b415173
      Shannon Nelson 提交于
      The filter counting in ionic_lif_addr() really isn't useful,
      and potentially misleading, especially when we're checking in
      ionic_lif_rx_mode() to see if we need to go into PROMISC mode.
      We can safely refactor this and remove a calling layer.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8b415173
    • S
      ionic: sync the filters in the work task · 969f8439
      Shannon Nelson 提交于
      In order to separate the atomic needs of __dev_uc_sync()
      and __dev_mc_sync() from the safe rx_mode handling, we need
      to have the ndo handler manipulate the driver's filter list,
      and later have the driver sync the filters to the firmware,
      outside of the atomic context.
      
      Here we put __dev_mc_sync() and __dev_uc_sync() back into the
      ndo callback to give them their netif_addr_lock context and
      have them update the driver's filter list, flagging changes
      that should be made to the device filter list.  Later, in the
      rx_mode handler, we read those hints and sync up the device's
      list as needed.
      
      It is possible for multiple add/delete requests to come from
      the stack before the rx_mode task processes the list, but the
      handling of the sync status flag should keep everything sorted
      correctly.  For example, if a delete of an existing filter is
      followed by another add before the rx_mode task is run, as can
      happen when going in and out of a bond, the add will cancel
      the delete and no actual changes will be sent to the device.
      
      We also add a check in the watchdog to see if there are any
      stray unsync'd filters, possibly left over from a filter
      overflow and waiting to get sync'd after some other filter
      gets removed to make room.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      969f8439
    • S
      ionic: flatten calls to set-rx-mode · b941ea05
      Shannon Nelson 提交于
      Since only two functions call through ionic_set_rx_mode(), one
      that can sleep and one that can't, we can split the function
      and put the bits of code into the callers.  This removes an
      unnecessary calling layer.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b941ea05
    • S
      ionic: remove old work task types · 56c8a53b
      Shannon Nelson 提交于
      With the move of mac filter handling to outside of the
      ndo_rx_mode context using the IONIC_DW_TYPE_RX_MODE,
      we no longer are using IONIC_DW_TYPE_RX_ADDR_ADD and
      IONIC_DW_TYPE_RX_ADDR_DEL and they can be removed.
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56c8a53b
  10. 28 7月, 2021 4 次提交
  11. 24 7月, 2021 2 次提交
  12. 09 4月, 2021 4 次提交
  13. 03 4月, 2021 2 次提交