Skip to contentSkip to conversation

wifi: remove copies of the NAPI_POLL_WEIGHT define

PATCH In review Jakub Kicinski 2 participants 8 messages Apr 29, 2022 – May 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover wifi: remove copies of the NAPI_POLL_WEIGHT define

This is prep for a small refactoring of the netif_napi_add() API.

Jakub Kicinski (3):
wifi: rtw88: remove a copy of the NAPI_POLL_WEIGHT define
wifi: ath10k: remove a copy of the NAPI_POLL_WEIGHT define
wifi: wil6210: use NAPI_POLL_WEIGHT for napi budget

 drivers/net/wireless/ath/ath10k/core.h     | 3 ---
 drivers/net/wireless/ath/ath10k/pci.c      | 2 +-
 drivers/net/wireless/ath/ath10k/sdio.c     | 2 +-
 drivers/net/wireless/ath/ath10k/snoc.c     | 2 +-
 drivers/net/wireless/ath/wil6210/netdev.c  | 8 ++++----
 drivers/net/wireless/ath/wil6210/wil6210.h | 1 -
 drivers/net/wireless/realtek/rtw88/main.h  | 1 -
 drivers/net/wireless/realtek/rtw88/pci.c   | 2 +-
 8 files changed, 8 insertions(+), 13 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 wifi: rtw88: remove a copy of the NAPI_POLL_WEIGHT define

Defining local versions of NAPI_POLL_WEIGHT with the same values in the drivers just makes refactoring harder.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 drivers/net/wireless/realtek/rtw88/main.h | 1 -
 drivers/net/wireless/realtek/rtw88/pci.c  | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.h +0 -1
index 17815af9dd4e..2019c908fd5f 100644
@@ -17,7 +17,6 @@
 
 #include "util.h"
 
-#define RTW_NAPI_WEIGHT_NUM		64
 #define RTW_MAX_MAC_ID_NUM		32
 #define RTW_MAX_SEC_CAM_NUM		32
 #define MAX_PG_CAM_BACKUP_NUM		8
drivers/net/wireless/realtek/rtw88/pci.c +1 -1
index a0991d3f15c0..cf7177b00092 100644
@@ -1703,7 +1703,7 @@ static void rtw_pci_napi_init(struct rtw_dev *rtwdev)
 
 	init_dummy_netdev(&rtwpci->netdev);
 	netif_napi_add(&rtwpci->netdev, &rtwpci->napi, rtw_pci_napi_poll,
-		       RTW_NAPI_WEIGHT_NUM);
+		       NAPI_POLL_WEIGHT);
 }
 
 static void rtw_pci_napi_deinit(struct rtw_dev *rtwdev)
Signature · 1 line
2.34.1
#2 lore raw

Re: [wireless-next,1/3] rtw88: remove a copy of the NAPI_POLL_WEIGHT define

Quoted 4 lines · Jakub Kicinski

Defining local versions of NAPI_POLL_WEIGHT with the same values in the drivers just makes refactoring harder.

Patch applied to wireless-next.git, thanks.

0d3b26c4b97a rtw88: remove a copy of the NAPI_POLL_WEIGHT define

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

PATCH 2/3 wifi: ath10k: remove a copy of the NAPI_POLL_WEIGHT define

In reply to Jakub Kicinski

Defining local versions of NAPI_POLL_WEIGHT with the same values in the drivers just makes refactoring harder.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 drivers/net/wireless/ath/ath10k/core.h | 3 ---
 drivers/net/wireless/ath/ath10k/pci.c  | 2 +-
 drivers/net/wireless/ath/ath10k/sdio.c | 2 +-
 drivers/net/wireless/ath/ath10k/snoc.c | 2 +-
 4 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +0 -3
index 9f6680b3be0a..8bfabbcfdb14 100644
@@ -59,9 +59,6 @@
 #define ATH10K_KEEPALIVE_MAX_IDLE 3895
 #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
 
-/* NAPI poll budget */
-#define ATH10K_NAPI_BUDGET      64
-
 /* SMBIOS type containing Board Data File Name Extension */
 #define ATH10K_SMBIOS_BDF_EXT_TYPE 0xF8
 
drivers/net/wireless/ath/ath10k/pci.c +1 -1
index 4d4e2f91e15c..bf1c938be7d0 100644
@@ -3216,7 +3216,7 @@ static void ath10k_pci_free_irq(struct ath10k *ar)
 void ath10k_pci_init_napi(struct ath10k *ar)
 {
 	netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
-		       ATH10K_NAPI_BUDGET);
+		       NAPI_POLL_WEIGHT);
 }
 
 static int ath10k_pci_init_irq(struct ath10k *ar)
