Skip to content

Commit 044f2fb

Browse files
khayash1Paolo Abeni
authored andcommitted
net: stmmac: Limit FIFO size by hardware capability
Tx/Rx FIFO size is specified by the parameter "{tx,rx}-fifo-depth" from stmmac_platform layer. However, these values are constrained by upper limits determined by the capabilities of each hardware feature. There is a risk that the upper bits will be truncated due to the calculation, so it's appropriate to limit them to the upper limit values and display a warning message. This only works if the hardware capability has the upper limit values. Fixes: e7877f5 ("stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree") Signed-off-by: Kunihiko Hayashi <[email protected]> Reviewed-by: Yanteng Si <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent f5fb35a commit 044f2fb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7236,6 +7236,21 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
72367236
priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues;
72377237
}
72387238

7239+
if (priv->dma_cap.rx_fifo_size &&
7240+
priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) {
7241+
dev_warn(priv->device,
7242+
"Rx FIFO size (%u) exceeds dma capability\n",
7243+
priv->plat->rx_fifo_size);
7244+
priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
7245+
}
7246+
if (priv->dma_cap.tx_fifo_size &&
7247+
priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) {
7248+
dev_warn(priv->device,
7249+
"Tx FIFO size (%u) exceeds dma capability\n",
7250+
priv->plat->tx_fifo_size);
7251+
priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size;
7252+
}
7253+
72397254
priv->hw->vlan_fail_q_en =
72407255
(priv->plat->flags & STMMAC_FLAG_VLAN_FAIL_Q_EN);
72417256
priv->hw->vlan_fail_q = priv->plat->vlan_fail_q;

0 commit comments

Comments
 (0)