[openib-general] ipoib: ignores dma mapping errors on TX?

Roland Dreier rdreier at cisco.com
Mon Oct 9 11:01:06 PDT 2006


    Michael> It seems that IPoIB ignores the possibility that
    Michael> dma_map_single with DMA_TO_DEVICE direction might return
    Michael> dma_mapping_error.

    Michael> Is there some reason that such mappings can't fail?

No, it's just an oversight.  Most network device drivers don't check
for DMA mapping errors but it's probably better to do so anyway.  I
added this to my queue:

commit 8edaf479946022d67350d6c344952fb65064e51b
Author: Roland Dreier <rolandd at cisco.com>
Date:   Mon Oct 9 10:54:20 2006 -0700

    IPoIB: Check for DMA mapping error for TX packets
    
    Signed-off-by: Roland Dreier <rolandd at cisco.com>

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index f426a69..8bf5e9e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -355,6 +355,11 @@ void ipoib_send(struct net_device *dev, 
 	tx_req->skb = skb;
 	addr = dma_map_single(priv->ca->dma_device, skb->data, skb->len,
 			      DMA_TO_DEVICE);
+	if (unlikely(dma_mapping_error(addr))) {
+		++priv->stats.tx_errors;
+		dev_kfree_skb_any(skb);
+		return;
+	}
 	pci_unmap_addr_set(tx_req, mapping, addr);
 
 	if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1),




More information about the general mailing list