Re: [PATCH] tun: use netif_receive_skb instead of netif_rx_ni

Qin Chuanyu
2014-02-12T01:50:22Z

On 2014/2/11 23:24, Eric Dumazet wrote:
>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>> index 44c4db8..90b4e58 100644
>> --- a/drivers/net/tun.c
>> +++ b/drivers/net/tun.c
>> @@ -1184,7 +1184,9 @@ static ssize_t tun_get_user(struct tun_struct
>> *tun, struct tun_file *tfile,
>> skb_probe_transport_header(skb, 0);
>>
>> rxhash = skb_get_hash(skb);
>> - netif_rx_ni(skb);
>> + rcu_read_lock_bh();
>> + netif_receive_skb(skb);
>> + rcu_read_unlock_bh();
>>
>> tun->dev->stats.rx_packets++;
>> tun->dev->stats.rx_bytes += len;
>
> I already said this patch is not good :
>
> rcu_read_lock_bh() makes no sense here.
>
> What is really needed is local_bh_disable();
>
> Herbert patch ( http://patchwork.ozlabs.org/patch/52963/ ) had a much
> cleaner form.
>
> Just use it, CC him, credit him, please ?
>
To: Herbert Xu
I saw that you had delivered a patch to resolve the problem of cgroup.
patch num is f845172531fb7410c7fb7780b1a6e51ee6df7d52

so would you deliver your patch for tun again? I had test it and found
it work well.

To: Eric
I approve your idea that rcu_read_lock make no sense. but I couldn't
understand why dev_queue_xmit use it.
What is the difference between vhost thread using tap to xmit skb and
another thread use dev_queue_xmit to xmit skb？
It is really my honor if you could explain it for me.
Thanks.