1. Dec 09, 2022
  2. Dec 08, 2022
    • Jakub Kicinski's avatar
      Merge branch 'net-ethernet-ti-am65-cpsw-fix-set-channel-operation' · d8b879c0
      Jakub Kicinski authored
      Roger Quadros says:
      
      ====================
      net: ethernet: ti: am65-cpsw: Fix set channel operation
      
      This contains a critical bug fix for the recently merged suspend/resume
      support [1] that broke set channel operation. (ethtool -L eth0 tx <n>)
      
      As there were 2 dependent patches on top of the offending commit [1]
      first revert them and then apply them back after the correct fix.
      
      [1] fd23df72 ("net: ethernet: ti: am65-cpsw: Add suspend/resume support")
      ====================
      
      Link: https://lore.kernel.org/r/20221206094419.19478-1-rogerq@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d8b879c0
    • Roger Quadros's avatar
      net: ethernet: ti: am65-cpsw: Fix hardware switch mode on suspend/resume · 020b232f
      Roger Quadros authored
      
      
      On low power during system suspend the ALE table context is lost.
      Save the ALE context before suspend and restore it after resume.
      
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      020b232f
    • Roger Quadros's avatar
      net: ethernet: ti: am65-cpsw: retain PORT_VLAN_REG after suspend/resume · 1581cd8b
      Roger Quadros authored
      
      
      During suspend resume the context of PORT_VLAN_REG is lost so
      save it during suspend and restore it during resume for
      host port and slave ports.
      
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1581cd8b
    • Roger Quadros's avatar
      net: ethernet: ti: am65-cpsw: Add suspend/resume support · 24bc19b0
      Roger Quadros authored
      
      
      Add PM handlers for System suspend/resume.
      
      As DMA driver doesn't yet support suspend/resume we free up
      the DMA channels at suspend and acquire and initialize them
      at resume.
      
      In this revised approach we do not free the TX/RX IRQs at
      am65_cpsw_nuss_common_stop() as it causes problems.
      We will now free them only on .suspend() as we need to release
      the DMA channels (as DMA looses context) and re-acquiring
      them on .resume() may not necessarily give us the same
      IRQs.
      
      To make this easier:
      - introduce am65_cpsw_nuss_remove_rx_chns() which is
         similar to am65_cpsw_nuss_remove_tx_chns(). These will
         be invoked in pm.suspend() to release the DMA channels
         and free up the IRQs.
      - move napi_add() and request_irq() calls to
         am65_cpsw_nuss_init_rx/tx_chns() so we can invoke them
         in pm.resume() to acquire the DMA channels and IRQs.
      
      As CPTS looses contect during suspend/resume, invoke the
      necessary CPTS suspend/resume helpers.
      
      ALE_CLEAR command is issued in cpsw_ale_start() so no need
      to issue it before the call to cpsw_ale_start().
      
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      24bc19b0
    • Roger Quadros's avatar
      Revert "net: ethernet: ti: am65-cpsw: Add suspend/resume support" · 1a014663
      Roger Quadros authored
      This reverts commit fd23df72
      
      .
      
      This commit broke set channel operation. Revert this and
      implement it with a different approach in a separate patch.
      
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1a014663
    • Roger Quadros's avatar
      Revert "net: ethernet: ti: am65-cpsw: retain PORT_VLAN_REG after suspend/resume" · 1bae8fa8
      Roger Quadros authored
      This reverts commit 643cf0e3.
      
      This is to make it easier to revert the offending commit
      fd23df72
      
       ("net: ethernet: ti: am65-cpsw: Add suspend/resume support")
      
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1bae8fa8
    • Roger Quadros's avatar
      Revert "net: ethernet: ti: am65-cpsw: Fix hardware switch mode on suspend/resume" · 1a352596
      Roger Quadros authored
      This reverts commit 1af3cb37.
      
      This is to make it easier to revert the offending commit
      fd23df72
      
       ("net: ethernet: ti: am65-cpsw: Add suspend/resume support")
      
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1a352596
    • Jakub Kicinski's avatar
      Merge branch 'devlink-add-port-function-attribute-to-enable-disable-roce-and-migratable' · e1228581
      Jakub Kicinski authored
      Shay Drory says:
      
      ====================
      devlink: Add port function attribute to enable/disable Roce and migratable
      
      This series is a complete rewrite of the series "devlink: Add port
      function attribute to enable/disable roce"
      link:
      https://lore.kernel.org/netdev/20221102163954.279266-1-danielj@nvidia.com/
      
      Currently mlx5 PCI VF and SF are enabled by default for RoCE
      functionality. And mlx5 PCI VF is disable by dafault for migratable
      functionality.
      
      Currently a user does not have the ability to disable RoCE for a PCI
      VF/SF device before such device is enumerated by the driver.
      
      User is also incapable to do such setting from smartnic scenario for a
      VF from the smartnic.
      
      Current 'enable_roce' device knob is limited to do setting only at
      driverinit time. By this time device is already created and firmware has
      already allocated necessary system memory for supporting RoCE.
      
      Also, Currently a user does not have the ability to enable migratable
      for a PCI VF.
      
      The above are a hyper visor level control, to set the functionality of
      devices passed through to guests.
      
      This is achieved by extending existing 'port function' object to control
      capabilities of a function. This enables users to control capability of
      the device before enumeration.
      
      Examples when user prefers to disable RoCE for a VF when using switchdev
      mode:
      
      $ devlink port show pci/0000:06:00.0/1
      pci/0000:06:00.0/1: type eth netdev pf0vf0 flavour pcivf controller 0
      pfnum 0 vfnum 0 external false splittable false
        function:
          hw_addr 00:00:00:00:00:00 roce enable
      
      $ devlink port function set pci/0000:06:00.0/1 roce disable
      
      $ devlink port show pci/0000:06:00.0/1
      pci/0000:06:00.0/1: type eth netdev pf0vf0 flavour pcivf controller 0
      pfnum 0 vfnum 0 external false splittable false
        function:
          hw_addr 00:00:00:00:00:00 roce disable
      
      FAQs:
      -----
      1. What does roce enable/disable do?
      Ans: It disables RoCE capability of the function before its enumerated,
      so when driver reads the capability from the device firmware, it is
      disabled.
      At this point RDMA stack will not be able to create UD, QP1, RC, XRC
      type of QPs. When RoCE is disabled, the GID table of all ports of the
      device is disabled in the device and software stack.
      
      2. How is the roce 'port function' option different from existing
      devlink param?
      Ans: RoCE attribute at the port function level disables the RoCE
      capability at the specific function level; while enable_roce only does
      at the software level.
      
      3. Why is this option for disabling only RoCE and not the whole RDMA
      device?
      Ans: Because user still wants to use the RDMA device for non RoCE
      commands in more memory efficient way.
      ====================
      
      Link: https://lore.kernel.org/r/20221206185119.380138-1-shayd@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e1228581
    • Shay Drory's avatar
      net/mlx5: E-Switch, Implement devlink port function cmds to control migratable · e5b9642a
      Shay Drory authored
      
      
      Implement devlink port function commands to enable / disable migratable.
      This is used to control the migratable capability of the device.
      
      Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
      Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
      Acked-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e5b9642a
    • Shay Drory's avatar
      devlink: Expose port function commands to control migratable · a8ce7b26
      Shay Drory authored
      
      
      Expose port function commands to enable / disable migratable
      capability, this is used to set the port function as migratable.
      
      Live migration is the process of transferring a live virtual machine
      from one physical host to another without disrupting its normal
      operation.
      
      In order for a VM to be able to perform LM, all the VM components must
      be able to perform migration. e.g.: to be migratable.
      In order for VF to be migratable, VF must be bound to VFIO driver with
      migration support.
      
      When migratable capability is enabled for a function of the port, the
      device is making the necessary preparations for the function to be
      migratable, which might include disabling features which cannot be
      migrated.
      
      Example of LM with migratable function configuration:
      Set migratable of the VF's 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 migratable disable
      
      $ devlink port function set pci/0000:06:00.0/2 migratable enable
      
      $ 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 migratable enable
      
      Bind VF to VFIO driver with migration support:
      $ echo <pci_id> > /sys/bus/pci/devices/0000:08:00.0/driver/unbind
      $ echo mlx5_vfio_pci > /sys/bus/pci/devices/0000:08:00.0/driver_override
      $ echo <pci_id> > /sys/bus/pci/devices/0000:08:00.0/driver/bind
      
      Attach VF to the VM.
      Start the VM.
      Perform LM.
      
      Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Acked-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a8ce7b26