diff options
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r-- | drivers/net/forcedeth.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d5d458c3421f..d3f4bcaa9692 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1386,9 +1386,13 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1386 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1386 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1387 | if (skb) { | 1387 | if (skb) { |
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, skb->data, | 1389 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1390 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1390 | skb->data, |
1391 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1391 | (skb_end_pointer(skb) - |
1392 | skb->data), | ||
1393 | PCI_DMA_FROMDEVICE); | ||
1394 | np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - | ||
1395 | skb->data); | ||
1392 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); | 1396 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); |
1393 | wmb(); | 1397 | wmb(); |
1394 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); | 1398 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); |
@@ -1416,9 +1420,13 @@ static int nv_alloc_rx_optimized(struct net_device *dev) | |||
1416 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1420 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1417 | if (skb) { | 1421 | if (skb) { |
1418 | np->put_rx_ctx->skb = skb; | 1422 | np->put_rx_ctx->skb = skb; |
1419 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, skb->data, | 1423 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1420 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1424 | skb->data, |
1421 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1425 | (skb_end_pointer(skb) - |
1426 | skb->data), | ||
1427 | PCI_DMA_FROMDEVICE); | ||
1428 | np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - | ||
1429 | skb->data); | ||
1422 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; | 1430 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; |
1423 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; | 1431 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; |
1424 | wmb(); | 1432 | wmb(); |
@@ -1602,8 +1610,9 @@ static void nv_drain_rx(struct net_device *dev) | |||
1602 | wmb(); | 1610 | wmb(); |
1603 | if (np->rx_skb[i].skb) { | 1611 | if (np->rx_skb[i].skb) { |
1604 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, | 1612 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, |
1605 | np->rx_skb[i].skb->end-np->rx_skb[i].skb->data, | 1613 | (skb_end_pointer(np->rx_skb[i].skb) - |
1606 | PCI_DMA_FROMDEVICE); | 1614 | np->rx_skb[i].skb->data), |
1615 | PCI_DMA_FROMDEVICE); | ||
1607 | dev_kfree_skb(np->rx_skb[i].skb); | 1616 | dev_kfree_skb(np->rx_skb[i].skb); |
1608 | np->rx_skb[i].skb = NULL; | 1617 | np->rx_skb[i].skb = NULL; |
1609 | } | 1618 | } |
@@ -4378,7 +4387,8 @@ static int nv_loopback_test(struct net_device *dev) | |||
4378 | for (i = 0; i < pkt_len; i++) | 4387 | for (i = 0; i < pkt_len; i++) |
4379 | pkt_data[i] = (u8)(i & 0xff); | 4388 | pkt_data[i] = (u8)(i & 0xff); |
4380 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | 4389 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, |
4381 | tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); | 4390 | (skb_end_pointer(tx_skb) - |
4391 | tx_skb->data), PCI_DMA_FROMDEVICE); | ||
4382 | 4392 | ||
4383 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 4393 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
4384 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); | 4394 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); |
@@ -4435,7 +4445,7 @@ static int nv_loopback_test(struct net_device *dev) | |||
4435 | } | 4445 | } |
4436 | 4446 | ||
4437 | pci_unmap_page(np->pci_dev, test_dma_addr, | 4447 | pci_unmap_page(np->pci_dev, test_dma_addr, |
4438 | tx_skb->end-tx_skb->data, | 4448 | (skb_end_pointer(tx_skb) - tx_skb->data), |
4439 | PCI_DMA_TODEVICE); | 4449 | PCI_DMA_TODEVICE); |
4440 | dev_kfree_skb_any(tx_skb); | 4450 | dev_kfree_skb_any(tx_skb); |
4441 | out: | 4451 | out: |