From patchwork Tue Jun 28 07:09:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 9202121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 165956074E for ; Tue, 28 Jun 2016 07:10:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04CEF285F2 for ; Tue, 28 Jun 2016 07:10:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC949285F3; Tue, 28 Jun 2016 07:10:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8969E285F4 for ; Tue, 28 Jun 2016 07:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbcF1HJs (ORCPT ); Tue, 28 Jun 2016 03:09:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbcF1HJr (ORCPT ); Tue, 28 Jun 2016 03:09:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1393A70C; Tue, 28 Jun 2016 07:09:46 +0000 (UTC) Received: from redhat.com (vpn1-5-219.ams2.redhat.com [10.36.5.219]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5S79g6O001322; Tue, 28 Jun 2016 03:09:43 -0400 Date: Tue, 28 Jun 2016 10:09:42 +0300 From: "Michael S. Tsirkin" To: Jason Wang 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 Subject: Re: [PATCH net-next V2] tun: introduce tx skb ring Message-ID: <20160628100907-mutt-send-email-mst@redhat.com> 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <576B701F.2020105@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Jun 2016 07:09:46 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- -- 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 --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);