From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0073.outbound.protection.outlook.com [104.47.42.73]) by dpdk.org (Postfix) with ESMTP id C4407D592 for ; Tue, 17 Jan 2017 08:16:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PwKLpZtBp8UPzc+KRePKPyAinFeZZ3YSq8hqfJv8nME=; b=F5IkNsPQVgtXoP9W3A9bVOmQdDlp+sqaNGQ3OmnIw2YHIyfqtN8s3fRL2rGMgOgyz2cRzqAjbTYT64tDFP3qYiMB8EWgyJBxMXb+og5SOgDOmMX58/aYkcxMo07cll2ZBRsjz/gerhBDX5JTRoWsMTAG60iAG1ic6v29YE+E2EI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BY1PR0701MB1724.namprd07.prod.outlook.com (10.162.111.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Tue, 17 Jan 2017 07:16:21 +0000 From: Jerin Jacob To: CC: , , , , , , Helin Zhang , Jerin Jacob Date: Tue, 17 Jan 2017 12:43:59 +0530 Message-ID: <1484637244-7548-25-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1484637244-7548-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484637244-7548-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0030.INDPRD01.PROD.OUTLOOK.COM (10.164.137.37) To BY1PR0701MB1724.namprd07.prod.outlook.com (10.162.111.143) X-MS-Office365-Filtering-Correlation-Id: 62c5bbde-4cbd-4c31-a21f-08d43ea8bf00 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 3:L6DiiKV+w6dYsMOAgzbzBBgU8bZBZRPnucXKuAKhfddQiusvN203GcNzq+hqarlzMZWkNhsY93jZ8O3swhnoGMRyVsfKI+Ll2iSYhe9l/SdII6D23HNhXVTabMi5/0Z2n9v4m5sunE8T+eR98LMxFNShbiogJo4OOE717uu8Ow1DIQSZUx7ybLUwARSuE2SKuQoSsMNcMYXd6NgeAJ0AXIXGiQwMdGFcZGs4umkT4LH0CgHwzT8Zbxh/A2Rtfp9C80njTTMTdVDLq/rg+qiepw== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 25:iDc8hhKv8zz1+5COpblLyH4lpsPwWQyxFFwNQQhm0abHQ6GgpZHoz+3zs9zSMNTBvsrreRozB5GltSyYqB8OXGeFaIkrpaJzI4R2eb2I4Opl6/YXG6xmAnBOXDMtqXgY1n0Y81YVJnV4RZwln2GtOv9exMEbev4FEmnPoja5XFymy36BzELdFTzj216leCvW2aN7rWkvBn0edgPTuPNuJecaAXOOKugV/DI6C2YC+XqzVSNNoATue8FVeJmYFAqr/kn6se+VElf7fvYBi7/rx9V0XO2gfhTX8OGU3Z5B09k6ZzMhwG6ArbuYpXtXlOsK04dfrVBF1Jqtlr7ix863H6qsvSTr4WBo4AtDG+NeGwft+I3OyCCu21Eg4wJiQWbkg2eW2U/FJPAJS9rCqSBJS5X0bQA1QeAYPXlTZa7Zpq0FBR2gUODGmMmuVoYex827pSGZlChGSpXDRzg4DwHLkSMcdZD+1vBzeBKIcGMDqAijnHbBLoZG8KGLiZHZXA/sPzbBW3panMOL9h0rHJ+LsE2ot+XEWOpNv0G/bvDcMNTgECv7bH0z1Mm+JAKVP5UCR3kn4rciQ0Xdo5g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UenEGTBviGLUJBwIjZ8p2c+RLT0DpNMkOFDIHpEljcGFpOgVudDDC0o2FaKFvkmgW3YlJYkXQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:BY1PR0701MB1724; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 4:OoEDboW0HBRuGMatHcwQpgHMHdqsuXjNcxGo2Xsb1/jscLZEx6+JecasQiXiJ9cmsfuMtlSRRb/y7fy/DbvuyoWk+FanC/IGEf5LaZ2aXeiV9KC/dMRu2t+grTHXKVvxB518qmGp6CUjo7vaYK0PeM8Y7Xvd0sKAhoFmTHNhP1MxMnfZuQMPOxAZzdyQ2OUP5R7/DVaSogs/UUJU5CIztmvrRrIi1iYv5tBUo9Ulacv1ceeHBhPru95OsWTjn4aDgyc2bEejSDqqT/rSDyH9uF2kDoHUaR770e5n2pbkoh4ZyoVX24RX1wzyGniuelOaCPkr70sUYqbv6rzHNPpJwiKygUGt8u/dMhO1Aj4iFMiSScYuKAQAV+mj3YpEDwOyN1ilzG5PatPRyfF+HNmBkWNN8MJv+4XlmOMFB/Yte8PugRtIZ+1BiR9cCD4QDFF+cqhJX2t8xCccSlA3QAecTt10VXiM03t3cOXRwEcyBkwjPIlfIYOw+//ybHnlcjBwxqtR7BbOeyO06cpqah3Gn255WJbEqnYKkzPCPoLb2aPZ4driG6znxqzshvMAx7wk5LEpOIXE4GtAUgEJSt2V211/ToX92G/PMgDNh7uiZ1f7cXk5Lsi5CzxsINWf7fq2gRz6COfJH8UQnG6zm8K3FA== X-Forefront-PRVS: 01901B3451 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(199003)(189002)(2906002)(4326007)(76506005)(107886002)(53416004)(189998001)(92566002)(106356001)(38730400001)(575784001)(47776003)(25786008)(6486002)(54906002)(66066001)(6506006)(305945005)(7736002)(6512007)(5009440100003)(81156014)(3846002)(50226002)(5003940100001)(68736007)(4001430100002)(6116002)(76176999)(50986999)(2351001)(97736004)(81166006)(5660300001)(8676002)(105586002)(69596002)(42186005)(48376002)(6666003)(36756003)(33646002)(101416001)(2950100002)(6916009)(110136003)(50466002)(42882006)(30001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1724; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1724; 23:jwW8FNxpIemQmlv5oGNZTyT/gUU5Bd1aC4kEwFj?= =?us-ascii?Q?xFTVu5BLjlwg8jNttf6dljQVnFUb/uH+Ks+7JcjOGDQ5D76Z1aIfmk2/qQYV?= =?us-ascii?Q?Igk4qOi+9gh7nhFYuU2SHWb6TX3weID/Fv0Y7IULsV0SMhrc94fbmxKtT5Fg?= =?us-ascii?Q?cSmn94NzqkhQf3qvUr8CXmrWIzkaOiCaSkKSu/KyuRqBQVy+FhatnKw+xtIj?= =?us-ascii?Q?TJW8bcIDsYhjKZlm6qqE8EesXzmGEPXfFlr6+DNyAjIcXrwwfiMBASK5tQqU?= =?us-ascii?Q?rhzV8OkKo7FMcDocEwNrLMqAxmG+S5YO8PLnZMTvQgzFnulPSFK0GL53lQCV?= =?us-ascii?Q?s8WLevpqtzniknVqe3i6pEeq7fWpkjilR0PTfyvboNrGfKQXHGH0tcXAbWug?= =?us-ascii?Q?cuaHlsxT7SJzgeAu7ChXybZcgfnFwbefCTuOkZEwnTVh/Uu4FZMMWBWWBtzB?= =?us-ascii?Q?0WTKwzaaSfx8j3GoHHWfD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GIZNPZNk3uO2emDvC85OrJLIMSjr9D1E8VlizncetiohyYwYrIXXOR/aR6g/QRGotbtFibZcWVJEXupMD8jegg+0lSQd27AW0Qse8AcHNYwWNss/V1XhulED2DdsOSvWNEkmETkDfSsL2Ltsylk5emctCVRtbnm9+EFeaQssgBONbpN/Gb6jUZ12IOvV3bC/hp+d2834sbw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 07:16:21.4154 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1724 Subject: [dpdk-dev] [PATCH v4 24/29] net/ixgbe: use eal I/O device memory read/write API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2017 07:16:27 -0000 From: Santosh Shukla Replace the raw I/O device memory read/write access with eal abstraction for I/O device memory read/write access to fix portability issues across different architectures. CC: Helin Zhang CC: Konstantin Ananyev Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- drivers/net/ixgbe/base/ixgbe_osdep.h | 11 +++++++---- drivers/net/ixgbe/ixgbe_rxtx.c | 13 +++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index 77f0af5..9b874b8 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -44,6 +44,7 @@ #include #include #include +#include #include "../ixgbe_logs.h" #include "../ixgbe_bypass_defines.h" @@ -121,16 +122,18 @@ typedef int bool; #define prefetch(x) rte_prefetch0(x) -#define IXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg))) +#define IXGBE_PCI_REG(reg) rte_read32(reg) static inline uint32_t ixgbe_read_addr(volatile void* addr) { return rte_le_to_cpu_32(IXGBE_PCI_REG(addr)); } -#define IXGBE_PCI_REG_WRITE(reg, value) do { \ - IXGBE_PCI_REG((reg)) = (rte_cpu_to_le_32(value)); \ -} while(0) +#define IXGBE_PCI_REG_WRITE(reg, value) \ + rte_write32((rte_cpu_to_le_32(value)), reg) + +#define IXGBE_PCI_REG_WRITE_RELAXED(reg, value) \ + rte_write32_relaxed((rte_cpu_to_le_32(value)), reg) #define IXGBE_PCI_REG_ADDR(hw, reg) \ ((volatile uint32_t *)((char *)(hw)->hw_addr + (reg))) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 00013c6..bbf6ba4 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -326,7 +326,7 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* update tail pointer */ rte_wmb(); - IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, txq->tx_tail); + IXGBE_PCI_REG_WRITE_RELAXED(txq->tdt_reg_addr, txq->tx_tail); return nb_pkts; } @@ -904,7 +904,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u", (unsigned) txq->port_id, (unsigned) txq->queue_id, (unsigned) tx_id, (unsigned) nb_tx); - IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, tx_id); + IXGBE_PCI_REG_WRITE_RELAXED(txq->tdt_reg_addr, tx_id); txq->tx_tail = tx_id; return nb_tx; @@ -1639,7 +1639,8 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, /* update tail pointer */ rte_wmb(); - IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, cur_free_trigger); + IXGBE_PCI_REG_WRITE_RELAXED(rxq->rdt_reg_addr, + cur_free_trigger); } if (rxq->rx_tail >= rxq->nb_rx_desc) @@ -2043,8 +2044,8 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, if (!ixgbe_rx_alloc_bufs(rxq, false)) { rte_wmb(); - IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, - next_rdt); + IXGBE_PCI_REG_WRITE_RELAXED(rxq->rdt_reg_addr, + next_rdt); nb_hold -= rxq->rx_free_thresh; } else { PMD_RX_LOG(DEBUG, "RX bulk alloc failed " @@ -2215,7 +2216,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, rxq->port_id, rxq->queue_id, rx_id, nb_hold, nb_rx); rte_wmb(); - IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, prev_id); + IXGBE_PCI_REG_WRITE_RELAXED(rxq->rdt_reg_addr, prev_id); nb_hold = 0; } -- 2.5.5