Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753432AbbENRSS (ORCPT ); Thu, 14 May 2015 13:18:18 -0400 Received: from smtp.citrix.com ([66.165.176.89]:16672 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753276AbbENRSL (ORCPT ); Thu, 14 May 2015 13:18:11 -0400 X-IronPort-AV: E=Sophos;i="5.13,430,1427760000"; d="scan'208";a="262772861" From: Julien Grall To: CC: , , , , , Julien Grall , Konrad Rzeszutek Wilk , Boris Ostrovsky , "David Vrabel" , Subject: [RFC 12/23] xen: Extend page_to_mfn to take an offset in the page Date: Thu, 14 May 2015 18:00:52 +0100 Message-ID: <1431622863-28575-13-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> References: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 Content-Type: text/plain X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1854 Lines: 54 With 64KB page granularity support in Linux, a page will be split accross multiple MFN (Xen is using 4KB page granularity). Thoses MFNs may not be contiguous. With the offset in the page, the helper will be able to know which MFN the driver needs to retrieve. Signed-off-by: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Cc: netdev@vger.kernel.org --- drivers/net/xen-netfront.c | 2 +- include/xen/page.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 381d38f..6a0e329 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -431,7 +431,7 @@ static struct xen_netif_tx_request *xennet_make_one_txreq( BUG_ON((signed short)ref < 0); gnttab_grant_foreign_access_ref(ref, queue->info->xbdev->otherend_id, - page_to_mfn(page), GNTMAP_readonly); + page_to_mfn(page, 0), GNTMAP_readonly); queue->tx_skbs[id].skb = skb; queue->grant_tx_page[id] = page; diff --git a/include/xen/page.h b/include/xen/page.h index 89ae01c..8848da1 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -20,9 +20,9 @@ #include -static inline unsigned long page_to_mfn(struct page *page) +static inline unsigned long page_to_mfn(struct page *page, unsigned int offset) { - return pfn_to_mfn(xen_page_to_pfn(page)); + return pfn_to_mfn(xen_page_to_pfn(page) + (offset >> XEN_PAGE_SHIFT)); } struct xen_memory_region { -- 2.1.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/