mbox series

[net-next,00/12] net: microchip: add FDMA library and use it for Sparx5

Message ID 20240902-fdma-sparx5-v1-0-1e7d5e5a9f34@microchip.com (mailing list archive)
Headers show
Series net: microchip: add FDMA library and use it for Sparx5 | expand

Message

Daniel Machon Sept. 2, 2024, 2:54 p.m. UTC
This patch series is the first of a 2-part series, that adds a new
common FDMA library for Microchip switch chips Sparx5 and lan966x. These
chips share the same FDMA engine, and as such will benefit from a
common library with a common implementation.  This also has the benefit
of removing a lot open-coded bookkeeping and duplicate code for the two
drivers.

Additionally, upstreaming efforts for a third chip, lan969x, will begin
in the near future. This chip will use the new library too.

In this first series, the FDMA library is introduced and used by the
Sparx5 switch driver.

 ###################
 # Example of use: #
 ###################

- Initialize the rx and tx fdma structs with values for: number of
  DCB's, number of DB's, channel ID, DB size (data buffer size), and
  total size of the requested memory. Also provide two callbacks:
  nextptr_cb() and dataptr_cb() for getting the nextptr and dataptr.

- Allocate memory using fdma_alloc_phys() or fdma_alloc_coherent().

- Initialize the DCB's with fdma_dcb_init().

- Add new DCB's with fdma_dcb_add().

- Free memory with fdma_free_phys() or fdma_free_coherent().

 #####################
 # Patch  breakdown: #
 #####################

Patch #1:  introduces library and selects it for Sparx5.

Patch #2:  includes the fdma_api.h header and removes old symbols.

Patch #3:  replaces old rx and tx variables with equivalent ones from the
           fdma struct. Only the variables that can be changed without
           breaking traffic is changed in this patch.

Patch #4:  uses the library for allocation of rx buffers. This requires
           quite a bit of refactoring in this single patch.

Patch #5:  uses the library for adding DCB's in the rx path.

Patch #6:  uses the library for freeing rx buffers.

Patch #7:  uses the library helpers in the rx path.

Patch #8:  uses the library for allocation of tx buffers. This requires
           quite a bit of refactoring in this single patch.

Patch #9:  uses the library for adding DCB's in the tx path.

Patch #10: uses the library helpers in the tx path.

Patch #11: ditches the existing linked list for storing buffer addresses,
           and instead uses offsets into contiguous memory.

Patch #12: modifies existing rx and tx functions to be direction
           independent.

To: David S. Miller <davem@davemloft.net>
To: Eric Dumazet <edumazet@google.com>
To: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
To: Lars Povlsen <lars.povlsen@microchip.com>
To: Steen Hegelund <Steen.Hegelund@microchip.com>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
To: UNGLinuxDriver@microchip.com
To: rdunlap@infradead.org
To: horms@kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
Daniel Machon (12):
      net: microchip: add FDMA library
      net: sparx5: use FDMA library symbols
      net: sparx5: replace a few variables with new equivalent ones
      net: sparx5: use the FDMA library for allocation of rx buffers
      net: sparx5: use FDMA library for adding DCB's in the rx path
      net: sparx5: use library helper for freeing rx buffers
      net: sparx5: use a few FDMA helpers in the rx path
      net: sparx5: use the FDMA library for allocation of tx buffers
      net: sparx5: use FDMA library for adding DCB's in the tx path
      net: sparx5: use library helper for freeing tx buffers
      net: sparx5: use contiguous memory for tx buffers
      net: sparx5: ditch sparx5_fdma_rx/tx_reload() functions

 drivers/net/ethernet/microchip/Kconfig             |   1 +
 drivers/net/ethernet/microchip/Makefile            |   1 +
 drivers/net/ethernet/microchip/fdma/Kconfig        |  18 +
 drivers/net/ethernet/microchip/fdma/Makefile       |   7 +
 drivers/net/ethernet/microchip/fdma/fdma_api.c     | 146 ++++++++
 drivers/net/ethernet/microchip/fdma/fdma_api.h     | 243 +++++++++++++
 drivers/net/ethernet/microchip/sparx5/Kconfig      |   1 +
 drivers/net/ethernet/microchip/sparx5/Makefile     |   1 +
 .../net/ethernet/microchip/sparx5/sparx5_fdma.c    | 382 +++++++--------------
 .../net/ethernet/microchip/sparx5/sparx5_main.h    |  31 +-
 10 files changed, 545 insertions(+), 286 deletions(-)
---
base-commit: 221f9cce949ac8042f65b71ed1fde13b99073256
change-id: 20240902-fdma-sparx5-5a7c0840d23f

Best regards,

Comments

patchwork-bot+netdevbpf@kernel.org Sept. 4, 2024, 11 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 2 Sep 2024 16:54:05 +0200 you wrote:
> This patch series is the first of a 2-part series, that adds a new
> common FDMA library for Microchip switch chips Sparx5 and lan966x. These
> chips share the same FDMA engine, and as such will benefit from a
> common library with a common implementation.  This also has the benefit
> of removing a lot open-coded bookkeeping and duplicate code for the two
> drivers.
> 
> [...]

Here is the summary with links:
  - [net-next,01/12] net: microchip: add FDMA library
    https://git.kernel.org/netdev/net-next/c/30e48a75df9c
  - [net-next,02/12] net: sparx5: use FDMA library symbols
    https://git.kernel.org/netdev/net-next/c/947a72f40f69
  - [net-next,03/12] net: sparx5: replace a few variables with new equivalent ones
    https://git.kernel.org/netdev/net-next/c/e8218f7a9f44
  - [net-next,04/12] net: sparx5: use the FDMA library for allocation of rx buffers
    https://git.kernel.org/netdev/net-next/c/8fec1cea941d
  - [net-next,05/12] net: sparx5: use FDMA library for adding DCB's in the rx path
    https://git.kernel.org/netdev/net-next/c/17b952108681
  - [net-next,06/12] net: sparx5: use library helper for freeing rx buffers
    https://git.kernel.org/netdev/net-next/c/6647f2fd8df0
  - [net-next,07/12] net: sparx5: use a few FDMA helpers in the rx path
    https://git.kernel.org/netdev/net-next/c/4ff58c394715
  - [net-next,08/12] net: sparx5: use the FDMA library for allocation of tx buffers
    https://git.kernel.org/netdev/net-next/c/0a5c44085089
  - [net-next,09/12] net: sparx5: use FDMA library for adding DCB's in the tx path
    https://git.kernel.org/netdev/net-next/c/f4aa7e361ae2
  - [net-next,10/12] net: sparx5: use library helper for freeing tx buffers
    https://git.kernel.org/netdev/net-next/c/bb7a60dab43b
  - [net-next,11/12] net: sparx5: use contiguous memory for tx buffers
    https://git.kernel.org/netdev/net-next/c/55e84c3cfd06
  - [net-next,12/12] net: sparx5: ditch sparx5_fdma_rx/tx_reload() functions
    https://git.kernel.org/netdev/net-next/c/51152312dc99

You are awesome, thank you!