aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index e3d8520209b8..0bf46ed4e684 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2528,7 +2528,7 @@ static int skge_up(struct net_device *dev)
2528 skge_write32(hw, B0_IMSK, hw->intr_mask); 2528 skge_write32(hw, B0_IMSK, hw->intr_mask);
2529 spin_unlock_irq(&hw->hw_lock); 2529 spin_unlock_irq(&hw->hw_lock);
2530 2530
2531 netif_poll_enable(dev); 2531 napi_enable(&skge->napi);
2532 return 0; 2532 return 0;
2533 2533
2534 free_rx_ring: 2534 free_rx_ring:
@@ -2558,7 +2558,7 @@ static int skge_down(struct net_device *dev)
2558 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) 2558 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2559 del_timer_sync(&skge->link_timer); 2559 del_timer_sync(&skge->link_timer);
2560 2560
2561 netif_poll_disable(dev); 2561 napi_disable(&skge->napi);
2562 netif_carrier_off(dev); 2562 netif_carrier_off(dev);
2563 2563
2564 spin_lock_irq(&hw->hw_lock); 2564 spin_lock_irq(&hw->hw_lock);
@@ -3044,14 +3044,13 @@ static void skge_tx_done(struct net_device *dev)
3044 } 3044 }
3045} 3045}
3046 3046
3047static int skge_poll(struct net_device *dev, int *budget) 3047static int skge_poll(struct napi_struct *napi, int to_do)
3048{ 3048{
3049 struct skge_port *skge = netdev_priv(dev); 3049 struct skge_port *skge = container_of(napi, struct skge_port, napi);
3050 struct net_device *dev = skge->netdev;
3050 struct skge_hw *hw = skge->hw; 3051 struct skge_hw *hw = skge->hw;
3051 struct skge_ring *ring = &skge->rx_ring; 3052 struct skge_ring *ring = &skge->rx_ring;
3052 struct skge_element *e; 3053 struct skge_element *e;
3053 unsigned long flags;
3054 int to_do = min(dev->quota, *budget);
3055 int work_done = 0; 3054 int work_done = 0;
3056 3055
3057 skge_tx_done(dev); 3056 skge_tx_done(dev);
@@ -3082,20 +3081,16 @@ static int skge_poll(struct net_device *dev, int *budget)
3082 wmb(); 3081 wmb();
3083 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START); 3082 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);
3084 3083
3085 *budget -= work_done; 3084 if (work_done < to_do) {
3086 dev->quota -= work_done; 3085 spin_lock_irq(&hw->hw_lock);
3087 3086 __netif_rx_complete(dev, napi);
3088 if (work_done >= to_do) 3087 hw->intr_mask |= napimask[skge->port];
3089 return 1; /* not done */ 3088 skge_write32(hw, B0_IMSK, hw->intr_mask);
3090 3089 skge_read32(hw, B0_IMSK);
3091 spin_lock_irqsave(&hw->hw_lock, flags); 3090 spin_unlock_irq(&hw->hw_lock);
3092 __netif_rx_complete(dev); 3091 }
3093 hw->intr_mask |= napimask[skge->port];
3094 skge_write32(hw, B0_IMSK, hw->intr_mask);
3095 skge_read32(hw, B0_IMSK);
3096 spin_unlock_irqrestore(&hw->hw_lock, flags);
3097 3092
3098 return 0; 3093 return work_done;
3099} 3094}
3100 3095
3101/* Parity errors seem to happen when Genesis is connected to a switch 3096/* Parity errors seem to happen when Genesis is connected to a switch
@@ -3252,8 +3247,9 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
3252 } 3247 }
3253 3248
3254 if (status & (IS_XA1_F|IS_R1_F)) { 3249 if (status & (IS_XA1_F|IS_R1_F)) {
3250 struct skge_port *skge = netdev_priv(hw->dev[0]);
3255 hw->intr_mask &= ~(IS_XA1_F|IS_R1_F); 3251 hw->intr_mask &= ~(IS_XA1_F|IS_R1_F);
3256 netif_rx_schedule(hw->dev[0]); 3252 netif_rx_schedule(hw->dev[0], &skge->napi);
3257 } 3253 }
3258 3254
3259 if (status & IS_PA_TO_TX1) 3255 if (status & IS_PA_TO_TX1)
@@ -3271,13 +3267,14 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
3271 skge_mac_intr(hw, 0); 3267 skge_mac_intr(hw, 0);
3272 3268
3273 if (hw->dev[1]) { 3269 if (hw->dev[1]) {
3270 struct skge_port *skge = netdev_priv(hw->dev[1]);
3271
3274 if (status & (IS_XA2_F|IS_R2_F)) { 3272 if (status & (IS_XA2_F|IS_R2_F)) {
3275 hw->intr_mask &= ~(IS_XA2_F|IS_R2_F); 3273 hw->intr_mask &= ~(IS_XA2_F|IS_R2_F);
3276 netif_rx_schedule(hw->dev[1]); 3274 netif_rx_schedule(hw->dev[1], &skge->napi);
3277 } 3275 }
3278 3276
3279 if (status & IS_PA_TO_RX2) { 3277 if (status & IS_PA_TO_RX2) {
3280 struct skge_port *skge = netdev_priv(hw->dev[1]);
3281 ++skge->net_stats.rx_over_errors; 3278 ++skge->net_stats.rx_over_errors;
3282 skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2); 3279 skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2);
3283 } 3280 }
@@ -3569,8 +3566,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3569 SET_ETHTOOL_OPS(dev, &skge_ethtool_ops); 3566 SET_ETHTOOL_OPS(dev, &skge_ethtool_ops);
3570 dev->tx_timeout = skge_tx_timeout; 3567 dev->tx_timeout = skge_tx_timeout;
3571 dev->watchdog_timeo = TX_WATCHDOG; 3568 dev->watchdog_timeo = TX_WATCHDOG;
3572 dev->poll = skge_poll;
3573 dev->weight = NAPI_WEIGHT;
3574#ifdef CONFIG_NET_POLL_CONTROLLER 3569#ifdef CONFIG_NET_POLL_CONTROLLER
3575 dev->poll_controller = skge_netpoll; 3570 dev->poll_controller = skge_netpoll;
3576#endif 3571#endif
@@ -3580,6 +3575,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3580 dev->features |= NETIF_F_HIGHDMA; 3575 dev->features |= NETIF_F_HIGHDMA;
3581 3576
3582 skge = netdev_priv(dev); 3577 skge = netdev_priv(dev);
3578 netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT);
3583 skge->netdev = dev; 3579 skge->netdev = dev;
3584 skge->hw = hw; 3580 skge->hw = hw;
3585 skge->msg_enable = netif_msg_init(debug, default_msg); 3581 skge->msg_enable = netif_msg_init(debug, default_msg);