diff options
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r-- | drivers/net/forcedeth.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d04214e4e581..7a018027fcc0 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1385,11 +1385,12 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1385 | while (np->put_rx.orig != less_rx) { | 1385 | while (np->put_rx.orig != less_rx) { |
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 | skb->dev = dev; | ||
1389 | np->put_rx_ctx->skb = skb; | 1388 | np->put_rx_ctx->skb = skb; |
1390 | 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, |
1391 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1390 | skb->data, |
1392 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1391 | skb_tailroom(skb), |
1392 | PCI_DMA_FROMDEVICE); | ||
1393 | np->put_rx_ctx->dma_len = skb_tailroom(skb); | ||
1393 | 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); |
1394 | wmb(); | 1395 | wmb(); |
1395 | 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); |
@@ -1416,11 +1417,12 @@ static int nv_alloc_rx_optimized(struct net_device *dev) | |||
1416 | while (np->put_rx.ex != less_rx) { | 1417 | while (np->put_rx.ex != less_rx) { |
1417 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1418 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1418 | if (skb) { | 1419 | if (skb) { |
1419 | skb->dev = dev; | ||
1420 | np->put_rx_ctx->skb = skb; | 1420 | np->put_rx_ctx->skb = skb; |
1421 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, skb->data, | 1421 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1422 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1422 | skb->data, |
1423 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1423 | skb_tailroom(skb), |
1424 | PCI_DMA_FROMDEVICE); | ||
1425 | np->put_rx_ctx->dma_len = skb_tailroom(skb); | ||
1424 | 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; |
1425 | 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; |
1426 | wmb(); | 1428 | wmb(); |
@@ -1604,8 +1606,9 @@ static void nv_drain_rx(struct net_device *dev) | |||
1604 | wmb(); | 1606 | wmb(); |
1605 | if (np->rx_skb[i].skb) { | 1607 | if (np->rx_skb[i].skb) { |
1606 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, | 1608 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, |
1607 | np->rx_skb[i].skb->end-np->rx_skb[i].skb->data, | 1609 | (skb_end_pointer(np->rx_skb[i].skb) - |
1608 | PCI_DMA_FROMDEVICE); | 1610 | np->rx_skb[i].skb->data), |
1611 | PCI_DMA_FROMDEVICE); | ||
1609 | dev_kfree_skb(np->rx_skb[i].skb); | 1612 | dev_kfree_skb(np->rx_skb[i].skb); |
1610 | np->rx_skb[i].skb = NULL; | 1613 | np->rx_skb[i].skb = NULL; |
1611 | } | 1614 | } |
@@ -4376,11 +4379,12 @@ static int nv_loopback_test(struct net_device *dev) | |||
4376 | ret = 0; | 4379 | ret = 0; |
4377 | goto out; | 4380 | goto out; |
4378 | } | 4381 | } |
4382 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | ||
4383 | skb_tailroom(tx_skb), | ||
4384 | PCI_DMA_FROMDEVICE); | ||
4379 | pkt_data = skb_put(tx_skb, pkt_len); | 4385 | pkt_data = skb_put(tx_skb, pkt_len); |
4380 | for (i = 0; i < pkt_len; i++) | 4386 | for (i = 0; i < pkt_len; i++) |
4381 | pkt_data[i] = (u8)(i & 0xff); | 4387 | pkt_data[i] = (u8)(i & 0xff); |
4382 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | ||
4383 | tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); | ||
4384 | 4388 | ||
4385 | 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) { |
4386 | 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); |
@@ -4437,7 +4441,7 @@ static int nv_loopback_test(struct net_device *dev) | |||
4437 | } | 4441 | } |
4438 | 4442 | ||
4439 | pci_unmap_page(np->pci_dev, test_dma_addr, | 4443 | pci_unmap_page(np->pci_dev, test_dma_addr, |
4440 | tx_skb->end-tx_skb->data, | 4444 | (skb_end_pointer(tx_skb) - tx_skb->data), |
4441 | PCI_DMA_TODEVICE); | 4445 | PCI_DMA_TODEVICE); |
4442 | dev_kfree_skb_any(tx_skb); | 4446 | dev_kfree_skb_any(tx_skb); |
4443 | out: | 4447 | out: |