[libmlx4] Update to latest upstream git version Fix modprobe.conf file

Doug Ledford dledford at fedoraproject.org
Tue Jan 3 16:56:54 UTC 2012


commit 675049ed9c817cd69d89011940382e263f178587
Author: Doug Ledford <dledford at redhat.com>
Date:   Tue Jan 3 11:56:47 2012 -0500

    Update to latest upstream git version
    Fix modprobe.conf file
    
    Signed-off-by: Doug Ledford <dledford at redhat.com>

 0004-Add-IBoE-support.patch                        |  136 ++++++++++++++++++++
 0005-Add-IBoE-UD-VLANs-support.patch               |   82 ++++++++++++
 ...ist-of-supported-ConnectX-devices-with-ke.patch |   56 ++++++++
 libmlx4-modprobe.conf                              |    2 +-
 libmlx4.spec                                       |   14 ++-
 5 files changed, 287 insertions(+), 3 deletions(-)
---
diff --git a/0004-Add-IBoE-support.patch b/0004-Add-IBoE-support.patch
new file mode 100644
index 0000000..3c9b614
--- /dev/null
+++ b/0004-Add-IBoE-support.patch
@@ -0,0 +1,136 @@
+From 902aa188c156e8e2832f5afdf76eb2655fa80582 Mon Sep 17 00:00:00 2001
+From: Or Gerlitz <ogerlitz at mellanox.com>
+Date: Tue, 19 Jul 2011 09:32:52 +0000
+Subject: [PATCH 4/7] Add IBoE support
+
+Modify libmlx4 to support IBoE.  The only user space piece to handle
+is the creation of UD address handles - the L2 Ethernet attributes
+have to be resolved from the DGID.  Derived from work by Eli Cohen
+<eli at mellanox.co.il>
+
+Signed-off-by: Or Gerlitz <ogerlitz at mellanox.com>
+---
+ src/mlx4.h  |    1 +
+ src/qp.c    |    1 +
+ src/verbs.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
+ src/wqe.h   |    3 ++-
+ 4 files changed, 51 insertions(+), 3 deletions(-)
+
+diff --git a/src/mlx4.h b/src/mlx4.h
+index 4445998..b277b06 100644
+--- a/src/mlx4.h
++++ b/src/mlx4.h
+@@ -241,6 +241,7 @@ struct mlx4_av {
+ struct mlx4_ah {
+ 	struct ibv_ah			ibv_ah;
+ 	struct mlx4_av			av;
++	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 ec138cd..4d79e38 100644
+--- 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);
++	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 1ac1362..389801c 100644
+--- a/src/verbs.c
++++ b/src/verbs.c
+@@ -614,9 +614,44 @@ int mlx4_destroy_qp(struct ibv_qp *ibqp)
+ 	return 0;
+ }
+ 
++static int link_local_gid(const union ibv_gid *gid)
++{
++	uint32_t hi = *(uint32_t *)(gid->raw);
++	uint32_t lo = *(uint32_t *)(gid->raw + 4);
++	if (hi == htonl(0xfe800000) && lo == 0)
++		return 1;
++
++	return 0;
++}
++
++static uint16_t get_vlan_id(union ibv_gid *gid)
++{
++	uint16_t vid;
++	vid = gid->raw[11] << 8 | gid->raw[12];
++	return vid < 0x1000 ? vid : 0xffff;
++}
++
++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;
++
++	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;
++		return 0;
++	} else
++		return 1;
++}
++
+ 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;
++
++	if (ibv_query_port(pd->context, attr->port_num, &port_attr))
++		return NULL;
+ 
+ 	ah = malloc(sizeof *ah);
+ 	if (!ah)
+@@ -625,8 +660,12 @@ struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
+ 	memset(&ah->av, 0, sizeof ah->av);
+ 
+ 	ah->av.port_pd   = htonl(to_mpd(pd)->pdn | (attr->port_num << 24));
+-	ah->av.g_slid    = attr->src_path_bits;
+-	ah->av.dlid      = htons(attr->dlid);
++
++	if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
++		ah->av.g_slid = attr->src_path_bits;
++		ah->av.dlid   = htons(attr->dlid);
++	}
++
+ 	if (attr->static_rate) {
+ 		ah->av.stat_rate = attr->static_rate + MLX4_STAT_RATE_OFFSET;
+ 		/* XXX check rate cap? */
+@@ -642,6 +681,12 @@ 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 (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET)
++		if (mlx4_resolve_grh_to_l2(ah, attr)) {
++			free(ah);
++			return NULL;
++		}
++
+ 	return &ah->ibv_ah;
+ }
+ 
+diff --git a/src/wqe.h b/src/wqe.h
+index 6f7f309..043f0da 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];
++	uint16_t		reserved;
++	uint8_t			mac[6];
+ };
+ 
+ struct mlx4_wqe_data_seg {
+-- 
+1.7.6.4
+
diff --git a/0005-Add-IBoE-UD-VLANs-support.patch b/0005-Add-IBoE-UD-VLANs-support.patch
new file mode 100644
index 0000000..c923cb1
--- /dev/null
+++ b/0005-Add-IBoE-UD-VLANs-support.patch
@@ -0,0 +1,82 @@
+From 3e73678e88d2ea414a9f4ae187f6412593bd0a1f Mon Sep 17 00:00:00 2001
+From: Or Gerlitz <ogerlitz at mellanox.com>
+Date: Tue, 19 Jul 2011 09:34:15 +0000
+Subject: [PATCH 5/7] Add IBoE UD/VLANs support
+
+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 at mellanox.com>
+---
+ src/mlx4.h  |    1 +
+ src/qp.c    |    1 +
+ src/verbs.c |    9 +++++++--
+ src/wqe.h   |    2 +-
+ 4 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/mlx4.h b/src/mlx4.h
+index b277b06..0ad838d 100644
+--- a/src/mlx4.h
++++ b/src/mlx4.h
+@@ -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];
+ };
+ 
+diff --git a/src/qp.c b/src/qp.c
+index 4d79e38..40a6689 100644
+--- 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);
+ }
+ 
+diff --git a/src/verbs.c b/src/verbs.c
+index 389801c..199d107 100644
+--- a/src/verbs.c
++++ b/src/verbs.c
+@@ -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;
+diff --git a/src/wqe.h b/src/wqe.h
+index 043f0da..bbd22ba 100644
+--- 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];
+ };
+ 
+-- 
+1.7.6.4
+
diff --git a/0006-Align-the-list-of-supported-ConnectX-devices-with-ke.patch b/0006-Align-the-list-of-supported-ConnectX-devices-with-ke.patch
new file mode 100644
index 0000000..d63b016
--- /dev/null
+++ b/0006-Align-the-list-of-supported-ConnectX-devices-with-ke.patch
@@ -0,0 +1,56 @@
+From 1488631df283f03aefb1a7f67367c6e4e371a9a3 Mon Sep 17 00:00:00 2001
+From: Or Gerlitz <ogerlitz at mellanox.com>
+Date: Tue, 19 Jul 2011 09:36:13 +0000
+Subject: [PATCH 6/7] Align the list of supported ConnectX devices with kernel
+
+Align the list of ConnectX devices supported by the library to be the
+same as the mlx4 driver from the upstream kernel.
+
+These two simple awk/cut commands can be used to actually validate the
+claim made by the changelog:
+
+    grep MELLANOX libmlx4.git/src/mlx4.c | grep HCA | awk '{ print $2 }' | cut -d ")" -f 1 > lib
+    grep MELLANOX linux-2.6.git/drivers/net/mlx4/main.c | awk '{ print $3 }' | cut -d ")" -f 1 > ker
+    diff lib ker
+
+Signed-off-by: Or Gerlitz <ogerlitz at mellanox.com>
+---
+ src/mlx4.c |   22 ++++++++++++++++++++++
+ 1 files changed, 22 insertions(+), 0 deletions(-)
+
+diff --git a/src/mlx4.c b/src/mlx4.c
+index 1295c53..8cf249a 100644
+--- a/src/mlx4.c
++++ b/src/mlx4.c
+@@ -66,6 +66,28 @@ 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, 0x6368),	/* MT25408 "Hermon" EN 10GigE */
++	HCA(MELLANOX, 0x6750),	/* MT25408 "Hermon" EN 10GigE PCIe gen2 */
++	HCA(MELLANOX, 0x6372),	/* MT25458 ConnectX EN 10GBASE-T 10GigE */
++	HCA(MELLANOX, 0x675a),	/* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */
++	HCA(MELLANOX, 0x6764),	/* MT26468 ConnectX EN 10GigE PCIe gen2*/
++	HCA(MELLANOX, 0x6746),	/* MT26438 ConnectX EN 40GigE PCIe gen2 5GT/s */
++	HCA(MELLANOX, 0x676e),	/* MT26478 ConnectX2 40GigE PCIe gen2 */
++	HCA(MELLANOX, 0x1002),	/* MT25400 Family [ConnectX-2 Virtual Function] */
++	HCA(MELLANOX, 0x1003),	/* MT27500 Family [ConnectX-3] */
++	HCA(MELLANOX, 0x1004),	/* MT27500 Family [ConnectX-3 Virtual Function] */
++	HCA(MELLANOX, 0x1005),	/* MT27510 Family */
++	HCA(MELLANOX, 0x1006),	/* MT27511 Family */
++	HCA(MELLANOX, 0x1007),	/* MT27520 Family */
++	HCA(MELLANOX, 0x1008),	/* MT27521 Family */
++	HCA(MELLANOX, 0x1009),	/* MT27530 Family */
++	HCA(MELLANOX, 0x100a),	/* MT27531 Family */
++	HCA(MELLANOX, 0x100b),	/* MT27540 Family */
++	HCA(MELLANOX, 0x100c),	/* MT27541 Family */
++	HCA(MELLANOX, 0x100d),	/* MT27550 Family */
++	HCA(MELLANOX, 0x100e),	/* MT27551 Family */
++	HCA(MELLANOX, 0x100f),	/* MT27560 Family */
++	HCA(MELLANOX, 0x1010),	/* MT27561 Family */
+ };
+ 
+ static struct ibv_context_ops mlx4_ctx_ops = {
+-- 
+1.7.6.4
+
diff --git a/libmlx4-modprobe.conf b/libmlx4-modprobe.conf
index 6af4b87..edf7eda 100644
--- a/libmlx4-modprobe.conf
+++ b/libmlx4-modprobe.conf
@@ -1 +1 @@
-install mlx4_core /sbin/modprobe --ignore-install mlx4_core && if [ -f /etc/rdma/setup-mlx4.awk -a -f /etc/rdma/mlx4.conf ]; then awk -f /etc/rdma/setup-mlx4.awk /etc/rdma/mlx4.conf /sbin/setup-mlx4; fi; /sbin/modprobe mlx4_en; /sbin/modprobe mlx4_ib
+install mlx4_core /sbin/modprobe --ignore-install mlx4_core && if [ -f /etc/rdma/setup-mlx4.awk -a -f /etc/rdma/mlx4.conf ]; then awk -f /etc/rdma/setup-mlx4.awk /etc/rdma/mlx4.conf; fi; /sbin/modprobe mlx4_en; /sbin/modprobe mlx4_ib
diff --git a/libmlx4.spec b/libmlx4.spec
index 29cfccf..2e543e1 100644
--- a/libmlx4.spec
+++ b/libmlx4.spec
@@ -10,6 +10,9 @@ Source: http://openib.org/downloads/mlx4/%{name}-%{version}.tar.gz
 Source1: libmlx4-modprobe.conf
 Source2: libmlx4-mlx4.conf
 Source3: libmlx4-setup-mlx4.awk
+Patch4:  0004-Add-IBoE-support.patch
+Patch5:  0005-Add-IBoE-UD-VLANs-support.patch
+Patch6:  0006-Align-the-list-of-supported-ConnectX-devices-with-ke.patch
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 Provides: libmlx4-devel = %{version}-%{release}
 Obsoletes: %{name}-devel < 1.0.1-2
@@ -36,6 +39,9 @@ application, which may be useful for debugging.
 
 %prep
 %setup -q
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 %build
 %ifnarch ia64 %{sparc} %{arm}
@@ -51,8 +57,8 @@ make DESTDIR=%{buildroot} install
 install -D -m 644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/modprobe.d/libmlx4.conf
 install -D -m 644 %{SOURCE2} ${RPM_BUILD_ROOT}%{_sysconfdir}/rdma/mlx4.conf
 install -D -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_sysconfdir}/rdma/setup-mlx4.awk
-# remove unpackaged files from the buildroot
-rm -f $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/libmlx4.so
+# Remove unpackaged files
+rm -f %{buildroot}%{_libdir}/libmlx4.{la,so}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -71,6 +77,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libmlx4.a
 
 %changelog
+* Tue Jan 03 2012 Doug Ledford <dledford at redhat.com> - 1.0.2-2
+- Update with changesets in current git head so we can get IBoE
+  support
+
 * Wed Jul 20 2011 Doug Ledford <dledford at redhat.com> - 1.0.2-1
 - Update to latest version
 - Fix modprobe.conf to look in /etc/rdma instead of /etc/ofed


More information about the scm-commits mailing list