Commit 8b5be268 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[FORCEDETH]: Use skb_tailroom where appropriate

Reducing the number of skb->data direct accesses.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d004b8d4
...@@ -1388,11 +1388,9 @@ static int nv_alloc_rx(struct net_device *dev) ...@@ -1388,11 +1388,9 @@ static int nv_alloc_rx(struct net_device *dev)
np->put_rx_ctx->skb = skb; np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = pci_map_single(np->pci_dev, np->put_rx_ctx->dma = pci_map_single(np->pci_dev,
skb->data, skb->data,
(skb_end_pointer(skb) - skb_tailroom(skb),
skb->data),
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - np->put_rx_ctx->dma_len = skb_tailroom(skb);
skb->data);
np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma);
wmb(); wmb();
np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL);
...@@ -1422,11 +1420,9 @@ static int nv_alloc_rx_optimized(struct net_device *dev) ...@@ -1422,11 +1420,9 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
np->put_rx_ctx->skb = skb; np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = pci_map_single(np->pci_dev, np->put_rx_ctx->dma = pci_map_single(np->pci_dev,
skb->data, skb->data,
(skb_end_pointer(skb) - skb_tailroom(skb),
skb->data),
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - np->put_rx_ctx->dma_len = skb_tailroom(skb);
skb->data);
np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32;
np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF;
wmb(); wmb();
...@@ -4383,12 +4379,12 @@ static int nv_loopback_test(struct net_device *dev) ...@@ -4383,12 +4379,12 @@ static int nv_loopback_test(struct net_device *dev)
ret = 0; ret = 0;
goto out; goto out;
} }
test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data,
skb_tailroom(tx_skb),
PCI_DMA_FROMDEVICE);
pkt_data = skb_put(tx_skb, pkt_len); pkt_data = skb_put(tx_skb, pkt_len);
for (i = 0; i < pkt_len; i++) for (i = 0; i < pkt_len; i++)
pkt_data[i] = (u8)(i & 0xff); pkt_data[i] = (u8)(i & 0xff);
test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data,
(skb_end_pointer(tx_skb) -
tx_skb->data), PCI_DMA_FROMDEVICE);
if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment