[ewg] [PATCH] libmlx4: Add RDMAoE support
Eli Cohen
eli at mellanox.co.il
Mon Jun 15 06:43:32 PDT 2009
Modify mlx4_create_ah() to check the port link type and for Ethernet ports, do
a system call to retrieve the remote port's MAC address.
Add ConnectX EN 10GigE PCIe gen2 to the list of supported device.
Make modifications to address vector data structs and code to accomodate for
RDMAoE.
Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
src/mlx4.c | 1 +
src/mlx4.h | 3 +++
src/qp.c | 2 ++
src/verbs.c | 14 ++++++++++++++
src/wqe.h | 3 ++-
5 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/mlx4.c b/src/mlx4.c
index 34ece39..d2e32fd 100644
--- a/src/mlx4.c
+++ b/src/mlx4.c
@@ -66,6 +66,7 @@ struct {
HCA(MELLANOX, 0x6354), /* MT25408 "Hermon" QDR */
HCA(MELLANOX, 0x6732), /* MT25408 "Hermon" DDR PCIe gen2 */
HCA(MELLANOX, 0x673c), /* MT25408 "Hermon" QDR PCIe gen2 */
+ HCA(MELLANOX, 0x6750), /* MT25408 "Hermon" EN 10GigE PCIe gen2 */
};
static struct ibv_context_ops mlx4_ctx_ops = {
diff --git a/src/mlx4.h b/src/mlx4.h
index 827a201..20d3fdd 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -236,11 +236,14 @@ struct mlx4_av {
uint8_t hop_limit;
uint32_t sl_tclass_flowlabel;
uint8_t dgid[16];
+ uint8_t mac[8];
};
struct mlx4_ah {
struct ibv_ah ibv_ah;
struct mlx4_av av;
+ uint16_t vlan;
+ uint8_t mac[6];
};
static inline unsigned long align(unsigned long val, unsigned long align)
diff --git a/src/qp.c b/src/qp.c
index d194ae3..cd8fab0 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -143,6 +143,8 @@ 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);
}
static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ibv_sge *sg)
diff --git a/src/verbs.c b/src/verbs.c
index cc179a0..ff59a93 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -617,6 +617,7 @@ int mlx4_destroy_qp(struct ibv_qp *ibqp)
struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
{
struct mlx4_ah *ah;
+ struct ibv_port_attr port_attr;
ah = malloc(sizeof *ah);
if (!ah)
@@ -642,7 +643,20 @@ struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
memcpy(ah->av.dgid, attr->grh.dgid.raw, 16);
}
+ if (ibv_query_port(pd->context, attr->port_num, &port_attr))
+ goto err;
+
+ if (port_attr.link_type == PORT_LINK_ETH) {
+ if (ibv_cmd_get_mac(pd, attr->port_num, ah->av.dgid, ah->mac))
+ goto err;
+ ah->vlan = 0;
+ }
+
+
return &ah->ibv_ah;
+err:
+ free(ah);
+ return NULL;
}
int mlx4_destroy_ah(struct ibv_ah *ah)
diff --git a/src/wqe.h b/src/wqe.h
index 6f7f309..ea6f27f 100644
--- a/src/wqe.h
+++ b/src/wqe.h
@@ -78,7 +78,8 @@ struct mlx4_wqe_datagram_seg {
uint32_t av[8];
uint32_t dqpn;
uint32_t qkey;
- uint32_t reserved[2];
+ __be16 vlan;
+ uint8_t mac[6];
};
struct mlx4_wqe_data_seg {
--
1.6.3.1
More information about the ewg
mailing list