[dpdk-dev] [PATCH v2] kni: use netif_rx instead of netif_receive_skb in which ocurr deallock on userpace contex

Alex Markuze alex at weka.io
Thu Jul 17 14:24:52 CEST 2014


On Thu, Jul 17, 2014 at 3:02 PM, Thomas Monjalon
<thomas.monjalon at 6wind.com> wrote:
> Hi,
>
> 2014-07-11 23:37, Yao-Po Wang:
>> Per netif_receive_skb function description, it may only be called from
>> interrupt contex, but KNI is run on kthread that like as user-space
>> contex. It may occur deallock, if netif_receive_skb called from kthread,
>> so it should be repleaced by netif_rx or adding local_bh_disable/enable
>> around netif_receive_skb.
>>
>> Signed-off-by: Yao-Po Wang <blue119 at gmail.com>
>
>> --- a/lib/librte_eal/linuxapp/kni/kni_net.c
>> +++ b/lib/librte_eal/linuxapp/kni/kni_net.c
>>                       /* Call netif interface */
>> -                     netif_receive_skb(skb);
>> +                     netif_rx(skb);
>
> Is there someone confident to approve this change?

Yao-Po is correct.

Please see this comment In Linux source code .
http://lxr.free-electrons.com/source/net/core/dev.c#L3715

Context:
All todays network drivers use(ixgbe is no exception) NAPI which is a
soft irq context of the receive flow .
This is the context in which netif_receive_skb should be called in.
KNI is not soft IRQ context so the generic netif_rx is the
right function.

>
> --
> Thomas


More information about the dev mailing list