Skip to content

Commit 4b4a8ec

Browse files
committed
Merge branch 'net-stmmac-xgmac-minor-fixes'
Rohan G Thomas says: ==================== net: stmmac: xgmac: Minor fixes This patch series includes following minor fixes for stmmac dwxgmac driver: 1. Disable Rx FIFO overflow interrupt for dwxgmac 2. Correct supported speed modes for dwxgmac 3. Check for coe-unsupported flag before setting CIC bit of Tx Desc3 in the AF_XDP flow v2: https://lore.kernel.org/[email protected] v1: https://lore.kernel.org/[email protected] ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 24be090 + b1eded5 commit 4b4a8ec

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ static void dwxgmac2_core_init(struct mac_device_info *hw,
4949
writel(XGMAC_INT_DEFAULT_EN, ioaddr + XGMAC_INT_EN);
5050
}
5151

52+
static void dwxgmac2_update_caps(struct stmmac_priv *priv)
53+
{
54+
if (!priv->dma_cap.mbps_10_100)
55+
priv->hw->link.caps &= ~(MAC_10 | MAC_100);
56+
else if (!priv->dma_cap.half_duplex)
57+
priv->hw->link.caps &= ~(MAC_10HD | MAC_100HD);
58+
}
59+
5260
static void dwxgmac2_set_mac(void __iomem *ioaddr, bool enable)
5361
{
5462
u32 tx = readl(ioaddr + XGMAC_TX_CONFIG);
@@ -1424,6 +1432,7 @@ static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en,
14241432

14251433
const struct stmmac_ops dwxgmac210_ops = {
14261434
.core_init = dwxgmac2_core_init,
1435+
.update_caps = dwxgmac2_update_caps,
14271436
.set_mac = dwxgmac2_set_mac,
14281437
.rx_ipc = dwxgmac2_rx_ipc,
14291438
.rx_queue_enable = dwxgmac2_rx_queue_enable,
@@ -1532,8 +1541,8 @@ int dwxgmac2_setup(struct stmmac_priv *priv)
15321541
mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins);
15331542

15341543
mac->link.caps = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
1535-
MAC_1000FD | MAC_2500FD | MAC_5000FD |
1536-
MAC_10000FD;
1544+
MAC_10 | MAC_100 | MAC_1000FD |
1545+
MAC_2500FD | MAC_5000FD | MAC_10000FD;
15371546
mac->link.duplex = 0;
15381547
mac->link.speed10 = XGMAC_CONFIG_SS_10_MII;
15391548
mac->link.speed100 = XGMAC_CONFIG_SS_100_MII;

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,6 @@ static void dwxgmac2_dma_rx_mode(struct stmmac_priv *priv, void __iomem *ioaddr,
203203
}
204204

205205
writel(value, ioaddr + XGMAC_MTL_RXQ_OPMODE(channel));
206-
207-
/* Enable MTL RX overflow */
208-
value = readl(ioaddr + XGMAC_MTL_QINTEN(channel));
209-
writel(value | XGMAC_RXOIE, ioaddr + XGMAC_MTL_QINTEN(channel));
210206
}
211207

212208
static void dwxgmac2_dma_tx_mode(struct stmmac_priv *priv, void __iomem *ioaddr,
@@ -386,8 +382,11 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv,
386382
static int dwxgmac2_get_hw_feature(void __iomem *ioaddr,
387383
struct dma_features *dma_cap)
388384
{
385+
struct stmmac_priv *priv;
389386
u32 hw_cap;
390387

388+
priv = container_of(dma_cap, struct stmmac_priv, dma_cap);
389+
391390
/* MAC HW feature 0 */
392391
hw_cap = readl(ioaddr + XGMAC_HW_FEATURE0);
393392
dma_cap->edma = (hw_cap & XGMAC_HWFEAT_EDMA) >> 31;
@@ -410,6 +409,8 @@ static int dwxgmac2_get_hw_feature(void __iomem *ioaddr,
410409
dma_cap->vlhash = (hw_cap & XGMAC_HWFEAT_VLHASH) >> 4;
411410
dma_cap->half_duplex = (hw_cap & XGMAC_HWFEAT_HDSEL) >> 3;
412411
dma_cap->mbps_1000 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1;
412+
if (dma_cap->mbps_1000 && priv->synopsys_id >= DWXGMAC_CORE_2_20)
413+
dma_cap->mbps_10_100 = 1;
413414

414415
/* MAC HW feature 1 */
415416
hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1);

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
25842584
struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue);
25852585
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
25862586
struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
2587+
bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported;
25872588
struct xsk_buff_pool *pool = tx_q->xsk_pool;
25882589
unsigned int entry = tx_q->cur_tx;
25892590
struct dma_desc *tx_desc = NULL;
@@ -2671,7 +2672,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
26712672
}
26722673

26732674
stmmac_prepare_tx_desc(priv, tx_desc, 1, xdp_desc.len,
2674-
true, priv->mode, true, true,
2675+
csum, priv->mode, true, true,
26752676
xdp_desc.len);
26762677

26772678
stmmac_enable_dma_transmission(priv, priv->ioaddr, queue);
@@ -4983,6 +4984,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
49834984
{
49844985
struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
49854986
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
4987+
bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported;
49864988
unsigned int entry = tx_q->cur_tx;
49874989
struct dma_desc *tx_desc;
49884990
dma_addr_t dma_addr;
@@ -5034,7 +5036,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
50345036
stmmac_set_desc_addr(priv, tx_desc, dma_addr);
50355037

50365038
stmmac_prepare_tx_desc(priv, tx_desc, 1, xdpf->len,
5037-
true, priv->mode, true, true,
5039+
csum, priv->mode, true, true,
50385040
xdpf->len);
50395041

50405042
tx_q->tx_count_frames++;

0 commit comments

Comments
 (0)