[openib-general] [RFC] ib_mad

Hal Rosenstock halr at voltaire.com
Wed Sep 22 22:23:20 PDT 2004


On Thu, 2004-09-23 at 00:34, Hal Rosenstock wrote:
> On Wed, 2004-09-22 at 18:37, Sean Hefty wrote:
> > I'll start submitting comments in the form of patches.  
> > I'll try to keep each patch as small 
> > and contained as possible.  
> 
> OK. Thanks.
> 
> > This first one is fairly easy.  
> > I didn't see where struct ib_mad_buf was used.  
> 
> It's needed in the PCI mapping/unmapping. In i386, PPC, and some
> other architectures, the mapping is a nop so it might appear unused.
> I don't think the void *buf pointer is needed.
> 
> > If it's needed, can it be merged directly into ib_mad_private_header?
> 
> Sure. I will post a patch for this.

Here's the patch to fix PCI receive mapping:

Index: ib_mad_priv.h
===================================================================
--- ib_mad_priv.h	(revision 879)
+++ ib_mad_priv.h	(working copy)
@@ -77,15 +77,10 @@
 #define MAX_MGMT_VERSION	8
 
 
-struct ib_mad_buf {
-	void *mad_buf;
-	DECLARE_PCI_UNMAP_ADDR(mapping)
-};
-
 struct ib_mad_private_header {
 	struct ib_mad_recv_wc recv_wc; /* must be first member (for now !!!)
*/
 	struct ib_mad_recv_buf recv_buf;
-	struct ib_mad_buf buf;
+	DECLARE_PCI_UNMAP_ADDR(mapping)
 } __attribute__ ((packed));
 
 struct ib_mad_private {
Index: ib_mad.c
===================================================================
--- ib_mad.c	(revision 879)
+++ ib_mad.c	(working copy)
@@ -719,7 +719,7 @@
 	spin_unlock_irqrestore(&port_priv->recv_list_lock, flags);
 
 	pci_unmap_single(port_priv->device->dma_device,
-			 pci_unmap_addr(&recv->buf, mapping),
+			 pci_unmap_addr(&recv->header, mapping),
 			 sizeof(struct ib_mad_private) - sizeof(struct
ib_mad_private_header),
 			 PCI_DMA_FROMDEVICE);
 
@@ -976,14 +976,14 @@
 	port_priv->recv_posted_mad_count[convert_qpnum(qp->qp_num)]++;
 	spin_unlock_irqrestore(&port_priv->recv_list_lock, flags);
 
-	pci_unmap_addr_set(&mad_priv->header.buf, mapping, sg_list.addr);
+	pci_unmap_addr_set(&mad_priv->header, mapping, sg_list.addr);
 
 	/* Now, post receive WR */
 	ret = ib_post_recv(qp, &recv_wr, &bad_recv_wr);
 	if (ret) {
 
 		pci_unmap_single(port_priv->device->dma_device,
-				 pci_unmap_addr(&mad_priv->header.buf, mapping),
+				 pci_unmap_addr(&mad_priv->header, mapping),
 				 sizeof *mad_priv - sizeof mad_priv->header,
 				 PCI_DMA_FROMDEVICE);
 





More information about the general mailing list