Skip to content

Commit 5e6038b

Browse files
elvinongbldavem330
authored andcommitted
net: stmmac: fix TSO and TBS feature enabling during driver open
TSO and TBS cannot co-exist and current implementation requires two fixes: 1) stmmac_open() does not need to call stmmac_enable_tbs() because the MAC is reset in stmmac_init_dma_engine() anyway. 2) Inside stmmac_hw_setup(), we should call stmmac_enable_tso() for TX Q that is _not_ configured for TBS. Fixes: 579a25a ("net: stmmac: Initial support for TBS") Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 90b669d commit 5e6038b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,8 +2757,15 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
27572757

27582758
/* Enable TSO */
27592759
if (priv->tso) {
2760-
for (chan = 0; chan < tx_cnt; chan++)
2760+
for (chan = 0; chan < tx_cnt; chan++) {
2761+
struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
2762+
2763+
/* TSO and TBS cannot co-exist */
2764+
if (tx_q->tbs & STMMAC_TBS_AVAIL)
2765+
continue;
2766+
27612767
stmmac_enable_tso(priv, priv->ioaddr, 1, chan);
2768+
}
27622769
}
27632770

27642771
/* Enable Split Header */
@@ -2850,9 +2857,8 @@ static int stmmac_open(struct net_device *dev)
28502857
struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
28512858
int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en;
28522859

2860+
/* Setup per-TXQ tbs flag before TX descriptor alloc */
28532861
tx_q->tbs |= tbs_en ? STMMAC_TBS_AVAIL : 0;
2854-
if (stmmac_enable_tbs(priv, priv->ioaddr, tbs_en, chan))
2855-
tx_q->tbs &= ~STMMAC_TBS_AVAIL;
28562862
}
28572863

28582864
ret = alloc_dma_desc_resources(priv);

0 commit comments

Comments
 (0)