[openib-general][PATCH] mthca & ib_verbs.h client reregister event support by the SW

Leonid Arsh leonida at voltaire.com
Sun Apr 9 23:01:12 PDT 2006


Hello,

     I'm resending the fixed client reregister event support patch.
     The event is handled by the software now, as Michael recommended, not by the hardware.
     (The previouse patch with the hardware event handling may be found in the mail message
      "[openib-general][PATCH] mthca & ib_verbs.h client reregister	event support" )

     Note, I moved the "port_info" struct definition from ipath_mad.c to ib_smi.h,
     so the ipath is touched too, but this doesn't change the functionality.

     I'm also sending the user space verbs patch again,
     to be applied together with the kernel space patch.
     (I sent it before in the mail message "[openib-general] verbs.h client reregister event support")
     See below.


Signed-off-by: Leonid Arsh <leonida at voltaire.com>

Index: linux-kernel/infiniband/include/rdma/ib_verbs.h
===================================================================
--- linux-kernel/infiniband/include/rdma/ib_verbs.h	(revision 8509)
+++ linux-kernel/infiniband/include/rdma/ib_verbs.h	(working copy)
@@ -283,7 +283,8 @@
 	IB_EVENT_SM_CHANGE,
 	IB_EVENT_SRQ_ERR,
 	IB_EVENT_SRQ_LIMIT_REACHED,
