[PATCH v4] net/netvsc: fix parsing of VLAN metadata
Ferruh Yigit
ferruh.yigit at amd.com
Thu Feb 15 12:46:29 CET 2024
On 2/14/2024 10:17 PM, Long Li wrote:
>> +#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?
>
Hi Long,
That is good idea indeed, so others can benefit from them. Thanks.
@Alan, can you please move above macros to './lib/net/rte_ether.h', with
RTE_VLAN_ prefix? And use them from net library in the driver.
Btw, CFI seems renamed to DEI (Drop Eligible Indicator), perhaps can be
good to go with that acronym.
More information about the dev
mailing list