net: stmmac: prepare dma operations for multiple queues
Subsystems (4)
cover net: stmmac: prepare dma operations for multiple queues
As agreed with David Miller, this patch-set is the second of 3 to enable multiple queues in stmmac.
This second one concentrates on dma operations adding functionalities as:
a) DMA Operation Mode configuration per channel and done in the multiple queues configuration function
b) DMA IRQ enable and Disable by channel
c) DMA start and stop by channel
d) RX and TX ring length configuration by channel
e) RX and TX set tail pointer by channel
f) DMA Channel initialization broke into Channel comon, RX and TX initialization
g) TSO being configured for all available channels
h) DMA interrupt treatment by channel
Joao Pinto (11):
net: stmmac: prepare dma op mode config for multiple queues
net: stmmac: enable/disable dma irq prepared for multiple queues
net: stmmac: rx/tx dma start/stop prepared for multiple queues
net: stmmac: prepare stmmac_tx_err for multiple queues
net: stmmac: prepare dma interrupt treatment for multiple queues
net: stmmac: rx watchdog config prepared for multiple queues
net: stmmac: rx and tx ring length prepared for multiple queues
net: stmmac: prepare rx/tx set tail function for multiple queues
net: stmmac: dma channel init prepared for multiple queues
net: stmmac: tso init prepared for multiple queues
net: stmmac: stmmac interrupt treatment prepared for multiple queues
drivers/net/ethernet/stmicro/stmmac/common.h | 31 +- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 3 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 192 ++++++----- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 20 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 56 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 15 +- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 +- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 3 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 372 ++++++++++++++++----- 9 files changed, 467 insertions(+), 239 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/11 net: stmmac: prepare dma op mode config for multiple queues
This patch prepares DMA Operation Mode configuration for multiple queues. The work consisted on breaking the DMA operation Mode configuration function into RX and TX scope and adapting its mechanism in stmmac_main.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 3 + drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 118 +++++++++++----------- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 84 +++++++++++---- 3 files changed, 125 insertions(+), 80 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +3 -0
@@ -424,6 +424,9 @@ struct stmmac_dma_ops {* An invalid value enables the store-and-forward mode */ void (*dma_mode)(void __iomem *ioaddr,int txmode,int rxmode,int rxfifosz); +void (*dma_rx_mode)(void __iomem *ioaddr,int mode,u32 channel, +int fifosz); +void (*dma_tx_mode)(void __iomem *ioaddr,int mode,u32 channel);/* To track extra statistic (if supported) */ void (*dma_diagnostic_fr) (void *data,struct stmmac_extra_stats *x,void __iomem *ioaddr);
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +57 -61
166 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +65 -19
134 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 2/11 net: stmmac: enable/disable dma irq prepared for multiple queues
In reply to Joao PintoThis patch prepares the DMA IRQ enable/disable process for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 4 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 6 +++--- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 12 ++++++------ drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 4 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 4 ++-- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++------ 6 files changed, 22 insertions(+), 21 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +2 -2
@@ -431,8 +431,8 @@ struct stmmac_dma_ops {void (*dma_diagnostic_fr) (void *data,struct stmmac_extra_stats *x,void __iomem *ioaddr);void (*enable_dma_transmission) (void __iomem *ioaddr); -void (*enable_dma_irq) (void __iomem *ioaddr); -void (*disable_dma_irq) (void __iomem *ioaddr); +void (*enable_dma_irq)(void __iomem *ioaddr,u32 chan); +void (*disable_dma_irq)(void __iomem *ioaddr,u32 chan);void (*start_tx) (void __iomem *ioaddr);void (*stop_tx) (void __iomem *ioaddr);void (*start_rx) (void __iomem *ioaddr);
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +3 -3
@@ -185,9 +185,9 @@int dwmac4_dma_reset (void __iomem *ioaddr);void dwmac4_enable_dma_transmission (void __iomem *ioaddr,u32 tail_ptr); -void dwmac4_enable_dma_irq (void __iomem *ioaddr); -void dwmac410_enable_dma_irq (void __iomem *ioaddr); -void dwmac4_disable_dma_irq (void __iomem *ioaddr); +void dwmac4_enable_dma_irq (void __iomem *ioaddr,u32 chan); +void dwmac410_enable_dma_irq (void __iomem *ioaddr,u32 chan); +void dwmac4_disable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac4_dma_start_tx (void __iomem *ioaddr);void dwmac4_dma_stop_tx (void __iomem *ioaddr);void dwmac4_dma_start_rx (void __iomem *ioaddr);
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +6 -6
@@ -104,21 +104,21 @@ void dwmac4_set_rx_ring_len(void __iomem *ioaddr, u32 len)writel (len, ioaddr +DMA_CHAN_RX_RING_LEN (STMMAC_CHAN0 )); } -void dwmac4_enable_dma_irq (void __iomem *ioaddr) +void dwmac4_enable_dma_irq (void __iomem *ioaddr,u32 chan) {writel (DMA_CHAN_INTR_DEFAULT_MASK , ioaddr + -DMA_CHAN_INTR_ENA (STMMAC_CHAN0 )); +DMA_CHAN_INTR_ENA (chan)); } -void dwmac410_enable_dma_irq (void __iomem *ioaddr) +void dwmac410_enable_dma_irq (void __iomem *ioaddr,u32 chan) {writel (DMA_CHAN_INTR_DEFAULT_MASK_4_10 , - ioaddr +DMA_CHAN_INTR_ENA (STMMAC_CHAN0 )); + ioaddr +DMA_CHAN_INTR_ENA (chan)); } -void dwmac4_disable_dma_irq (void __iomem *ioaddr) +void dwmac4_disable_dma_irq (void __iomem *ioaddr,u32 chan) { -writel (0 , ioaddr +DMA_CHAN_INTR_ENA (STMMAC_CHAN0 )); +writel (0 , ioaddr +DMA_CHAN_INTR_ENA (chan)); } int dwmac4_dma_interrupt(void __iomem *ioaddr,
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +2 -2
@@ -137,8 +137,8 @@#define DMA_CONTROL_FTF 0x00100000/* Flush transmit FIFO */ void dwmac_enable_dma_transmission (void __iomem *ioaddr); -void dwmac_enable_dma_irq (void __iomem *ioaddr); -void dwmac_disable_dma_irq (void __iomem *ioaddr); +void dwmac_enable_dma_irq (void __iomem *ioaddr,u32 chan); +void dwmac_disable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac_dma_start_tx (void __iomem *ioaddr);void dwmac_dma_stop_tx (void __iomem *ioaddr);void dwmac_dma_start_rx (void __iomem *ioaddr);
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +2 -2
@@ -47,12 +47,12 @@ void dwmac_enable_dma_transmission(void __iomem *ioaddr)writel (1 , ioaddr +DMA_XMT_POLL_DEMAND ); } -void dwmac_enable_dma_irq (void __iomem *ioaddr) +void dwmac_enable_dma_irq (void __iomem *ioaddr,u32 chan) {writel (DMA_INTR_DEFAULT_MASK , ioaddr +DMA_INTR_ENA ); } -void dwmac_disable_dma_irq (void __iomem *ioaddr) +void dwmac_disable_dma_irq (void __iomem *ioaddr,u32 chan) {writel (0 , ioaddr +DMA_INTR_ENA ); }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +7 -6
@@ -1422,14 +1422,14 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)netif_tx_unlock (priv->dev); } -static inline void stmmac_enable_dma_irq (struct stmmac_priv *priv) +static inline void stmmac_enable_dma_irq (struct stmmac_priv *priv,u32 chan) { - priv->hw->dma->enable_dma_irq (priv->ioaddr); + priv->hw->dma->enable_dma_irq (priv->ioaddr, chan); } -static inline void stmmac_disable_dma_irq (struct stmmac_priv *priv) +static inline void stmmac_disable_dma_irq (struct stmmac_priv *priv,u32 chan) { - priv->hw->dma->disable_dma_irq (priv->ioaddr); + priv->hw->dma->disable_dma_irq (priv->ioaddr, chan); }/**
@@ -1506,7 +1506,7 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv) status = priv->hw->dma->dma_interrupt (priv->ioaddr, &priv->xstats);if (likely ((status & handle_rx)) || (status & handle_tx)) {if (likely (napi_schedule_prep (&priv->napi))) { -stmmac_disable_dma_irq (priv); +stmmac_disable_dma_irq (priv, chan);__napi_schedule (&priv->napi); } }
@@ -2832,6 +2832,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget) { struct stmmac_priv *priv = container_of(napi, struct stmmac_priv, napi);int work_done =0 ; +u32 chan =STMMAC_CHAN0 ; priv->xstats.napi_poll++;stmmac_tx_clean (priv);
@@ -2839,7 +2840,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget) work_done =stmmac_rx (priv, budget);if (work_done < budget) {napi_complete_done (napi, work_done); -stmmac_enable_dma_irq (priv); +stmmac_enable_dma_irq (priv, chan); }return work_done; }
Signature · 1 line
2.9.3
PATCH 3/11 net: stmmac: rx/tx dma start/stop prepared for multiple queues
In reply to Joao PintoThis patch prepares the RX/TX DMA stop/start process for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 8 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 8 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 24 ++--- drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 8 +- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 8 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 108 +++++++++++++++++++--- 6 files changed, 125 insertions(+), 39 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +4 -4
@@ -433,10 +433,10 @@ struct stmmac_dma_ops {void (*enable_dma_transmission) (void __iomem *ioaddr);void (*enable_dma_irq)(void __iomem *ioaddr,u32 chan);void (*disable_dma_irq)(void __iomem *ioaddr,u32 chan); -void (*start_tx) (void __iomem *ioaddr); -void (*stop_tx) (void __iomem *ioaddr); -void (*start_rx) (void __iomem *ioaddr); -void (*stop_rx) (void __iomem *ioaddr); +void (*start_tx)(void __iomem *ioaddr,u32 chan); +void (*stop_tx)(void __iomem *ioaddr,u32 chan); +void (*start_rx)(void __iomem *ioaddr,u32 chan); +void (*stop_rx)(void __iomem *ioaddr,u32 chan);int (*dma_interrupt) (void __iomem *ioaddr,struct stmmac_extra_stats *x);/* If supported then get the optional core features */
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +4 -4
@@ -188,10 +188,10 @@ void dwmac4_enable_dma_transmission(void __iomem *ioaddr, u32 tail_ptr);void dwmac4_enable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac410_enable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac4_disable_dma_irq (void __iomem *ioaddr,u32 chan); -void dwmac4_dma_start_tx (void __iomem *ioaddr); -void dwmac4_dma_stop_tx (void __iomem *ioaddr); -void dwmac4_dma_start_rx (void __iomem *ioaddr); -void dwmac4_dma_stop_rx (void __iomem *ioaddr); +void dwmac4_dma_start_tx (void __iomem *ioaddr,u32 chan); +void dwmac4_dma_stop_tx (void __iomem *ioaddr,u32 chan); +void dwmac4_dma_start_rx (void __iomem *ioaddr,u32 chan); +void dwmac4_dma_stop_rx (void __iomem *ioaddr,u32 chan);int dwmac4_dma_interrupt (void __iomem *ioaddr,struct stmmac_extra_stats *x);void dwmac4_set_rx_ring_len (void __iomem *ioaddr,u32 len);
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +12 -12
@@ -45,49 +45,49 @@ void dwmac4_set_tx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan)writel (tail_ptr, ioaddr +DMA_CHAN_TX_END_ADDR (0 )); } -void dwmac4_dma_start_tx (void __iomem *ioaddr) +void dwmac4_dma_start_tx (void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CHAN_TX_CONTROL (STMMAC_CHAN0 )); +u32 value =readl (ioaddr +DMA_CHAN_TX_CONTROL (chan)); value |=DMA_CONTROL_ST ; -writel (value, ioaddr +DMA_CHAN_TX_CONTROL (STMMAC_CHAN0 )); +writel (value, ioaddr +DMA_CHAN_TX_CONTROL (chan)); value =readl (ioaddr +GMAC_CONFIG ); value |=GMAC_CONFIG_TE ;writel (value, ioaddr +GMAC_CONFIG ); } -void dwmac4_dma_stop_tx (void __iomem *ioaddr) +void dwmac4_dma_stop_tx (void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CHAN_TX_CONTROL (STMMAC_CHAN0 )); +u32 value =readl (ioaddr +DMA_CHAN_TX_CONTROL (chan)); value &= ~DMA_CONTROL_ST ; -writel (value, ioaddr +DMA_CHAN_TX_CONTROL (STMMAC_CHAN0 )); +writel (value, ioaddr +DMA_CHAN_TX_CONTROL (chan)); value =readl (ioaddr +GMAC_CONFIG ); value &= ~GMAC_CONFIG_TE ;writel (value, ioaddr +GMAC_CONFIG ); } -void dwmac4_dma_start_rx (void __iomem *ioaddr) +void dwmac4_dma_start_rx (void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CHAN_RX_CONTROL (STMMAC_CHAN0 )); +u32 value =readl (ioaddr +DMA_CHAN_RX_CONTROL (chan)); value |=DMA_CONTROL_SR ; -writel (value, ioaddr +DMA_CHAN_RX_CONTROL (STMMAC_CHAN0 )); +writel (value, ioaddr +DMA_CHAN_RX_CONTROL (chan)); value =readl (ioaddr +GMAC_CONFIG ); value |=GMAC_CONFIG_RE ;writel (value, ioaddr +GMAC_CONFIG ); } -void dwmac4_dma_stop_rx (void __iomem *ioaddr) +void dwmac4_dma_stop_rx (void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CHAN_RX_CONTROL (STMMAC_CHAN0 )); +u32 value =readl (ioaddr +DMA_CHAN_RX_CONTROL (chan)); value &= ~DMA_CONTROL_SR ; -writel (value, ioaddr +DMA_CHAN_RX_CONTROL (STMMAC_CHAN0 )); +writel (value, ioaddr +DMA_CHAN_RX_CONTROL (chan)); value =readl (ioaddr +GMAC_CONFIG ); value &= ~GMAC_CONFIG_RE ;
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +4 -4
@@ -139,10 +139,10 @@void dwmac_enable_dma_transmission (void __iomem *ioaddr);void dwmac_enable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac_disable_dma_irq (void __iomem *ioaddr,u32 chan); -void dwmac_dma_start_tx (void __iomem *ioaddr); -void dwmac_dma_stop_tx (void __iomem *ioaddr); -void dwmac_dma_start_rx (void __iomem *ioaddr); -void dwmac_dma_stop_rx (void __iomem *ioaddr); +void dwmac_dma_start_tx (void __iomem *ioaddr,u32 chan); +void dwmac_dma_stop_tx (void __iomem *ioaddr,u32 chan); +void dwmac_dma_start_rx (void __iomem *ioaddr,u32 chan); +void dwmac_dma_stop_rx (void __iomem *ioaddr,u32 chan);int dwmac_dma_interrupt (void __iomem *ioaddr,struct stmmac_extra_stats *x);int dwmac_dma_reset (void __iomem *ioaddr);
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +4 -4
@@ -57,28 +57,28 @@ void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan)writel (0 , ioaddr +DMA_INTR_ENA ); } -void dwmac_dma_start_tx (void __iomem *ioaddr) +void dwmac_dma_start_tx (void __iomem *ioaddr,u32 chan) {u32 value =readl (ioaddr +DMA_CONTROL ); value |=DMA_CONTROL_ST ;writel (value, ioaddr +DMA_CONTROL ); } -void dwmac_dma_stop_tx (void __iomem *ioaddr) +void dwmac_dma_stop_tx (void __iomem *ioaddr,u32 chan) {u32 value =readl (ioaddr +DMA_CONTROL ); value &= ~DMA_CONTROL_ST ;writel (value, ioaddr +DMA_CONTROL ); } -void dwmac_dma_start_rx (void __iomem *ioaddr) +void dwmac_dma_start_rx (void __iomem *ioaddr,u32 chan) {u32 value =readl (ioaddr +DMA_CONTROL ); value |=DMA_CONTROL_SR ;writel (value, ioaddr +DMA_CONTROL ); } -void dwmac_dma_stop_rx (void __iomem *ioaddr) +void dwmac_dma_stop_rx (void __iomem *ioaddr,u32 chan) {u32 value =readl (ioaddr +DMA_CONTROL ); value &= ~DMA_CONTROL_SR ;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +97 -11
153 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 4/11 net: stmmac: prepare stmmac_tx_err for multiple queues
In reply to Joao PintoThis patch prepares stmmac_err for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -4
@@ -1525,12 +1525,12 @@ static inline void stmmac_disable_dma_irq(struct stmmac_priv *priv, u32 chan)/** * stmmac_tx_err - to manage the tx error * @priv: driver private structure +* @chan: channel index * Description: it cleans the descriptors and restarts the transmission * in case of transmission errors. */ -static void stmmac_tx_err (struct stmmac_priv *priv) +static void stmmac_tx_err (struct stmmac_priv *priv,u32 chan) { -u32 chan =STMMAC_CHAN0 ;int i;netif_stop_queue (priv->dev);
@@ -1616,7 +1616,7 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv) priv->xstats.threshold = tc; } }else if (unlikely (status == tx_hard_error)) -stmmac_tx_err (priv); +stmmac_tx_err (priv, chan); }/**
@@ -2944,9 +2944,10 @@ static int stmmac_poll(struct napi_struct *napi, int budget)static void stmmac_tx_timeout (struct net_device *dev) {struct stmmac_priv *priv =netdev_priv (dev); +u32 chan =STMMAC_CHAN0 ;/* Clear Tx resources and restart transmitting again */ -stmmac_tx_err (priv); +stmmac_tx_err (priv, chan); }/**
Signature · 1 line
2.9.3
PATCH 5/11 net: stmmac: prepare dma interrupt treatment for multiple queues
In reply to Joao PintoThis patch prepares DMA interrupts treatment for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 8 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 3 +- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 55 +++++++++++++---------- 6 files changed, 41 insertions(+), 31 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -1
@@ -438,7 +438,7 @@ struct stmmac_dma_ops {void (*start_rx)(void __iomem *ioaddr,u32 chan);void (*stop_rx)(void __iomem *ioaddr,u32 chan);int (*dma_interrupt) (void __iomem *ioaddr, -struct stmmac_extra_stats *x); +struct stmmac_extra_stats *x,u32 chan);/* If supported then get the optional core features */ void (*get_hw_feature)(void __iomem *ioaddr,struct dma_features *dma_cap);
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +1 -1
@@ -193,7 +193,7 @@ void dwmac4_dma_stop_tx(void __iomem *ioaddr, u32 chan);void dwmac4_dma_start_rx (void __iomem *ioaddr,u32 chan);void dwmac4_dma_stop_rx (void __iomem *ioaddr,u32 chan);int dwmac4_dma_interrupt (void __iomem *ioaddr, -struct stmmac_extra_stats *x); +struct stmmac_extra_stats *x,u32 chan);void dwmac4_set_rx_ring_len (void __iomem *ioaddr,u32 len);void dwmac4_set_tx_ring_len (void __iomem *ioaddr,u32 len);void dwmac4_set_rx_tail_ptr (void __iomem *ioaddr,u32 tail_ptr,u32 chan);
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +4 -4
@@ -122,11 +122,11 @@ void dwmac4_disable_dma_irq(void __iomem *ioaddr, u32 chan) }int dwmac4_dma_interrupt (void __iomem *ioaddr, -struct stmmac_extra_stats *x) +struct stmmac_extra_stats *x,u32 chan) {int ret =0 ; -u32 intr_status =readl (ioaddr +DMA_CHAN_STATUS (0 )); +u32 intr_status =readl (ioaddr +DMA_CHAN_STATUS (chan));/* ABNORMAL interrupts */ if (unlikely (intr_status &DMA_CHAN_STATUS_AIS )) {
@@ -153,7 +153,7 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,if (likely (intr_status &DMA_CHAN_STATUS_RI )) {u32 value; - value =readl (ioaddr +DMA_CHAN_INTR_ENA (STMMAC_CHAN0 )); + 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++;
@@ -172,7 +172,7 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,* status [21-0] expect reserved bits [5-3] */ writel ((intr_status &0x3fffc7 ), - ioaddr +DMA_CHAN_STATUS (STMMAC_CHAN0 )); + ioaddr +DMA_CHAN_STATUS (chan));return ret; }
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +2 -1
@@ -143,7 +143,8 @@ void dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan);void dwmac_dma_stop_tx (void __iomem *ioaddr,u32 chan);void dwmac_dma_start_rx (void __iomem *ioaddr,u32 chan);void dwmac_dma_stop_rx (void __iomem *ioaddr,u32 chan); -int dwmac_dma_interrupt (void __iomem *ioaddr,struct stmmac_extra_stats *x); +int dwmac_dma_interrupt (void __iomem *ioaddr,struct stmmac_extra_stats *x, +u32 chan);int dwmac_dma_reset (void __iomem *ioaddr);#endif /* __DWMAC_DMA_H__ */
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +1 -1
@@ -156,7 +156,7 @@ static void show_rx_process_state(unsigned int status)#endif int dwmac_dma_interrupt (void __iomem *ioaddr, -struct stmmac_extra_stats *x) +struct stmmac_extra_stats *x,u32 chan) {int ret =0 ;/* read the status register (CSR5) */
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +32 -23
64 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 6/11 net: stmmac: rx watchdog config prepared for multiple queues
In reply to Joao PintoThis patch adds rx watchdog configuration for all queues.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 3 ++- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 8 ++++---- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 3 ++- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 5 files changed, 11 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -1
@@ -443,7 +443,7 @@ struct stmmac_dma_ops {void (*get_hw_feature)(void __iomem *ioaddr,struct dma_features *dma_cap);/* Program the HW RX Watchdog */ -void (*rx_watchdog) (void __iomem *ioaddr,u32 riwt); +void (*rx_watchdog)(void __iomem *ioaddr,u32 riwt,u32 number_chan);void (*set_tx_ring_len)(void __iomem *ioaddr,u32 len);void (*set_rx_ring_len)(void __iomem *ioaddr,u32 len);void (*set_rx_tail_ptr)(void __iomem *ioaddr,u32 tail_ptr,u32 chan);
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +2 -1
@@ -247,7 +247,8 @@ static void dwmac1000_get_hw_feature(void __iomem *ioaddr, dma_cap->enh_desc = (hw_cap &DMA_HW_FEAT_ENHDESSEL ) >>24 ; } -static void dwmac1000_rx_watchdog (void __iomem *ioaddr,u32 riwt) +static void dwmac1000_rx_watchdog (void __iomem *ioaddr,u32 riwt, +u32 number_chan) {writel (riwt, ioaddr +DMA_RX_WATCHDOG ); }
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +4 -4
@@ -174,12 +174,12 @@ static void dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space)_dwmac4_dump_dma_regs (ioaddr, i, reg_space); } -static void dwmac4_rx_watchdog (void __iomem *ioaddr,u32 riwt) +static void dwmac4_rx_watchdog (void __iomem *ioaddr,u32 riwt,u32 number_chan) { -int i; +u32 chan; -for (i =0 ; i <DMA_CHANNEL_NB_MAX ; i++) -writel (riwt, ioaddr +DMA_CHAN_RX_WATCHDOG (i)); +for (chan =0 ; chan < number_chan; chan++) +writel (riwt, ioaddr +DMA_CHAN_RX_WATCHDOG (chan)); } static void dwmac4_dma_rx_chan_op_mode(void __iomem *ioaddr, int mode,
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +2 -1
@@ -730,6 +730,7 @@ static int stmmac_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) {struct stmmac_priv *priv =netdev_priv (dev); +u32 rx_cnt = priv->plat->rx_queues_to_use;unsigned int rx_riwt;/* Check not supported parameters */
@@ -768,7 +769,7 @@ static int stmmac_set_coalesce(struct net_device *dev, priv->tx_coal_frames = ec->tx_max_coalesced_frames; priv->tx_coal_timer = ec->tx_coalesce_usecs; priv->rx_riwt = rx_riwt; - priv->hw->dma->rx_watchdog (priv->ioaddr, priv->rx_riwt); + priv->hw->dma->rx_watchdog (priv->ioaddr, priv->rx_riwt, rx_cnt);return 0 ; }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -1
@@ -1915,6 +1915,7 @@ static void stmmac_mtl_configuration(struct stmmac_priv *priv)static int stmmac_hw_setup (struct net_device *dev,bool init_ptp) {struct stmmac_priv *priv =netdev_priv (dev); +u32 rx_cnt = priv->plat->rx_queues_to_use;int ret;/* DMA initialization and SW reset */
@@ -1988,7 +1989,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { priv->rx_riwt =MAX_DMA_RIWT ; - priv->hw->dma->rx_watchdog (priv->ioaddr,MAX_DMA_RIWT ); + priv->hw->dma->rx_watchdog (priv->ioaddr,MAX_DMA_RIWT , rx_cnt); }if (priv->hw->pcs && priv->hw->mac->pcs_ctrl_ane)
Signature · 1 line
2.9.3
PATCH 7/11 net: stmmac: rx and tx ring length prepared for multiple queues
In reply to Joao PintoThis patch prepares tx and rx ring length configuration for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 4 +-- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 4 +-- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 8 +++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 32 +++++++++++++++++------ 4 files changed, 32 insertions(+), 16 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +2 -2
@@ -444,8 +444,8 @@ struct stmmac_dma_ops { struct dma_features *dma_cap);/* Program the HW RX Watchdog */ void (*rx_watchdog)(void __iomem *ioaddr,u32 riwt,u32 number_chan); -void (*set_tx_ring_len)(void __iomem *ioaddr,u32 len); -void (*set_rx_ring_len)(void __iomem *ioaddr,u32 len); +void (*set_tx_ring_len)(void __iomem *ioaddr,u32 len,u32 chan); +void (*set_rx_ring_len)(void __iomem *ioaddr,u32 len,u32 chan);void (*set_rx_tail_ptr)(void __iomem *ioaddr,u32 tail_ptr,u32 chan);void (*set_tx_tail_ptr)(void __iomem *ioaddr,u32 tail_ptr,u32 chan);void (*enable_tso)(void __iomem *ioaddr,bool en,u32 chan);
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +2 -2
@@ -194,8 +194,8 @@ void dwmac4_dma_start_rx(void __iomem *ioaddr, u32 chan);void dwmac4_dma_stop_rx (void __iomem *ioaddr,u32 chan);int dwmac4_dma_interrupt (void __iomem *ioaddr,struct stmmac_extra_stats *x,u32 chan); -void dwmac4_set_rx_ring_len (void __iomem *ioaddr,u32 len); -void dwmac4_set_tx_ring_len (void __iomem *ioaddr,u32 len); +void dwmac4_set_rx_ring_len (void __iomem *ioaddr,u32 len,u32 chan); +void dwmac4_set_tx_ring_len (void __iomem *ioaddr,u32 len,u32 chan);void dwmac4_set_rx_tail_ptr (void __iomem *ioaddr,u32 tail_ptr,u32 chan);void dwmac4_set_tx_tail_ptr (void __iomem *ioaddr,u32 tail_ptr,u32 chan);
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +4 -4
@@ -94,14 +94,14 @@ void dwmac4_dma_stop_rx(void __iomem *ioaddr, u32 chan)writel (value, ioaddr +GMAC_CONFIG ); } -void dwmac4_set_tx_ring_len (void __iomem *ioaddr,u32 len) +void dwmac4_set_tx_ring_len (void __iomem *ioaddr,u32 len,u32 chan) { -writel (len, ioaddr +DMA_CHAN_TX_RING_LEN (STMMAC_CHAN0 )); +writel (len, ioaddr +DMA_CHAN_TX_RING_LEN (chan)); } -void dwmac4_set_rx_ring_len (void __iomem *ioaddr,u32 len) +void dwmac4_set_rx_ring_len (void __iomem *ioaddr,u32 len,u32 chan) { -writel (len, ioaddr +DMA_CHAN_RX_RING_LEN (STMMAC_CHAN0 )); +writel (len, ioaddr +DMA_CHAN_RX_RING_LEN (chan)); }void dwmac4_enable_dma_irq (void __iomem *ioaddr,u32 chan)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +24 -8
@@ -1802,6 +1802,27 @@ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)add_timer (&priv->txtimer); } +static void stmmac_set_rings_length (struct stmmac_priv *priv) +{ +u32 rx_channels_count = priv->plat->rx_queues_to_use; +u32 tx_channels_count = priv->plat->tx_queues_to_use; +u32 chan; + +/* set TX ring length */ +if (priv->hw->dma->set_tx_ring_len) { +for (chan =0 ; chan < tx_channels_count; chan++) + priv->hw->dma->set_tx_ring_len (priv->ioaddr, + (DMA_TX_SIZE -1 ), chan); + } + +/* set RX ring length */ +if (priv->hw->dma->set_rx_ring_len) { +for (chan =0 ; chan < rx_channels_count; chan++) + priv->hw->dma->set_rx_ring_len (priv->ioaddr, + (DMA_RX_SIZE -1 ), chan); + } +} +/** * stmmac_set_tx_queue_weight - Set TX queue weight * @priv: driver private structure
@@ -1995,14 +2016,9 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)if (priv->hw->pcs && priv->hw->mac->pcs_ctrl_ane) priv->hw->mac->pcs_ctrl_ane (priv->hw,1 , priv->hw->ps,0 ); -/* set TX ring length */ -if (priv->hw->dma->set_tx_ring_len) - priv->hw->dma->set_tx_ring_len (priv->ioaddr, - (DMA_TX_SIZE -1 )); -/* set RX ring length */ -if (priv->hw->dma->set_rx_ring_len) - priv->hw->dma->set_rx_ring_len (priv->ioaddr, - (DMA_RX_SIZE -1 )); +/* set TX and RX rings length */ +stmmac_set_rings_length (priv); +/* Enable TSO */ if (priv->tso) priv->hw->dma->enable_tso (priv->ioaddr,1 ,STMMAC_CHAN0 );
Signature · 1 line
2.9.3
PATCH 8/11 net: stmmac: prepare rx/tx set tail function for multiple queues
In reply to Joao PintoThis patch prepares RX and TX set tail functions for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +2 -2
@@ -37,12 +37,12 @@ int dwmac4_dma_reset(void __iomem *ioaddr)void dwmac4_set_rx_tail_ptr (void __iomem *ioaddr,u32 tail_ptr,u32 chan) { -writel (tail_ptr, ioaddr +DMA_CHAN_RX_END_ADDR (0 )); +writel (tail_ptr, ioaddr +DMA_CHAN_RX_END_ADDR (chan)); }void dwmac4_set_tx_tail_ptr (void __iomem *ioaddr,u32 tail_ptr,u32 chan) { -writel (tail_ptr, ioaddr +DMA_CHAN_TX_END_ADDR (0 )); +writel (tail_ptr, ioaddr +DMA_CHAN_TX_END_ADDR (chan)); }void dwmac4_dma_start_tx (void __iomem *ioaddr,u32 chan)
Signature · 1 line
2.9.3
PATCH 9/11 net: stmmac: dma channel init prepared for multiple queues
In reply to Joao PintoThis patch prepares the DMA initialization process for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 8 +++ drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 66 ++++++++++++++--------- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 50 +++++++++++++---- 3 files changed, 87 insertions(+), 37 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +8 -0
@@ -416,6 +416,14 @@ struct stmmac_dma_ops {int (*reset)(void __iomem *ioaddr);void (*init)(void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,u32 dma_tx,u32 dma_rx,int atds); +void (*init_chan)(void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg,u32 chan); +void (*init_rx_chan)(void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_rx_phy,u32 chan); +void (*init_tx_chan)(void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_tx_phy,u32 chan);/* Configure the AXI Bus Mode Register */ void (*axi)(void __iomem *ioaddr,struct stmmac_axi *axi);/* Dump DMA registers */
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +40 -26
104 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +39 -11
64 lines not on this page · raw message
Signature · 1 line
2.9.3
David Miller
maintainerRe: [PATCH 09/11] net: stmmac: dma channel init prepared for multiple queues
From: Joao Pinto <[email protected]>
Date: Mon, 13 Mar 2017 16:12:40 +0000
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_check_ether_addr(struct stmmac_priv *priv) · line 1741
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4
-0@@ -1732,6 +1732,10 @@ static void stmmac_check_ether_addr(struct stmmac_priv *priv)*/ static int stmmac_init_dma_engine (struct stmmac_priv *priv) { +u32 rx_channels_count = priv->plat->rx_queues_to_use; +u32 tx_channels_count = priv->plat->tx_queues_to_use; +u32 dummy_dma_rx_phy, dummy_dma_tx_phy =0 ; +u32 chan =0 ;int atds =0 ;int ret =0 ;
dummy_dma_rx_phy is declared, but not initialized:
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-2@@ -1749,19 +1753,43 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)return ret; } - priv->hw->dma->init (priv->ioaddr, priv->plat->dma_cfg, - priv->dma_tx_phy, priv->dma_rx_phy, atds);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_init_dma_engine(struct stmmac_priv *priv) · line 1760
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4
-5-if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { - priv->rx_tail_addr = priv->dma_rx_phy + - (DMA_RX_SIZE *sizeof (struct dma_desc )); - priv->hw->dma->set_rx_tail_ptr (priv->ioaddr, priv->rx_tail_addr, -STMMAC_CHAN0 ); +/* DMA Configuration */ + priv->hw->dma->init (priv->ioaddr, priv->plat->dma_cfg, + dummy_dma_tx_phy, dummy_dma_rx_phy, atds); +
Yet it is used here, still uninitialized.
The compiler even warns about this.
PATCH 10/11 net: stmmac: tso init prepared for multiple queues
In reply to Joao PintoThis patch configures TSO for all available tx queues.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -2
@@ -1965,6 +1965,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) {struct stmmac_priv *priv =netdev_priv (dev);u32 rx_cnt = priv->plat->rx_queues_to_use; +u32 tx_cnt = priv->plat->tx_queues_to_use; +u32 chan;int ret;/* DMA initialization and SW reset */
@@ -2048,8 +2050,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)stmmac_set_rings_length (priv);/* Enable TSO */ -if (priv->tso) - priv->hw->dma->enable_tso (priv->ioaddr,1 ,STMMAC_CHAN0 ); +if (priv->tso) { +for (chan =0 ; chan < tx_cnt; chan++) + priv->hw->dma->enable_tso (priv->ioaddr,1 , chan); + }return 0 ; }
Signature · 1 line
2.9.3
PATCH 11/11 net: stmmac: stmmac interrupt treatment prepared for multiple queues
In reply to Joao PintoThis patch prepares the main ISR for multiple queues.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 28 ++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +20 -8
@@ -3114,6 +3114,12 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) {struct net_device *dev = (struct net_device *)dev_id;struct stmmac_priv *priv =netdev_priv (dev); +u32 rx_cnt = priv->plat->rx_queues_to_use; +u32 tx_cnt = priv->plat->tx_queues_to_use; +u32 queues_count; +u32 queue; + + queues_count = (rx_cnt > tx_cnt) ? rx_cnt : tx_cnt;if (priv->irq_wake)pm_wakeup_event (priv->device,0 );
@@ -3128,20 +3134,26 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)int status = priv->hw->mac->host_irq_status (priv->hw, &priv->xstats); -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) - status |= priv->hw->mac->host_mtl_irq_status (priv->hw, -STMMAC_CHAN0 ); -if (unlikely (status)) {/* For LPI we need to save the tx status */ if (status &CORE_IRQ_TX_PATH_IN_LPI_MODE ) priv->tx_path_in_lpi_mode = true;if (status &CORE_IRQ_TX_PATH_EXIT_LPI_MODE ) priv->tx_path_in_lpi_mode = false; -if (status &CORE_IRQ_MTL_RX_OVERFLOW && priv->hw->dma->set_rx_tail_ptr) - priv->hw->dma->set_rx_tail_ptr (priv->ioaddr, - priv->rx_tail_addr, -STMMAC_CHAN0 ); + } + +if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { +for (queue =0 ; queue < queues_count; queue++) { + status |= + priv->hw->mac->host_mtl_irq_status (priv->hw, + queue); + +if (status &CORE_IRQ_MTL_RX_OVERFLOW && + priv->hw->dma->set_rx_tail_ptr) + priv->hw->dma->set_rx_tail_ptr (priv->ioaddr, + priv->rx_tail_addr, + queue); + } }/* PCS link status */
Signature · 1 line
2.9.3