mirror of https://github.com/torvalds/linux.git
net: stmmac: Consider Tx VLAN offload tag length for maxSDU
Queue maxSDU requirement of 802.1 Qbv standard requires mac to drop
packets that exceeds maxSDU length and maxSDU doesn't include
preamble, destination and source address, or FCS but includes
ethernet type and VLAN header.
On hardware with Tx VLAN offload enabled, VLAN header length is not
included in the skb->len, when Tx VLAN offload is requested. This
leads to incorrect length checks and allows transmission of
oversized packets. Add the VLAN_HLEN to the skb->len before checking
the Qbv maxSDU if Tx VLAN offload is requested for the packet.
Fixes: c5c3e1bfc9 ("net: stmmac: Offload queueMaxSDU from tc-taprio")
Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com>
Link: https://patch.msgid.link/20251028-qbv-fixes-v4-2-26481c7634e3@altera.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c657f86106
commit
ded9813d17
|
|
@ -4500,6 +4500,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
bool has_vlan, set_ic;
|
bool has_vlan, set_ic;
|
||||||
int entry, first_tx;
|
int entry, first_tx;
|
||||||
dma_addr_t des;
|
dma_addr_t des;
|
||||||
|
u32 sdu_len;
|
||||||
|
|
||||||
tx_q = &priv->dma_conf.tx_queue[queue];
|
tx_q = &priv->dma_conf.tx_queue[queue];
|
||||||
txq_stats = &priv->xstats.txq_stats[queue];
|
txq_stats = &priv->xstats.txq_stats[queue];
|
||||||
|
|
@ -4517,11 +4518,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->est && priv->est->enable &&
|
if (priv->est && priv->est->enable &&
|
||||||
priv->est->max_sdu[queue] &&
|
priv->est->max_sdu[queue]) {
|
||||||
skb->len > priv->est->max_sdu[queue]){
|
sdu_len = skb->len;
|
||||||
|
/* Add VLAN tag length if VLAN tag insertion offload is requested */
|
||||||
|
if (priv->dma_cap.vlins && skb_vlan_tag_present(skb))
|
||||||
|
sdu_len += VLAN_HLEN;
|
||||||
|
if (sdu_len > priv->est->max_sdu[queue]) {
|
||||||
priv->xstats.max_sdu_txq_drop[queue]++;
|
priv->xstats.max_sdu_txq_drop[queue]++;
|
||||||
goto max_sdu_err;
|
goto max_sdu_err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
|
if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
|
||||||
if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, queue))) {
|
if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, queue))) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue