On 4/15/2022 5:07 AM, Gagandeep Singh wrote:
Hi

-----Original Message-----
From: Harold Huang <baymaxhu...@gmail.com>
Sent: Friday, April 15, 2022 8:54 AM
To: Gagandeep Singh <g.si...@nxp.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH] kni: update kernel API to receive packets

On Thu, Apr 14, 2022 at 8:23 PM Gagandeep Singh <g.si...@nxp.com> wrote:

API 'netif_rx_ni()' has been removed in kernel with commit:
baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any
context.")

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().

But this change would cause KNI kernel module does not work in the old kernel
without this patch. I suggested using netif_rx_ni to keep compatibility.

netif_rx() API exists from very older versions of kernel before v2.6. There 
will be
no compilation issues. Only difference was, netif_rx_ni() can be used in 
noninterrupt contexts
to improve performance.

May not be compilation issue, but with old kernels won't the behavior be different when 'netif_rx_ni()' switched to 'netif_rx()'?

Now, in latest kernel, netif_rx_ni() is removed and netif_rx can handle all the 
contexts.
So we have to replace this API otherwise compilation will break on latest 
kernel.



Signed-off-by: Gagandeep Singh <g.si...@nxp.com>
---
  kernel/linux/kni/kni_net.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index 29e5b9e21f..e66b35314a 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni)
                 skb->ip_summed = CHECKSUM_UNNECESSARY;

                 /* Call netif interface */
-               netif_rx_ni(skb);
+               netif_rx(skb);

                 /* Update statistics */
                 dev->stats.rx_bytes += len;
--
2.25.1



--
Thanks, Harold.

Reply via email to