[PATCH net v3 2/3] net: stmmac: Consider Tx VLAN offload tag length for maxSDU

G Thomas, Rohan rohan.g.thomas at altera.com
Mon Oct 27 02:03:54 PDT 2025


Hi All,

I've noticed one more issue with this commit. Need to drop the packet
before inserting the context descriptor with VLAN. So I think I have to
keep the max_sdu check in the original place itself, but add VLAN length 
if priv->dma_cap.vlins && skb_vlan_tag_present(skb) are true. Will 
change it accordingly in the next version.

Apologies for the oversight in the initial patch.

On 10/17/2025 11:41 AM, Rohan G Thomas via B4 Relay wrote:
> From: Rohan G Thomas <rohan.g.thomas at altera.com>
> 
> On hardware with Tx VLAN offload enabled, add the VLAN tag length to
> the skb length before checking the Qbv maxSDU if Tx VLAN offload is
> requested for the packet. Add 4 bytes for 802.1Q tag.
> 
> Fixes: c5c3e1bfc9e0 ("net: stmmac: Offload queueMaxSDU from tc-taprio")
> Signed-off-by: Rohan G Thomas <rohan.g.thomas at altera.com>
> Reviewed-by: Matthew Gerlach <matthew.gerlach at altera.com>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++-------
>   1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index dedaaef3208bfadc105961029f79d0d26c3289d8..23bf4a3d324b7f8e8c3067ed4d47b436a89c97d3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4500,6 +4500,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>   	bool has_vlan, set_ic;
>   	int entry, first_tx;
>   	dma_addr_t des;
> +	u32 sdu_len;
>   
>   	tx_q = &priv->dma_conf.tx_queue[queue];
>   	txq_stats = &priv->xstats.txq_stats[queue];
> @@ -4516,13 +4517,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>   			return stmmac_tso_xmit(skb, dev);
>   	}
>   
> -	if (priv->est && priv->est->enable &&
> -	    priv->est->max_sdu[queue] &&
> -	    skb->len > priv->est->max_sdu[queue]){
> -		priv->xstats.max_sdu_txq_drop[queue]++;
> -		goto max_sdu_err;
> -	}
> -
>   	if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
>   		if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, queue))) {
>   			netif_tx_stop_queue(netdev_get_tx_queue(priv->dev,
> @@ -4535,8 +4529,18 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>   		return NETDEV_TX_BUSY;
>   	}
>   
> +	sdu_len = skb->len;
>   	/* Check if VLAN can be inserted by HW */
>   	has_vlan = stmmac_vlan_insert(priv, skb, tx_q);
> +	if (has_vlan)
> +		sdu_len += VLAN_HLEN;
> +
> +	if (priv->est && priv->est->enable &&
> +	    priv->est->max_sdu[queue] &&
> +	    skb->len > priv->est->max_sdu[queue]){
> +		priv->xstats.max_sdu_txq_drop[queue]++;
> +		goto max_sdu_err;
> +	}
>   
>   	entry = tx_q->cur_tx;
>   	first_entry = entry;
> 

Best Regards,
Rohan



More information about the linux-arm-kernel mailing list