[openib-general] [RFC] [PATCH] Remove redundant ib_qp_cap from 2 verb routines.

Hal Rosenstock halr at voltaire.com
Mon Nov 1 12:42:16 PST 2004


On Mon, 2004-11-01 at 12:40, Sean Hefty wrote:
> On Mon, 01 Nov 2004 11:24:35 -0500
> Hal Rosenstock <halr at voltaire.com> wrote:
> 
> > On Fri, 2004-10-29 at 16:14, Sean Hefty wrote:
> > > On Fri, 29 Oct 2004 13:01:03 -0700 (PDT)
> > > Krishna Kumar <krkumar at us.ibm.com> wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I know this changes the verbs interface a bit, but ...
> > > > 
> > > > I don't see a value in the qp_cap being passed to different
> > > > routines, when either ib_qp_attr or ib_qp_init_attr, both of which
> > > > contain a qp_cap, are being passed at the same time.
> > > 
> > > The parameter is there to separate input/output parameters, and
> > > resulted from the original VAPI evolution of the code.  There's no
> > > strong technical reason that it cannot be removed.
> > 
> > Should this patch be applied ? If so, I will test this and then it can
> > also be merged to roland's branch.
> 
> I'm fine with applying this patch - just wanted to let others provide
> input.  We should probably modify ipoib before committing the changes.

Thanks. Applied (excepting the change to mthca_provider.c).

Attached is the remaining patch for roland's branch. Note mad.c will
need to be moved over as well.

-- Hal

Index: include/ib_verbs.h
===================================================================
--- include/ib_verbs.h	(revision 1106)
+++ include/ib_verbs.h	(working copy)
@@ -709,12 +709,10 @@
 					       struct ib_ah_attr *ah_attr);
 	int                        (*destroy_ah)(struct ib_ah *ah);
 	struct ib_qp *             (*create_qp)(struct ib_pd *pd,
-						struct ib_qp_init_attr *qp_init_attr,
-						struct ib_qp_cap *qp_cap);
+						struct ib_qp_init_attr *qp_init_attr);
 	int                        (*modify_qp)(struct ib_qp *qp,
 						struct ib_qp_attr *qp_attr,
-						int qp_attr_mask,
-						struct ib_qp_cap *qp_cap);
+						int qp_attr_mask);
 	int                        (*query_qp)(struct ib_qp *qp,
 					       struct ib_qp_attr *qp_attr,
 					       int qp_attr_mask,
@@ -851,13 +849,11 @@
 int ib_destroy_ah(struct ib_ah *ah);
 
 struct ib_qp *ib_create_qp(struct ib_pd *pd,
-			   struct ib_qp_init_attr *qp_init_attr,
-			   struct ib_qp_cap *qp_cap);
+			   struct ib_qp_init_attr *qp_init_attr);
 
 int ib_modify_qp(struct ib_qp *qp,
 		 struct ib_qp_attr *qp_attr,
-		 int qp_attr_mask,
-		 struct ib_qp_cap *qp_cap);
+		 int qp_attr_mask);
 
 int ib_query_qp(struct ib_qp *qp,
 		struct ib_qp_attr *qp_attr,
Index: core/verbs.c
===================================================================
--- core/verbs.c	(revision 1106)
+++ core/verbs.c	(working copy)
@@ -105,12 +105,11 @@
 /* Queue pairs */
 
 struct ib_qp *ib_create_qp(struct ib_pd *pd,
-			   struct ib_qp_init_attr *qp_init_attr,
-			   struct ib_qp_cap *qp_cap)
+			   struct ib_qp_init_attr *qp_init_attr)
 {
 	struct ib_qp *qp;
 
-	qp = pd->device->create_qp(pd, qp_init_attr, qp_cap);
+	qp = pd->device->create_qp(pd, qp_init_attr);
 
 	if (!IS_ERR(qp)) {
 		qp->device     	  = pd->device;
@@ -133,10 +132,9 @@
 
 int ib_modify_qp(struct ib_qp *qp,
 		 struct ib_qp_attr *qp_attr,
-		 int qp_attr_mask,
-		 struct ib_qp_cap *qp_cap)
+		 int qp_attr_mask)
 {
-	return qp->device->modify_qp(qp, qp_attr, qp_attr_mask, qp_cap);
+	return qp->device->modify_qp(qp, qp_attr, qp_attr_mask);
 }
 EXPORT_SYMBOL(ib_modify_qp);
 
Index: hw/mthca/mthca_provider.c
===================================================================
--- hw/mthca/mthca_provider.c	(revision 1106)
+++ hw/mthca/mthca_provider.c	(working copy)
@@ -287,8 +287,7 @@
 }
 
 static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
