[PATCH] kni: update kernel API to receive packets

Wang, Haiyue haiyue.wang at intel.com
Wed Apr 20 09:45:05 CEST 2022


> -----Original Message-----
> From: Gagandeep Singh <g.singh at nxp.com>
> Sent: Wednesday, April 20, 2022 13:03
> To: dev at dpdk.org
> Cc: Gagandeep Singh <g.singh at nxp.com>
> Subject: [PATCH] kni: update kernel API to receive packets
> 
> API 'netif_rx_ni()' has been removed in kernel with commit:
> baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.")
> 

It should be 5.18:
	git describe --contains baebdf48c3600
	v5.18-rc1~136^2~356^2~1

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/core/dev.c?h=v5.18-rc1#n4917

vs

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/net/core/dev.c?h=v5.17.3#n4836

> The API netif_rx() can be used for any context to receive packets
> from device drivers.
> 
> This patch replaces the API netif_rx_ni() with netif_rx() for
> kernel version 5.17 and above.
> 
> Signed-off-by: Gagandeep Singh <g.singh at nxp.com>
> ---
>  kernel/linux/kni/kni_net.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
> index 29e5b9e21f..764ac0b225 100644
> --- a/kernel/linux/kni/kni_net.c
> +++ b/kernel/linux/kni/kni_net.c
> @@ -441,7 +441,11 @@ kni_net_rx_normal(struct kni_dev *kni)
>  		skb->ip_summed = CHECKSUM_UNNECESSARY;
> 
>  		/* Call netif interface */
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
> +		netif_rx(skb);
> +#else
>  		netif_rx_ni(skb);
> +#endif
> 
>  		/* Update statistics */
>  		dev->stats.rx_bytes += len;
> --
> 2.25.1



More information about the dev mailing list