[openib-general] [PATCH] ib_mad: Undo send side PCI mapping/unmapping

Hal Rosenstock halr at voltaire.com
Wed Sep 15 09:10:50 PDT 2004


ib_mad: Undo send side PCI mapping/unmapping

Index: ib_mad_priv.h
===================================================================
--- ib_mad_priv.h	(revision 839)
+++ ib_mad_priv.h	(working copy)
@@ -108,8 +108,6 @@
 	struct ib_mad_agent *agent;
 	u64 wr_id;			/* client WRID */
 	int timeout_ms;
-	struct ib_mad_buf *buf;
-	u32 buf_len;
 };
 
 struct ib_mad_mgmt_method_table {
Index: ib_mad.c
===================================================================
--- ib_mad.c	(revision 839)
+++ ib_mad.c	(working copy)
@@ -293,7 +293,6 @@
 	struct ib_send_wr	wr;
 	struct ib_send_wr	*bad_wr;
 	struct ib_mad_send_wr_private *mad_send_wr;
-	struct ib_sge		gather_list;
 	unsigned long flags;
 
 	cur_send_wr = send_wr;
@@ -318,25 +317,16 @@
 			return -ENOMEM;	
 		}
 
-		/* Setup gather list */
-		gather_list.addr = pci_map_single(mad_agent->device->dma_device,
-						  cur_send_wr->sg_list->addr,
-						  cur_send_wr->sg_list->length,
-						  PCI_DMA_TODEVICE);
-		gather_list.length = cur_send_wr->sg_list->length;
-		gather_list.lkey = cur_send_wr->sg_list->lkey;
-
 		/* Initialize MAD send WR tracking structure */
 		mad_send_wr->agent = mad_agent;
 		mad_send_wr->wr_id = cur_send_wr->wr_id;
 		/* Timeout valid only when MAD is a request !!! */
 		mad_send_wr->timeout_ms = cur_send_wr->wr.ud.timeout_ms;
-		mad_send_wr->buf_len = gather_list.length;
 
 		wr.next = NULL;
 		wr.opcode = IB_WR_SEND; /* cur_send_wr->opcode ? */ 
 		wr.wr_id = (unsigned long)mad_send_wr;
-		wr.sg_list = &gather_list;
+		wr.sg_list = cur_send_wr->sg_list;
 		wr.num_sge = cur_send_wr->num_sge;
 		wr.wr.ud.remote_qpn = cur_send_wr->wr.ud.remote_qpn;
 		wr.wr.ud.remote_qkey = cur_send_wr->wr.ud.remote_qkey;
@@ -351,17 +341,8 @@
 		((struct ib_mad_port_private
*)mad_agent->device->mad)->send_posted_mad_count++;
 		spin_unlock_irqrestore(&((struct ib_mad_port_private
*)mad_agent->device->mad)->send_list_lock, flags);
 
-		pci_unmap_addr_set(&mad_send_wr->buf, mapping, 
-				   gather_list.addr);
-
 		ret = ib_post_send(mad_agent->qp, &wr, &bad_wr);
 		if (ret) {
-			pci_unmap_single(mad_agent->device->dma_device,
-					 pci_unmap_addr(&mad_send_wr->buf,
-						 	mapping),
-					 gather_list.length,
-					 PCI_DMA_TODEVICE);
-
 			/* Unlink from posted send MAD list */
 			spin_unlock_irqrestore(&((struct ib_mad_port_private
*)mad_agent->device->mad)->send_list_lock, flags);
 			list_del(&mad_send_wr->send_list);
@@ -803,11 +784,6 @@
 	}
 	spin_unlock_irqrestore(&port_priv->send_list_lock, flags);
 
-	pci_unmap_single(port_priv->device->dma_device,
-			 pci_unmap_addr(&send_wr->buf, mapping),
-			 send_wr->buf_len,
-			 PCI_DMA_TODEVICE);
-
 	/* Restore client wr_id in WC */
 	wc->wr_id = send_wr->wr_id;
 	/* Invoke client send callback */
@@ -1065,7 +1041,7 @@
 	spin_lock_irqsave(&port_priv->send_list_lock, flags);
 	while (!list_empty(&port_priv->send_posted_mad_list)) {
 
-		/* PCI mapping !!! */
+		/* PCI mapping ? */
 
 		list_del(&port_priv->send_posted_mad_list);
 






More information about the general mailing list