ag71xx: Switch from driver to kernel macro for NAPI_WEIGHT.
authorRosen Penev <rosenp@gmail.com>
Tue, 17 Oct 2017 16:25:56 +0000 (09:25 -0700)
committerJohn Crispin <john@phrozen.org>
Mon, 6 Nov 2017 15:39:41 +0000 (16:39 +0100)
NAPI_POLL_WEIGHT was introduced in the kernel for exactly this purpose 5 years ago.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c

index 898bde1d257bb70801f4f585c1aa278ebb9d0030..7b1cc1e1032f7b87430a9be1507ddb3e3faa26bc 100644 (file)
@@ -40,7 +40,6 @@
 #define AG71XX_DRV_NAME                "ag71xx"
 #define AG71XX_DRV_VERSION     "0.5.35"
 
-#define AG71XX_NAPI_WEIGHT     64
 #define AG71XX_OOM_REFILL      (1 + HZ/10)
 
 #define AG71XX_INT_ERR (AG71XX_INT_RX_BE | AG71XX_INT_TX_BE)
@@ -136,8 +135,8 @@ struct ag71xx_napi_stats {
        unsigned long           tx_packets;
        unsigned long           tx_packets_max;
 
-       unsigned long           rx[AG71XX_NAPI_WEIGHT + 1];
-       unsigned long           tx[AG71XX_NAPI_WEIGHT + 1];
+       unsigned long           rx[NAPI_POLL_WEIGHT + 1];
+       unsigned long           tx[NAPI_POLL_WEIGHT + 1];
 };
 
 struct ag71xx_debug {
index c86803c9ceda7c57f643df29acc8254768b3d264..89cea0c0f5ae97c9917cd13e1ee89bd31fe45e58 100644 (file)
@@ -78,7 +78,7 @@ void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx)
        if (rx) {
                stats->rx_count++;
                stats->rx_packets += rx;
-               if (rx <= AG71XX_NAPI_WEIGHT)
+               if (rx <= NAPI_POLL_WEIGHT)
                        stats->rx[rx]++;
                if (rx > stats->rx_packets_max)
                        stats->rx_packets_max = rx;
@@ -87,7 +87,7 @@ void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx)
        if (tx) {
                stats->tx_count++;
                stats->tx_packets += tx;
-               if (tx <= AG71XX_NAPI_WEIGHT)
+               if (tx <= NAPI_POLL_WEIGHT)
                        stats->tx[tx]++;
                if (tx > stats->tx_packets_max)
                        stats->tx_packets_max = tx;
@@ -121,7 +121,7 @@ static ssize_t read_file_napi_stats(struct file *file, char __user *user_buf,
        len += snprintf(buf + len, buflen - len, "%3s  %10s %10s\n",
                        "len", "rx", "tx");
 
-       for (i = 1; i <= AG71XX_NAPI_WEIGHT; i++)
+       for (i = 1; i <= NAPI_POLL_WEIGHT; i++)
                len += snprintf(buf + len, buflen - len,
                                "%3d: %10lu %10lu\n",
                                i, stats->rx[i], stats->tx[i]);
index 566e9513d8b7c6ef101902ae7d281dcc1c233893..e9a3d59fa3ee44becb48d9ad0ad644e4cc04dc46 100644 (file)
@@ -1360,7 +1360,7 @@ static int ag71xx_probe(struct platform_device *pdev)
 
        memcpy(dev->dev_addr, pdata->mac_addr, ETH_ALEN);
 
-       netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
+       netif_napi_add(dev, &ag->napi, ag71xx_poll, NAPI_POLL_WEIGHT);
 
        ag71xx_dump_regs(ag);