1. 23 May, 2020 40 commits
    • David S. Miller's avatar
      Merge branch 'r8169-remove-mask-argument-from-few-ERI-OCP-functions' · 54b9aca0
      David S. Miller authored
      Heiner Kallweit says:
      
      ====================
      r8169: remove mask argument from few ERI/OCP functions
      
      Few ERI/OCP functions have a mask argument that isn't needed.
      Remove it to simplify the functions.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      54b9aca0
    • Heiner Kallweit's avatar
      r8169: remove mask argument from r8168ep_ocp_read · 787c0c04
      Heiner Kallweit authored
      Remove the mask argument as it's not used by r8168ep_ocp_read().
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      787c0c04
    • Heiner Kallweit's avatar
      r8169: remove mask argument from r8168dp_ocp_read · a15aaa03
      Heiner Kallweit authored
      All callers read the full 32bit value, therefore the mask argument can
      be removed.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a15aaa03
    • Heiner Kallweit's avatar
      r8169: remove mask argument from rtl_w0w1_eri · 54113ded
      Heiner Kallweit authored
      rtl_eri_read() returns the full 32bit value, therefore there's no
      benefit in writing back parts of it only. handle it like the vendor
      driver and write the full 32 bit always. Omitting the mask argument
      avoids some overhead and makes the code better readable.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      54113ded
    • David S. Miller's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue · 2b1a7f74
      David S. Miller authored
      Jeff Kirsher says:
      
      ====================
      100GbE Intel Wired LAN Driver Updates 2020-05-22
      
      This series contains updates to virtchnl and the ice driver.
      
      Geert Uytterhoeven fixes a data structure alignment issue in the
      virtchnl structures.
      
      Henry adds Flow Director support which allows for the redirection on
      ntuple rules over six patches.  Initially Henry adds the initial
      infrastructure for Flow Director, and then later adds IPv4 and IPv6
      support, as well as being able to display the ntuple rules.
      
      Bret add Accelerated Receive Flow Steering (aRFS) support which is used
      to steer receive flows to a specific queue.  Fixes a transmit timeout
      when the VF link transitions from up/down/up because the transmit and
      receive queue interrupts are not enabled as part of VF's link up.  Fixed
      an issue when the default VF LAN address is changed and after reset the
      PF will attempt to add the new MAC, which fails because it already
      exists. This causes the VF to be disabled completely until it is removed
      and enabled via sysfs.
      
      Anirudh (Ani) makes a fix where the ice driver needs to call set_mac_cfg
      to enable jumbo frames, so ensure it gets called during initialization
      and after reset.  Fix bad register reads during a register dump in
      ethtool by removing the bad registers.
      
      Paul fixes an issue where the receive Malicious Driver Detection (MDD)
      auto reset message was not being logged because it occurred after the VF
      reset.
      
      Victor adds a check for compatibility between the Dynamic Device
      Personalization (DDP) package and the NIC firmware to ensure that
      everything aligns.
      
      Jesse fixes a administrative queue string call with the appropriate
      error reporting variable.  Also fixed the loop variables that are
      comparing or assigning signed against unsigned values.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b1a7f74
    • 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
    • Jesse Brandeburg's avatar
      ice: cleanup unsigned loops · c1e08830
      Jesse Brandeburg authored
      Fix loop variables that are comparing or assigning signed against
      unsigned values, mostly by declaring loop counters as unsigned.
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c1e08830
    • Jesse Brandeburg's avatar
      ice: fix usage of incorrect variable · 9d68a79c
      Jesse Brandeburg authored
      The driver was using rq_last_status where it should have been
      using sq_last_status. Fix the string to be using the correct
      error reporting variable.
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9d68a79c
    • Anirudh Venkataramanan's avatar
      ice: Fix bad register reads · 1fba4a8a
      Anirudh Venkataramanan authored
      The "ethtool -d" handler reads registers in the ice_regs_dump_list array
      and returns read values back to the userspace.
      
      The register offsets PFINT0_ITR* are not valid as per the specification
      and reading these causes a "unable to handle kernel paging request" bug
      in the driver. Remove these registers from ice_regs_dump_list.
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1fba4a8a
    • Victor Raj's avatar
      ice: check for compatibility between DDP package and firmware · b8272919
      Victor Raj authored
      Require the Dynamic Device Personalization (DDP) file to have the same
      major version number and the same or older minor number than the firmware
      version major and minor, respectively.
      
      Check the OS and NVM package versions before downloading the package.
      If the OS package version is not compatible with NVM then return an
      appropriate error.
      
      Split the 32-byte segment name into a 28-byte segment name and
      a 4-byte Track-ID. Older packages will still work with this change
      because no package has a name that will take up more than 28 bytes;
      in this case the Track-ID will be 0.
      
      Note that the driver will store the segment name as 32-bytes in the
      ice_hw structure, in order to normalize the length of the various
      package name strings that it uses.
      
      Also add section ID and structure for the segment metadata section.
      Signed-off-by: default avatarVictor Raj <victor.raj@intel.com>
      Signed-off-by: default avatarDan Nowlin <dan.nowlin@intel.com>
      Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b8272919
    • Brett Creeley's avatar
      ice: Check if unicast MAC exists before setting VF MAC · 47ebc7b0
      Brett Creeley authored
      Currently if a unicast MAC is set via ndo_set_vf_mac, the PF driver will
      set the VF's dflt_lan_addr.addr once some basic checks have passed. The
      VF is then reset. During reset the PF driver will attempt to program the
      VF's MAC from the dflt_lan_addr.addr field. This fails when the MAC
      already exists on the PF's switch.
      
      This is causing the VF to be completely disabled until removing/enabling
      any VFs via sysfs.
      
      Fix this by checking if the unicast MAC exists before triggering a VF
      reset directly in ndo_set_vf_mac. Also, add a check if the unicast MAC
      is set to the same value as before and return 0 if that is the case.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      47ebc7b0
    • Brett Creeley's avatar
      ice: Fix Tx timeout when link is toggled on a VF's interface · 4dc926d3
      Brett Creeley authored
      Currently if the iavf is loaded and a VF link transitions from up to
      down to up again a Tx timeout will be triggered. This happens because
      Tx/Rx queue interrupts are only enabled when receiving the
      VIRTCHNL_OP_CONFIG_MAP_IRQ message, which happens on reset or initial
      iavf driver load, but not when bringing link up. This is problematic
      because they are disabled on the VIRTCHNL_OP_DISABLE_QUEUES message,
      which is part of bringing a VF's link down. However, they are not
      enabled on the VIRTCHNL_OP_ENABLE_QUEUES message, which is part of
      bringing a VF's link up.
      
      Fix this by re-enabling the VF's Rx and Tx queue interrupts when they
      were previously configured. This is done by first checking to make
      sure the previous value in QINT_[R|T]QCTL.MSIX_INDX is not 0, which
      is used to represent the OICR in the VF's interrupt space. If the
      MSIX_INDX is non-zero then enable the interrupt by setting the
      QINT_[R|T]CTL.CAUSE_ENA bit to 1.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      4dc926d3
    • Paul Greenwalt's avatar
      ice: print Rx MDD auto reset message before VF reset · 7438a3b0
      Paul Greenwalt authored
      Rx MDD auto reset message was not being logged because logging occurred
      after the VF reset and the VF MDD data was reinitialized.
      
      Log the Rx MDD auto reset message before triggering the VF reset.
      Signed-off-by: default avatarPaul Greenwalt <paul.greenwalt@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      7438a3b0
    • Anirudh Venkataramanan's avatar
      ice: Call ice_aq_set_mac_cfg · 42449105
      Anirudh Venkataramanan authored
      As per the specification, the driver needs to call set_mac_cfg
      (opcode 0x0603) to be able to exercise jumbo frames. Call the
      function during initialization and the post reset rebuild flow.
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      42449105
    • Brett Creeley's avatar
      ice: Implement aRFS · 28bf2672
      Brett Creeley authored
      Enable accelerated Receive Flow Steering (aRFS). It is used to steer Rx
      flows to a specific queue. This functionality is triggered by the network
      stack through ndo_rx_flow_steer and requires Flow Director (ntuple on) to
      function.
      
      The fltr_info is used to add/remove/update flow rules in the HW, the
      fltr_state is used to determine what to do with the filter with respect
      to HW and/or SW, and the flow_id is used in co-ordination with the
      network stack.
      
      The work for aRFS is split into two paths: the ndo_rx_flow_steer
      operation and the ice_service_task. The former is where the kernel hands
      us an Rx SKB among other items to setup aRFS and the latter is where
      the driver adds/updates/removes filter rules from HW and updates filter
      state.
      
      In the Rx path the following things can happen:
              1. New aRFS entries are added to the hash table and the state is
                 set to ICE_ARFS_INACTIVE so the filter can be updated in HW
                 by the ice_service_task path.
              2. aRFS entries have their Rx Queue updated if we receive a
                 pre-existing flow_id and the filter state is ICE_ARFS_ACTIVE.
                 The state is set to ICE_ARFS_INACTIVE so the filter can be
                 updated in HW by the ice_service_task path.
              3. aRFS entries marked as ICE_ARFS_TODEL are deleted
      
      In the ice_service_task path the following things can happen:
              1. New aRFS entries marked as ICE_ARFS_INACTIVE are added or
                 updated in HW.
                 and their state is updated to ICE_ARFS_ACTIVE.
              2. aRFS entries are deleted from HW and their state is updated
                 to ICE_ARFS_TODEL.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarMadhu Chittim <madhu.chittim@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      28bf2672
    • Henry Tieman's avatar
      ice: Restore filters following reset · 83af0039
      Henry Tieman authored
      Following a reset, Flow Director filters are cleared from the hardware.
      Rebuild the filters using the software structures containing the filter
      rules.
      Signed-off-by: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      83af0039
    • Henry Tieman's avatar
      ice: Enable flex-bytes support · 2c57ffcb
      Henry Tieman authored
      Flex-bytes allows for packet matching based on an offset and value. This
      is supported via the ethtool user-def option.  It is specified by providing
      an offset followed by a 2 byte match value. Offset is measured from the
      start of the MAC address.
      
      The following restrictions apply to flex-bytes. The specified offset must
      be an even number and be smaller than 0x1fe.
      
      Example usage:
      
      ethtool -N eth0 flow-type tcp4 src-ip 192.168.0.55 dst-ip 172.16.0.55 \
      src-port 12 dst-port 13 user-def 0x10ffff action 32
      Signed-off-by: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      2c57ffcb
    • Henry Tieman's avatar
      ice: Support IPv6 Flow Director filters · 165d80d6
      Henry Tieman authored
      Extend supported filters to allow for IPv6 filters.
      
      Supported fields are: src-ip, dst-ip, src-port, and dst-port
      Supported flow-types are: tcp6, udp6, sctp6, ip6
      
      Example usage:
      
      ethtool -N eth0 flow-type tcp6 src-port 12 dst-port 13 \
      src-ip fce0::1:34 dst-ip fce0::1:35 action 32
      Signed-off-by: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      165d80d6
    • Henry Tieman's avatar
      ice: Support IPv4 Flow Director filters · cac2a27c
      Henry Tieman authored
      Support the addition and deletion of IPv4 filters.
      
      Supported fields are: src-ip, dst-ip, src-port, and dst-port
      Supported flow-types are: tcp4, udp4, sctp4, ip4
      
      Example usage:
      
      ethtool -N eth0 flow-type tcp4 src-ip 192.168.0.55 dst-ip 172.16.0.55 \
      src-port 16 dst-port 12 action 32
      Signed-off-by: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      cac2a27c
    • Henry Tieman's avatar
      ice: Support displaying ntuple rules · 4ab95646
      Henry Tieman authored
      Add functionality for ethtool --show-ntuple, allowing for filters to be
      displayed when set functionality is added. Add statistics related to
      Flow Director matches and status.
      Signed-off-by: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      4ab95646
    • Henry Tieman's avatar
      ice: Initialize Flow Director resources · 148beb61
      Henry Tieman authored
      Flow Director allows for redirection based on ntuple rules. Rules are
      programmed using the ethtool set-ntuple interface. Supported actions are
      redirect to queue and drop.
      
      Setup the initial framework to process Flow Director filters. Create and
      allocate resources to manage and program filters to the hardware. Filters
      are processed via a sideband interface; a control VSI is created to manage
      communication and process requests through the sideband. Upon allocation of
      resources, update the hardware tables to accept perfect filters.
      Signed-off-by: default avatarHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      148beb61
    • Geert Uytterhoeven's avatar
      virtchnl: Add missing explicit padding to structures · 65ece6de
      Geert Uytterhoeven authored
      On e.g. m68k, the alignment of 32-bit values is only 2 bytes, leading
      to the following:
      
          ./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      					^
          ./include/linux/avf/virtchnl.h:577:1: note: in expansion of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
           VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:577:32: error: enumerator value for ‘virtchnl_static_assert_virtchnl_filter’ is not an integer constant
           VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
      				    ^~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:147:53: note: in definition of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      							 ^
          ./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      					^
          ./include/linux/avf/virtchnl.h:619:1: note: in expansion of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
           VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:619:31: error: enumerator value for ‘virtchnl_static_assert_virtchnl_pf_event’ is not an integer constant
           VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
      				   ^~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:147:53: note: in definition of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      							 ^
          ./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      					^
          ./include/linux/avf/virtchnl.h:640:1: note: in expansion of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
           VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:640:31: error: enumerator value for ‘virtchnl_static_assert_virtchnl_iwarp_qv_info’ is not an integer constant
           VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
      				   ^~~~~~~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:147:53: note: in definition of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      							 ^
          ./include/linux/avf/virtchnl.h:147:36: warning: division by zero [-Wdiv-by-zero]
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      					^
          ./include/linux/avf/virtchnl.h:647:1: note: in expansion of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
           VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:647:31: error: enumerator value for ‘virtchnl_static_assert_virtchnl_iwarp_qvlist_info’ is not an integer constant
           VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
      				   ^~~~~~~~~~~~~~~~~~~~~~~~~~
          ./include/linux/avf/virtchnl.h:147:53: note: in definition of macro ‘VIRTCHNL_CHECK_STRUCT_LEN’
            { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
      							 ^
      
      Fix this by adding explicit padding to structures with holes.
      
      Reported-by: <noreply@ellerman.id.au>
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      65ece6de
    • 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