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

Tom Tucker tom at opengridcomputing.com
Tue Oct 10 10:24:18 PDT 2006


Does anyone know what might happen if a device tries to bus master
bad_dma_address. Does it get a pci-abort, an NMI, a bus err interrupt, all
of the above?


On 10/9/06 1:01 PM, "Roland Dreier" <rdreier at cisco.com> wrote:

>     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),
> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
> 






More information about the general mailing list