Skip to content

Commit a38eeec

Browse files
committed
Merge branch 'net-stmmac-fixes-for-stmmac-tx-vlan-insert-and-est'
Rohan G Thomas says: ==================== net: stmmac: Fixes for stmmac Tx VLAN insert and EST This patchset includes following fixes for stmmac Tx VLAN insert and EST implementations: 1. Disable STAG insertion offloading, as DWMAC IPs doesn't support offload of STAG for double VLAN packets and CTAG for single VLAN packets when using the same register configuration. The current configuration in the driver is undocumented and is adding an additional 802.1Q tag with VLAN ID 0 for double VLAN packets. 2. Consider Tx VLAN offload tag length for maxSDU estimation. 3. Fix GCL bounds check ==================== Link: https://patch.msgid.link/20251028-qbv-fixes-v4-0-26481c7634e3@altera.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 0dd1be4 + 48b2e32 commit a38eeec

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

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

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4089,18 +4089,11 @@ static int stmmac_release(struct net_device *dev)
40894089
static bool stmmac_vlan_insert(struct stmmac_priv *priv, struct sk_buff *skb,
40904090
struct stmmac_tx_queue *tx_q)
40914091
{
4092-
u16 tag = 0x0, inner_tag = 0x0;
4093-
u32 inner_type = 0x0;
40944092
struct dma_desc *p;
4093+
u16 tag = 0x0;
40954094

4096-
if (!priv->dma_cap.vlins)
4095+
if (!priv->dma_cap.vlins || !skb_vlan_tag_present(skb))
40974096
return false;
4098-
if (!skb_vlan_tag_present(skb))
4099-
return false;
4100-
if (skb->vlan_proto == htons(ETH_P_8021AD)) {
4101-
inner_tag = skb_vlan_tag_get(skb);
4102-
inner_type = STMMAC_VLAN_INSERT;
4103-
}
41044097

41054098
tag = skb_vlan_tag_get(skb);
41064099

@@ -4109,7 +4102,7 @@ static bool stmmac_vlan_insert(struct stmmac_priv *priv, struct sk_buff *skb,
41094102
else
41104103
p = &tx_q->dma_tx[tx_q->cur_tx];
41114104

4112-
if (stmmac_set_desc_vlan_tag(priv, p, tag, inner_tag, inner_type))
4105+
if (stmmac_set_desc_vlan_tag(priv, p, tag, 0x0, 0x0))
41134106
return false;
41144107

41154108
stmmac_set_tx_owner(priv, p);
@@ -4507,6 +4500,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
45074500
bool has_vlan, set_ic;
45084501
int entry, first_tx;
45094502
dma_addr_t des;
4503+
u32 sdu_len;
45104504

45114505
tx_q = &priv->dma_conf.tx_queue[queue];
45124506
txq_stats = &priv->xstats.txq_stats[queue];
@@ -4524,10 +4518,15 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
45244518
}
45254519

45264520
if (priv->est && priv->est->enable &&
4527-
priv->est->max_sdu[queue] &&
4528-
skb->len > priv->est->max_sdu[queue]){
4529-
priv->xstats.max_sdu_txq_drop[queue]++;
4530-
goto max_sdu_err;
4521+
priv->est->max_sdu[queue]) {
4522+
sdu_len = skb->len;
4523+
/* Add VLAN tag length if VLAN tag insertion offload is requested */
4524+
if (priv->dma_cap.vlins && skb_vlan_tag_present(skb))
4525+
sdu_len += VLAN_HLEN;
4526+
if (sdu_len > priv->est->max_sdu[queue]) {
4527+
priv->xstats.max_sdu_txq_drop[queue]++;
4528+
goto max_sdu_err;
4529+
}
45314530
}
45324531

45334532
if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
@@ -7573,11 +7572,8 @@ int stmmac_dvr_probe(struct device *device,
75737572
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
75747573
ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
75757574
}
7576-
if (priv->dma_cap.vlins) {
7575+
if (priv->dma_cap.vlins)
75777576
ndev->features |= NETIF_F_HW_VLAN_CTAG_TX;
7578-
if (priv->dma_cap.dvlan)
7579-
ndev->features |= NETIF_F_HW_VLAN_STAG_TX;
7580-
}
75817577
#endif
75827578
priv->msg_enable = netif_msg_init(debug, default_msg_level);
75837579

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
981981
if (qopt->cmd == TAPRIO_CMD_DESTROY)
982982
goto disable;
983983

984-
if (qopt->num_entries >= dep)
984+
if (qopt->num_entries > dep)
985985
return -EINVAL;
986986
if (!qopt->cycle_time)
987987
return -ERANGE;
@@ -1012,7 +1012,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
10121012
s64 delta_ns = qopt->entries[i].interval;
10131013
u32 gates = qopt->entries[i].gate_mask;
10141014

1015-
if (delta_ns > GENMASK(wid, 0))
1015+
if (delta_ns > GENMASK(wid - 1, 0))
10161016
return -ERANGE;
10171017
if (gates > GENMASK(31 - wid, 0))
10181018
return -ERANGE;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static void vlan_enable(struct mac_device_info *hw, u32 type)
212212

213213
value = readl(ioaddr + VLAN_INCL);
214214
value |= VLAN_VLTI;
215-
value |= VLAN_CSVL; /* Only use SVLAN */
215+
value &= ~VLAN_CSVL; /* Only use CVLAN */
216216
value &= ~VLAN_VLC;
217217
value |= (type << VLAN_VLC_SHIFT) & VLAN_VLC;
218218
writel(value, ioaddr + VLAN_INCL);

0 commit comments

Comments
 (0)