[source] Revert "ag71xx: Switch from driver to kernel macro for NAPI_WEIGHT."

LEDE Commits lede-commits at lists.infradead.org
Fri Dec 8 10:55:34 PST 2017


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/524d103e7efb5fb505c4f9549fb9b90755a36100

commit 524d103e7efb5fb505c4f9549fb9b90755a36100
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Mon Dec 4 11:40:21 2017 -0800

    Revert "ag71xx: Switch from driver to kernel macro for NAPI_WEIGHT."
    
    The motivation for this was misguided. It turns out tuning the NAPI weight could be useful for testing purposes. Therefore reverting.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 .../linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h | 5 +++--
 .../files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c      | 6 +++---
 .../ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c  | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
index 7b1cc1e..898bde1 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
@@ -40,6 +40,7 @@
 #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)
@@ -135,8 +136,8 @@ struct ag71xx_napi_stats {
 	unsigned long		tx_packets;
 	unsigned long		tx_packets_max;
 
-	unsigned long		rx[NAPI_POLL_WEIGHT + 1];
-	unsigned long		tx[NAPI_POLL_WEIGHT + 1];
+	unsigned long		rx[AG71XX_NAPI_WEIGHT + 1];
+	unsigned long		tx[AG71XX_NAPI_WEIGHT + 1];
 };
 
 struct ag71xx_debug {
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
index 89cea0c..c86803c 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
@@ -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 <= NAPI_POLL_WEIGHT)
+		if (rx <= AG71XX_NAPI_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 <= NAPI_POLL_WEIGHT)
+		if (tx <= AG71XX_NAPI_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 <= NAPI_POLL_WEIGHT; i++)
+	for (i = 1; i <= AG71XX_NAPI_WEIGHT; i++)
 		len += snprintf(buf + len, buflen - len,
 				"%3d: %10lu %10lu\n",
 				i, stats->rx[i], stats->tx[i]);
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index e9a3d59..566e951 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -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, NAPI_POLL_WEIGHT);
+	netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
 
 	ag71xx_dump_regs(ag);
 



More information about the lede-commits mailing list