drivers/net/wireless/ath/ath10k/sdio.c +1 -1
index 73693c66cef1..24283c02a5ef 100644
@@ -2532,7 +2532,7 @@ static int ath10k_sdio_probe(struct sdio_func *func,
 	}
 
 	netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_sdio_napi_poll,
-		       ATH10K_NAPI_BUDGET);
+		       NAPI_POLL_WEIGHT);
 
 	ath10k_dbg(ar, ATH10K_DBG_BOOT,
 		   "sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n",
drivers/net/wireless/ath/ath10k/snoc.c +1 -1
index 8328966a0471..607e8164bf98 100644
@@ -1243,7 +1243,7 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget)
 static void ath10k_snoc_init_napi(struct ath10k *ar)
 {
 	netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll,
-		       ATH10K_NAPI_BUDGET);
+		       NAPI_POLL_WEIGHT);
 }
 
 static int ath10k_snoc_request_irq(struct ath10k *ar)
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH wireless-next 2/3] wifi: ath10k: remove a copy of the NAPI_POLL_WEIGHT define

Quoted 8 lines · Jakub Kicinski

Defining local versions of NAPI_POLL_WEIGHT with the same values in the drivers just makes refactoring harder.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

Quoted 6 lines
---
 drivers/net/wireless/ath/ath10k/core.h | 3 ---
 drivers/net/wireless/ath/ath10k/pci.c  | 2 +-
 drivers/net/wireless/ath/ath10k/sdio.c | 2 +-
 drivers/net/wireless/ath/ath10k/snoc.c | 2 +-
 4 files changed, 3 insertions(+), 6 deletions(-)

This failed to build as recently usb.c got napi poll as well, I fixed it in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=89fc2e14d3e50cad605104572228d3740df7ca77

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#6 lore raw

Re: [PATCH wireless-next 2/3] wifi: ath10k: remove a copy of the NAPI_POLL_WEIGHT define

In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski

Defining local versions of NAPI_POLL_WEIGHT with the same values in the drivers just makes refactoring harder.

2 patches applied to ath-next branch of ath.git, thanks.

52bcfd1b239b ath10k: remove a copy of the NAPI_POLL_WEIGHT define 3b3299a1080e wil6210: use NAPI_POLL_WEIGHT for napi budget

Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#7 lore raw

PATCH 3/3 wifi: wil6210: use NAPI_POLL_WEIGHT for napi budget

In reply to Jakub Kicinski

The comment next to WIL6210_NAPI_BUDGET says "arbitrary". If we're picking arbitrary values let's pick the recommended default which is NAPI_POLL_WEIGHT.

---
 drivers/net/wireless/ath/wil6210/netdev.c  | 8 ++++----
 drivers/net/wireless/ath/wil6210/wil6210.h | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/wil6210/netdev.c +4 -4
index 0913f0bf60e7..390648066382 100644
@@ -457,17 +457,17 @@ int wil_if_add(struct wil6210_priv *wil)
 	if (wil->use_enhanced_dma_hw) {
 		netif_napi_add(&wil->napi_ndev, &wil->napi_rx,
 			       wil6210_netdev_poll_rx_edma,
-			       WIL6210_NAPI_BUDGET);
+			       NAPI_POLL_WEIGHT);
 		netif_tx_napi_add(&wil->napi_ndev,
 				  &wil->napi_tx, wil6210_netdev_poll_tx_edma,
-				  WIL6210_NAPI_BUDGET);
+				  NAPI_POLL_WEIGHT);
 	} else {
 		netif_napi_add(&wil->napi_ndev, &wil->napi_rx,
 			       wil6210_netdev_poll_rx,
-			       WIL6210_NAPI_BUDGET);
+			       NAPI_POLL_WEIGHT);
 		netif_tx_napi_add(&wil->napi_ndev,
 				  &wil->napi_tx, wil6210_netdev_poll_tx,
-				  WIL6210_NAPI_BUDGET);
+				  NAPI_POLL_WEIGHT);
 	}
 
 	wil_update_net_queues_bh(wil, vif, NULL, true);
drivers/net/wireless/ath/wil6210/wil6210.h +0 -1
index 11946ecd0b99..22a6eb3e12b7 100644
@@ -82,7 +82,6 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
 #define WIL6210_MAX_TX_RINGS	(24) /* HW limit */
 #define WIL6210_MAX_CID		(20) /* max number of stations */
 #define WIL6210_RX_DESC_MAX_CID	(8)  /* HW limit */
-#define WIL6210_NAPI_BUDGET	(16) /* arbitrary */
 #define WIL_MAX_AMPDU_SIZE	(64 * 1024) /* FW/HW limit */
 #define WIL_MAX_AGG_WSIZE	(32) /* FW/HW limit */
 #define WIL_MAX_AMPDU_SIZE_128	(128 * 1024) /* FW/HW limit */
Signature · 1 line
2.34.1