[PATCH v4] net/netvsc: fix parsing of VLAN metadata

Long Li longli at microsoft.com
Wed Feb 14 23:17:34 CET 2024


> +#define HN_VLAN_CFI_SHIFT	12
> +#define HN_VLAN_PRI_SHIFT	13
> +#define HN_VLAN_PRI_MASK	0xe000 /* Priority Code Point */
> +#define HN_VLAN_CFI_MASK	0x1000 /* Canonical Format Indicator / Drop
> Eligible Indicator */
> +#define HN_VLAN_VID_MASK	0x0fff /* VLAN Identifier */
> +
> +#define HN_VLAN_TCI_ID(vlan_tci)	((vlan_tci) & HN_VLAN_VID_MASK)
> +#define HN_VLAN_TCI_PRI(vlan_tci)	(((vlan_tci) & HN_VLAN_PRI_MASK) >>
> HN_VLAN_PRI_SHIFT)
> +#define HN_VLAN_TCI_CFI(vlan_tci)	(((vlan_tci) & HN_VLAN_CFI_MASK) >>
> HN_VLAN_CFI_SHIFT)
> +#define HN_VLAN_TCI_MAKE(id, pri, cfi)	((id) |
> 	\
> +					 ((pri) << HN_VLAN_PRI_SHIFT) |	\
> +					 ((cfi) << HN_VLAN_CFI_SHIFT))
> +

The patch looks good.

It seems HN_VLAN_TCI_ID, HN_VLAN_TCI_PRI, HN_VLAN_TCI_CFI and HN_VLAN_TCI_MAKE could be useful to other drivers. (at least to MANA)

Ferruh, do you think we should define those common functions in ./lib/net/rte_ether.h?

Thanks

Long


More information about the dev mailing list