diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-20 11:08:20 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:41 -0400 |
commit | 8b5be26831b973d8013e8b4c9860d9694310cdc6 (patch) | |
tree | 0cd7aba3ed382d17796500094b2a067a76d79708 | |
parent | d004b8d4903180c111e114726982c194adf2a04f (diff) |
[FORCEDETH]: Use skb_tailroom where appropriate
Reducing the number of skb->data direct accesses.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/forcedeth.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d3f4bcaa9692..7a018027fcc0 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1388,11 +1388,9 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1388 | np->put_rx_ctx->skb = skb; | 1388 | np->put_rx_ctx->skb = skb; |
1389 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, | 1389 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1390 | skb->data, | 1390 | skb->data, |
1391 | (skb_end_pointer(skb) - | 1391 | skb_tailroom(skb), |
1392 | skb->data), | ||
1393 | PCI_DMA_FROMDEVICE); | 1392 | PCI_DMA_FROMDEVICE); |
1394 | np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - | 1393 | np->put_rx_ctx->dma_len = skb_tailroom(skb); |
1395 | skb->data); | ||
1396 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); | 1394 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); |
1397 | wmb(); | 1395 | wmb(); |
1398 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); | 1396 | 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 | np->put_rx_ctx->skb = skb; | 1420 | np->put_rx_ctx->skb = skb; |
1423 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, | 1421 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1424 | skb->data, | 1422 | skb->data, |
1425 | (skb_end_pointer(skb) - | 1423 | skb_tailroom(skb), |
1426 | skb->data), | ||
1427 | PCI_DMA_FROMDEVICE); | 1424 | PCI_DMA_FROMDEVICE); |
1428 | np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - | 1425 | np->put_rx_ctx->dma_len = skb_tailroom(skb); |
1429 | skb->data); | ||
1430 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; | 1426 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; |
1431 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; | 1427 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; |
1432 | wmb(); | 1428 | wmb(); |
@@ -4383,12 +4379,12 @@ static int nv_loopback_test(struct net_device *dev) | |||
4383 | ret = 0; | 4379 | ret = 0; |
4384 | goto out; | 4380 | goto out; |
4385 | } | 4381 | } |
4382 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | ||
4383 | skb_tailroom(tx_skb), | ||
4384 | PCI_DMA_FROMDEVICE); | ||
4386 | pkt_data = skb_put(tx_skb, pkt_len); | 4385 | pkt_data = skb_put(tx_skb, pkt_len); |
4387 | for (i = 0; i < pkt_len; i++) | 4386 | for (i = 0; i < pkt_len; i++) |
4388 | pkt_data[i] = (u8)(i & 0xff); | 4387 | pkt_data[i] = (u8)(i & 0xff); |
4389 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | ||
4390 | (skb_end_pointer(tx_skb) - | ||
4391 | tx_skb->data), PCI_DMA_FROMDEVICE); | ||
4392 | 4388 | ||
4393 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 4389 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
4394 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); | 4390 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); |