[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1317935310.24742.18.camel@dagon.hellion.org.uk>
Date: Thu, 6 Oct 2011 22:08:30 +0100
From: Ian Campbell <Ian.Campbell@...citrix.com>
To: Michał Mirosław <mirqus@...il.com>
CC: David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Jon Mason <jdmason@...zu.us>
Subject: Re: [PATCH 1/8] vxge: convert to SKB paged frag API.
On Thu, 2011-10-06 at 21:45 +0100, Michał Mirosław wrote:
> W dniu 6 października 2011 18:00 użytkownik Ian Campbell
> <Ian.Campbell@...rix.com> napisał:
> > On Thu, 2011-10-06 at 08:05 +0100, Ian Campbell wrote:
> >> On Wed, 2011-10-05 at 22:03 +0100, Michał Mirosław wrote:
> >> > 2011/10/5 Ian Campbell <ian.campbell@...rix.com>:
> >> > [...]
> >> > > --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
> >> > > +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
> >> > > @@ -923,9 +923,9 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
> >> > > if (!frag->size)
> >> > > continue;
> >> > >
> >> > > - dma_pointer = (u64) pci_map_page(fifo->pdev, frag->page,
> >> > > - frag->page_offset, frag->size,
> >> > > - PCI_DMA_TODEVICE);
> >> > > + dma_pointer = (u64)skb_frag_dma_map(&fifo->pdev->dev, frag,
> >> > > + 0, frag->size,
> >> > > + PCI_DMA_TODEVICE);
> >> >
> >> > This should be DMA_TO_DEVICE instead of PCI_DMA_TODEVICE.
> >> > > if (unlikely(pci_dma_mapping_error(fifo->pdev, dma_pointer)))
> >> > > goto _exit2;
> >> > I would also change this to dma_mapping_error() in one go.
> >> > Just a random patch check.
> >> Thanks Michał.
> >> I'm sure I must have made the same mistakes in a whole bunch of patches
> >> which have already been applied. I'll knock up a fixup patch.
> > Here it is. David, if you want N separate patches (or a git pull
> > request?) let me know.
>
> There's a catch there, though:
>
> [...]
> > mapping = skb_frag_dma_map(&tp->pdev->dev, frag, 0,
> > - len, PCI_DMA_TODEVICE);
> > + len, DMA_TO_DEVICE);
> >
> > tnapi->tx_buffers[entry].skb = NULL;
> > dma_unmap_addr_set(&tnapi->tx_buffers[entry], mapping,
> > mapping);
> > - if (pci_dma_mapping_error(tp->pdev, mapping))
> > + if (dma_mapping_error(tp->pdev, mapping))
>
> dma_mapping_error() takes struct device *, so those changes should be:
>
> dma_mapping_error(&tp->pdev->dev, mapping)
>
> (Like skb_frag_dma_map()'s first argument).
You are absolutely right, I've no idea how I missed the very obvious
warning this produces. Incremental patch is below, sorry about this!
8<-------------------------------------------------------
>From 5be2edc6eec5c66b58f4287f1d3ba3637afa7ad6 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@...rix.com>
Date: Thu, 6 Oct 2011 22:05:41 +0100
Subject: [PATCH] net: fix argument to dma_mapping_error after conversion to skb_frag_dma_map
The recent conversion from pci_dma_mapping_error to dma_mapping_error missed
the change in the exact parameter, which needs to be the struct device * not
the struct pci_device *.
Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
---
drivers/net/ethernet/broadcom/tg3.c | 2 +-
drivers/net/ethernet/marvell/sky2.c | 4 ++--
drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +-
.../net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 +-
drivers/net/ethernet/qlogic/qla3xxx.c | 2 +-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +-
drivers/net/ethernet/qlogic/qlge/qlge_main.c | 2 +-
drivers/net/ethernet/sfc/tx.c | 2 +-
8 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 3abcb4d..9dbd1af 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6784,7 +6784,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
tnapi->tx_buffers[entry].skb = NULL;
dma_unmap_addr_set(&tnapi->tx_buffers[entry], mapping,
mapping);
- if (dma_mapping_error(tp->pdev, mapping))
+ if (dma_mapping_error(&tp->pdev->dev, mapping))
goto dma_error;
if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping,
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 7baff3e..a3ce9b6 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1231,7 +1231,7 @@ static int sky2_rx_map_skb(struct pci_dev *pdev, struct rx_ring_info *re,
frag->size,
DMA_FROM_DEVICE);
- if (dma_mapping_error(pdev, re->frag_addr[i]))
+ if (dma_mapping_error(&pdev->dev, re->frag_addr[i]))
goto map_page_error;
}
return 0;
@@ -1938,7 +1938,7 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
mapping = skb_frag_dma_map(&hw->pdev->dev, frag, 0,
frag->size, DMA_TO_DEVICE);
- if (dma_mapping_error(hw->pdev, mapping))
+ if (dma_mapping_error(&hw->pdev->dev, mapping))
goto mapping_unwind;
upper = upper_32_bits(mapping);
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index d247030..c6f0056 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -1508,7 +1508,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
map[i + 1] = skb_frag_dma_map(&mac->dma_pdev->dev, frag, 0,
frag->size, DMA_TO_DEVICE);
map_size[i+1] = frag->size;
- if (dma_mapping_error(mac->dma_pdev, map[i + 1])) {
+ if (dma_mapping_error(&mac->dma_pdev->dev, map[i + 1])) {
nfrags = i;
goto out_err_nolock;
}
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index b061c07..e2ba78b 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1907,7 +1907,7 @@ netxen_map_tx_skb(struct pci_dev *pdev,
map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
DMA_TO_DEVICE);
- if (dma_mapping_error(pdev, map))
+ if (dma_mapping_error(&pdev->dev, map))
goto unwind;
nf->dma = map;
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 8932265..46f9b64 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2391,7 +2391,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size,
DMA_TO_DEVICE);
- err = dma_mapping_error(qdev->pdev, map);
+ err = dma_mapping_error(&qdev->pdev->dev, map);
if (err) {
netdev_err(qdev->ndev,
"PCI mapping frags failed with error: %d\n",
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index c9756e7..eac19e7d 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -2137,7 +2137,7 @@ qlcnic_map_tx_skb(struct pci_dev *pdev,
map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
DMA_TO_DEVICE);
- if (dma_mapping_error(pdev, map))
+ if (dma_mapping_error(&pdev->dev, map))
goto unwind;
nf->dma = map;
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 094ac22..f2d9bb7 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1434,7 +1434,7 @@ static int ql_map_send(struct ql_adapter *qdev,
map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size,
DMA_TO_DEVICE);
- err = dma_mapping_error(qdev->pdev, map);
+ err = dma_mapping_error(&qdev->pdev->dev, map);
if (err) {
netif_err(qdev, tx_queued, qdev->ndev,
"PCI mapping frags failed with error: %d.\n",
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 7f47efc..3964a62 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -927,7 +927,7 @@ static int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
{
st->unmap_addr = skb_frag_dma_map(&efx->pci_dev->dev, frag, 0,
frag->size, DMA_TO_DEVICE);
- if (likely(!dma_mapping_error(efx->pci_dev, st->unmap_addr))) {
+ if (likely(!dma_mapping_error(&efx->pci_dev->dev, st->unmap_addr))) {
st->unmap_single = false;
st->unmap_len = frag->size;
st->in_len = frag->size;
--
1.7.2.5
Ian.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists