[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240902-fdma-sparx5-v1-0-1e7d5e5a9f34@microchip.com>
Date: Mon, 2 Sep 2024 16:54:05 +0200
From: Daniel Machon <daniel.machon@...rochip.com>
To: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Lars Povlsen <lars.povlsen@...rochip.com>, "Steen
Hegelund" <Steen.Hegelund@...rochip.com>, Horatiu Vultur
<horatiu.vultur@...rochip.com>, <UNGLinuxDriver@...rochip.com>,
<rdunlap@...radead.org>, <horms@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
Jens Emil Schulz Østergaard
<jensemil.schulzostergaard@...rochip.com>
Subject: [PATCH net-next 00/12] net: microchip: add FDMA library and use it
for Sparx5
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@...emloft.net>
To: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
To: Paolo Abeni <pabeni@...hat.com>
To: Lars Povlsen <lars.povlsen@...rochip.com>
To: Steen Hegelund <Steen.Hegelund@...rochip.com>
To: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: UNGLinuxDriver@...rochip.com
To: rdunlap@...radead.org
To: horms@...nel.org
Cc: linux-kernel@...r.kernel.org
Cc: netdev@...r.kernel.org
Cc: linux-arm-kernel@...ts.infradead.org
Signed-off-by: Daniel Machon <daniel.machon@...rochip.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,
--
Daniel Machon <daniel.machon@...rochip.com>
Powered by blists - more mailing lists