diff options
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 46819af3b062..0a18b9e96da1 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <asm/system.h> | 55 | #include <asm/system.h> |
56 | 56 | ||
57 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; | 57 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; |
58 | static char mv643xx_eth_driver_version[] = "1.2"; | 58 | static char mv643xx_eth_driver_version[] = "1.3"; |
59 | 59 | ||
60 | #define MV643XX_ETH_CHECKSUM_OFFLOAD_TX | 60 | #define MV643XX_ETH_CHECKSUM_OFFLOAD_TX |
61 | #define MV643XX_ETH_NAPI | 61 | #define MV643XX_ETH_NAPI |
@@ -474,11 +474,19 @@ static void rxq_refill(struct rx_queue *rxq) | |||
474 | /* | 474 | /* |
475 | * Reserve 2+14 bytes for an ethernet header (the | 475 | * Reserve 2+14 bytes for an ethernet header (the |
476 | * hardware automatically prepends 2 bytes of dummy | 476 | * hardware automatically prepends 2 bytes of dummy |
477 | * data to each received packet), 4 bytes for a VLAN | 477 | * data to each received packet), 16 bytes for up to |
478 | * header, and 4 bytes for the trailing FCS -- 24 | 478 | * four VLAN tags, and 4 bytes for the trailing FCS |
479 | * bytes total. | 479 | * -- 36 bytes total. |
480 | */ | 480 | */ |
481 | skb_size = mp->dev->mtu + 24; | 481 | skb_size = mp->dev->mtu + 36; |
482 | |||
483 | /* | ||
484 | * Make sure that the skb size is a multiple of 8 | ||
485 | * bytes, as the lower three bits of the receive | ||
486 | * descriptor's buffer size field are ignored by | ||
487 | * the hardware. | ||
488 | */ | ||
489 | skb_size = (skb_size + 7) & ~7; | ||
482 | 490 | ||
483 | skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1); | 491 | skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1); |
484 | if (skb == NULL) | 492 | if (skb == NULL) |
@@ -509,10 +517,8 @@ static void rxq_refill(struct rx_queue *rxq) | |||
509 | skb_reserve(skb, 2); | 517 | skb_reserve(skb, 2); |
510 | } | 518 | } |
511 | 519 | ||
512 | if (rxq->rx_desc_count != rxq->rx_ring_size) { | 520 | if (rxq->rx_desc_count != rxq->rx_ring_size) |
513 | rxq->rx_oom.expires = jiffies + (HZ / 10); | 521 | mod_timer(&rxq->rx_oom, jiffies + (HZ / 10)); |
514 | add_timer(&rxq->rx_oom); | ||
515 | } | ||
516 | 522 | ||
517 | spin_unlock_irqrestore(&mp->lock, flags); | 523 | spin_unlock_irqrestore(&mp->lock, flags); |
518 | } | 524 | } |
@@ -529,7 +535,7 @@ static int rxq_process(struct rx_queue *rxq, int budget) | |||
529 | int rx; | 535 | int rx; |
530 | 536 | ||
531 | rx = 0; | 537 | rx = 0; |
532 | while (rx < budget) { | 538 | while (rx < budget && rxq->rx_desc_count) { |
533 | struct rx_desc *rx_desc; | 539 | struct rx_desc *rx_desc; |
534 | unsigned int cmd_sts; | 540 | unsigned int cmd_sts; |
535 | struct sk_buff *skb; | 541 | struct sk_buff *skb; |
@@ -554,7 +560,7 @@ static int rxq_process(struct rx_queue *rxq, int budget) | |||
554 | spin_unlock_irqrestore(&mp->lock, flags); | 560 | spin_unlock_irqrestore(&mp->lock, flags); |
555 | 561 | ||
556 | dma_unmap_single(NULL, rx_desc->buf_ptr + 2, | 562 | dma_unmap_single(NULL, rx_desc->buf_ptr + 2, |
557 | mp->dev->mtu + 24, DMA_FROM_DEVICE); | 563 | rx_desc->buf_size, DMA_FROM_DEVICE); |
558 | rxq->rx_desc_count--; | 564 | rxq->rx_desc_count--; |
559 | rx++; | 565 | rx++; |
560 | 566 | ||
@@ -636,9 +642,9 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget) | |||
636 | txq_reclaim(mp->txq + i, 0); | 642 | txq_reclaim(mp->txq + i, 0); |
637 | 643 | ||
638 | if (netif_carrier_ok(mp->dev)) { | 644 | if (netif_carrier_ok(mp->dev)) { |
639 | spin_lock(&mp->lock); | 645 | spin_lock_irq(&mp->lock); |
640 | __txq_maybe_wake(mp->txq + mp->txq_primary); | 646 | __txq_maybe_wake(mp->txq + mp->txq_primary); |
641 | spin_unlock(&mp->lock); | 647 | spin_unlock_irq(&mp->lock); |
642 | } | 648 | } |
643 | } | 649 | } |
644 | #endif | 650 | #endif |
@@ -650,8 +656,6 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget) | |||
650 | 656 | ||
651 | if (rx < budget) { | 657 | if (rx < budget) { |
652 | netif_rx_complete(mp->dev, napi); | 658 | netif_rx_complete(mp->dev, napi); |
653 | wrl(mp, INT_CAUSE(mp->port_num), 0); | ||
654 | wrl(mp, INT_CAUSE_EXT(mp->port_num), 0); | ||
655 | wrl(mp, INT_MASK(mp->port_num), INT_TX_END | INT_RX | INT_EXT); | 659 | wrl(mp, INT_MASK(mp->port_num), INT_TX_END | INT_RX | INT_EXT); |
656 | } | 660 | } |
657 | 661 | ||
@@ -1796,6 +1800,7 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id) | |||
1796 | */ | 1800 | */ |
1797 | #ifdef MV643XX_ETH_NAPI | 1801 | #ifdef MV643XX_ETH_NAPI |
1798 | if (int_cause & INT_RX) { | 1802 | if (int_cause & INT_RX) { |
1803 | wrl(mp, INT_CAUSE(mp->port_num), ~(int_cause & INT_RX)); | ||
1799 | wrl(mp, INT_MASK(mp->port_num), 0x00000000); | 1804 | wrl(mp, INT_MASK(mp->port_num), 0x00000000); |
1800 | rdl(mp, INT_MASK(mp->port_num)); | 1805 | rdl(mp, INT_MASK(mp->port_num)); |
1801 | 1806 | ||