From 5cfa3e3c3f1da6a28ad693b8d1e3ae05786963bc Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 17 Oct 2022 20:01:59 +0100 Subject: [PATCH] net: Fix build for Linux v6.1 Upstream Linux kernel commit b48b89f9c189 ("net: drop the weight argument from netif_napi_add") removes the weight argument from the netif_napi_add() function and this is breaking the build of a few drivers that use this function. Fix this by updating these drivers to use the netif_napi_add_weight() function instead for Linux v6.1. Bug 3831575 Change-Id: I5ab3c2380db75313f9226c68777e6245e9e9dad5 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2793511 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/net/can/mttcan/native/m_ttcan_linux.c | 4 ++++ drivers/net/ethernet/nvidia/pcie/tegra_vnet.c | 5 +++++ drivers/net/tegra_hv_net.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/drivers/net/can/mttcan/native/m_ttcan_linux.c b/drivers/net/can/mttcan/native/m_ttcan_linux.c index 47f2e4a4..dbb5b806 100644 --- a/drivers/net/can/mttcan/native/m_ttcan_linux.c +++ b/drivers/net/can/mttcan/native/m_ttcan_linux.c @@ -1186,7 +1186,11 @@ static struct net_device *alloc_mttcan_dev(void) CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO | CAN_CTRLMODE_BERR_REPORTING | CAN_CTRLMODE_ONE_SHOT; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) + netif_napi_add_weight(dev, &priv->napi, mttcan_poll_ir, MTT_CAN_NAPI_WEIGHT); +#else netif_napi_add(dev, &priv->napi, mttcan_poll_ir, MTT_CAN_NAPI_WEIGHT); +#endif return dev; } diff --git a/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c b/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c index fb9cf68d..4ffd561b 100644 --- a/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c +++ b/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c @@ -9,6 +9,7 @@ #include #include #include +#include struct tvnet_priv { struct net_device *ndev; @@ -792,7 +793,11 @@ static int tvnet_host_probe(struct pci_dev *pdev, /* Setup BAR0 meta data */ tvnet_host_setup_bar0_md(tvnet); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) + netif_napi_add_weight(ndev, &tvnet->napi, tvnet_host_poll, TVNET_NAPI_WEIGHT); +#else netif_napi_add(ndev, &tvnet->napi, tvnet_host_poll, TVNET_NAPI_WEIGHT); +#endif ndev->mtu = TVNET_DEFAULT_MTU; diff --git a/drivers/net/tegra_hv_net.c b/drivers/net/tegra_hv_net.c index c7ccb074..d2a933cb 100644 --- a/drivers/net/tegra_hv_net.c +++ b/drivers/net/tegra_hv_net.c @@ -742,7 +742,11 @@ static int tegra_hv_net_probe(struct platform_device *pdev) goto out_unreserve; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) + netif_napi_add_weight(ndev, &hvn->napi, tegra_hv_net_poll, 64); +#else netif_napi_add(ndev, &hvn->napi, tegra_hv_net_poll, 64); +#endif ret = register_netdev(ndev); if (ret) { dev_err(dev, "Failed to register netdev\n");