From 217da833a0e8e8117cd64343da6028307c85af1f Mon Sep 17 00:00:00 2001 From: Jason Mei Date: Thu, 14 Mar 2024 10:00:48 +0800 Subject: [PATCH] net: Use conftest to determime NAPI interface Add compile time tests to the conftest.sh script to determine netif_napi interface check at compile time for the kernel being used. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into the kernel and so the kernel version checks do not work. Bug 4456727 Bug 4451567 Change-Id: I7b00c3b491d778a9bf2f0d1069a5e4546b722e2a Signed-off-by: Jason Mei Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096002 Reviewed-by: Manikanta Maddireddy Reviewed-by: Bibek Basu (cherry picked from commit 888f248ee2bb01d4cb0365061c35019730fdb6b2) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096946 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c b/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c index 4dd4aa7e..3a1fe619 100644 --- a/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c +++ b/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +#include + #include #include #include @@ -1881,8 +1883,11 @@ static int tvnet_ep_pci_epf_bind(struct pci_epf *epf) tvnet->ndev = ndev; SET_NETDEV_DEV(ndev, fdev); ndev->netdev_ops = &tvnet_netdev_ops; +#if defined(NV_NETIF_NAPI_ADD_WEIGHT_PRESENT) /* Linux v6.1 */ + netif_napi_add_weight(ndev, &tvnet->napi, tvnet_ep_poll, TVNET_NAPI_WEIGHT); +#else netif_napi_add(ndev, &tvnet->napi, tvnet_ep_poll, TVNET_NAPI_WEIGHT); - +#endif ndev->mtu = TVNET_DEFAULT_MTU; ret = register_netdev(ndev);