1. 22 Jun, 2020 15 commits
    • David S. Miller's avatar
      Merge branch 'bonding-initial-support-for-hardware-crypto-offload' · 2b3445e8
      David S. Miller authored
      Jarod Wilson says:
      
      ====================
      bonding: initial support for hardware crypto offload
      
      This is an initial functional implementation for doing pass-through of
      hardware encryption from bonding device to capable slaves, in active-backup
      bond setups. This was developed and tested using ixgbe-driven Intel x520
      interfaces with libreswan and a transport mode connection, primarily using
      netperf, with assorted connection failures forced during transmission. The
      failover works quite well in my testing, and overall performance is right
      on par with offload when running on a bare interface, no bond involved.
      
      Caveats: this is ONLY enabled for active-backup, because I'm not sure
      how one would manage multiple offload handles for different devices all
      running at the same time in the same xfrm, and it relies on some minor
      changes to both the xfrm code and slave device driver code to get things
      to behave, and I don't have immediate access to any other hardware that
      could function similarly, but the NIC driver changes are minimal and
      straight-forward enough that I've included what I think ought to be
      enough for mlx5 devices too.
      
      v2: reordered patches, switched (back) to using CONFIG_XFRM_OFFLOAD
      to wrap the code additions and wrapped overlooked additions.
      v3: rebase w/net-next open, add proper cc list to cover letter
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b3445e8
    • Jarod Wilson's avatar
      bonding: support hardware encryption offload to slaves · 18cb261a
      Jarod Wilson authored
      Currently, this support is limited to active-backup mode, as I'm not sure
      about the feasilibity of mapping an xfrm_state's offload handle to
      multiple hardware devices simultaneously, and we rely on being able to
      pass some hints to both the xfrm and NIC driver about whether or not
      they're operating on a slave device.
      
      I've tested this atop an Intel x520 device (ixgbe) using libreswan in
      transport mode, succesfully achieving ~4.3Gbps throughput with netperf
      (more or less identical to throughput on a bare NIC in this system),
      as well as successful failover and recovery mid-netperf.
      
      v2: just use CONFIG_XFRM_OFFLOAD for wrapping, isolate more code with it
      
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      CC: intel-wired-lan@lists.osuosl.org
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18cb261a
    • Jarod Wilson's avatar
      mlx5: become aware of when running as a bonding slave · bf3a058d
      Jarod Wilson authored
      I've been unable to get my hands on suitable supported hardware to date,
      but I believe this ought to be all that is needed to enable the mlx5
      driver to also work with bonding active-backup crypto offload passthru.
      
      CC: Boris Pismenny <borisp@mellanox.com>
      CC: Saeed Mahameed <saeedm@mellanox.com>
      CC: Leon Romanovsky <leon@kernel.org>
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf3a058d
    • Jarod Wilson's avatar
      ixgbe_ipsec: become aware of when running as a bonding slave · 0dea9ea9
      Jarod Wilson authored
      Slave devices in a bond doing hardware encryption also need to be aware
      that they're slaves, so we operate on the slave instead of the bonding
      master to do the actual hardware encryption offload bits.
      
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      CC: intel-wired-lan@lists.osuosl.org
      Acked-by: default avatarJeff Kirsher <Jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0dea9ea9
    • Jarod Wilson's avatar
      xfrm: bail early on slave pass over skb · 272c2330
      Jarod Wilson authored
      This is prep work for initial support of bonding hardware encryption
      pass-through support. The bonding driver will fill in the slave_dev
      pointer, and we use that to know not to skb_push() again on a given
      skb that was already processed on the bond device.
      
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      CC: intel-wired-lan@lists.osuosl.org
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      272c2330
    • David S. Miller's avatar
      Merge branch 'devlink-Support-get-set-mac-address-of-a-port-function' · 389cc2f3
      David S. Miller authored
      Parav Pandit says:
      
      ====================
      devlink: Support get,set mac address of a port function
      
      Currently, ip link set dev <pfndev> vf <vf_num> <param> <value> has
      below few limitations.
      
      1. Command is limited to set VF parameters only.
      It cannot set the default MAC address for the PCI PF.
      
      2. It can be set only on system where PCI SR-IOV capability exists.
      In smartnic based system, eswitch of a NIC resides on a different
      embedded cpu which has the VF and PF representors for the SR-IOV
      functions of a host system in which this smartnic is plugged-in.
      
      3. It cannot setup the function attributes of sub-function described
      in detail in comprehensive RFC [1] and [2].
      
      This series covers the first small part to let user query and set MAC
      address (hardware address) of a PCI PF/VF which is represented by
      devlink port pcipf, pcivf port flavours respectively.
      
      Whenever a devlink port manages a function connected to a devlink port,
      it allows to query and set its hardware address.
      
      Driver implements necessary get/set callback functions if it supports
      port function for a given port type.
      
      Patch summary:
      Patch-1 Prepares devlink port fill routines for extack
      Patch-2 and 3 extended devlink interface to get/set port function
      attributes, mainly hardware address to start with.
      
      Patch-2 Extended port dump command to query port function hardware
      address
      Patch-3 Introduces a command to set the hardware address of a port
      function
      
      Patch-4 to 9 refactors and implement devlink callbacks in mlx5_core
      driver.
      Patch-4 Constify the mac address pointer in set routines
      Patch-5 Introduces eswich check helper to use in devlink facing
      callbacks
      Patch-6 Moves port index, port number conversion routine to eswitch
      header file
      Patch-7 Implements port function query devlink callback
      Patch-8 Refactors mac address setting routine to uniformly use
      state_lock
      Patch-9 Implements port function set devlink callback
      
      [1] https://lore.kernel.org/netdev/20200519092258.GF4655@nanopsycho/
      [2] https://marc.info/?l=linux-netdev&m=158555928517777&w=2
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      389cc2f3
    • Parav Pandit's avatar
      net/mlx5: E-switch, Supporting setting devlink port function mac address · 330077d1
      Parav Pandit authored
      Enable user to set mac address of the PCI PF and VF port function.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      330077d1
    • Parav Pandit's avatar
      net/mlx5: Split mac address setting function for using state_lock · 1094795c
      Parav Pandit authored
      Refactor mac address setting function to let caller hold the necessary
      state_lock mutex, so that subsequent patch and use this helper routine.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1094795c
    • Parav Pandit's avatar
      net/mlx5: E-switch, Support querying port function mac address · f099fde1
      Parav Pandit authored
      Support querying mac address of the eswitch devlink port function.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f099fde1
    • Parav Pandit's avatar
      net/mlx5: Move helper to eswitch layer · 443bf36e
      Parav Pandit authored
      To use port number to port index conversion at eswitch level, move it to
      eswitch header.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      443bf36e
    • Parav Pandit's avatar
      net/mlx5: E-switch, Introduce and use eswitch support check helper · bd939753
      Parav Pandit authored
      Introduce an helper routine to get esw from a devlink device and use it
      at eswitch callbacks and in subsequent patch.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bd939753
    • Parav Pandit's avatar
      net/mlx5: Constify mac address pointer · fa997825
      Parav Pandit authored
      Since none of the functions need to modify the input mac address,
      constify them.
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fa997825
    • Parav Pandit's avatar
      net/devlink: Support setting hardware address of port function · a1e8ae90
      Parav Pandit authored
      PCI PF and VF devlink port can manage the function represented by a
      devlink port.
      
      Allow users to set port function's hardware address.
      
      Example of a PCI VF port which supports a port function:
      $ devlink port show pci/0000:06:00.0/2
      pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
        function:
          hw_addr 00:00:00:00:00:00
      
      $ devlink port function set pci/0000:06:00.0/2 hw_addr 00:11:22:33:44:55
      
      $ devlink port show pci/0000:06:00.0/2
      pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
        function:
          hw_addr 00:11:22:33:44:55
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1e8ae90
    • Parav Pandit's avatar
      net/devlink: Support querying hardware address of port function · 2a916ecc
      Parav Pandit authored
      PCI PF and VF devlink port can manage the function represented by
      a devlink port.
      
      Enable users to query port function's hardware address.
      
      Example of a PCI VF port which supports a port function:
      $ devlink port show pci/0000:06:00.0/2
      pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
        function:
          hw_addr 00:11:22:33:44:66
      
      $ devlink port show pci/0000:06:00.0/2 -jp
      {
          "port": {
              "pci/0000:06:00.0/2": {
                  "type": "eth",
                  "netdev": "enp6s0pf0vf1",
                  "flavour": "pcivf",
                  "pfnum": 0,
                  "vfnum": 1,
                  "function": {
                      "hw_addr": "00:11:22:33:44:66"
                  }
              }
          }
      }
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a916ecc
    • Parav Pandit's avatar
      net/devlink: Prepare devlink port functions to fill extack · a829eb0d
      Parav Pandit authored
      Prepare devlink port related functions to optionally fill up
      the extack information which will be used in subsequent patch by port
      function attribute(s).
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a829eb0d
  2. 21 Jun, 2020 25 commits