1. 14 Feb, 2017 1 commit
    • David S. Miller's avatar
      Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue · 417d18d3
      David S. Miller authored
      Jeff Kirsher says:
      
      ====================
      40GbE Intel Wired LAN Driver Updates 2017-02-11
      
      This series contains updates to i40e and i40evf only.
      
      Jake makes a minor change to prevent a minor bit of work, if it is not
      necessary.  In the case where we do not have a client, there is no need
      to check the client params, so move the check till after we have ensured
      we have a client.  Correct a code comment which incorrectly implied
      that raw_packet buffers were freed in i40e_clean_tx_ring(), so fixed
      the code comment to better explain where memory is freed.  Reduce the
      severity and frequency of the message notifying we cleared the receive
      timestamp register, since the logic has a much better detection scheme
      that could detect a stalled receive timestamp register.  The improved
      logic was actually causing the notification message to occur more
      frequently and was giving the user a false perception that a timestamp
      event was missed for a valid packet, so reduce the severity from
      dev_warn to dev_dbg and only fire off the message when 3 or 4 of the
      RXTIME registers are stalled and get cleared within the same
      watchdog event.  Fixed a bug, where we were modifying the mac_filter
      outside a lock when handling the addition of broadcast filters.  Fix
      this by updating i40e_update_filter_state logic so that it knows to
      avoid broadcast filters, which ensures that we do not have to remove
      the filter separately and can put it back using the normal flow.
      Refactored how we add new filters to firmware to avoid a race condition
      that can occur due to removing filters from the hash temporarily.
      
      Mitch adds a sleep (without timeout) so that we wait for a reply from
      the PF before we continue, since the iWarp client cannot continue until
      the operation is completed.  Fixed up a function which could never
      return an error, to be void and cleaned up the checking of the now
      null and void return value.
      
      Scott limits the DMA sync to CPU to the actual length of the incoming
      packet, versus the syncing of the entire buffer.  Also reduces the
      receive buffer struct (by a single pointer) and align the driver to be
      more consistent with other Intel drivers with respect to packets that
      span buffers.
      
      Sudheer adds a field to track the bus number info and modified log
      statements to print bus, device and function information.
      
      Henry adds the ability to store the FEC status bits from the link up
      event.  Also adds the ethtool support for FEC capabilities and 25G
      link types.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      417d18d3
  2. 13 Feb, 2017 27 commits
  3. 12 Feb, 2017 12 commits
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: honor NFT_SET_OBJECT in set backend selection · 7286ff7f
      Pablo Neira Ayuso authored
      Check for NFT_SET_OBJECT feature flag, otherwise we may end up selecting
      the wrong set backend.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      7286ff7f
    • Pablo Neira Ayuso's avatar
      netfilter: update MAINTAINERS · fc52497e
      Pablo Neira Ayuso authored
      It's been a while since Patrick has been suspended as coreteam member [1].
      Update this file to remove him.
      
      While at this, remove references to all foo-tables variants, given the
      project hosts more than just that, eg. ipset, conntrack, ...
      
      [1] https://marc.info/?l=netfilter-devel&m=146887464512702Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      fc52497e
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: add NFTA_RULE_ID attribute · 1a94e38d
      Pablo Neira Ayuso authored
      This new attribute allows us to uniquely identify a rule in transaction.
      Robots may trigger an insertion followed by deletion in a batch, in that
      scenario we still don't have a public rule handle that we can use to
      delete the rule. This is similar to the NFTA_SET_ID attribute that
      allows us to refer to an anonymous set from a batch.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      1a94e38d
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: add check_genid to the nfnetlink subsystem · 74e8bcd2
      Pablo Neira Ayuso authored
      This patch implements the check generation id as provided by nfnetlink.
      This allows us to reject ruleset updates against stale baseline, so
      userspace can retry update with a fresh ruleset cache.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      74e8bcd2
    • Pablo Neira Ayuso's avatar
      netfilter: nfnetlink: allow to check for generation ID · 8c4d4e8b
      Pablo Neira Ayuso authored
      This patch allows userspace to specify the generation ID that has been
      used to build an incremental batch update.
      
      If userspace specifies the generation ID in the batch message as
      attribute, then nfnetlink compares it to the current generation ID so
      you make sure that you work against the right baseline. Otherwise, bail
      out with ERESTART so userspace knows that its changeset is stale and
      needs to respin. Userspace can do this transparently at the cost of
      taking slightly more time to refresh caches and rework the changeset.
      
      This check is optional, if there is no NFNL_BATCH_GENID attribute in the
      batch begin message, then no check is performed.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      8c4d4e8b
    • Pablo Neira Ayuso's avatar
      netfilter: nfnetlink: add nfnetlink_rcv_skb_batch() · 48656835
      Pablo Neira Ayuso authored
      Add new nfnetlink_rcv_skb_batch() to wrap initial nfnetlink batch
      handling.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      48656835
    • Pablo Neira Ayuso's avatar
      netfilter: nfnetlink: get rid of u_intX_t types · b745d035
      Pablo Neira Ayuso authored
      Use uX types instead.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      b745d035
    • Gao Feng's avatar
      netfilter: nf_ct_expect: nf_ct_expect_insert() returns void · 4dee62b1
      Gao Feng authored
      Because nf_ct_expect_insert() always succeeds now, its return value can
      be just void instead of int. And remove code that checks for its return
      value.
      Signed-off-by: default avatarGao Feng <fgao@ikuai8.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      4dee62b1
    • Gao Feng's avatar
      netfilter: nf_ct_sip: Use mod_timer_pending() · a96e66e7
      Gao Feng authored
      timer_del() followed by timer_add() can be replaced by
      mod_timer_pending().
      Signed-off-by: default avatarGao Feng <fgao@ikuai8.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      a96e66e7
    • Henry Tieman's avatar
      i40e: Save more link abilities when using ethtool · b7eaf8f1
      Henry Tieman authored
      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: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b7eaf8f1
    • Jacob Keller's avatar
      i40e: avoid race condition when sending filters to firmware for addition · 671889e6
      Jacob Keller authored
      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: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      671889e6
    • Jacob Keller's avatar
      i40e: allow i40e_update_filter_state to skip broadcast filters · d88d40b0
      Jacob Keller authored
      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: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d88d40b0