1. 19 2月, 2017 7 次提交
  2. 12 2月, 2017 13 次提交
    • H
      i40e: Save more link abilities when using ethtool · b7eaf8f1
      Henry Tieman 提交于
      Ethtool support needs to save more PHY information. The
      added information includes FEC capabilities and 25G link
      types. Without this change it is possible to lose 25G or
      FEC settings by using ethtool.
      
      Change-ID: Ie42255b1e901ffbf9583b8c46466a54894114280
      Signed-off-by: NHenry Tieman <henry.w.tieman@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b7eaf8f1
    • J
      i40e: avoid race condition when sending filters to firmware for addition · 671889e6
      Jacob Keller 提交于
      Refactor how we add new filters to firmware to avoid a race condition
      that can occur due to removing filters from the hash temporarily.
      
      To understand the race condition, suppose that you have a number of MAC
      filters, but have not yet added any VLANs. Now, add two VLANs in rapid
      succession. A possible resulting flow would look something like the
      following:
      
      (1) lock hash for add VLAN
      (2) add the new MAC/VLAN combos for each current MAC filter
      (3) unlock hash
      (4) lock hash for filter sync
      (5) notice that we have a VLAN, so prepare to update all MAC filters
          with VLAN=-1 to be VLAN=0.
      (6) move NEW and REMOVE filters to temporary list
      (7) unlock hash
      (8) lock hash for add VLAN
      (9) add new MAC/VLAN combos. Notice that no MAC filters are currently in
          the hash list, so we don't add any VLANs <--- BUG!
      (10) unlock hash
      (11) sync the temporary lists to firmware
      (12) lock hash for post-sync
      (13) move the temporary elements back to the main list
      ....
      
      Because we take filters out of the main hash into temporary lists, we
      introduce a narrow window where it is possible that other callers to the
      list will not see some of the filters which were previously added but
      have not yet been finalized. This results in sometimes dropping VLAN
      additions, and could also result in failing to add a MAC address on the
      newly added VLAN.
      
      One obvious way to avoid this race condition would be to lock the entire
      firmware process. Unfortunately this does not work because adminq
      firmware commands take a mutex which results in a sleep while atomic
      BUG(). So, we can't use the simplest approach.
      
      An alternative approach is to simply not remove the filters from the
      hash list while adding. Instead, add an i40e_new_mac_filter structure
      which we will use to track added filters. This avoids the need to remove
      the filter from the hash list. We'll store a pointer to the original
      i40e_mac_filter, along with our own copy of the state.
      
      We won't update the state directly, so as to avoid race with other code
      that may modify the state while under the lock. We are safe to read
      f->macaddr and f->vlan since these only change in two locations. The
      first is on filter creation, which must have already occurred. The
      second is inside i40e_correct_vlan_filters which was previously run
      after creation of this object and can't be run again until after. Thus,
      we should be safe to read the MAC address and VLAN while outside the
      lock.
      
      We also aren't going to run into a use-after-free issue because the only
      place where we free filters is when they are marked FAILED or when we
      remove them inside the sync subtask. Since the subtask has its own
      critical flag to prevent duplicate runs, we know this won't happen. We
      also know that the only location to transition a filter from NEW to
      FAILED is inside the subtask also, so we aren't worried about that
      either.
      
      Use the wrapper i40e_new_mac_filter for additions, and once we've
      finalized the addition to firmware, we will update the filter state
      inside a lock, and then free the wrapper structure.
      
      In order to avoid a possible race condition with filter deletion, we
      won't update the original filter state unless it is still
      I40E_FILTER_NEW when we finish the firmware sync.
      
      This approach is more complex, but avoids race conditions related to
      filters being temporarily removed from the list. We do not need the same
      behavior for deletion because we always unconditionally removed the
      filters from the list regardless of the firmware status.
      
      Change-Id: I14b74bc2301f8e69433fbe77ebca532db20c5317
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      671889e6
    • J
      i40e: allow i40e_update_filter_state to skip broadcast filters · d88d40b0
      Jacob Keller 提交于
      Fix a bug where we modified the mac_filter_hash while outside a lock,
      when handling addition of broadcast filters.
      
      Normally, we add filters to firmware by batching the additions into
      lists and issuing 1 update for every few filters. Broadcast filters are
      handled differently, by instead setting the broadcast promiscuous mode
      flags. In order to make sure the 1<->1 mapping of filters in our
      addition array lined up with filters in the hlist tmp_add_list, we had
      to remove the filter and move it back to the main hash. However, we
      didn't do this under lock, which could cause consistency problems for
      the list.
      
      Fix this by updating i40e_update_filter_state logic so that it knows to
      avoid broadcast filters. This ensures that we don't have to remove the
      filter separately, and can put it back using the normal flow.
      
      Change-ID: Id288fade80b3e3a9a54b68cc249188cb95147518
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d88d40b0
    • J
      i40e: don't warn every time we clear an Rx timestamp register · e6e3fc2b
      Jacob Keller 提交于
      The intent of this message was to indicate to a user that we might have
      missed a timestamp event for a valid packet. The original method of
      detecting the missed events relied on waiting until all 4 registers were
      filled.
      
      A recent commit d55458c0cd7a5 ("i40e: replace PTP Rx timestamp hang
      logic") replaced this logic with much better detection
      scheme that could detect a stalled Rx timestamp register even when other
      registers were still functional.
      
      The new logic means that a message will be displayed almost as soon as
      a timestamp for a dropped frame occurs. This new logic highlights that
      the hardware will attempt timestamp for frames which it later decides to
      drop. The most prominent example is when a multicast PTP frame is
      received on a multicast address that we are not subscribed to.
      
      Because the hardware initiates the Rx timestamp as soon as possible, it
      will latch an RXTIME register, but then drop the packet.
      
      This results in users being confused by the message as they are not
      expecting to see dropped timestamp messages unless their application
      also indicates that timestamps were missing.
      
      Resolve this by reducing the severity and frequency of the displayed
      message. We now only print the message if 3 or 4 of the RXTIME registers
      are stalled and get cleared within the same watchdog event. This ensures
      that the common case does not constantly display the message.
      Additionally, since the message is likely not as meaningful to most
      users, reduce the message to a dev_dbg instead of a dev_warn.
      
      Users can still get a count of the number of timestamps dropped by
      reading the ethtool statistics value, if necessary.
      
      Change-ID: I35494442226a444c418dfb4f91a3070d06c8435c
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e6e3fc2b
    • H
      i40e: Save link FEC info from link up event · 3e03d7cc
      Henry Tieman 提交于
      Store the FEC status bits from the link up event into the
      hw_link_info structure.
      
      Change-ID: I9a7b256f6dfb0dce89c2f503075d0d383526832e
      Signed-off-by: NHenry Tieman <henry.w.tieman@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3e03d7cc
    • S
      i40e: Add bus number info to i40e_bus_info struct · b3f028fc
      Sudheer Mogilappagari 提交于
      Currently i40e_bus_info has PCI device and function info only and log
      messages print device number as bus number. Added field to provide bus
      number info and modified log statements to print bus, device and
      function information.
      
      Change-ID: I811617cee2714cc0d6bade8d369f57040990756f
      Signed-off-by: NSudheer Mogilappagari <sudheer.mogilappagari@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b3f028fc
    • M
      i40e: Clean up dead code · 3bb83baf
      Mitch Williams 提交于
      The function i40e_client_prepare() can never return an error. So make it
      void and quit checking its return value.
      
      Change-ID: I9ff311e2324dde329eb68648efb2c94aaff856db
      Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3bb83baf
    • B
    • J
      i40e: update comment explaining where FDIR buffers are freed · a158aeaf
      Jacob Keller 提交于
      The original comment implies that the only location where the raw_packet
      buffer will be freed is in i40e_clean_tx_ring() which is incorrect. In
      fact this isn't even the normal case. Update the comment explaining
      where the memory is freed.
      
      Change-ID: Ie0defc35ed1c3af183f81fdc60b6d783707a5595
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      a158aeaf
    • S
      i40e/i40evf: eliminate i40e_pull_tail() · 9b37c937
      Scott Peterson 提交于
      Reorganize the i40e_pull_tail() logic, doing it in i40e_add_rx_frag()
      where it's cheaper.  The igb driver does this the same way.
      
      Also renames i40e_page_is_reserved() to reflect what it actually
      tests.
      
      Change-ID: Icd9cc507aae1fcdc02308b3a09034111b4c24071
      Signed-off-by: NScott Peterson <scott.d.peterson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9b37c937
    • S
      i40e/i40evf: Moves skb from i40e_rx_buffer to i40e_ring · e72e5659
      Scott Peterson 提交于
      This patch reduces the size of struct i40e_rx_buffer by one pointer,
      and makes the i40e driver a little more consistent with the igb driver
      in terms of packets that span buffers.
      
      We do this by moving the skb field from struct i40e_rx_buffer to
      struct i40e_ring. We pass the skb we already have (or NULL if we
      don't) to i40e_fetch_rx_buffer(), which skips the skb allocation if we
      already have one for this packet.
      
      Change-ID: I4ad48a531844494ba0c5d8e1a62209a057f661b0
      Signed-off-by: NScott Peterson <scott.d.peterson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e72e5659
    • S
      i40e/i40evf: Limit DMA sync of RX buffers to actual packet size · 7987dcd7
      Scott Peterson 提交于
      On packet RX, we perform a DMA sync for CPU before passing the
      packet up.  Here we limit that sync to the actual length of the
      incoming packet, rather than always syncing the entire buffer.
      
      Change-ID: I626aaf6c37275a8ce9e81efcaa773f327b331487
      Signed-off-by: NScott Peterson <scott.d.peterson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      7987dcd7
    • J
      i40e: don't check params until after checking for client instance · d7ce6422
      Jacob Keller 提交于
      We can avoid the minor bit of work by calling check params after we
      check for the client instance, since we're about to return early in
      cases where we do not have a client.
      
      Change-ID: I56f8ea2ba48d4f571fa331c9ace50819a022fa1c
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d7ce6422
  3. 03 2月, 2017 12 次提交
  4. 09 1月, 2017 1 次提交
  5. 11 12月, 2016 1 次提交
  6. 07 12月, 2016 6 次提交
    • J
      i40e: move all updates for VLAN mode into i40e_sync_vsi_filters · 489a3265
      Jacob Keller 提交于
      In a similar fashion to how we handled exiting VLAN mode, move the logic
      in i40e_vsi_add_vlan into i40e_sync_vsi_filters. Extract this logic into
      its own function for ease of understanding as it will become quite
      complex.
      
      The new function, i40e_correct_mac_vlan_filters() correctly updates all
      filters for when we need to enter VLAN mode, exit VLAN mode, and also
      enforces the PVID when assigned.
      
      Call i40e_correct_mac_vlan_filters from i40e_sync_vsi_filters passing it
      the number of active VLAN filters, and the two temporary lists.
      
      Remove the function for updating VLAN=0 filters from i40e_vsi_add_vlan.
      
      The end result is that the logic for entering and exiting VLAN mode is
      in one location which has the most knowledge about all filters. This
      ensures that we always correctly have the non-VLAN filters assigned to
      VID=0 or VID=-1 regardless of how we ended up getting to this result.
      
      Additionally this enforces the PVID at sync time so that we know for
      certain that an assigned PVID results in only filters with that PVID
      will be added to the firmware.
      
      Change-ID: I895cee81e9c92d0a16baee38bd0ca51bbb14e372
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      489a3265
    • J
      i40e: use (add|rm)_vlan_all_mac helper functions when changing PVID · 9af52f60
      Jacob Keller 提交于
      The current flow for adding or updating the PVID for a VF uses
      i40e_vsi_add_vlan and i40e_vsi_kill_vlan which each take, then release
      the hash lock. In addition the two functions also must take special care
      that they do not perform VLAN mode changes as this will make the code in
      i40e_ndo_set_vf_port_vlan behave incorrectly.
      
      Fix these issues by using the new helper functions i40e_add_vlan_all_mac
      and i40e_rm_vlan_all_mac which expect the hash lock to already be taken.
      Additionally these functions do not perform any state updates in regards
      to VLAN mode, so they are safe to use in the PVID update flow.
      
      It should be noted that we don't need the VLAN mode update code here,
      because there are only a few flows here.
      
      (a) we're adding a new PVID
        In this case, if we already had VLAN filters the VSI is knocked
        offline so we don't need to worry about pre-existing VLAN filters
      
      (b) we're replacing an existing PVID
        In this case, we can't have any VLAN filters except those with the old
        PVID which we already take care of manually.
      
      (c) we're removing an existing PVID
        Similarly to above, we can't have any existing VLAN filters except
        those with the old PVID which we already take care of correctly.
      
      Because of this, we do not need (or even want) the special accounting
      done in i40e_vsi_add_vlan, so use of the helpers is a saner alternative.
      It also opens the door for a future patch which will refactor the flow
      of i40e_vsi_add_vlan now that it is not needed in this function.
      
      Change-ID: Ia841f63da94e12b106f41cf7d28ce8ce92f2ad99
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9af52f60
    • J
      i40e: factor out addition/deletion of VLAN per each MAC address · 490a4ad3
      Jacob Keller 提交于
      A future refactor of how the PF assigns a PVID to a VF will want to be
      able to add and remove a block of filters by VLAN without worrying about
      accidentally triggering the accounting for I40E_VLAN_ANY. Additionally
      the PVID assignment would like to be able to batch several changes under
      one use of the mac_filter_hash_lock.
      
      Factor out the addition and deletion of a VLAN on all MACs into their
      own function which i40e_vsi_(add|kill)_vlan can use. These new functions
      expect the caller to take the hash lock, as well as perform any
      necessary accounting for updating I40E_VLAN_ANY filters if we are now
      operating under VLAN mode.
      
      Change-ID: If79e5b60b770433275350a74b3f1880333a185d5
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      490a4ad3
    • J
      i40e: delete filter after adding its replacement when converting · 75697025
      Jacob Keller 提交于
      Fix a subtle issue with the code for converting VID=-1 filters into VID=0
      filters when adding a new VLAN. Previously the code deleted the VID=-1
      filter, and then added a new VID=0 filter. In the rare case that the
      addition fails due to -ENOMEM, we end up completely deleting the filter
      which prevents recovery if memory pressure subsides. While it is not
      strictly an issue because it is likely that memory issues would result
      in many other problems, we shouldn't delete the filter until after the
      addition succeeds.
      
      Change-ID: Icba07ddd04ecc6a3b27c2e29f2c1c8673d266826
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      75697025
    • J
      i40e: refactor i40e_update_filter_state to avoid passing aq_err · ac9e2390
      Jacob Keller 提交于
      The current caller of i40e_update_filter_state incorrectly passes
      aq_ret, an i40e_status variable, instead of the expected aq_err. This
      happens to work because i40e_status is actually just a typedef integer,
      and 0 is still the successful return. However i40e_update_filter_state
      has special handling for ENOSPC which is currently being ignored.
      
      Also notice that firmware does not update the per-filter response for
      many types of errors, such as EINVAL. Thus, modify the filter setup so
      that the firmware response memory is pre-set with I40E_AQC_MM_ERR_NO_RES.
      
      This enables us to refactor i40e_update_filter_state, removing the need
      to pass aq_err and avoiding a need for having 3 different flows for
      checking the filter state.
      
      The resulting code for i40e_update_filter_state is much simpler, only
      a single loop and we always check each filter response value every time.
      Since we pre-set the response value to match our expected error this
      correctly works for all success and error flows.
      
      Change-ID: Ie292c9511f34ee18c6ef40f955ad13e28b7aea7d
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      ac9e2390
    • J
      i40e: recalculate vsi->active_filters from hash contents · 38326218
      Jacob Keller 提交于
      Previous code refactors have accidentally caused issues with the
      counting of active_filters. Avoid similar issues in the future by simply
      re-counting the active filters every time after we handle add and delete
      of all the filters. Additionally this allows us to simplify the check
      for when we exit promiscuous mode since we can combine the check for
      failed filters at the same time.
      
      Additionally since we recount filters at the end we need to set
      vsi->promisc_threshold as well.
      
      The resulting code takes a bit longer since we do have to loop over
      filters again. However, the result is more readable and less likely to
      become incorrect due to failed accounting of filters in the future.
      Finally, this ensures that it is not possible for vsi->active_filters to
      ever underflow since we never decrement it.
      
      Change-ID: Ib4f3a377e60eb1fa6c91ea86cc02238c08edd102
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      38326218