Skip to content

Commit d84ad2c

Browse files
Danielmachonkuba-moo
authored andcommitted
net: lan969x: add FDMA implementation
The lan969x switch device supports manual frame injection and extraction to and from the switch core, using a number of injection and extraction queues. This technique is currently supported, but delivers poor performance compared to Frame DMA (FDMA). This lan969x implementation of FDMA, hooks into the existing FDMA for Sparx5, but requires its own RX and TX handling, as lan969x does not support the same native cache coherency that Sparx5 does. Effectively, this means that we are going to use the DMA mapping API for mapping and unmapping TX buffers. The RX loop will utilize the page pool API for efficient RX handling. Other than that, the implementation is largely the same, and utilizes the FDMA library for DCB and DB handling. Some numbers: Manual injection/extraction (before this series): // iperf3 -c 1.0.1.1 [ ID] Interval Transfer Bitrate [ 5] 0.00-10.02 sec 345 MBytes 289 Mbits/sec sender [ 5] 0.00-10.06 sec 345 MBytes 288 Mbits/sec receiver FDMA (after this series): // iperf3 -c 1.0.1.1 [ ID] Interval Transfer Bitrate [ 5] 0.00-10.03 sec 1.10 GBytes 940 Mbits/sec sender [ 5] 0.00-10.07 sec 1.10 GBytes 936 Mbits/sec receiver Reviewed-by: Steen Hegelund <[email protected]> Signed-off-by: Daniel Machon <[email protected]> Link: https://patch.msgid.link/20250113-sparx5-lan969x-switch-driver-5-v2-5-c468f02fd623@microchip.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 56143c5 commit d84ad2c

File tree

8 files changed

+448
-7
lines changed

8 files changed

+448
-7
lines changed

drivers/net/ethernet/microchip/sparx5/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ config SPARX5_DCB
2828
config LAN969X_SWITCH
2929
bool "Lan969x switch driver"
3030
depends on SPARX5_SWITCH
31+
select PAGE_POOL
3132
help
3233
This driver supports the lan969x family of network switch devices.

drivers/net/ethernet/microchip/sparx5/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ sparx5-switch-$(CONFIG_LAN969X_SWITCH) += lan969x/lan969x_regs.o \
2121
lan969x/lan969x_calendar.o \
2222
lan969x/lan969x_vcap_ag_api.o \
2323
lan969x/lan969x_vcap_impl.o \
24-
lan969x/lan969x_rgmii.o
24+
lan969x/lan969x_rgmii.o \
25+
lan969x/lan969x_fdma.o
2526

2627
# Provide include files
2728
ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap

drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,10 @@ static const struct sparx5_ops lan969x_ops = {
341341
.ptp_irq_handler = &lan969x_ptp_irq_handler,
342342
.dsm_calendar_calc = &lan969x_dsm_calendar_calc,
343343
.port_config_rgmii = &lan969x_port_config_rgmii,
344+
.fdma_init = &lan969x_fdma_init,
345+
.fdma_deinit = &lan969x_fdma_deinit,
346+
.fdma_poll = &lan969x_fdma_napi_poll,
347+
.fdma_xmit = &lan969x_fdma_xmit,
344348
};
345349

346350
const struct sparx5_match_data lan969x_desc = {

drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,11 @@ int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
7272
int lan969x_port_config_rgmii(struct sparx5_port *port,
7373
struct sparx5_port_config *conf);
7474

75+
/* lan969x_fdma.c */
76+
int lan969x_fdma_init(struct sparx5 *sparx5);
77+
int lan969x_fdma_deinit(struct sparx5 *sparx5);
78+
int lan969x_fdma_napi_poll(struct napi_struct *napi, int weight);
79+
int lan969x_fdma_xmit(struct sparx5 *sparx5, u32 *ifh, struct sk_buff *skb,
80+
struct net_device *dev);
81+
7582
#endif

0 commit comments

Comments
 (0)