[openib-general] [PATCH] ib_mad: Use IB_MAD_QPS_CORE and IB_MAD_QPS_SUPPORTED definitions

Hal Rosenstock halr at voltaire.com
Sat Sep 11 11:38:10 PDT 2004


ib_mad: Use IB_MAD_QPS_CORE and IB_MAD_QPS_SUPPORTED definitions rather
than hard coded constant

Index: ib_mad.c
===================================================================
--- ib_mad.c	(revision 785)
+++ ib_mad.c	(working copy)
@@ -972,7 +972,7 @@
 {
 	int ret, i;
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < IB_MAD_QPS_CORE; i++) {
 		ret = ib_mad_change_qp_state_to_init(priv->qp[i], priv->port);
 		if (ret) {
 			printk(KERN_ERR "Could not change QP%d state to INIT\n", i);
@@ -992,7 +992,7 @@
 		goto error;
 	}
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < IB_MAD_QPS_CORE; i++) {
 		ret = ib_mad_change_qp_state_to_rtr(priv->qp[i]);
 		if (ret) {
 			printk(KERN_ERR "Could not change QP%d state to RTR\n", i);
@@ -1009,7 +1009,7 @@
 	return 0;
 error:
 	ib_mad_return_posted_recv_mads(priv);
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < IB_MAD_QPS_CORE; i++) {
 		ib_mad_change_qp_state_to_reset(priv->qp[i]);
 	}
 
@@ -1023,7 +1023,7 @@
 {
 	int i;
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < IB_MAD_QPS_CORE; i++) {
 		ib_mad_change_qp_state_to_reset(priv->qp[i]);
 	}
 
@@ -1120,7 +1120,7 @@
 		goto error5;
 	}
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < IB_MAD_QPS_CORE; i++) {
 		memset(&qp_init_attr, 0, sizeof qp_init_attr);
 		qp_init_attr.send_cq = priv->cq;
 		qp_init_attr.recv_cq = priv->cq;
Index: ib_mad_priv.h
===================================================================
--- ib_mad_priv.h	(revision 785)
+++ ib_mad_priv.h	(working copy)
@@ -59,6 +59,9 @@
 #include <linux/pci.h>
 
 
+#define IB_MAD_QPS_CORE		2 /* Always QP0 and QP1 */
+#define IB_MAD_QPS_SUPPORTED	2
+
 /* QP and CQ parameters */
 #define IB_MAD_QP_SEND_SIZE	2048
 #define IB_MAD_QP_RECV_SIZE	512
@@ -123,7 +126,7 @@
 	struct ib_device *device;
 	int port;
 	struct ib_mad_mgmt_class_table *version[MAX_MGMT_VERSION];
-	struct ib_qp *qp[2];
+	struct ib_qp *qp[IB_MAD_QPS_SUPPORTED];
 	struct ib_cq *cq;
 	struct ib_pd *pd;
 	struct ib_mr *mr;





More information about the general mailing list