1. 01 11月, 2016 11 次提交
    • J
      i40e: remove duplicate add/delete adminq command code for filters · 00936319
      Jacob Keller 提交于
      We duplicate some code around adding and deleting filters using the
      adminq interface. This is prone to errors in case there are bugs. Use
      functions which extract the logic to their own portion so that we don't
      duplicate it twice in code.
      
      Change-ID: I60d68aeb887976787dec00b23ab386a106e61465
      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>
      00936319
    • J
      i40e: avoid looping to check whether we're in VLAN mode · cbebb85f
      Jacob Keller 提交于
      We determine that a VSI is in vlan_mode whenever it has any filters
      with a VLAN other than -1 (I40E_VLAN_ALL). The previous method of doing
      so was to perform a loop whenever we needed the check. However, we can
      notice that only place where filters are added (i40e_add_filter) can
      change the condition from false to true, and the only place we can
      return to false is in i40e_vsi_sync_filters_subtask. Thus, we can remove
      the loop and use a boolean directly.
      
      Doing this avoids looping over filters repeatedly especially while we're
      already inside a loop over all the filters. This should reduce the
      latency of filter operations throughout the driver.
      
      Change-ID: Iafde08df588da2a2ea666997d05e11fad8edc338
      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>
      cbebb85f
    • A
      i40e: fix MAC filters when removing VLANs · 84f5ca6c
      Alan Brady 提交于
      Currently there exists a bug where adding at least one VLAN and then
      removing all VLANs leaves the mac filters for the VSI with an incorrect
      value for 'vid' which indicates the mac filter's VLAN status.
      
      The current implementation for handling the removal of VLANs is wrong
      for a couple reasons. The first is that when i40e_vsi_kill_vlan
      iterates through the MAC filters, it fails to account for the MAC filter
      status; i.e. it's not accommodating for filters that are about to be
      deleted. The second problem is that MAC filters can be deleted in other
      places (specifically i40e_set_rx_mode). Thus if it occurs that all the
      VLAN MAC filters get deleted we need to switch out of VLAN mode, but the
      code path through i40e_vsi_kill_vlan has already been executed and we're
      now stuck in VLAN mode.
      
      This patch fixes the issue by removing the check from i40e_vsi_kill_vlan
      and puts the check instead in i40e_sync_vsi_filters where we're
      guaranteed to see all filter deletions and can properly detect when we
      need to switch out of VLAN mode.
      
      Change-ID: Ib38fe6034b356eee9a0e20b8a9eeed5ff2debcd9
      Signed-off-by: NAlan Brady <alan.brady@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      84f5ca6c
    • J
      i40e: properly cleanup on allocation failure in i40e_sync_vsi_filters · 4a2ce27b
      Jacob Keller 提交于
      Currently, we fail to correctly restore filters on the temporary add
      list when we fail to allocate memory either for deletion or addition.
      Replace calls to "goto out;" with calls to a new location that correctly
      handles memory allocation failures.
      
      Note that it is safe for us to call i40e_undo_filter_entries on the
      tmp_del_list even after we've deleted filters because at this point it
      will be empty, so we don't need to separate the logic for add and
      delete failure.
      
      Change-Id: Iee107fd219c6e03e2fd9645c2debf8e8384a8521
      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>
      4a2ce27b
    • J
      i40e: store MAC/VLAN filters in a hash with the MAC Address as key · 278e7d0b
      Jacob Keller 提交于
      Replace the mac_filter_list with a static size hash table of 8bits. The
      primary advantage of this is a decrease in latency of operations related
      to searching for specific MAC filters, including .set_rx_mode. Using
      a linked list resulted in several locations which were O(n^2). Using
      a hash table should give us latency growth closer to O(n*log(n)).
      
      Change-ID: I5330bd04053b880e670210933e35830b95948ebb
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      278e7d0b
    • J
      i40e: implement __i40e_del_filter and use where applicable · 290d2557
      Jacob Keller 提交于
      When inside a loop where we call i40e_del_filter we use an O(n^2)
      pattern where i40e_del_filter calls i40e_find_filter for us. We can
      avoid this O(n^2) logic by factoring a function, __i40e_del_filter() out
      from the i40e_del_filter code. This allows us to re-use the delete logic
      where appropriate without having to search for the filter twice.
      
      This new function benefits several functions including i40e_vsi_add_vlan,
      i40e_vsi_kill_vlan, i40e_del_mac_vlan_all, and i40e_vsi_release.
      
      Change-ID: I75fabe0f53bf73f56b80d342e5fdcfcc28f4d3eb
      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>
      290d2557
    • J
      i40e: When searching all MAC/VLAN filters, ignore removed filters · 57b341d6
      Jacob Keller 提交于
      When adding new MAC address filters, the driver determines if it should
      behave in VLAN mode (where all MAC addresses get assigned to every
      existing VLAN) or in non-VLAN mode where MAC addresses get assigned the
      VLAN_ANY identifier. Under some circumstances it is possible that a VLAN
      has been marked for removal (such that all filters of that VLAN are set
      to I40E_FILTER_REMOVE), and a subsequent call to i40e_put_mac_in_vlan
      may occur prior to the driver subtask that syncs filters to the
      hardware.
      
      In this case, we may add filters to the new removed VLAN, even though it
      should have been removed. This is most obvious when first adding a new
      VLAN. We will delete all filters which are in I40E_VLAN_ANY (-1) and
      then re-add them as in VLAN 0 (untagged). Then before we sync filters,
      we will add new MAC address filter, which will be added to every VLAN
      that exists. Unfortunately, this will include I40E_VLAN_ANY, so we will
      end up incorrectly adding filters to the -1 VLAN. This can be fixed by
      simply skipping all filters which are marked for removal.
      
      A similar check is not necessary in i40e_del_mac_all_vlan, since we are
      deleting, and any filter which we find already marked for removal would
      simply be deleted again, which doesn't cause any issues.
      
      Change-Id: I7962154013ce02fe950584690aeeb3ed853d0086
      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>
      57b341d6
    • J
      i40e: refactor i40e_put_mac_in_vlan to avoid changing f->vlan · 5feb3d7b
      Jacob Keller 提交于
      When a PVID has been assigned to a VSI, the function
      i40e_put_mac_in_vlan arbitrarily modifies all filters
      to have the same VLAN. This is obviously incorrect
      because it could be modifying active filters without
      putting them into the NEW state. The correct method
      is to remove then re-add filters which is already done
      in the code where we assign the PVID.
      
      Fix this issue and a few other minor nits at the same
      time. First, when we have a PVID don't even bother
      looping and simply add the filter with the PVID immediately.
      
      In the case of the loop, we now can remove several checks.
      We also don't need to use i40e_find_filter first before
      calling i40e_add_filter, since i40e_add_filter implicitly
      does a lookup already.
      
      Finally, update the return semantics of this function so
      that on failure to add a filter it returns NULL, but on
      success, it returns the last filter added. Otherwise,
      we're just returning the last filter in the list. An
      alternative fix might be to return 0 or an error code,
      but this is pretty invasive to every call site.
      
      Change-ID: I2325dfd843aec76d89fb0d7cb0e7c4f290a34840
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      5feb3d7b
    • J
      i40e: move i40e_put_mac_in_vlan and i40e_del_mac_all_vlan · 35ec2ff3
      Jacob Keller 提交于
      A future patch will be modifying these functions and making a call to
      a static function which currently is defined after these functions. Move
      them in a separate patch to ease review and ensure the moved code is
      correct.
      
      Change-ID: I2ca7fd4e10c0c07ed2291db1ea41bf5987fc6474
      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>
      35ec2ff3
    • J
      i40e: make use of __dev_uc_sync and __dev_mc_sync · 6622f5cd
      Jacob Keller 提交于
      The kernel provides __dev_uc_sync and __dev_mc_sync in order for drivers
      which need individual notification of add and delete for each filter.
      These functions allow us to vastly simplify our .set_rx_mode handler. We
      need to implement two functions for sync and unsync which add and remove
      filters respectively.
      
      This change avoids a very complex and inefficient algorithm which
      resulted in an abnormal latency for the .set_rx_mode NDO operation. The
      resulting code after this change is more readable, more efficient, and
      less code.
      
      Due to the callback signature used by these functions we also must
      update several other functions to take a const u8 * pointer.
      
      Change-Id: I2ca7fd4e10c0c07ed2291db1ea41bf5987fc6474
      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>
      6622f5cd
    • J
      i40e: drop is_vf and is_netdev fields in struct i40e_mac_filter · 1bc87e80
      Jacob Keller 提交于
      Originally the is_vf and is_netdev fields were added in order to
      distinguish between VF and netdev filters in a single VSI. However, it
      can be noted that we use separate VSI for SRIOV VFs and for netdev VSI.
      Thus, since a single VSI should only ever have one type of filter, we
      can simply remove the checks and remove the typing.
      
      In a similar fashion, we can note that the only remaining way to get
      multiple filters of a single type is through a debug command that was
      added to debugfs. This command is useless in practice, and results in
      causing bugs if we keep counter tracking but lose the is_vf and
      is_netdev protections as desired above.
      
      Since the only time we'd actually have a counter value besides 0 and
      1 is through use of this debugfs hook, we can remove this unnecessary
      command, and the entire counter logic it required.
      
      We vastly simplify mac filters by removing
      
      (a) the distinction between VF and netdev filters
      (b) counting logic
      (c) the ability to add and remove filters bypassing the stack via debugfs
      
      Change-ID: Idf916dd2a1159b1188ddbab5bef6b85ea6bf27d9
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1bc87e80
  2. 29 10月, 2016 7 次提交
  3. 28 10月, 2016 3 次提交
  4. 18 10月, 2016 1 次提交
    • J
      ethernet/intel: use core min/max MTU checking · 91c527a5
      Jarod Wilson 提交于
      e100: min_mtu 68, max_mtu 1500
      - remove e100_change_mtu entirely, is identical to old eth_change_mtu,
        and no longer serves a purpose. No need to set min_mtu or max_mtu
        explicitly, as ether_setup() will already set them to 68 and 1500.
      
      e1000: min_mtu 46, max_mtu 16110
      
      e1000e: min_mtu 68, max_mtu varies based on adapter
      
      fm10k: min_mtu 68, max_mtu 15342
      - remove fm10k_change_mtu entirely, does nothing now
      
      i40e: min_mtu 68, max_mtu 9706
      
      i40evf: min_mtu 68, max_mtu 9706
      
      igb: min_mtu 68, max_mtu 9216
      - There are two different "max" frame sizes claimed and both checked in
        the driver, the larger value wasn't relevant though, so I've set max_mtu
        to the smaller of the two values here to retain identical behavior.
      
      igbvf: min_mtu 68, max_mtu 9216
      - Same issue as igb duplicated
      
      ixgb: min_mtu 68, max_mtu 16114
      - Also remove pointless old == new check, as that's done in dev_set_mtu
      
      ixgbe: min_mtu 68, max_mtu 9710
      
      ixgbevf: min_mtu 68, max_mtu dependent on hardware/firmware
      - Some hw can only handle up to max_mtu 1504 on a vf, others 9710
      
      CC: netdev@vger.kernel.org
      CC: intel-wired-lan@lists.osuosl.org
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      91c527a5
  5. 04 10月, 2016 4 次提交
  6. 25 9月, 2016 7 次提交
  7. 23 9月, 2016 2 次提交
  8. 02 9月, 2016 1 次提交
  9. 26 8月, 2016 1 次提交
  10. 20 8月, 2016 3 次提交
    • J
      i40e: use alloc_workqueue instead of create_singlethread_workqueue · 6992a6c9
      Jacob Keller 提交于
      Replace calls to create_singlethread_workqueue instead with alloc_workqueue
      as is style with other Intel drivers. This provides more control over
      workqueue creation, and allows explicit setting of the desired mode of
      operation. It also makes it more obvious that driver name constant is
      passed to a format "%s".
      
      Change-ID: I6192b44caf5140336cd54c5b350d51c73b541fdb
      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>
      6992a6c9
    • J
      i40e: use configured RSS key and lookup table in i40e_vsi_config_rss · 552b9962
      Jacob Keller 提交于
      A previous refactor added support to store user configuration for VSIs,
      so that extra VSIs such as for VMDq can use this information when
      configuring. Unfortunately the i40e_vsi_config_rss function was missed
      in this refactor, and the values were being ignored. Fix this by
      checking for the fields and using those instead of always using the
      default values.
      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>
      552b9962
    • J
      i40e: fix broken i40e_config_rss_aq function · 776b2e15
      Jacob Keller 提交于
      X722 hardware requires using the admin queue to configure RSS. This
      function was previously re-written in commit e69ff813 ("i40e: rework
      the functions to configure RSS with similar parameters").
      However, the previous refactor did not work correctly for a few reasons
      
      (a) it does not check whether seed is NULL before using it, resulting in
      a NULL pointer dereference
      
      [  402.954721] BUG: unable to handle kernel NULL pointer dereference at           (null)
      [  402.955568] IP: [<ffffffffa0090ccf>] i40e_config_rss_aq.constprop.65+0x2f/0x1c0 [i40e]
      [  402.956402] PGD ad610067 PUD accc0067 PMD 0
      [  402.957235] Oops: 0000 [#1] SMP
      [  402.958064] Modules linked in: ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_filter ebtable_
      broute bridge stp llc ebtable_nat ebtables ip6table_mangle ip6table_raw ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv
      6 ip6table_security ip6table_filter ip6_tables iptable_mangle iptable_raw iptable_nat nf_conntrack_ipv4_ nf_defrag_ipv4_ nf_nat_ip
      v4_ nf_nat nf_conntrack iptable_security intel_rapl i86_kg_temp_thermal coretemp kvm_intel kvm irqbypass crct10dif_clMl crc32_
      pclMl ghash_clMlni_intel iTCO_wdt iTCO_vendor_support shpchp sb_edac dcdbas pcspkr joydev ipmi_devintf wmi edac_core ipmi_ssif
       acpi_ad acpi_ower_meter ipmi_si ipmi_msghandler mei_me nfsd lpc_ich mei ioatdma tpm_tis auth_rpcgss tpm nfs_acl lockd grace s
      unrpc ifs nngag200 i2c_algo_bit drm_kms_helper ttm drm iigbe bnx2x i40e dca mdio ptp pps_core libcrc32c fjes crc32c_intel
      [  402.965563] CPU: 22 PID: 2461 Conm: ethtool Not tainted 4.6.0-rc7_1.2-ABNidQ+ #20
      [  402.966719] Hardware name: Dell Inc. PowerEdge R720/0C4Y3R, BIOS 2.5.2 01/28/2015
      [  402.967862] task: ffff880219b51dc0 ti: ffff8800b3408000 task.ti: ffff8800b3408000
      [  402.969046] RIP: 0010:[<ffffffffa0090ccf>]  [<ffffffffa0090ccf>] i40e_config_rss_aq.constprop.65+0x2f/0x1c0 [i40e]
      [  402.970339] RSP: 0018:ffff8800b340ba90  EFLAGS: 00010246
      [  402.971616] RAX: 0000000000000000 RBX: ffff88042ec14000 RCX: 0000000000000200
      [  402.972961] RDX: ffff880428eb9200 RSI: 0000000000000000 RDI: ffff88042ec14000
      [  402.974312] RBP: ffff8800b340baf8 R08: ffff880237ada8f0 R09: ffff880428eb9200
      [  402.975709] R10: ffff880428eb9200 R11: 0000000000000000 R12: ffff88042ec2e000
      [  402.977104] R13: ffff88042ec2e000 R14: ffff88042ec14000 R15: ffff88022ea00800
      [  402.978541] FS:  00007f84fd054700(0000) GS:ffff880237ac0000(0000) knlGS:0000000000000000
      [  402.980003] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  402.981508] CR2: 0000000000000000 CR3: 000000003289e000 CR4: 00000000000406e0
      [  402.983028] Stack:
      [  402.984578]  0000000002000200 0000000000000000 ffff88023ffeda68 ffff88023ffef000
      [  402.986187]  0000000000000268 ffff8800b340bbf8 ffff88023ffedd80 0000000088ce4f1d
      [  402.987844]  ffff88042ec14000 ffff88022ea00800 ffff88042ec2e000 ffff88042ec14000
      [  402.989509] Call Trace:
      [  402.991200]  [<ffffffffa009636f>] i40e_config_rss+0x11f/0x1c0 [i40e]
      [  402.992924]  [<ffffffffa00a1ae0>] i40e_set_rifh+0ic0/0x130 [i40e]
      [  402.994684]  [<ffffffff816d54b7>] ethtool_set_rifh+0x1f7/0x300
      [  402.996446]  [<ffffffff8136d02b>] ? cred_has_capability+0io6b/0x100
      [  402.998203]  [<ffffffff8136d102>] ? selinux_capable+0x12/0x20
      [  402.999968]  [<ffffffff8136277b>] ? security_capable+0x4b/0x70
      [  403.001707]  [<ffffffff816d6da3>] dev_ethtool+0x1423/0x2290
      [  403.003461]  [<ffffffff816eab41>] dev_ioctl+0x191/0io630
      [  403.005186]  [<ffffffff811cf80a>] ? lru_cache_add+0x3a/0i80
      [  403.006942]  [<ffffffff817f2a8e>] ? _raw_spin_unlock+0ie/0x20
      [  403.008691]  [<ffffffff816adb95>] sock_do_ioctl+0x45/0i50
      [  403.010421]  [<ffffffff816ae229>] sock_ioctl+0x209/0x2d0
      [  403.012173]  [<ffffffff81262194>] do_vfs_ioctl+0u4/0io6c0
      [  403.013911]  [<ffffffff81262829>] SyS_ioctl+0x79/0x90
      [  403.015710]  [<ffffffff817f2e72>] entry_SYSCALL_64_fastpath+0x1a/0u4
      [  403.017500] Code: 90 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 89 fb 48 83 ec 40 4c 8b a7 e0 05 00 00 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 <48> 8b 06 41 0f b7 bc 24 f2 0f 00 00 48 89 45 9c 48 8b 46 08 48
      [  403.021454] RIP  [<ffffffffa0090ccf>] i40e_config_rss_aq.constprop.65+0x2f/0x1c0 [i40e]
      [  403.023395]  RSP <ffff8800b340ba90>
      [  403.025271] CR2: 0000000000000000
      [  403.027169] ---[ end trace 64561b528cf61cf0 ]---
      
      (b) it does not even bother to use the passed in *lut parameter which
      defines the requested lookup table. Instead it uses its own round robin
      table.
      
      Fix these issues by re-writing it to be similar to i40e_config_rss_reg
      and i40e_get_rss_aq.
      
      Fixes: e69ff813 ("i40e: rework the functions to configure RSS with similar parameters", 2015-10-21)
      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>
      776b2e15