[PATCH 1/1] net/mana: add vlan tagging support

Long Li longli at microsoft.com
Fri Feb 9 19:48:11 CET 2024


> +		if (oob->rx_vlan_tag_present) {
> +			mbuf->ol_flags |=
> +				RTE_MBUF_F_RX_VLAN |
> RTE_MBUF_F_RX_VLAN_STRIPPED;
> +			mbuf->vlan_tci = oob->rx_vlan_id;
> +		}
> +

Netvsc has the following code for dealing with vlan on RX mbufs (in hn_rxtx.c):
                /* NDIS always strips tag, put it back if necessary */
                if (!hv->vlan_strip && rte_vlan_insert(&m)) {

It seems we should do the same?

>  		pkts[pkt_received++] = mbuf;
>  		rxq->stats.packets++;
>  		rxq->stats.bytes += mbuf->data_len;
> diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c index
> 58c4a1d976..f075fcb0f5 100644
> --- a/drivers/net/mana/tx.c
> +++ b/drivers/net/mana/tx.c
> @@ -180,6 +180,15 @@ get_vsq_frame_num(uint32_t vsq)
>  	return v.vsq_frame;
>  }
> 
> +#define VLAN_PRIO_MASK		0xe000 /* Priority Code Point */
> +#define VLAN_PRIO_SHIFT		13
> +#define VLAN_CFI_MASK		0x1000 /* Canonical Format Indicator
> / Drop Eligible Indicator */
> +#define VLAN_VID_MASK		0x0fff /* VLAN Identifier */
> +
> +#define mana_mbuf_vlan_tag_get_id(m)	((m)->vlan_tci &
> VLAN_VID_MASK)
> +#define mana_mbuf_vlan_tag_get_cfi(m)	(!!((m)->vlan_tci &
> VLAN_CFI_MASK))
> +#define mana_mbuf_vlan_tag_get_prio(m)	(((m)->vlan_tci &
> VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)
> +

Those definitions look like those in @Alan Elder's patch for netvsc. Can we consolidate some of those definitions into a common place? 

Maybe in "lib/net/rte_ether.h"?

Thanks,

Long


More information about the dev mailing list