[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57397C14.1080701@redhat.com>
Date:	Mon, 16 May 2016 15:51:48 +0800
From:	Jason Wang <jasowang@...hat.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	davem@...emloft.net, mst@...hat.com, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] tuntap: introduce tx skb ring
On 2016年05月16日 11:56, Eric Dumazet wrote:
> On Mon, 2016-05-16 at 09:17 +0800, Jason Wang wrote:
>> We used to queue tx packets in sk_receive_queue, this is less
>> efficient since it requires spinlocks to synchronize between producer
>> and consumer.
> ...
>
>>   	struct tun_struct *detached;
>> +	/* reader lock */
>> +	spinlock_t rlock;
>> +	unsigned long tail;
>> +	struct tun_desc tx_descs[TUN_RING_SIZE];
>> +	/* writer lock */
>> +	spinlock_t wlock;
>> +	unsigned long head;
>>   };
>>   
> Ok, we had these kind of ideas floating around for many other cases,
> like qdisc, UDP or af_packet sockets...
>
> I believe we should have a common set of helpers, not hidden in
> drivers/net/tun.c but in net/core/skb_ring.c or something, with more
> flexibility (like the number of slots)
>
Yes, this sounds good.
> BTW, why are you using spin_lock_irqsave() in tun_net_xmit() and
> tun_peek() ?
>
> BH should be disabled already (in tun_next_xmit()), and we can not
> transmit from hard irq.
>
> Thanks.
Right, no need. But for tun_peek() we need spin_lock_bh() since it was 
called by vhost-net.
Thanks
Powered by blists - more mailing lists
 