-	IB_EVENT_QP_LAST_WQE_REACHED
+	IB_EVENT_QP_LAST_WQE_REACHED,
+	IB_EVENT_CLIENT_REREGISTER
 };
 
 struct ib_event {
Index: linux-kernel/infiniband/include/rdma/ib_smi.h
===================================================================
--- linux-kernel/infiniband/include/rdma/ib_smi.h	(revision 8509)
+++ linux-kernel/infiniband/include/rdma/ib_smi.h	(working copy)
@@ -91,4 +91,40 @@
 	return ((smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
 }
 
+struct port_info {
+	__be64	mkey;
+	__be64	gid_prefix;
+	__be16	lid;
+	__be16	sm_lid;
+	__be32	cap_mask;
+	__be16	diag_code;
+	__be16	mkey_lease_period;
+	u8	local_port_num;
+	u8	link_width_enabled;
+	u8	link_width_supported;
+	u8	link_width_active;
+	u8	linkspeed_portstate;		/* 4 bits, 4 bits */
+	u8	portphysstate_linkdown;		/* 4 bits, 4 bits */
+	u8	mkeyprot_resv_lmc;		/* 2 bits, 3 bits, 3 bits */
+	u8	linkspeedactive_enabled;	/* 4 bits, 4 bits */
+	u8	neighbormtu_mastersmsl;		/* 4 bits, 4 bits */
+	u8	vlcap_inittype;			/* 4 bits, 4 bits */
+	u8	vl_high_limit;
+	u8	vl_arb_high_cap;
+	u8	vl_arb_low_cap;
+	u8	inittypereply_mtucap;		/* 4 bits, 4 bits */
+	u8	vlstallcnt_hoqlife;		/* 3 bits, 5 bits */
+	u8	operationalvl_pei_peo_fpi_fpo;	/* 4 bits, 1, 1, 1, 1 */
+	__be16	mkey_violations;
+	__be16	pkey_violations;
+	__be16	qkey_violations;
+	u8	guid_cap;
+	u8	clientrereg_resv_subnetto;	/* 1 bit, 2 bits, 5 bits */
+	u8	resv_resptimevalue;		/* 3 bits, 5 bits */
+	u8	localphyerrors_overrunerrors;	/* 4 bits, 4 bits */
+	__be16	max_credit_hint;
+	u8	resv;
+	u8	link_roundtrip_latency[3];
+} __attribute__ ((packed));
+
 #endif /* IB_SMI_H */
Index: linux-kernel/infiniband/hw/ipath/ipath_mad.c
===================================================================
--- linux-kernel/infiniband/hw/ipath/ipath_mad.c	(revision 8509)
+++ linux-kernel/infiniband/hw/ipath/ipath_mad.c	(working copy)
@@ -136,42 +136,6 @@
 	return reply(smp, __LINE__);
 }
 
-struct port_info {
-	__be64 mkey;
-	__be64 gid_prefix;
-	__be16 lid;
-	__be16 sm_lid;
-	__be32 cap_mask;
-	__be16 diag_code;
-	__be16 mkey_lease_period;
-	u8 local_port_num;
-	u8 link_width_enabled;
-	u8 link_width_supported;
-	u8 link_width_active;
-	u8 linkspeed_portstate;			/* 4 bits, 4 bits */
-	u8 portphysstate_linkdown;		/* 4 bits, 4 bits */
-	u8 mkeyprot_resv_lmc;			/* 2 bits, 3 bits, 3 bits */
-	u8 linkspeedactive_enabled;		/* 4 bits, 4 bits */
-	u8 neighbormtu_mastersmsl;		/* 4 bits, 4 bits */
-	u8 vlcap_inittype;			/* 4 bits, 4 bits */
-	u8 vl_high_limit;
-	u8 vl_arb_high_cap;
-	u8 vl_arb_low_cap;
-	u8 inittypereply_mtucap;		/* 4 bits, 4 bits */
-	u8 vlstallcnt_hoqlife;			/* 3 bits, 5 bits */
-	u8 operationalvl_pei_peo_fpi_fpo;	/* 4 bits, 1, 1, 1, 1 */
-	__be16 mkey_violations;
-	__be16 pkey_violations;
-	__be16 qkey_violations;
-	u8 guid_cap;
-	u8 clientrereg_resv_subnetto;		/* 1 bit, 2 bits, 5 bits */
-	u8 resv_resptimevalue;			/* 3 bits, 5 bits */
-	u8 localphyerrors_overrunerrors;	/* 4 bits, 4 bits */
-	__be16 max_credit_hint;
-	u8 resv;
-	u8 link_roundtrip_latency[3];
-} __attribute__ ((packed));
-
 static int recv_subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
 				  u8 port)
 {
Index: linux-kernel/infiniband/hw/mthca/mthca_mad.c
===================================================================
--- linux-kernel/infiniband/hw/mthca/mthca_mad.c	(revision 8509)
+++ linux-kernel/infiniband/hw/mthca/mthca_mad.c	(working copy)
@@ -81,19 +81,27 @@
 		      u8 port_num,
 		      struct ib_mad *mad)
 {
-	struct ib_event event;
+	struct ib_event  event;
+	struct port_info *pinfo;
 
 	if ((mad->mad_hdr.mgmt_class  == IB_MGMT_CLASS_SUBN_LID_ROUTED ||
 	     mad->mad_hdr.mgmt_class  == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) &&
 	    mad->mad_hdr.method     == IB_MGMT_METHOD_SET) {
 		if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO) {
+			pinfo = (struct port_info *)((struct ib_smp *)mad)->data;
+
 			update_sm_ah(to_mdev(ibdev), port_num,
-				     be16_to_cpup((__be16 *) (mad->data + 58)),
-				     (*(u8 *) (mad->data + 76)) & 0xf);
+				     be16_to_cpup(&pinfo->lid),
+				     pinfo->neighbormtu_mastersmsl & 0xf);
 
 			event.device           = ibdev;
-			event.event            = IB_EVENT_LID_CHANGE;
 			event.element.port_num = port_num;
+
+			if(pinfo->clientrereg_resv_subnetto & 0x80)
+				event.event            = IB_EVENT_CLIENT_REREGISTER;
+			else
+				event.event            = IB_EVENT_LID_CHANGE;
+
 			ib_dispatch_event(&event);
 		}
 
@@ -103,6 +111,7 @@
 			event.element.port_num = port_num;
 			ib_dispatch_event(&event);
 		}
+
 	}
 }
 





This is the user space verbs patch:

Signed-off-by: Leonid Arsh <leonida at voltaire.com>

Index: userspace/libibverbs/include/infiniband/verbs.h
===================================================================
--- userspace/libibverbs/include/infiniband/verbs.h	(revision 8165)
+++ userspace/libibverbs/include/infiniband/verbs.h	(working copy)
@@ -190,7 +190,8 @@
 	IBV_EVENT_SM_CHANGE,
 	IBV_EVENT_SRQ_ERR,
 	IBV_EVENT_SRQ_LIMIT_REACHED,
-	IBV_EVENT_QP_LAST_WQE_REACHED
+	IBV_EVENT_QP_LAST_WQE_REACHED,
+	IBV_EVENT_CLIENT_REREGISTER
 };
 
 struct ibv_async_event {



More information about the general mailing list