diff mbox

[net-next,V2] tun: introduce tx skb ring

Message ID 20160628100907-mutt-send-email-mst@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin June 28, 2016, 7:09 a.m. UTC
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 <mst@redhat.com>

--

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jason Wang June 30, 2016, 1:50 a.m. UTC | #1
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 <mst@redhat.com>
>
> --
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);
 }
 
+static inline int skb_raay_resize_multiple(struct skb_array **rings, int nrings,
+					   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);
+}
+
 static inline void skb_array_cleanup(struct skb_array *a)
 {
 	ptr_ring_cleanup(&a->ring, __skb_array_destroy_skb);