diff options
Diffstat (limited to 'drivers/net/macb.c')
-rw-r--r-- | drivers/net/macb.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index f50501013b1c..e82aee41d77e 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -316,10 +316,11 @@ static void macb_tx(struct macb *bp) | |||
316 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", | 316 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", |
317 | (unsigned long)status); | 317 | (unsigned long)status); |
318 | 318 | ||
319 | if (status & MACB_BIT(UND)) { | 319 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { |
320 | int i; | 320 | int i; |
321 | printk(KERN_ERR "%s: TX underrun, resetting buffers\n", | 321 | printk(KERN_ERR "%s: TX %s, resetting buffers\n", |
322 | bp->dev->name); | 322 | bp->dev->name, status & MACB_BIT(UND) ? |
323 | "underrun" : "retry limit exceeded"); | ||
323 | 324 | ||
324 | /* Transfer ongoing, disable transmitter, to avoid confusion */ | 325 | /* Transfer ongoing, disable transmitter, to avoid confusion */ |
325 | if (status & MACB_BIT(TGO)) | 326 | if (status & MACB_BIT(TGO)) |
@@ -520,27 +521,10 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
520 | macb_writel(bp, RSR, status); | 521 | macb_writel(bp, RSR, status); |
521 | 522 | ||
522 | work_done = 0; | 523 | work_done = 0; |
523 | if (!status) { | ||
524 | /* | ||
525 | * This may happen if an interrupt was pending before | ||
526 | * this function was called last time, and no packets | ||
527 | * have been received since. | ||
528 | */ | ||
529 | napi_complete(napi); | ||
530 | goto out; | ||
531 | } | ||
532 | 524 | ||
533 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", | 525 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", |
534 | (unsigned long)status, budget); | 526 | (unsigned long)status, budget); |
535 | 527 | ||
536 | if (!(status & MACB_BIT(REC))) { | ||
537 | dev_warn(&bp->pdev->dev, | ||
538 | "No RX buffers complete, status = %02lx\n", | ||
539 | (unsigned long)status); | ||
540 | napi_complete(napi); | ||
541 | goto out; | ||
542 | } | ||
543 | |||
544 | work_done = macb_rx(bp, budget); | 528 | work_done = macb_rx(bp, budget); |
545 | if (work_done < budget) | 529 | if (work_done < budget) |
546 | napi_complete(napi); | 530 | napi_complete(napi); |
@@ -549,7 +533,6 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
549 | * We've done what we can to clean the buffers. Make sure we | 533 | * We've done what we can to clean the buffers. Make sure we |
550 | * get notified when new packets arrive. | 534 | * get notified when new packets arrive. |
551 | */ | 535 | */ |
552 | out: | ||
553 | macb_writel(bp, IER, MACB_RX_INT_FLAGS); | 536 | macb_writel(bp, IER, MACB_RX_INT_FLAGS); |
554 | 537 | ||
555 | /* TODO: Handle errors */ | 538 | /* TODO: Handle errors */ |
@@ -590,7 +573,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
590 | } | 573 | } |
591 | } | 574 | } |
592 | 575 | ||
593 | if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND))) | 576 | if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND) | |
577 | MACB_BIT(ISR_RLE))) | ||
594 | macb_tx(bp); | 578 | macb_tx(bp); |
595 | 579 | ||
596 | /* | 580 | /* |
@@ -1100,6 +1084,18 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1100 | return phy_mii_ioctl(phydev, if_mii(rq), cmd); | 1084 | return phy_mii_ioctl(phydev, if_mii(rq), cmd); |
1101 | } | 1085 | } |
1102 | 1086 | ||
1087 | static const struct net_device_ops macb_netdev_ops = { | ||
1088 | .ndo_open = macb_open, | ||
1089 | .ndo_stop = macb_close, | ||
1090 | .ndo_start_xmit = macb_start_xmit, | ||
1091 | .ndo_set_multicast_list = macb_set_rx_mode, | ||
1092 | .ndo_get_stats = macb_get_stats, | ||
1093 | .ndo_do_ioctl = macb_ioctl, | ||
1094 | .ndo_validate_addr = eth_validate_addr, | ||
1095 | .ndo_change_mtu = eth_change_mtu, | ||
1096 | .ndo_set_mac_address = eth_mac_addr, | ||
1097 | }; | ||
1098 | |||
1103 | static int __init macb_probe(struct platform_device *pdev) | 1099 | static int __init macb_probe(struct platform_device *pdev) |
1104 | { | 1100 | { |
1105 | struct eth_platform_data *pdata; | 1101 | struct eth_platform_data *pdata; |
@@ -1175,12 +1171,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1175 | goto err_out_iounmap; | 1171 | goto err_out_iounmap; |
1176 | } | 1172 | } |
1177 | 1173 | ||
1178 | dev->open = macb_open; | 1174 | dev->netdev_ops = &macb_netdev_ops; |
1179 | dev->stop = macb_close; | ||
1180 | dev->hard_start_xmit = macb_start_xmit; | ||
1181 | dev->get_stats = macb_get_stats; | ||
1182 | dev->set_multicast_list = macb_set_rx_mode; | ||
1183 | dev->do_ioctl = macb_ioctl; | ||
1184 | netif_napi_add(dev, &bp->napi, macb_poll, 64); | 1175 | netif_napi_add(dev, &bp->napi, macb_poll, 64); |
1185 | dev->ethtool_ops = &macb_ethtool_ops; | 1176 | dev->ethtool_ops = &macb_ethtool_ops; |
1186 | 1177 | ||