From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbcF3BvO (ORCPT ); Wed, 29 Jun 2016 21:51:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55039 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751650AbcF3BvL (ORCPT ); Wed, 29 Jun 2016 21:51:11 -0400 Subject: Re: [PATCH net-next V2] tun: introduce tx skb ring To: "Michael S. Tsirkin" References: <1465979897-4445-1-git-send-email-jasowang@redhat.com> <20160617033218-mutt-send-email-mst@redhat.com> <20160622211620-mutt-send-email-mst@redhat.com> <576B701F.2020105@redhat.com> <20160628100907-mutt-send-email-mst@redhat.com> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, davem@davemloft.net, eric.dumazet@gmail.com, brouer@redhat.com From: Jason Wang Message-ID: <57747AEC.8050307@redhat.com> Date: Thu, 30 Jun 2016 09:50:36 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160628100907-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Jun 2016 01:50:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年06月28日 15:09, Michael S. Tsirkin wrote: > On Thu, Jun 23, 2016 at 01:14:07PM +0800, Jason Wang wrote: >> >> On 2016年06月23日 02:18, Michael S. Tsirkin wrote: >>> On Fri, Jun 17, 2016 at 03:41:20AM +0300, Michael S. Tsirkin wrote: >>>>> Would it help to have ptr_ring_resize that gets an array of >>>>> rings and resizes them both to same length? >>> OK, here it is. Untested so far, and no skb wrapper. >>> Pls let me know whether this is what you had in mind. >> Exactly what I want. >> >> Thanks > Ok and this for skb_array > > --> > skb_array: add wrappers for resizing > > Signed-off-by: Michael S. Tsirkin > > -- > > diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h > index c900708..7e01c1f 100644 > --- a/include/linux/skb_array.h > +++ b/include/linux/skb_array.h > @@ -151,16 +151,24 @@ static inline int skb_array_init(struct skb_array *a, int size, gfp_t gfp) > return ptr_ring_init(&a->ring, size, 0, gfp); > } > > -void __skb_array_destroy_skb(void *ptr) > +static void __skb_array_destroy_skb(void *ptr) > { > kfree_skb(ptr); > } > > -int skb_array_resize(struct skb_array *a, int size, gfp_t gfp) > +static inline int skb_array_resize(struct skb_array *a, int size, gfp_t gfp) > { > return ptr_ring_resize(&a->ring, size, gfp, __skb_array_destroy_skb); > } Will split up the above tweak into another patch when reposting. > > +static inline int skb_raay_resize_multiple(struct skb_array **rings, int nrings, I think you mean 'skb_array_resize' here. > + int size, gfp_t gfp) > +{ > + BUILD_BUG_ON(offsetof(struct skb_array, ring)); > + ptr_ring_resize_multiple((struct ptr_ring **)rings, nrings, size, gfp, > + __skb_array_destroy_skb); This should be return ptr_ring_resize_multiple(... > +} > + > static inline void skb_array_cleanup(struct skb_array *a) > { > ptr_ring_cleanup(&a->ring, __skb_array_destroy_skb); With this, looks like there's no need for a new flag. Will repost the series with those two patches. Thanks