Add VLAN support for the UD address handle creation flow, where the
VLAN id is taken from the destination GID and the VLAN priority from
the IB SL specified by the application.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
struct mlx4_ah {
struct ibv_ah ibv_ah;
struct mlx4_av av;
+ uint16_t vlan;
uint8_t mac[6];
};
memcpy(dseg->av, &to_mah(wr->wr.ud.ah)->av, sizeof (struct mlx4_av));
dseg->dqpn = htonl(wr->wr.ud.remote_qpn);
dseg->qkey = htonl(wr->wr.ud.remote_qkey);
+ dseg->vlan = htons(to_mah(wr->wr.ud.ah)->vlan);
memcpy(dseg->mac, to_mah(wr->wr.ud.ah)->mac, 6);
}
static int mlx4_resolve_grh_to_l2(struct mlx4_ah *ah, struct ibv_ah_attr *attr)
{
- if (get_vlan_id(&attr->grh.dgid) != 0xffff)
- return 1;
+ uint16_t vid;
if (link_local_gid(&attr->grh.dgid)) {
memcpy(ah->mac, &attr->grh.dgid.raw[8], 3);
memcpy(ah->mac + 3, &attr->grh.dgid.raw[13], 3);
ah->mac[0] ^= 2;
+
+ vid = get_vlan_id(&attr->grh.dgid);
+ if (vid != 0xffff) {
+ ah->av.port_pd |= htonl(1 << 29);
+ ah->vlan = vid | ((attr->sl & 7) << 13);
+ }
return 0;
} else
return 1;
uint32_t av[8];
uint32_t dqpn;
uint32_t qkey;
- uint16_t reserved;
+ uint16_t vlan;
uint8_t mac[6];
};