[openwrt/openwrt] bmips: enet: restore netif_napi_add weight

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 1 10:22:09 PDT 2024


noltari pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/2bf2ee7be899565b9c3ab75aa8c068e7d339f103

commit 2bf2ee7be899565b9c3ab75aa8c068e7d339f103
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Mon Jul 1 19:01:47 2024 +0200

    bmips: enet: restore netif_napi_add weight
    
    Switch to netif_napi_add_weight and add back weight value from <= v5.15.
    
    Fixes: 8f6033e287ea ("bmips: enet: add compatibility with kernel 6.1")
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 .../linux/bmips/files/drivers/net/ethernet/broadcom/bcm6348-enet.c | 7 +------
 .../bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c     | 7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6348-enet.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6348-enet.c
index 21eb6ea0c2..5e5259a492 100644
--- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6348-enet.c
+++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6348-enet.c
@@ -25,7 +25,6 @@
 #include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
-#include <linux/version.h>
 
 /* DMA channels */
 #define DMA_CHAN_WIDTH			0x10
@@ -1647,11 +1646,7 @@ static int bcm6348_emac_probe(struct platform_device *pdev)
 	ndev->min_mtu = ETH_ZLEN - ETH_HLEN;
 	ndev->mtu = ETH_DATA_LEN - VLAN_ETH_HLEN;
 	ndev->max_mtu = ENET_MAX_MTU - VLAN_ETH_HLEN;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)
-	netif_napi_add(ndev, &emac->napi, bcm6348_emac_poll);
-#else
-	netif_napi_add(ndev, &emac->napi, bcm6348_emac_poll, 16);
-#endif
+	netif_napi_add_weight(ndev, &emac->napi, bcm6348_emac_poll, 16);
 	SET_NETDEV_DEV(ndev, dev);
 
 	ret = devm_register_netdev(dev, ndev);
diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
index b72a788378..7031a74490 100644
--- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
+++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
@@ -20,7 +20,6 @@
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
-#include <linux/version.h>
 
 /* TODO: Bigger frames may work but we do not trust that they are safe on all
  * platforms so more research is needed, a max frame size of 2048 has been
@@ -1077,11 +1076,7 @@ static int bcm6368_enetsw_probe(struct platform_device *pdev)
 	ndev->min_mtu = ETH_ZLEN;
 	ndev->mtu = ETH_DATA_LEN;
 	ndev->max_mtu = ENETSW_MAX_MTU;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)
-	netif_napi_add(ndev, &priv->napi, bcm6368_enetsw_poll);
-#else
-	netif_napi_add(ndev, &priv->napi, bcm6368_enetsw_poll, 16);
-#endif
+	netif_napi_add_weight(ndev, &priv->napi, bcm6368_enetsw_poll, 16);
 
 	ret = devm_register_netdev(dev, ndev);
 	if (ret) {




More information about the lede-commits mailing list