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 <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096002
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
This commit is contained in:
Jason Mei
2024-03-14 10:00:48 +08:00
committed by mobile promotions
parent d01b6a3a2b
commit 888f248ee2

View File

@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <nvidia/conftest.h>
#include <linux/etherdevice.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -1883,8 +1885,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);