[openib-general] [PATCH] ib_mad: Change ib_mad_post_receive_mad to take QP pointer rather than type

Hal Rosenstock halr at voltaire.com
Fri Sep 10 17:00:51 PDT 2004


ib_mad: Change ib_mad_post_receive_mad to take QP pointer rather than
type. Also, Eliminate qp_type from ib_mad_private structure.

Index: ib_mad.c
===================================================================
--- ib_mad.c	(revision 777)
+++ ib_mad.c	(working copy)
@@ -776,7 +776,7 @@
 }
 
 static int ib_mad_post_receive_mad(struct ib_mad_port_private *priv,
-				   enum ib_qp_type qp_type)
+				   struct ib_qp *qp)
 {
 	struct ib_mad_private *mad_priv;
 	struct ib_sge sg_list;
@@ -791,7 +791,6 @@
 		return -ENOMEM;
 	}
 	mad_priv->header.next = NULL;
-	mad_priv->header.qp_type = qp_type;
 
 	/* Setup scatter list */
 	sg_list.addr = pci_map_single(priv->device->dma_device,
@@ -816,7 +815,7 @@
 	pci_unmap_addr_set(&mad_priv->header.buf, mapping, sg_list.addr);
 
 	/* Now, post receive WR */
-	if (ib_post_recv(priv->qp[qp_type], &recv_wr, &bad_recv_wr)) {
+	if (ib_post_recv(qp, &recv_wr, &bad_recv_wr)) {
 		/* Unlink from posted receive MAD list */
 		IB_MAD_RECV_LIST_LOCK(priv);
 		list_del((struct list_head *)mad_priv);
@@ -839,18 +838,14 @@
  */
 static int ib_mad_post_receive_mads(struct ib_mad_port_private *priv)
 {
-	int i;
+	int i, j;
 
 	for (i = 0; i < IB_MAD_QP_RECV_SIZE; i++) {
-		/* Post SMI receive */
-		if (ib_mad_post_receive_mad(priv, IB_QPT_SMI)) {
-			printk(KERN_ERR "SMI receive post %d failed\n", i + 1);
+		for (j = 0; j < 2; j++) {
+			if (ib_mad_post_receive_mad(priv, priv->qp[j])) {
+				printk(KERN_ERR "receive post %d failed\n", i + 1);
+			}
 		}
-
-		/* Post GSI receive */
-		if (ib_mad_post_receive_mad(priv, IB_QPT_GSI)) {
-			printk(KERN_ERR "GSI receive post %d failed\n", i + 1);
-		}
 	}
 
 	return 0;
Index: ib_mad_priv.h
===================================================================
--- ib_mad_priv.h	(revision 776)
+++ ib_mad_priv.h	(working copy)
@@ -79,7 +79,6 @@
 
 struct ib_mad_private_header {
 	struct ib_mad_private_header *next;
-	enum ib_qp_type qp_type;
 	struct ib_mad_buf buf;
 } __attribute__ ((packed));
 





More information about the general mailing list