Re: [PATCHv9 09/12] ib_core: Add VLAN support to IBoE

Jason Gunthorpe
2010-08-06T16:49:15Z

On Fri, Aug 06, 2010 at 05:41:53PM +0300, Eli Cohen wrote:
> -static inline void iboe_mac_to_ll(union ib_gid *gid, u8 *mac)
> +static inline void iboe_mac_vlan_to_ll(union ib_gid *gid, u8 *mac, u16 vid)
> {
> memset(gid->raw, 0, 16);
> *((u32 *)gid->raw) = cpu_to_be32(0xfe800000);
> - gid->raw[12] = 0xfe;
> - gid->raw[11] = 0xff;
> + if (vid) {
> + gid->raw[12] = vid & 0xff;
> + gid->raw[11] = vid >> 8;
> + } else {
> + gid->raw[12] = 0xfe;
> + gid->raw[11] = 0xff;
> + }
> memcpy(gid->raw + 13, mac + 3, 3);
> memcpy(gid->raw + 8, mac, 3);
> gid->raw[8] ^= 2;

My general comment on this would be the same I made for userspace:
Don't assume VID == 0 means no vlan tag. Use 0xFFFF or something that
is actually invalid.

Jason