aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ps3_gelic_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ps3_gelic_net.c')
-rw-r--r--drivers/net/ps3_gelic_net.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index e56503918436..92561c0450bc 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -556,6 +556,7 @@ static int gelic_net_stop(struct net_device *netdev)
556{ 556{
557 struct gelic_net_card *card = netdev_priv(netdev); 557 struct gelic_net_card *card = netdev_priv(netdev);
558 558
559 napi_disable(&card->napi);
559 netif_stop_queue(netdev); 560 netif_stop_queue(netdev);
560 561
561 /* turn off DMA, force end */ 562 /* turn off DMA, force end */
@@ -987,32 +988,24 @@ refill:
987 * if the quota is exceeded, but the driver has still packets. 988 * if the quota is exceeded, but the driver has still packets.
988 * 989 *
989 */ 990 */
990static int gelic_net_poll(struct net_device *netdev, int *budget) 991static int gelic_net_poll(struct napi_struct *napi, int budget)
991{ 992{
992 struct gelic_net_card *card = netdev_priv(netdev); 993 struct gelic_net_card *card = container_of(napi, struct gelic_net_card, napi);
993 int packets_to_do, packets_done = 0; 994 struct net_device *netdev = card->netdev;
994 int no_more_packets = 0; 995 int packets_done = 0;
995
996 packets_to_do = min(*budget, netdev->quota);
997 996
998 while (packets_to_do) { 997 while (packets_done < budget) {
999 if (gelic_net_decode_one_descr(card)) { 998 if (!gelic_net_decode_one_descr(card))
1000 packets_done++;
1001 packets_to_do--;
1002 } else {
1003 /* no more packets for the stack */
1004 no_more_packets = 1;
1005 break; 999 break;
1006 } 1000
1001 packets_done++;
1007 } 1002 }
1008 netdev->quota -= packets_done; 1003
1009 *budget -= packets_done; 1004 if (packets_done < budget) {
1010 if (no_more_packets) { 1005 netif_rx_complete(netdev, napi);
1011 netif_rx_complete(netdev);
1012 gelic_net_rx_irq_on(card); 1006 gelic_net_rx_irq_on(card);
1013 return 0; 1007 }
1014 } else 1008 return packets_done;
1015 return 1;
1016} 1009}
1017/** 1010/**
1018 * gelic_net_change_mtu - changes the MTU of an interface 1011 * gelic_net_change_mtu - changes the MTU of an interface
@@ -1055,7 +1048,7 @@ static irqreturn_t gelic_net_interrupt(int irq, void *ptr)
1055 1048
1056 if (status & GELIC_NET_RXINT) { 1049 if (status & GELIC_NET_RXINT) {
1057 gelic_net_rx_irq_off(card); 1050 gelic_net_rx_irq_off(card);
1058 netif_rx_schedule(netdev); 1051 netif_rx_schedule(netdev, &card->napi);
1059 } 1052 }
1060 1053
1061 if (status & GELIC_NET_TXINT) { 1054 if (status & GELIC_NET_TXINT) {
@@ -1159,6 +1152,8 @@ static int gelic_net_open(struct net_device *netdev)
1159 if (gelic_net_alloc_rx_skbs(card)) 1152 if (gelic_net_alloc_rx_skbs(card))
1160 goto alloc_skbs_failed; 1153 goto alloc_skbs_failed;
1161 1154
1155 napi_enable(&card->napi);
1156
1162 card->tx_dma_progress = 0; 1157 card->tx_dma_progress = 0;
1163 card->ghiintmask = GELIC_NET_RXINT | GELIC_NET_TXINT; 1158 card->ghiintmask = GELIC_NET_RXINT | GELIC_NET_TXINT;
1164 1159
@@ -1360,9 +1355,6 @@ static void gelic_net_setup_netdev_ops(struct net_device *netdev)
1360 /* tx watchdog */ 1355 /* tx watchdog */
1361 netdev->tx_timeout = &gelic_net_tx_timeout; 1356 netdev->tx_timeout = &gelic_net_tx_timeout;
1362 netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT; 1357 netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;
1363 /* NAPI */
1364 netdev->poll = &gelic_net_poll;
1365 netdev->weight = GELIC_NET_NAPI_WEIGHT;
1366 netdev->ethtool_ops = &gelic_net_ethtool_ops; 1358 netdev->ethtool_ops = &gelic_net_ethtool_ops;
1367} 1359}
1368 1360
@@ -1390,6 +1382,9 @@ static int gelic_net_setup_netdev(struct gelic_net_card *card)
1390 1382
1391 gelic_net_setup_netdev_ops(netdev); 1383 gelic_net_setup_netdev_ops(netdev);
1392 1384
1385 netif_napi_add(netdev, &card->napi,
1386 gelic_net_poll, GELIC_NET_NAPI_WEIGHT);
1387
1393 netdev->features = NETIF_F_IP_CSUM; 1388 netdev->features = NETIF_F_IP_CSUM;
1394 1389
1395 status = lv1_net_control(bus_id(card), dev_id(card), 1390 status = lv1_net_control(bus_id(card), dev_id(card),