On Thu, 8 Feb 2024 14:42:44 +0000
Alan Elder <alan.el...@microsoft.com> wrote:


> +                             struct ndis_pkt_vlan_info *vlan = (struct 
> ndis_pkt_vlan_info *)pi_data;
> +                             vlan->value = 0;
> +                             vlan->vlanid = (m->vlan_tci & HN_VLAN_VID_MASK);
> +                             vlan->cfi = (!!(m->vlan_tci & 
> HN_VLAN_CFI_MASK));
> +                             vlan->pri = ((m->vlan_tci & HN_VLAN_PRIO_MASK) 
> >> HN_VLAN_PRIO_SHIFT);

Lots of extra parenthesis here, please remove them.

> +struct ndis_pkt_vlan_info {
> +             union {
> +                             struct {
> +                                             uint32_t pri:3; /* User 
> Priority */
> +                                             uint32_t cfi:1; /* Canonical 
> Format ID / DEI */
> +                                             uint32_t vlanid:12; /* VLAN ID 
> */
> +                                             uint32_t reserved:16;
> +                             };
> +                             uint32_t value;
> +             };
> +};

Order of union elements is byte order sensitive, granted Hyper-V/Azure doesn't 
do big-endian.

Most of this driver came from FreeBSD. Did you look there to make sure naming 
is the
same. I.e would be good to be able to have same code in both places as much as 
possible.

Reply via email to