From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0049.outbound.protection.outlook.com [104.47.41.49]) by dpdk.org (Postfix) with ESMTP id AEC785689 for ; Wed, 14 Dec 2016 02:58:59 +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=aR2ZEZISSaY5VMw8QWQLfv4UmY9mdfzRw5Pk/f2uM6A=; b=XOvtDxRpmKnweVgBQ1RYguwAe3vOjnAUZ6mWgdIGyofdnqvvPtfQstHG8G/TwXLhRUowLfJ7CAygFwgOEQNm3kNw6YPeyIGkYYFHbiInrJaGIlxLv0iY8Rz1C7SJD82WlILZil+9NkV5/3dH6YfmgRgeXqvnZureuSqLgSLdhhU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (122.166.91.229) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Wed, 14 Dec 2016 01:58:55 +0000 From: Jerin Jacob To: CC: , , , , , Santosh Shukla , Jerin Jacob , Jing Chen Date: Wed, 14 Dec 2016 07:25:51 +0530 Message-ID: <1481680558-4003-22-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.166.91.229] X-ClientProxiedBy: MAXPR01CA0006.INDPRD01.PROD.OUTLOOK.COM (10.164.147.13) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: 4562e09d-49b2-46ff-f76e-08d423c4c4ab X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 3:DmOMzqo7wDNyAHSZ4pEvL6gEJnHteI6R9F9Yb0t8daHzlNRUz9TNSQh0ejEA/DpJhg9lMjbmGTCXxUSrToVjMNkYSA7WoFxHIR3gKVjyXc7/cyg3iPd+3RuMbbuI64Z9L5FvI0C3k+hBk5V9ghWQrFNc/Kv01+QcnXnX0lbXGqtHdzj8b9QB/ehuOkFyZpsNLiFObJbFTTDSPUxP955bNOUUEn4vYW3U6geARSbjB+uyBilPg/ebjUQtGneG0HqfimWmkrtr4vMIHb8cs3Vf0g==; 25:21xOKl4WiNJsdLoTmVvkk5Jy0p6fjPFNSrC35n16QPpTT/s9bxTw9f6CpyFD6/BEIPWqq/ggnG2EkjtU16hYebWFGMekXjEE9GY8V4m8q+MBcmvONDbfZAW99O5aygy7YdgPL6Ne8nAwDVj2rrtGw2I9aEz4L1O8AW0Kgk+rNPqq/SqufriTKTkPXb5BkNA2ONP7NqvyuEWc56Qf4Ne6rF46s8V+2IbRYZJawn4jXQKCoB97Ge6AVUBax3j/6h7jN8gLIllIgsfeP8GaHHVzb6PYdUKNYTPV0i+4i52zbhZulQZBX2osU3eNpCNllRUOT0ltGCdVveA0R3zywNUaIj45t1L7LARUctOQ/3ndeAxZvrR0s5g4oVNJyjFy5ghogSoJ+BLfBaTFbl06wDB4eAtyHk/fp2UNQwQmgHMdZsoAXpHinCN7K0TtkYaXl261LA36M6Ma9PQ19BUYAZHbEQ== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 31:p2jw5kOH2ly+sEuMZ8mL/1CZ5RRZKXTKzaoBZW2ftw72nxL16XcklRVI8ayWnL+zBReExrLAN4u0LJhwvFXgfISOKNsDC51tFs4MeJPkA3F7kVzLMGbCEeC/HnBa8Na5pjMMHk/GRLQKRTnH2bLHKgUw3H8/g372NqQ1TBdmxPBmbJxWtO5InhDxnDmtDCyBbGtNF887QUtJ0mglfrCJh53H77T+2y/q5UC9P2GhGCX/L0ila3eaEstAAw+GUJt/JYlz6NIWxEZMi2erKAkGVA==; 20:aSnkGW/pq6T3MPm/hrHsUaVr2KEFBh9O4GZsjqEAG0XaiLwqFF/T+dm9rrdaAyjTTHPrFn2AL/LzNHww7u5e0JtIehIoLfhziZKgfj3HiX42F9q6wS86Qky4mM3533byyCV3na0vc/Pg/Gxh0EEbcKWpIbHvv66UQWJQSCvCd8qvdqLnExWSk3ORf/UtJ63LQhZFvVFQDJs/E8WSFuwDkyehKOK0lPX1nyf2vBE7Lm71Ak4aUzXt8NdIEdFfLRMeJvJE6L03eSyK/E8iTl+wSRE3GsKnrKk2uXzLYEIqqZwQ6FO9LFEcbaGEGw0WrYRQSpp1+E+xKZeSwACtMYlxJVBQHSx1Pob12r1SC9GLqwi5lBmU6MqEQQm6ZtcBXCkh5rsjTETlRcP5ACalC4UOImhqDgNWD3i6QcYx9nVq3+i2U4Gz8SNFv6IHmhD1gF1Mcut/V4QfxC9hxW71rTL3Ta3eKLFEIbIuuYEHv07QwDoJnBzrR00mJLBYi0VeTDoXod70PAfD07yR36EJC6VtqKjSzQ3wqqtJbhItIgwTok8oWvrVF7B4joA4GWSl98HZW2ULaFDfYKQG6kQn6eGlUxrhOwKqFD3kN1vmFIGCX/o= 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)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6072148); SRVR:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:qqxa8a13q9ADKFqrSLMvJg01OkRxVk5DhBiQ4bd9DO+/TJk93HsyOwiqRqmqX1unE8S9DpIIpqgrbP+AtldgTo9v7VHQ4qef9mc6lOFnR8jULXwylX6R6e7a8fu6wdPP5CXjrXk4lfX9M8VLGnUi0j+1um8Jaag8+b8eoVdzltx1UPZ3JI+2l/R8oUNmMZeLvETPLIFU1JRHlVtlOrxtGIvwfufp3JEAlYeycuxkObV6RKLV+8EZZccwqbeD95mMjYIC12Sut06FBNiBg6xnK9Obsp/HODopOSkscEWzz05K6pUnUY5qrW7gKJO6U936QY7FhlPkbs/rf+ineRipweu6GwCPLRddS6HJU5SiqsZ0OSYGB7GDmKlzMihev2+MtljMA4fdMCEp3zhtDCfZBukyPaiVeVqrdqYv1zBJ8zNoPuPllCYaTCx2IfYHzxhQ83XENG+bSAhr8/Yuvx3z8ev0ps9BUrNoVr6btCnHYXcQdGJ2lV7wNZPFyyRKIhP1IQ473jGAv486DdeYE8lexGPH4qHnqQWdrowEDO6gbxZnPv85bikhZjG8VSnaqTDeFeVbVNLOzT0vJcHWGYZQL/5A5HGnHRCr+xofWZVBlAbt41hWP8/yyJXX7hnFSJSH214u9uKgOd+dmG+RtQjtuQ== X-Forefront-PRVS: 01565FED4C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(39840400002)(39410400002)(189002)(199003)(6116002)(6512006)(6506006)(6486002)(3846002)(66066001)(68736007)(47776003)(92566002)(5003940100001)(50986999)(76176999)(81156014)(50226002)(2906002)(110136003)(33646002)(6916009)(101416001)(42882006)(2950100002)(6666003)(4326007)(81166006)(38730400001)(105586002)(8676002)(106356001)(5660300001)(305945005)(48376002)(97736004)(50466002)(36756003)(2351001)(42186005)(7736002)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Micros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O9qZ0M7DHxTSzY9OINLIFD4f+J3Zz2LroDmgNogYV4yMHDvggKSuFOytgoaE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 7:3iYy+8aTLpQmM0joYwC/QCaaX+sj7O3QCMrmy0AbDS7Hhp5CkUaNrbRR+R7ArCqSEorp3xBGlGZ1tkQNtP+W6gYU1xvGJdl/SqNWTfkTgGVEIy4NUUpGRbjjffV4mkOISakI5zn+BzES5OqM/SayvpJLyVZPfEhvLLKwNFxyb3z4JYI9c6iowrGveVNwgdSEtaxOs61rQ+pN0yk3iBNgQ7j9QuokMCr/UuWnWZkD6e9x/bVuL4Ts5o8/z7wPXmvO4nKvveO72+M7bk+daRMQevc1pzjRy64ZrF2EJSQroQCj5kTJ3zEHNE5QS0w/dzP1v/abVPOv6tlCXWAKG0tt8UWAUx/GErRqFXxTEP3bDUJMshmUhckBl8H208KghwT/CxNDEnIMqsKfA/P+kb5DOI3wKzar7qP+mlYMou3FnPLwRHIWRaFQl2vQfeZnSJZCmVhYTIiGxEFPiRbaCFeTnQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2016 01:58:55.5173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: [dpdk-dev] [PATCH 21/28] net/fm10k: 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: Wed, 14 Dec 2016 01:59:00 -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. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob CC: Jing Chen --- drivers/net/fm10k/base/fm10k_osdep.h | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h index a21daa2..d91ff41 100644 --- a/drivers/net/fm10k/base/fm10k_osdep.h +++ b/drivers/net/fm10k/base/fm10k_osdep.h @@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "../fm10k_logs.h" /* TODO: this does not look like it should be used... */ @@ -88,17 +89,27 @@ typedef int bool; #endif /* offsets are WORD offsets, not BYTE offsets */ -#define FM10K_WRITE_REG(hw, reg, val) \ - ((((volatile uint32_t *)(hw)->hw_addr)[(reg)]) = ((uint32_t)(val))) -#define FM10K_READ_REG(hw, reg) \ - (((volatile uint32_t *)(hw)->hw_addr)[(reg)]) +#define FM10K_WRITE_REG(hw, reg, val) ({ \ + rte_writel(val, ((hw)->hw_addr + (reg))); \ +}) + +#define FM10K_READ_REG(hw, reg) ({ \ + uint32_t __val; \ + __val = rte_readl((hw)->hw_addr + (reg)); \ + __val; \ +}) + #define FM10K_WRITE_FLUSH(a) FM10K_READ_REG(a, FM10K_CTRL) -#define FM10K_PCI_REG(reg) (*((volatile uint32_t *)(reg))) +#define FM10K_PCI_REG(reg) ({ \ + uint32_t __val; \ + __val = rte_readl(reg); \ + __val; \ +}) -#define FM10K_PCI_REG_WRITE(reg, value) do { \ - FM10K_PCI_REG((reg)) = (value); \ -} while (0) +#define FM10K_PCI_REG_WRITE(reg, value) ({ \ + rte_writel(value, reg); \ +}) /* not implemented */ #define FM10K_READ_PCI_WORD(hw, reg) 0 -- 2.5.5