-				     struct ib_qp_init_attr *init_attr,
-				     struct ib_qp_cap *qp_cap)
+				     struct ib_qp_init_attr *init_attr)
 {
 	struct mthca_qp *qp;
 	int err;
@@ -347,8 +346,7 @@
 		return ERR_PTR(err);
 	}
 
-	*qp_cap = init_attr->cap;
-	qp_cap->max_inline_data = 0;
+        init_attr->cap.max_inline_data = 0;
 
 	return &qp->ibqp;
 }
Index: ulp/ipoib/ipoib_verbs.c
===================================================================
--- ulp/ipoib/ipoib_verbs.c	(revision 1106)
+++ ulp/ipoib/ipoib_verbs.c	(working copy)
@@ -27,7 +27,6 @@
 {
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	struct ib_qp_attr *qp_attr;
-	struct ib_qp_cap qp_cap;
 	int attr_mask;
 	int ret;
 	u16 pkey_index;
@@ -47,7 +46,7 @@
 	/* set correct QKey for QP */
 	qp_attr->qkey = priv->qkey;
 	attr_mask = IB_QP_QKEY;
-	ret = ib_modify_qp(priv->qp, qp_attr, attr_mask, &qp_cap);
+	ret = ib_modify_qp(priv->qp, qp_attr, attr_mask);
 	if (ret) {
 		ipoib_warn(priv, "failed to modify QP, ret = %d\n", ret);
 		goto out;
@@ -98,7 +97,6 @@
 		.rq_sig_type = IB_SIGNAL_ALL_WR,
 		.qp_type     = IB_QPT_UD
 	};
-	struct ib_qp_cap qp_cap;
 
 	struct ib_qp_attr qp_attr;
 	int attr_mask;
@@ -115,7 +113,7 @@
 	}
 	set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
 
-	priv->qp = ib_create_qp(priv->pd, &init_attr, &qp_cap);
+	priv->qp = ib_create_qp(priv->pd, &init_attr);
 	if (IS_ERR(priv->qp)) {
 		ipoib_warn(priv, "failed to create QP\n");
 		return PTR_ERR(priv->qp);
@@ -137,7 +135,7 @@
 	    IB_QP_PORT |
 	    IB_QP_PKEY_INDEX |
 	    IB_QP_STATE;
-	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask, &qp_cap);
+	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask);
 	if (ret) {
 		ipoib_warn(priv, "failed to modify QP to init, ret = %d\n", ret);
 		goto out_fail;
@@ -146,7 +144,7 @@
 	qp_attr.qp_state = IB_QPS_RTR;
 	/* Can't set this in a INIT->RTR transition */
 	attr_mask &= ~IB_QP_PORT;
-	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask, &qp_cap);
+	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask);
 	if (ret) {
 		ipoib_warn(priv, "failed to modify QP to RTR, ret = %d\n", ret);
 		goto out_fail;
@@ -156,7 +154,7 @@
 	qp_attr.sq_psn = 0;
 	attr_mask |= IB_QP_SQ_PSN;
 	attr_mask &= ~IB_QP_PKEY_INDEX;
-	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask, &qp_cap);
+	ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask);
 	if (ret) {
 		ipoib_warn(priv, "failed to modify QP to RTS, ret = %d\n", ret);
 		goto out_fail;








More information about the general mailing list