nvethernet: Fix build for Linux v5.14 and v5.17+

The nvethernet driver fails to build for Linux v5.14 and Linux v5.17+
kernels. In Linux v5.15 the return type of the get/set_coalesce
callbacks were updated. In Linux v5.17 the parameters for the
get/set_ringparam callbacks were updated. In Linux v6.1 the
weight parameter for the netif_napi_add() function was removed and the
function netif_napi_add_weight() was added for passing the weight
parameter. Add the necessary kernel version checks to ensure that the
drivers build with the different versions of the Linux kernel.

Bug 3793131

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I56738eddd27eb4ebf7db5a2d0d031a64379482e8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2820712
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2022-12-02 13:18:38 +00:00
committed by mobile promotions
parent dc420b6a6d
commit 1e04890051
2 changed files with 22 additions and 2 deletions

View File

@@ -4256,8 +4256,13 @@ static int ether_alloc_napi(struct ether_priv_data *pdata)
pdata->tx_napi[chan]->pdata = pdata;
pdata->tx_napi[chan]->chan = chan;
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
netif_napi_add_weight(ndev, &pdata->tx_napi[chan]->napi,
ether_napi_poll_tx, 64);
#else
netif_napi_add(ndev, &pdata->tx_napi[chan]->napi,
ether_napi_poll_tx, 64);
#endif
pdata->rx_napi[chan] = devm_kzalloc(dev,
sizeof(struct ether_rx_napi),
@@ -4269,8 +4274,13 @@ static int ether_alloc_napi(struct ether_priv_data *pdata)
pdata->rx_napi[chan]->pdata = pdata;
pdata->rx_napi[chan]->chan = chan;
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
netif_napi_add_weight(ndev, &pdata->rx_napi[chan]->napi,
ether_napi_poll_rx, 64);
#else
netif_napi_add(ndev, &pdata->rx_napi[chan]->napi,
ether_napi_poll_rx, 64);
#endif
}
return 0;