[openib-general] [PATCH] Don't require create_ah and modify_port provider methods

Steve Wise swise at opengridcomputing.com
Wed Mar 15 09:13:28 PST 2006


Roland,

Here is a patch that allows me to remove all the stub/ENOSYS methods
from the chelsio provider.  I tested this on the main trunk by running
ibv_rc_pingpong and rping over mthca.

Signed-off-by: Steve Wise <swise at opengridcomputing.com>


Index: verbs.c
===================================================================
--- verbs.c	(revision 5839)
+++ verbs.c	(working copy)
@@ -78,6 +78,9 @@
 {
 	struct ib_ah *ah;
 
+	if (!pd->device->create_ah)
+		return ERR_PTR(-ENOSYS);
+
 	ah = pd->device->create_ah(pd, ah_attr);
 
 	if (!IS_ERR(ah)) {
@@ -99,6 +102,9 @@
 	u16 gid_index;
 	int ret;
 
+	if (!pd->device->create_ah)
+		return ERR_PTR(-ENOSYS);
+
 	memset(&ah_attr, 0, sizeof ah_attr);
 	ah_attr.dlid = wc->slid;
 	ah_attr.sl = wc->sl;
Index: device.c
===================================================================
--- device.c	(revision 5839)
+++ device.c	(working copy)
@@ -86,8 +86,6 @@
 		IB_MANDATORY_FUNC(query_gid),
 		IB_MANDATORY_FUNC(alloc_pd),
 		IB_MANDATORY_FUNC(dealloc_pd),
-		IB_MANDATORY_FUNC(create_ah),
-		IB_MANDATORY_FUNC(destroy_ah),
 		IB_MANDATORY_FUNC(create_qp),
 		IB_MANDATORY_FUNC(modify_qp),
 		IB_MANDATORY_FUNC(destroy_qp),
@@ -594,6 +592,8 @@
 			return -EINVAL;
 	} else if (port_num < 1 || port_num > device->phys_port_cnt)
 		return -EINVAL;
+	if (!device->modify_port)
+		return -ENOSYS;
 
 	return device->modify_port(device, port_num, port_modify_mask,
 				   port_modify);




More information about the general mailing list