]> git.openfabrics.org - ~shefty/libmlx4.git/commitdiff
Add IBoE UD/VLANs support
authorOr Gerlitz <ogerlitz@mellanox.com>
Tue, 19 Jul 2011 09:34:15 +0000 (09:34 +0000)
committerRoland Dreier <roland@purestorage.com>
Tue, 26 Jul 2011 20:15:57 +0000 (13:15 -0700)
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>
src/mlx4.h
src/qp.c
src/verbs.c
src/wqe.h

index b277b062882b86d0ac2299aef365b816ab7117c9..0ad838db9d7ee0c3d14439b73b94d82f9ac81bed 100644 (file)
@@ -241,6 +241,7 @@ struct mlx4_av {
 struct mlx4_ah {
        struct ibv_ah                   ibv_ah;
        struct mlx4_av                  av;
+       uint16_t                        vlan;
        uint8_t                         mac[6];
 };
 
index 4d79e3881a1195295b57feaba89baa1599cad945..40a66897c50a6cf43ee1f6bc60b3330d406317c9 100644 (file)
--- a/src/qp.c
+++ b/src/qp.c
@@ -144,6 +144,7 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg,
        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);
 }
 
index 389801c8ecf7fd8da0e873facb32f02e4b8f5581..199d10768f8457951fbf96006de167960cd5b5df 100644 (file)
@@ -633,13 +633,18 @@ static uint16_t get_vlan_id(union ibv_gid *gid)
 
 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;
index 043f0dae8175101b5936c4316878a9d65145e18f..bbd22bad2250d4ee31a9279840b9fc8bc83adbe3 100644 (file)
--- a/src/wqe.h
+++ b/src/wqe.h
@@ -78,7 +78,7 @@ struct mlx4_wqe_datagram_seg {
        uint32_t                av[8];
        uint32_t                dqpn;
        uint32_t                qkey;
-       uint16_t                reserved;
+       uint16_t                vlan;
        uint8_t                 mac[6];
 };