From patchwork Tue Feb 7 02:26:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 724868 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vHSs25Pp2z9s2P for ; Tue, 7 Feb 2017 13:26:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E86S/zxE"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4D31730A5B; Tue, 7 Feb 2017 02:26:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DYykNcSMO5Xo; Tue, 7 Feb 2017 02:26:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 235CB30A47; Tue, 7 Feb 2017 02:26:44 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 6194D1BFEC6 for ; Tue, 7 Feb 2017 02:26:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5C0158A401 for ; Tue, 7 Feb 2017 02:26:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xb5h2QFJD5wd for ; Tue, 7 Feb 2017 02:26:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by hemlock.osuosl.org (Postfix) with ESMTPS id DFE658A3FA for ; Tue, 7 Feb 2017 02:26:41 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id e4so8101196pfg.0 for ; Mon, 06 Feb 2017 18:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=4Mq8+TGlOYrs5RdUKYJC8mqdFFLVoS+UFKBO1EkQsmg=; b=E86S/zxEoZgBWBERCq2ToJ5GFclX1LxbVRUgDBapQTRrgMOmFBCHmyah/rJNvSwc1b OUeG2hJRA6Q7+zhMwxwmtPfM6hgMKhUc116zy0tcekdHEjOxJk4xIEKkpO1lPJQ1fg3F cK4Ae3bru0CoyQ+ozyPGeSOWjKErnM760ToMvXP8P7hsBNYPWezyWW0gYXEdySYOxJ/I 88g3mLAjE8wh5Lz0IBZk+RmTJs3NDHUScFXKS+/3QOfilwA3bP5+YWeBFER2GGHFrWv2 klqJREM2i45owbwGFmmMA+TjDTbh1151ExAupsWunuvu5oBFBBW++NJkHFXX+SkfqFuA t6Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=4Mq8+TGlOYrs5RdUKYJC8mqdFFLVoS+UFKBO1EkQsmg=; b=q61TKgw1HNhgFOJdJ/t9I0RYI4bk/ngHrzYfrNV9xz2Nxt2chvLZEoMZdJjZzqlryO mSP0cuYy0jzgWZhOPU/fjr+OCdlxihSaU0Wj52/FLawqSo4s6z+txVi4zm+t8Z4pgpO3 pHOles9LyOWq2Dc0x1j39YaZAk5J1P1ZdiYLir5Y+v9Cvo4aAcwU2c88CgM36muNlPa6 5wr2BFRhw449QCYHhmGFD3NdhNp9VajfxQKGWk1kabABKXA+6+moq1uz0wrDbUqC4AKV MZcQMpy4RA6NM1nSFF0h3YWyXX53WRZ6OxjvsYjJ5hE/nlvs6FpgQ3uvQz+wSC0oHSkH 0Ong== X-Gm-Message-State: AIkVDXLPK2o4bTCkOujDiheUtmqVblYMo6KtBH+rwFWlLGqNZ9Lz+1eRvW0QHvQcgr61HQ== X-Received: by 10.98.133.202 with SMTP id m71mr17079706pfk.102.1486434401351; Mon, 06 Feb 2017 18:26:41 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id e4sm5689153pgc.45.2017.02.06.18.26.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 18:26:40 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Date: Mon, 06 Feb 2017 18:26:40 -0800 Message-ID: <20170207022632.9864.8422.stgit@localhost.localdomain> In-Reply-To: <20170207022339.9864.87863.stgit@localhost.localdomain> References: <20170207022339.9864.87863.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [next PATCH v5 07/12] igb: Use page_address offset from page instead of masking virtual address X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck Update the handling of page addresses so that we always refer to them using a void pointer, and try to use the consistent name of va indicating we are working with a virtual address. Signed-off-by: Alexander Duyck Tested-by: Aaron Brown --- v4: Split this code out of patch 6 of the original series. drivers/net/ethernet/intel/igb/igb.h | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++------ drivers/net/ethernet/intel/igb/igb_ptp.c | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index a74928cc0e58..6a88a08c021c 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h @@ -614,7 +614,7 @@ enum igb_boards { void igb_ptp_suspend(struct igb_adapter *adapter); void igb_ptp_rx_hang(struct igb_adapter *adapter); void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); -void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va, +void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, struct sk_buff *skb); int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 0820fded7331..c5cb93ebc633 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6929,7 +6929,7 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, struct sk_buff *skb) { struct page *page = rx_buffer->page; - unsigned char *va = page_address(page) + rx_buffer->page_offset; + void *va = page_address(page) + rx_buffer->page_offset; #if (PAGE_SIZE < 8192) unsigned int truesize = IGB_RX_BUFSZ; #else @@ -6971,7 +6971,7 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, add_tail_frag: skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, - (unsigned long)va & ~PAGE_MASK, size, truesize); + va - page_address(page), size, truesize); return igb_can_reuse_rx_page(rx_buffer, page, truesize); } @@ -6996,13 +6996,12 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, DMA_FROM_DEVICE); if (likely(!skb)) { - void *page_addr = page_address(page) + - rx_buffer->page_offset; + void *va = page_address(page) + rx_buffer->page_offset; /* prefetch first cache line of first page */ - prefetch(page_addr); + prefetch(va); #if L1_CACHE_BYTES < 128 - prefetch(page_addr + L1_CACHE_BYTES); + prefetch(va + L1_CACHE_BYTES); #endif /* allocate a skb to store the frags */ diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index c4477552ce9e..7a3fd4d74592 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -764,8 +764,7 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) * incoming frame. The value is stored in little endian format starting on * byte 8. **/ -void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, - unsigned char *va, +void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, struct sk_buff *skb) { __le64 *regval = (__le64 *)va;