1. 23 May, 2020 22 commits
    • David S. Miller's avatar
      Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue · 098205f3
      David S. Miller authored
      Jeff Kirsher says:
      
      ====================
      1GbE Intel Wired LAN Driver Updates 2020-05-22
      
      This series contains updates to e1000e, igc and igb.
      
      Many of the patches in this series are fixes, but many of the igc fixes
      are based on the recent filter rule handling Andre has been working,
      which will not backport to earlier/stable kernels.  The remaining fixes
      for e1000e and igb have CC'd stable where applicable.
      
      Andre continue with his refactoring of the filter rule code to help with
      reducing the complexity, in multiple patches.  Fix the inconsistent size
      of a struct field.  Fixed an issue where filter rules stay active in the
      hardware, even after it was deleted, so make sure to disable the filter
      rule before deleting.  Fixed an issue with NFC rules which were dropping
      valid multicast MAC address.  Fixed how the NFC rules are restored after
      the NIC is reset or brought up, so that they are restored in the same order
      they were initially setup in.  Fix a potential memory leak when the
      driver is unloaded and the NFC rules are not flushed from memory
      properly.  Fixed how NFC rule validation handles when a request to
      overwrite an existing rule.  Changed the locking around the NFC rule API
      calls from spin_locks to mutex locks to avoid unnecessary busy waiting
      on lock contention.
      
      Sasha clean up more unused code in the igc driver.
      
      Kai-Heng Feng from Canonical provides three fixes, first has igb report
      the speed and duplex as unknown when in runtime suspend.  Fixed e1000e
      to pass up the error when disabling ULP mode.  Fixed e1000e performance
      by disabling TSO by default for certain MACs.
      
      Vitaly disables S0ix entry and exit flows for ME systems.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      098205f3
    • David S. Miller's avatar
      Merge tag 'mlx5-updates-2020-05-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 46c54f95
      David S. Miller authored
      Saeed Mahameed says:
      
      ====================
      mlx5-updates-2020-05-22
      
      This series includes two updates and one cleanup patch
      
      1) Tang Bim, clean-up with IS_ERR() usage
      
      2) Vlad introduces a new mlx5 kconfig flag for TC support
      
         This is required due to the high volume of current and upcoming
         development in the eswitch and representors areas where some of the
         feature are TC based such as the downstream patches of MPLSoUDP and
         the following representor bonding support for VF live migration and
         uplink representor dynamic loading.
         For this Vlad kept TC specific code in tc.c and rep/tc.c and
         organized non TC code in representors specific files.
      
      3) Eli Cohen adds support for MPLS over UPD encap and decap TC offloads.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      46c54f95
    • Randy Dunlap's avatar
      net: psample: fix build error when CONFIG_INET is not enabled · 07a7f308
      Randy Dunlap authored
      Fix psample build error when CONFIG_INET is not set/enabled by
      bracketing the tunnel code in #ifdef CONFIG_NET / #endif.
      
      ../net/psample/psample.c: In function ‘__psample_ip_tun_to_nlattr’:
      ../net/psample/psample.c:216:25: error: implicit declaration of function ‘ip_tunnel_info_opts’; did you mean ‘ip_tunnel_info_opts_set’? [-Werror=implicit-function-declaration]
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Yotam Gigi <yotam.gi@gmail.com>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      07a7f308
    • Michael Walle's avatar
      net: phy: at803x: fix PHY ID masks · 0465d8f8
      Michael Walle authored
      Ever since its first commit 0ca7111a ("phy: add AT803x driver") the
      PHY ID mask was set to 0xffffffef. It is unclear to me why this mask was
      chosen in the first place. Both the AR8031/AR8033 and the AR8035
      datasheets mention it is always the given value:
       - for AR8031/AR8033 its 0x004d/0xd074
       - for AR8035 its 0x004d/0xd072
      
      Unfortunately, I don't have a datasheet for the AR8030. Therefore, we
      leave its PHY ID mask untouched. For the PHYs mentioned before use the
      handy PHY_ID_MATCH_EXACT() macro.
      
      I've tried to contact the author of the initial commit, but received no
      answer so far.
      
      Cc: Matus Ujhelyi <ujhelyi.m@gmail.com>
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0465d8f8
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · a152b859
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2020-05-23
      
      The following pull-request contains BPF updates for your *net-next* tree.
      
      We've added 50 non-merge commits during the last 8 day(s) which contain
      a total of 109 files changed, 2776 insertions(+), 2887 deletions(-).
      
      The main changes are:
      
      1) Add a new AF_XDP buffer allocation API to the core in order to help
         lowering the bar for drivers adopting AF_XDP support. i40e, ice, ixgbe
         as well as mlx5 have been moved over to the new API and also gained a
         small improvement in performance, from Björn Töpel and Magnus Karlsson.
      
      2) Add getpeername()/getsockname() attach types for BPF sock_addr programs
         in order to allow for e.g. reverse translation of load-balancer backend
         to service address/port tuple from a connected peer, from Daniel Borkmann.
      
      3) Improve the BPF verifier is_branch_taken() logic to evaluate pointers
         being non-NULL, e.g. if after an initial test another non-NULL test on
         that pointer follows in a given path, then it can be pruned right away,
         from John Fastabend.
      
      4) Larger rework of BPF sockmap selftests to make output easier to understand
         and to reduce overall runtime as well as adding new BPF kTLS selftests
         that run in combination with sockmap, also from John Fastabend.
      
      5) Batch of misc updates to BPF selftests including fixing up test_align
         to match verifier output again and moving it under test_progs, allowing
         bpf_iter selftest to compile on machines with older vmlinux.h, and
         updating config options for lirc and v6 segment routing helpers, from
         Stanislav Fomichev, Andrii Nakryiko and Alan Maguire.
      
      6) Conversion of BPF tracing samples outdated internal BPF loader to use
         libbpf API instead, from Daniel T. Lee.
      
      7) Follow-up to BPF kernel test infrastructure in order to fix a flake in
         the XDP selftests, from Jesper Dangaard Brouer.
      
      8) Minor improvements to libbpf's internal hashmap implementation, from
         Ian Rogers.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a152b859
    • Vitaly Lifshits's avatar
      e1000e: disable s0ix entry and exit flows for ME systems · e086ba2f
      Vitaly Lifshits authored
      Since ME systems do not support SLP_S0 in S0ix state, and S0ix entry
      and exit flows may cause errors on them it is best to avoid using
      e1000e_s0ix_entry_flow and e1000e_s0ix_exit_flow functions.
      
      This was done by creating a struct of all devices that comes with ME
      and by checking if the current device has ME.
      Signed-off-by: default avatarVitaly Lifshits <vitaly.lifshits@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e086ba2f
    • Kai-Heng Feng's avatar
      e1000e: Disable TSO for buffer overrun workaround · f2980103
      Kai-Heng Feng authored
      Commit b10effb9 ("e1000e: fix buffer overrun while the I219 is
      processing DMA transactions") imposes roughly 30% performance penalty.
      
      The commit log states that "Disabling TSO eliminates performance loss
      for TCP traffic without a noticeable impact on CPU performance", so
      let's disable TSO by default to regain the loss.
      
      CC: stable <stable@vger.kernel.org>
      Fixes: b10effb9 ("e1000e: fix buffer overrun while the I219 is processing DMA transactions")
      BugLink: https://bugs.launchpad.net/bugs/1802691Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      f2980103
    • Kai-Heng Feng's avatar
      e1000e: Warn if disabling ULP failed · 0c80cdbf
      Kai-Heng Feng authored
      The hardware may stop working if driver failed to disable ULP mode.
      
      Take the return value of e1000_disable_ulp_lpt_lp() into account, and
      pass up the error if it fails.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0c80cdbf
    • Kai-Heng Feng's avatar
      igb: Report speed and duplex as unknown when device is runtime suspended · 165ae7a8
      Kai-Heng Feng authored
      igb device gets runtime suspended when there's no link partner. We can't
      get correct speed under that state:
      $ cat /sys/class/net/enp3s0/speed
      1000
      
      In addition to that, an error can also be spotted in dmesg:
      [  385.991957] igb 0000:03:00.0 enp3s0: PCIe link lost
      
      Since device can only be runtime suspended when there's no link partner,
      we can skip reading register and let the following logic set speed and
      duplex with correct status.
      
      The more generic approach will be wrap get_link_ksettings() with begin()
      and complete() callbacks. However, for this particular issue, begin()
      calls igb_runtime_resume() , which tries to rtnl_lock() while the lock
      is already hold by upper ethtool layer.
      
      So let's take this approach until the igb_runtime_resume() no longer
      needs to hold rtnl_lock.
      
      CC: stable <stable@vger.kernel.org>
      Suggested-by: default avatarAlexander Duyck <alexander.duyck@gmail.com>
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      165ae7a8
    • Sasha Neftin's avatar
      igc: Remove unused descriptor's flags · 14ec06b0
      Sasha Neftin authored
      Enable Tidv register, Report Packet Sent, Report Status and
      Ethernet CRC flags not in use.
      This patch comes to clean up these flags.
      Signed-off-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      14ec06b0
    • Andre Guedes's avatar
      igc: Remove igc_nfc_rule_exit() · 5c739e77
      Andre Guedes authored
      During igc_down(), we call igc_nfc_rule_exit() which traverse the NFC
      rule list disabling filters one by one. Later on in igc_down() flow
      we issue an hardware reset which also clear all filters.  Since we
      already reset the hardware, we don't actually need to disable each
      filter manually. In order to simplify the code, this patch removes
      igc_nfc_rule() altogether.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      5c739e77
    • Andre Guedes's avatar
      igc: Change adapter->nfc_rule_lock to mutex · 42fc5dc0
      Andre Guedes authored
      This patch changes adapter->nfc_rule_lock type from spin_lock to mutex
      so we avoid unnecessary busy waiting on lock contention.
      
      A closer look at the execution context of NFC rule API users shows that
      all of them run in process context. The API users are: ethtool ops,
      igc_configure(), called when interface is brought up by user or reset
      workequeue thread, igc_down(), called when interface is brought down,
      and igc_remove(), called when driver is unloaded.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      42fc5dc0
    • Andre Guedes's avatar
      igc: Change return type from igc_disable_nfc_rule() · acda576f
      Andre Guedes authored
      None of igc_disable_nfc_rule() callers actually check its returning
      value. A closer look at why this function would fail shows that the
      only situation is when we try to delete an Ethertype or MAC filter that
      doesn't exist.
      
      That situation is very unlikely so we can change igc_del_etype_filter()
      and igc_del_mac_filter() logic to "if the filter doesn't exist, we are
      done", and keep the logic in igc_disable_nfc_rule() callers simple.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      acda576f
    • Andre Guedes's avatar
      igc: Fix NFC rule validation · 1894df0c
      Andre Guedes authored
      If we try to overwrite an existing rule with the same filter but
      different action, we get EEXIST error as shown below.
      
      $ ethtool -N eth0 flow-type ether dst <MACADDR> action 1 loc 10
      $ ethtool -N eth0 flow-type ether dst <MACADDR> action 2 loc 10
      rmgr: Cannot insert RX class rule: File exists
      
      The second command is expected to overwrite the previous rule in location
      10 and succeed.
      
      This patch fixes igc_ethtool_check_nfc_rule() so it also checks the
      rules location. In case they match, the rule under evaluation should not
      be considered invalid.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1894df0c
    • Andre Guedes's avatar
      igc: Fix NFC rules leak when driver is unloaded · e256ec83
      Andre Guedes authored
      If we have RFC rules in adapter->nfc_rule_list when the IGC driver
      is unloaded, all rules are leaked. This patch fixes the issue by
      introducing the helper igc_flush_nfc_rules() and calling it in
      igc_remove(). It also updates igc_set_features() so is reuses the
      new helper instead of re-implementing it.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e256ec83
    • Andre Guedes's avatar
      igc: Refactor igc_ethtool_update_nfc_rule() · 36fa2152
      Andre Guedes authored
      Current implementation of igc_ethtool_update_nfc_rule() is a bit
      convoluted since it handles too many things: rule lookup, deletion
      and addition. This patch breaks it into three functions so we simplify
      the code and improve code reuse.
      
      Code related to rule lookup is refactored out to a new function called
      igc_get_nfc_rule().
      
      Code related to rule addition is refactored out to a new function called
      igc_add_nfc_rule(). This function enables the rule in hardware and adds
      it to the adapter's list.
      
      Code related to rule deletion is refactored out to a new function called
      igc_del_nfc_rule(). This function disables the rule in hardware, removes
      it from adapter's list, and deletes it.
      
      As a byproduct of this refactoring, igc_enable_nfc_rule() and
      igc_disable_nfc_rule() are moved to igc_main.c since they are not used
      in igc_ethtool.c anymore, and igc_restore_nfc_rules() and igc_nfc_rule_
      exit() are moved around to avoid forward declaration.
      
      Also, since this patch already touches igc_ethtool_get_nfc_rule(), it
      takes the opportunity to remove the 'match_flags' check. Empty flags
      are not allowed to be added so no need to check that.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      36fa2152
    • Andre Guedes's avatar
      igc: Fix NFC rules restoration · d957c601
      Andre Guedes authored
      When network interface is brought up, the driver re-enables the NFC
      rules previously configured. However, this is done in reverse order
      the rules were added and hardware filters are configured differently.
      
      For example, consider the following rules:
      
      $ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:AA queue 0
      $ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:BB queue 1
      $ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:CC queue 2
      $ ethtool -N eth0 flow-type ether dst 00:00:00:00:00:DD queue 3
      
      RAL/RAH registers are configure so filter index 1 has address ending
      with AA, filter index 2 has address ending in BB, and so on.
      
      If we bring the interface down and up again, RAL/RAH registers are
      configured so filter index 1 has address ending in DD, filter index 2
      has CC, and so on. IOW, in reverse order we had before bringing the
      interface down.
      
      This issue can be fixed by traversing adapter->nfc_rule_list in
      backwards when restoring the rules. Since hlist doesn't support
      backwards traversal, this patch replaces it by list_head and fixes
      igc_restore_nfc_rules() accordingly.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d957c601
    • Andre Guedes's avatar
      igc: Fix NFC rules with multicast addresses · 39707c16
      Andre Guedes authored
      Multicast MAC addresses are valid address for NFC rules but
      igc_add_mac_filter() is currently rejecting them. In fact, the I225
      controller doesn't impose any constraint on the address value so this
      patch gets rid of the address validation check in MAC filter APIs.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      39707c16
    • Andre Guedes's avatar
      igc: Fix NFC rule overwrite cases · 4bdf89e8
      Andre Guedes authored
      When the 'loc' argument is passed in ethtool, the input rule overwrites
      any rule present in that location. In this situation we must disable the
      old rule otherwise it is left enabled in hardware. This patch fixes
      the issue by always calling igc_disable_nfc_rule() when deleting the
      old rule, no matter the value of 'input' argument.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      4bdf89e8
    • Andre Guedes's avatar
      igc: Fix locking issue when retrieving NFC rules · b500350a
      Andre Guedes authored
      Access to NFC rules stored in adapter->nfc_rule_list is protect by
      adapter->nfc_rule_lock. The functions igc_ethtool_get_nfc_rule()
      and igc_ethtool_get_nfc_rules() are missing to hold the lock while
      accessing rule objects.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b500350a
    • Andre Guedes's avatar
      igc: Fix 'sw_idx' type in struct igc_nfc_rule · d3ba9e6f
      Andre Guedes authored
      The 'sw_idx' field from 'struct igc_nfc_rule' is u16 type but it is
      assigned an u32 value in igc_ethtool_init_nfc_rule(). This patch changes
      'sw_idx' type to u32 so they match. Also, it makes more sense to call
      this field 'location' since it holds the NFC rule location.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d3ba9e6f
    • Andre Guedes's avatar
      igc: Refactor igc_ethtool_add_nfc_rule() · 16fdc16c
      Andre Guedes authored
      Current implementation of igc_ethtool_add_nfc_rule() is quite long and a
      bit convoluted so this patch does a code refactoring to improve the
      code.
      
      Code related to NFC rule object initialization is refactored out to the
      local helper function igc_ethtool_init_nfc_rule(). Likewise, code
      related to NFC rule validation is refactored out to another local
      helper, igc_ethtool_is_nfc_rule_valid().
      
      RX_CLS_FLOW_DISC check is removed since it is redundant. The macro is
      defined as the max value fsp->ring_cookie can have, so checking if
      fsp->ring_cookie >= adapter->num_rx_queues is already sufficient.
      
      Finally, some log messages are improved or added, and obvious comments
      are removed.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      16fdc16c
  2. 22 May, 2020 18 commits