Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754770Ab0KIIpU (ORCPT ); Tue, 9 Nov 2010 03:45:20 -0500 Received: from mga11.intel.com ([192.55.52.93]:40024 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754040Ab0KIIlg (ORCPT ); Tue, 9 Nov 2010 03:41:36 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,174,1288594800"; d="scan'208";a="624917725" 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, davem@davemloft.net, herbert@gondor.hengli.com.au, jdike@linux.intel.com Cc: Xin Xiaohui Subject: [PATCH v15 06/17] Use callback to deal with skb_release_data() specially. Date: Tue, 9 Nov 2010 17:03:11 +0800 Message-Id: <52fc15c05611c5af3802c19822fd6e9d5158669f.1289280886.git.xiaohui.xin@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1289293402-4791-1-git-send-email-xiaohui.xin@intel.com> References: <1289293402-4791-1-git-send-email-xiaohui.xin@intel.com> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1841 Lines: 62 From: Xin Xiaohui If buffer is external, then use the callback to destruct buffers. Signed-off-by: Xin Xiaohui Signed-off-by: Zhao Yu Reviewed-by: Jeff Dike --- include/linux/skbuff.h | 7 ++++--- net/core/skbuff.c | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 696e690..6e1e991 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..68e197e 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->dev && dev_is_mpassthru(skb->dev)) { + struct skb_ext_page *ext_page = + skb_shinfo(skb)->destructor_arg; + if (ext_page && ext_page->dtor) + ext_page->dtor(ext_page); + } + kfree(skb->head); } } -- 1.7.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/