[openib-general][PATCH 1 of 3] repost: Client Reregister support for kernel space

Leonid Arsh leonida at voltaire.com
Mon May 8 23:09:58 PDT 2006


Roland,
    I'm reposting the Client Reregister event support patch for the kernel space.

    The patch defines the event and implements it in MTHCA.
    The event is implemented in software, as Michael proposed.
    It also moves the port_info structure definition from ipath_mad.c to ib_smi.h.

Regards,
   Leonid


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 6969)
+++ 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 6969)
+++ 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 6969)
+++ linux-kernel/infiniband/hw/ipath/ipath_mad.c	(working copy)
@@ -137,42 +137,6 @@
 	return reply(smp);
 }
 
-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, 3 */
-	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 */
-	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 6969)
+++ linux-kernel/infiniband/hw/mthca/mthca_mad.c	(working copy)
@@ -105,20 +105,28 @@
 		      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;
+
 			mthca_update_rate(to_mdev(ibdev), port_num);
 			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);
 		}
 
@@ -128,6 +136,7 @@
 			event.element.port_num = port_num;
 			ib_dispatch_event(&event);
 		}
+
 	}
 }
 



More information about the general mailing list