From patchwork Wed Nov 10 09:23:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xin, Xiaohui" X-Patchwork-Id: 313392 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAA92Y9h017159 for ; Wed, 10 Nov 2010 09:02:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755062Ab0KJJBv (ORCPT ); Wed, 10 Nov 2010 04:01:51 -0500 Received: from mga02.intel.com ([134.134.136.20]:33973 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753494Ab0KJJBu (ORCPT ); Wed, 10 Nov 2010 04:01:50 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 10 Nov 2010 01:01:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,177,1288594800"; d="scan'208";a="572016080" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.36.134]) by orsmga002.jf.intel.com with ESMTP; 10 Nov 2010 01:01:34 -0800 From: xiaohui.xin@intel.com To: netdev@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, mingo@elte.hu, herbert@gondor.hengli.com.au, jdike@linux.intel.com, davem@davemloft.net Cc: Xin Xiaohui Subject: Re: [PATCH v15 00/17] Provide a zero-copy method on KVM virtio-net. Date: Wed, 10 Nov 2010 17:23:28 +0800 Message-Id: <1289381008-5484-1-git-send-email-xiaohui.xin@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <20101109.091516.112581012.davem@davemloft.net> References: <20101109.091516.112581012.davem@davemloft.net> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 10 Nov 2010 09:02:36 +0000 (UTC) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 10ba67d..ad4636e 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -199,14 +199,15 @@ struct skb_shared_info { struct sk_buff *frag_list; struct skb_shared_hwtstamps hwtstamps; + /* Intermediate layers must ensure that destructor_arg + * remains valid until skb destructor */ + void * destructor_arg; + /* * Warning : all fields before dataref are cleared in __alloc_skb() */ atomic_t dataref; - /* Intermediate layers must ensure that destructor_arg - * remains valid until skb destructor */ - void * destructor_arg; /* must be last field, see pskb_expand_head() */ skb_frag_t frags[MAX_SKB_FRAGS]; }; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c83b421..eb040f4 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -343,6 +343,13 @@ static void skb_release_data(struct sk_buff *skb) if (skb_has_frags(skb)) skb_drop_fraglist(skb); + if (skb_shinfo(skb)->destructor_arg) { + struct skb_ext_page *ext_page = + skb_shinfo(skb)->destructor_arg; + if (ext_page->dtor) + ext_page->dtor(ext_page); + } + kfree(skb->head); } }