Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757046Ab0G2LBp (ORCPT ); Thu, 29 Jul 2010 07:01:45 -0400 Received: from mga11.intel.com ([192.55.52.93]:58755 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756909Ab0G2LB1 (ORCPT ); Thu, 29 Jul 2010 07:01:27 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.55,279,1278313200"; d="scan'208";a="590877548" 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: [RFC PATCH v8 07/16] Modify netdev_alloc_page() to get external buffer Date: Thu, 29 Jul 2010 19:14:39 +0800 Message-Id: <1280402088-5849-8-git-send-email-xiaohui.xin@intel.com> X-Mailer: git-send-email 1.5.4.4 In-Reply-To: <1280402088-5849-7-git-send-email-xiaohui.xin@intel.com> References: <1280402088-5849-1-git-send-email-xiaohui.xin@intel.com> <1280402088-5849-2-git-send-email-xiaohui.xin@intel.com> <1280402088-5849-3-git-send-email-xiaohui.xin@intel.com> <1280402088-5849-4-git-send-email-xiaohui.xin@intel.com> <1280402088-5849-5-git-send-email-xiaohui.xin@intel.com> <1280402088-5849-6-git-send-email-xiaohui.xin@intel.com> <1280402088-5849-7-git-send-email-xiaohui.xin@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1680 Lines: 62 From: Xin Xiaohui Currently, it can get external buffers from mp device. Signed-off-by: Xin Xiaohui Signed-off-by: Zhao Yu Reviewed-by: Jeff Dike --- net/core/skbuff.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 117d82b..1a61e2b 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -269,11 +269,38 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, } EXPORT_SYMBOL(__netdev_alloc_skb); +struct page *netdev_alloc_ext_pages(struct net_device *dev, int npages) +{ + struct mpassthru_port *port; + struct skb_ext_page *ext_page = NULL; + + port = dev->mp_port; + if (!port) + goto out; + ext_page = port->ctor(port, NULL, npages); + if (ext_page) + return ext_page->page; +out: + return NULL; + +} +EXPORT_SYMBOL(netdev_alloc_ext_pages); + +struct page *netdev_alloc_ext_page(struct net_device *dev) +{ + return netdev_alloc_ext_pages(dev, 1); + +} +EXPORT_SYMBOL(netdev_alloc_ext_page); + struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask) { int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; struct page *page; + if (dev_is_mpassthru(dev)) + return netdev_alloc_ext_page(dev); + page = alloc_pages_node(node, gfp_mask, 0); return page; } -- 1.5.4.4 -- 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/