net: stmmac: rx and tx ring length prepared for multiple queues
This patch prepares tx and rx ring length configuration for multiple queues. Signed-off-by: Joao Pinto <jpinto@synopsys.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3c55d4d08b
commit
4854ab9966
@ -444,8 +444,8 @@ struct stmmac_dma_ops {
|
|||||||
struct dma_features *dma_cap);
|
struct dma_features *dma_cap);
|
||||||
/* Program the HW RX Watchdog */
|
/* Program the HW RX Watchdog */
|
||||||
void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 number_chan);
|
void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 number_chan);
|
||||||
void (*set_tx_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);
|
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_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 (*set_tx_tail_ptr)(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
|
||||||
void (*enable_tso)(void __iomem *ioaddr, bool en, u32 chan);
|
void (*enable_tso)(void __iomem *ioaddr, bool en, u32 chan);
|
||||||
|
@ -194,8 +194,8 @@ void dwmac4_dma_start_rx(void __iomem *ioaddr, u32 chan);
|
|||||||
void dwmac4_dma_stop_rx(void __iomem *ioaddr, u32 chan);
|
void dwmac4_dma_stop_rx(void __iomem *ioaddr, u32 chan);
|
||||||
int dwmac4_dma_interrupt(void __iomem *ioaddr,
|
int dwmac4_dma_interrupt(void __iomem *ioaddr,
|
||||||
struct stmmac_extra_stats *x, u32 chan);
|
struct stmmac_extra_stats *x, u32 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);
|
||||||
void dwmac4_set_tx_ring_len(void __iomem *ioaddr, u32 len);
|
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_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);
|
void dwmac4_set_tx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan);
|
||||||
|
|
||||||
|
@ -94,14 +94,14 @@ void dwmac4_dma_stop_rx(void __iomem *ioaddr, u32 chan)
|
|||||||
writel(value, ioaddr + GMAC_CONFIG);
|
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)
|
void dwmac4_enable_dma_irq(void __iomem *ioaddr, u32 chan)
|
||||||
|
@ -1802,6 +1802,27 @@ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
|
|||||||
add_timer(&priv->txtimer);
|
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
|
* stmmac_set_tx_queue_weight - Set TX queue weight
|
||||||
* @priv: driver private structure
|
* @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)
|
if (priv->hw->pcs && priv->hw->mac->pcs_ctrl_ane)
|
||||||
priv->hw->mac->pcs_ctrl_ane(priv->hw, 1, priv->hw->ps, 0);
|
priv->hw->mac->pcs_ctrl_ane(priv->hw, 1, priv->hw->ps, 0);
|
||||||
|
|
||||||
/* set TX ring length */
|
/* set TX and RX rings length */
|
||||||
if (priv->hw->dma->set_tx_ring_len)
|
stmmac_set_rings_length(priv);
|
||||||
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));
|
|
||||||
/* Enable TSO */
|
/* Enable TSO */
|
||||||
if (priv->tso)
|
if (priv->tso)
|
||||||
priv->hw->dma->enable_tso(priv->ioaddr, 1, STMMAC_CHAN0);
|
priv->hw->dma->enable_tso(priv->ioaddr, 1, STMMAC_CHAN0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user