Skip to content

Commit

Permalink
net: lan969x: add FDMA implementation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Danielmachon authored and kuba-moo committed Jan 15, 2025
1 parent 56143c5 commit d84ad2c
Show file tree
Hide file tree
Showing 8 changed files with 448 additions and 7 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/microchip/sparx5/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ config SPARX5_DCB
config LAN969X_SWITCH
bool "Lan969x switch driver"
depends on SPARX5_SWITCH
select PAGE_POOL
help
This driver supports the lan969x family of network switch devices.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/microchip/sparx5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ sparx5-switch-$(CONFIG_LAN969X_SWITCH) += lan969x/lan969x_regs.o \
lan969x/lan969x_calendar.o \
lan969x/lan969x_vcap_ag_api.o \
lan969x/lan969x_vcap_impl.o \
lan969x/lan969x_rgmii.o
lan969x/lan969x_rgmii.o \
lan969x/lan969x_fdma.o

# Provide include files
ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ static const struct sparx5_ops lan969x_ops = {
.ptp_irq_handler = &lan969x_ptp_irq_handler,
.dsm_calendar_calc = &lan969x_dsm_calendar_calc,
.port_config_rgmii = &lan969x_port_config_rgmii,
.fdma_init = &lan969x_fdma_init,
.fdma_deinit = &lan969x_fdma_deinit,
.fdma_poll = &lan969x_fdma_napi_poll,
.fdma_xmit = &lan969x_fdma_xmit,
};

const struct sparx5_match_data lan969x_desc = {
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@ int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
int lan969x_port_config_rgmii(struct sparx5_port *port,
struct sparx5_port_config *conf);

/* lan969x_fdma.c */
int lan969x_fdma_init(struct sparx5 *sparx5);
int lan969x_fdma_deinit(struct sparx5 *sparx5);
int lan969x_fdma_napi_poll(struct napi_struct *napi, int weight);
int lan969x_fdma_xmit(struct sparx5 *sparx5, u32 *ifh, struct sk_buff *skb,
struct net_device *dev);

#endif
Loading

0 comments on commit d84ad2c

Please sign in to comment.