net: stmmac: Performance improvements in Multi-Queue
Subsystems (4)
v3 cover net: stmmac: Performance improvements in Multi-Queue
Tested in XGMAC2 and GMAC5.
Jose Abreu (3):
net: stmmac: Fix NAPI poll in TX path when in multi-queue
net: stmmac: dwmac4: Also use TBU interrupt to clean TX path
net: stmmac: dwxgmac2: Also use TBU interrupt to clean TX path
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 24 ++--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 8 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 115 ++++++++++++--------- 5 files changed, 81 insertions(+), 75 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/3 net: stmmac: Fix NAPI poll in TX path when in multi-queue
Commit 8fce33317023 introduced the concept of NAPI per-channel and independent cleaning of TX path.
This is currently breaking performance in some cases. The scenario happens when all packets are being received in Queue 0 but the TX is performed in Queue != 0.
Fix this by using different NAPI instances per each TX and RX queue, as suggested by Florian.
Changes from v2:
- Only force restart transmission if there are pending packets
Changes from v1:
- Pass entire ring size to TX clean path (Florian)
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 115 +++++++++++++--------- 2 files changed, 68 insertions(+), 52 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +2 -3
@@ -78,11 +78,10 @@ struct stmmac_rx_queue { };struct stmmac_channel { -struct napi_struct napi____cacheline_aligned_in_smp ; +struct napi_struct rx_napi____cacheline_aligned_in_smp ; +struct napi_struct tx_napi____cacheline_aligned_in_smp ;struct stmmac_priv *priv_data;u32 index; -int has_rx; -int has_tx; };struct stmmac_tc_entry {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +66 -49
184 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 2/3 net: stmmac: dwmac4: Also use TBU interrupt to clean TX path
In reply to Jose AbreuTBU interrupt is a normal interrupt and can be used to trigger the cleaning of TX path. Lets check if it's active in DMA interrupt handler.
While at it, refactor a little bit the function:
- Don't check if RI is enabled because at function exit we will only clear the interrupts that are enabled so, no event will be missed.
In my tests with GMAC5 this increased performance.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +7 -17
@@ -124,9 +124,9 @@ void dwmac4_disable_dma_irq(void __iomem *ioaddr, u32 chan)int dwmac4_dma_interrupt (void __iomem *ioaddr,struct stmmac_extra_stats *x,u32 chan) { -int ret =0 ; -u32 intr_status =readl (ioaddr +DMA_CHAN_STATUS (chan)); +u32 intr_en =readl (ioaddr +DMA_CHAN_INTR_ENA (chan)); +int ret =0 ;/* ABNORMAL interrupts */ if (unlikely (intr_status &DMA_CHAN_STATUS_AIS )) {
@@ -151,16 +151,11 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,if (likely (intr_status &DMA_CHAN_STATUS_NIS )) { x->normal_irq_n++;if (likely (intr_status &DMA_CHAN_STATUS_RI )) { -u32 value; - - value =readl (ioaddr +DMA_CHAN_INTR_ENA (chan)); -/* to schedule NAPI on real RIE event. */ -if (likely (value &DMA_CHAN_INTR_ENA_RIE )) { - x->rx_normal_irq_n++; - ret |= handle_rx; - } + x->rx_normal_irq_n++; + ret |= handle_rx; } -if (likely (intr_status &DMA_CHAN_STATUS_TI )) { +if (likely (intr_status & (DMA_CHAN_STATUS_TI | +DMA_CHAN_STATUS_TBU ))) { x->tx_normal_irq_n++; ret |= handle_tx; }
@@ -168,12 +163,7 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr, x->rx_early_irq++; } -/* Clear the interrupt by writing a logic 1 to the chanX interrupt -* status [21-0] expect reserved bits [5-3] -*/ -writel ((intr_status &0x3fffc7 ), - ioaddr +DMA_CHAN_STATUS (chan)); - +writel (intr_status & intr_en, ioaddr +DMA_CHAN_STATUS (chan));return ret; }
Signature · 1 line
2.7.4
PATCH v3 3/3 net: stmmac: dwxgmac2: Also use TBU interrupt to clean TX path
In reply to Jose AbreuTBU interrupt is a normal interrupt and can be used to trigger the cleaning of TX path. Lets check if it's active in DMA interrupt handler.
While at it, refactor a little bit the function:
- Don't check if RI is enabled because at function exit we will only clear the interrupts that are enabled so, no event will be missed.
In my tests withe XGMAC2 this increased performance.
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 +++- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +3 -1
@@ -193,9 +193,10 @@#define XGMAC_AIE BIT(14)#define XGMAC_RBUE BIT(7)#define XGMAC_RIE BIT(6) +#define XGMAC_TBUE BIT(2)#define XGMAC_TIE BIT(0)#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | XGMAC_RBUE | \ - XGMAC_RIE | XGMAC_TIE) + XGMAC_RIE | XGMAC_TBUE | XGMAC_TIE)#define XGMAC_DMA_CH_Rx_WATCHDOG (x) (0x0000313c + (0x80 * (x)))#define XGMAC_RWT GENMASK(7, 0)#define XGMAC_DMA_CH_STATUS (x) (0x00003160 + (0x80 * (x)))
@@ -204,6 +205,7 @@#define XGMAC_FBE BIT(12)#define XGMAC_RBU BIT(7)#define XGMAC_RI BIT(6) +#define XGMAC_TBU BIT(2)#define XGMAC_TPS BIT(1)#define XGMAC_TI BIT(0)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +3 -5
@@ -283,12 +283,10 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, x->normal_irq_n++;if (likely (intr_status &XGMAC_RI )) { -if (likely (intr_en &XGMAC_RIE )) { - x->rx_normal_irq_n++; - ret |= handle_rx; - } + x->rx_normal_irq_n++; + ret |= handle_rx; } -if (likely (intr_status &XGMAC_TI )) { +if (likely (intr_status & (XGMAC_TI |XGMAC_TBU ))) { x->tx_normal_irq_n++; ret |= handle_tx; }
Signature · 1 line
2.7.4
David Miller
maintainerFrom: Jose Abreu <[email protected]>
Date: Tue, 19 Feb 2019 10:38:46 +0100
Quoted 1 line
Tested in XGMAC2 and GMAC5.
Series applied, thanks Jose.