[openib-general] [PATCH] RFC Verbs: add support for transport specific verbs

Sean Hefty sean.hefty at intel.com
Tue Feb 28 11:06:30 PST 2006


Add support for transport specific extensions to the ib_device verbs.
Relocate process_mad as an IB specific verb.

This provides a mechanism to add iWarp specific functionality, such as
the iWarp CM calls, to ib_device.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

---

Index: include/rdma/ib_verbs.h
===================================================================
--- include/rdma/ib_verbs.h	(revision 5532)
+++ include/rdma/ib_verbs.h	(working copy)
@@ -824,6 +824,16 @@ struct ib_cache {
 	struct ib_gid_cache   **gid_cache;
 };
 
+struct ib_verbs {
+	int                        (*process_mad)(struct ib_device *device,
+						  int process_mad_flags,
+						  u8 port_num,
+						  struct ib_wc *in_wc,
+						  struct ib_grh *in_grh,
+						  struct ib_mad *in_mad,
+						  struct ib_mad *out_mad);
+};
+
 struct ib_device {
 	struct device                *dma_device;
 
@@ -954,13 +964,10 @@ struct ib_device {
 	int                        (*detach_mcast)(struct ib_qp *qp,
 						   union ib_gid *gid,
 						   u16 lid);
-	int                        (*process_mad)(struct ib_device *device,
-						  int process_mad_flags,
-						  u8 port_num,
-						  struct ib_wc *in_wc,
-						  struct ib_grh *in_grh,
-						  struct ib_mad *in_mad,
-						  struct ib_mad *out_mad);
+
+	union {
+		struct ib_verbs     ib;
+	} ext_verbs;
 
 	struct module               *owner;
 	struct class_device          class_dev;
Index: core/mad.c
===================================================================
--- core/mad.c	(revision 5532)
+++ core/mad.c	(working copy)
@@ -704,9 +704,9 @@ static int handle_outgoing_dr_smp(struct
 		     send_wr->wr.ud.port_num, &mad_wc);
 
 	/* No GRH for DR SMP */
-	ret = device->process_mad(device, 0, port_num, &mad_wc, NULL,
-				  (struct ib_mad *)smp,
-				  (struct ib_mad *)&mad_priv->mad);
+	ret = device->ext_verbs.ib.process_mad(device, 0, port_num, &mad_wc,
+					       NULL, (struct ib_mad *)smp,
+					       (struct ib_mad *)&mad_priv->mad);
 	switch (ret)
 	{
 	case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY:
@@ -1787,7 +1787,7 @@ static void ib_mad_recv_done_handler(str
 
 local:
 	/* Give driver "right of first refusal" on incoming MAD */
-	if (port_priv->device->process_mad) {
+	if (port_priv->device->ext_verbs.ib.process_mad) {
 		int ret;
 
 		if (!response) {
@@ -1799,11 +1799,11 @@ local:
 			goto out;
 		}
 
-		ret = port_priv->device->process_mad(port_priv->device, 0,
-						     port_priv->port_num,
-						     wc, &recv->grh,
-						     &recv->mad.mad,
-						     &response->mad.mad);
+		ret = port_priv->device->
+		      ext_verbs.ib.process_mad(port_priv->device, 0,
+					       port_priv->port_num, wc,
+					       &recv->grh, &recv->mad.mad,
+					       &response->mad.mad);
 		if (ret & IB_MAD_RESULT_SUCCESS) {
 			if (ret & IB_MAD_RESULT_CONSUMED)
 				goto out;
Index: core/sysfs.c
===================================================================
--- core/sysfs.c	(revision 5532)
+++ core/sysfs.c	(working copy)
@@ -311,7 +311,7 @@ static ssize_t show_pma_counter(struct i
 	struct ib_mad *out_mad = NULL;
 	ssize_t ret;
 
-	if (!p->ibdev->process_mad)
+	if (!p->ibdev->ext_verbs.ib.process_mad)
 		return sprintf(buf, "N/A (no PMA)\n");
 
 	in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
@@ -329,7 +329,7 @@ static ssize_t show_pma_counter(struct i
 
 	in_mad->data[41] = p->port_num;	/* PortSelect field */
 
-	if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY,
+	if ((p->ibdev->ext_verbs.ib.process_mad(p->ibdev, IB_MAD_IGNORE_MKEY,
 		 p->port_num, NULL, NULL, in_mad, out_mad) &
 	     (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) !=
 	    (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) {
Index: core/smi.h
===================================================================
--- core/smi.h	(revision 5532)
+++ core/smi.h	(working copy)
@@ -58,7 +58,7 @@ static inline int smi_check_local_smp(st
 {
 	/* C14-9:3 -- We're at the end of the DR segment of path */
 	/* C14-9:4 -- Hop Pointer = Hop Count + 1 -> give to SMA/SM */
-	return ((device->process_mad &&
+	return ((device->ext_verbs.ib.process_mad &&
 		!ib_get_smp_direction(smp) &&
 		(smp->hop_ptr == smp->hop_cnt + 1)));
 }
Index: hw/ipath/ipath_verbs.c
===================================================================
--- hw/ipath/ipath_verbs.c	(revision 5532)
+++ hw/ipath/ipath_verbs.c	(working copy)
@@ -5949,7 +5949,7 @@ static int ipath_register_ib_device(cons
 	dev->dealloc_fmr = ipath_dealloc_fmr;
 	dev->attach_mcast = ipath_multicast_attach;
 	dev->detach_mcast = ipath_multicast_detach;
-	dev->process_mad = ipath_process_mad;
+	dev->ext_verbs.ib.process_mad = ipath_process_mad;
 
 	ret = ib_register_device(dev);
 	if (ret)
Index: hw/mthca/mthca_provider.c
===================================================================
--- hw/mthca/mthca_provider.c	(revision 5532)
+++ hw/mthca/mthca_provider.c	(working copy)
@@ -1329,7 +1329,7 @@ int mthca_register_device(struct mthca_d
 
 	dev->ib_dev.attach_mcast         = mthca_multicast_attach;
 	dev->ib_dev.detach_mcast         = mthca_multicast_detach;
-	dev->ib_dev.process_mad          = mthca_process_mad;
+	dev->ib_dev.ext_verbs.ib.process_mad	 = mthca_process_mad;
 
 	if (mthca_is_memfree(dev)) {
 		dev->ib_dev.req_notify_cq = mthca_arbel_arm_cq;






More information about the general mailing list