From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0070.outbound.protection.outlook.com [104.47.34.70]) by dpdk.org (Postfix) with ESMTP id 2F704F967 for ; Wed, 18 Jan 2017 02:23:20 +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=S77kj4uDTWyKUQZpX9ApGwKkn+vaxFzEQrioSKub5G0=; b=gabTEiHa+LS7m0hBqsyLV4/igBmrhCDfu2QJAa1xXCK1Th1d7TuBJdIluPQL4W3cY6O2TO/OA1swiLmANTPyHXUzJQ/0CCDLrWc1ifTJBfAWMdJWPa1X9pzSRtzEqpu4lPfq3/whQmPUbPpVk9BP9Kx1rVcjlVNnFa1/OOBo7yY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from jerin.caveonetworks.com (111.93.218.67) by BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Wed, 18 Jan 2017 01:23:14 +0000 From: Jerin Jacob To: CC: , , , , , , Harish Patil , Rasesh Mody , Jerin Jacob Date: Wed, 18 Jan 2017 06:51:30 +0530 Message-ID: <1484702502-25451-18-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1484702502-25451-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1484637244-7548-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484702502-25451-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: MA1PR01CA0115.INDPRD01.PROD.OUTLOOK.COM (10.174.56.159) To BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) X-MS-Office365-Filtering-Correlation-Id: 7974cc26-5c84-4685-1efd-08d43f409555 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 3:r5H7i8tqAkaQH1qa5ln7GG7pCnVa8VpXuJOGL6YGEyO2yer+5kxhWS96rB4ok/Fna0Yd6pJpzNoc7qAVI5iCy3IfyXUB8oK9ZGAmepoz0sn86f7ua7z0G/42hds7XvuN5nYAI0LGWIClaR3bnB9IlpaPmE0Ol8ic0Nrw5J4NOMnsOAq0Or4WSH8oWPRKK7lu0Zs/L8iWyevTdDoJqF5nRNkkP6lZgpu+8VzDh62gRN9GLC0ApqVob/RO5GA4mc+50seGY/6KeEnbjwZ9rSr69A==; 25:zFEqWIL/KIPFRWTDFGJn68M3Aq4DAXuVWFDqdV+KhOY+PcOn4Gdo/eBp9bdasknxwNwotTSnm+VrdC4Hnrj+Ct+5+PwMQ5Sy9Rc6+ZlpO+mJiJpI4CpYXpzi/a74UuRXBcGszZQR+80EFUbbMUdOY4Tlf9lzEVj4NcUDty15QhwWAqmTcjDWPpLZm+082zJMUfkywh/1EGL4c+hOFPS1YwJj5kpRFPCQmteSkJrJgnlTNePUB5IN2IwRXziKl8V6C+ebVJwi/j6QFG7BO6PDJ4GipaZSneiYNdbZE3uoeV1pL61YMyntmCRtBQoIszHehZzPkk/BoTGqg15EPHw21SfoaSTIRpGjtdgVy6OSB3H6PTuk9VsMQqN84ntTOEMka2bMNS3FfbnFijyLIzdqulW6lznzvr9NczWNZ15FvtTIdZZyxq7eJQqWihm29XBZSX5+IKDttrJq71prn00wBg== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 31:CdGJUEIwEXpbUWNFPKwFoiNHAFuvS6p/ARGffrKgJudHDOiUNbXKGSUibiCKDOiqbjALE/C2zk6tBvyeunEi/ecqE6hcVUYMCLhTkeusyMJNGtDuzhSsZ6ggv7CGdbHnkRYWFE6P7ERY5fvY0NFTRTTOYpjZiKup+NcDYtnLXMKRaqYvXtJyLi8u5MZ8ZXnmrHWzKSq7/JY72fnc6Gh3CE7eO6PWyxHQJKpjGiGtpfmySXlqxKsPzSmV37Xj8K5E; 20:GGgIq51jLaUcguC2wSIkS9NSX9reRA6aoGNrHu5tqHL63iGS4PTUYygTb1U0IsGjjj/edScuQ1jWfGjoWpaoJTOm6BPt+lqaelRoYPVPXVtbWe0PcCyAL3MNkJyR0p5PeoLyO4BFZH5Bac0s+AdK5o/E0eLUAXM11FHomckA5j72dcyADFx23QU99yi8Bce5Ta7zahRLirZ8QN2lqN++rge+ou9BfpMDeZyDYdDY420FLjT7FjyIQB5yUW1AU5JgcF7q6GQLVmc04yWBs19M1DepphKAlVzMrGCnkcAJ6N2cNgTvvTpEl19IcgYKL00zqJfz03bTACliNiiMSAH/IdlerOsqAqsB64cwE6TSxkc0i0+FkRhn20+YRlEmMIlgpbQRsdBuJSfq7b956533YUU/TTxTKcuw9M+W77UCGcGLnW92pelXakr7mbwptylKpd5tDl8TwHzz0nAe9afeEMV9LWYHCgKwitlLZCpiXKi2Ug//DMzaB+sYG/uo6jxM9zROHDFuAOfA8rHKz19gNYu56y+0vtaVGSJN0d+FCmf03tB5gzA2864wHy6a+vfb8y8PkfXt4u84eyKtROk8EgGC3dusG+xq/cVr5pbF3vA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148); SRVR:BY1PR0701MB1721; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 4:P1WGNa8UkXfvTF/lmmFXuZQ5hzl8GYLNN2aQQxHqPGj6N83VqW0ICG49kV+jbZCEyWUNpRXqN4bHk3dxTBe5qTCK6pGZomIWj4+HYzV0enNKVUJUBClfX71Gkl3MlUMxDgdCVpqlr0xS5CVVsYOvUH2VJKUohZtHBjoYofWNz6R58e8fmZNtR4LYO6crPajcXH0EvOH2WKBTkd8JcfBWDn50ejIXa6E2GMy44d5E3LN5P/sUfUBs+W/pcIrKZBseH/wYhrXE8AQuR86peMhB4zdsurtIuS8gBge64fNv8ygyIP45ajLJ1zKOMqpVnIGj48zEGfe/0GGU4gJNFcUZrsdqd388FixGmIy/ZpCVcSzMxj3CEaJtvOhg9BVdxyuTx3q624DvSuYsLBJ5AhvXixwxQpUSAWOoYsNzZu8ZxNNQP9tYf4FRg+zI8OPhu2+kjBEUscn6cdaZ99XnZeCBmsYTBMaCF3N0SFf99k+2J6LnAVQgzUm+wQrx7AhyThtooXmFPMPxJV8NJS5Mj0E+Uvj0pccOpTY//6noMyKOUqP7GISg8Gp4XaVAgvPxM526u4ml9yCWui3q/WwxNwDpSLHEdjE3KkFZx1DfEOsRit0+sfNnNTcxL8SqLDQv3vE1 X-Forefront-PRVS: 01917B1794 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(4326007)(6506006)(50986999)(97736004)(47776003)(107886002)(25786008)(189998001)(54906002)(66066001)(92566002)(101416001)(38730400001)(81156014)(81166006)(6486002)(2906002)(42186005)(53936002)(50226002)(8676002)(2351001)(68736007)(305945005)(53416004)(3846002)(50466002)(6666003)(105586002)(33646002)(6116002)(4001430100002)(5660300001)(6512007)(48376002)(69596002)(76176999)(42882006)(5003940100001)(5009440100003)(36756003)(7736002)(110136003)(6916009)(106356001)(2950100002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1721; H:jerin.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; BY1PR0701MB1721; 23:BeBcouNZmPdMbm79sVu4l9O3lbFLs8X0qMT+oun?= =?us-ascii?Q?fuQtaLW4JMMeXDJUkqMsjcg6yZ35lPdT7tUnUXHzinjxUsInhqiEURtXh0pl?= =?us-ascii?Q?V9IeEKajmGRBNFyfw38rljwOiJsUdMh8eK4+mUPDLRnccLjcbAKfarwj7q3y?= =?us-ascii?Q?v6/WUy4ChFNSSTTB2rGrsezW/eJwj3sOfYCqa3vKI2xxrvTKpqf3+a5GV78s?= =?us-ascii?Q?O1pnt6Ao3+dUgmZjcxjvmdmqDthI/FG1cNKC0w6My68ZvzdUy5zlTr2MtrM4?= =?us-ascii?Q?2hSuRHD2qx3pis2WLrLwJ8zkoaMwftOlrpbqurXnvtzoSmSVZXZszlbNRmNu?= =?us-ascii?Q?f4iIQpEw7vv6vO4Djv9VVbT6DqLU8PUTBCVBX0B5hI2sZAMeU01vV+HhhcZT?= =?us-ascii?Q?N7mnvZ3Zgn7nrFKLNbiztaz4eQJt86ednCwmzOwQ7g6y0d+dvvXpT1+uVJDs?= =?us-ascii?Q?RYNYOiCJpyC0GkwRpV80SaJPfBPnuZWP5u210bwEvPRxhLHWNrbVOcJFTK+w?= =?us-ascii?Q?VMhkMbx8UEbT5UZDa+03PUBOnkC0A/0R1q/JJ4JGBoT2KcCjvIfFZ3t4KUzS?= =?us-ascii?Q?YPHu8KJ+NTkkiLliL2n32i848j4/7Qm9aMJ7RJbZLaBXQTvvHmfRLHyxBBiU?= =?us-ascii?Q?4sDV69QA407SO5KSNDkazs/ome1a+qf2PF136ymPvZodOKAVj9wGCOuhsihq?= =?us-ascii?Q?26pyeY9CdXDm8St+BkGlIHoao+Von7dDr0UWxAuJk1uhQitx7mp5ofVxab3X?= =?us-ascii?Q?Mu/o5PqEfg+3i02HK41FyFPvpuIIlQf8JNnfJpbf1KMRUze9kpwVCNXicyBu?= =?us-ascii?Q?Fe311RObevdC6obKcOROaskNDQLm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+bcTkLsKgqUrnj9+XSIB/AdC6HsgRT/zuZREVYF8WQifcI1DeFu5ktvxlfTFJ/geKWIaueccS3UblTpyt6Cdt2pstOAIEMaQckoE1OV2DA3CNF9PSWRqy/tMTx755XY/VZer3ZnZ0e5XxFBDQU=; 24:twUKtrXAeXGziLh1gJ0l+mv1wwJ6jya0PrBWB/EffwcnHE6psjdNnXJQCQcB4/CnZmg3I5cPFRCnaPpVZYWsOQEsd07m61AXsTSbWTudl4k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 7:k0iNSrbxJBYDjtJygqgC21qa/St8An1bj4m0uHb3paw7eT7vVhXw0nsuaKgJFtqfnkoIQcoqfH0xhcjby0gbk0oBM+69CdFr5N7F7qEEUPNLsiXQw0dKkhyHEYvfaJq78/XEwHcl27wGNZqDibzCimNF9ymJkV4nXnr43gShNbT2Pr8nU2RZ5FlxcWv0zvPOSQE0dfgkKjvAM2LheWm/Xk3Nxw5WvJs5aSpro8ImkFudYeH5zytOtrtDB0I+ug1rErp4Wm6FLilFXAfQwOm8f7DTfBzrc0MfK5M/zz8w78BdQHJlsRfQb7DK6WMa/bSzqH/6U+ZeeA+DL6rVJpyylmD25RTG4Hv0sdygKX2Ey/oaQ6CNgfgXCsoqYCK9t/6eP+gn62MeJNC6elrr4MDRvQaIXeqG+n36WakMkt8caCUi1VA8uN2iF0oiIgxNuX0TT+ZaBAAa8/BJX+z9gs6j5g== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2017 01:23:14.9086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1721 Subject: [dpdk-dev] [PATCH v5 17/29] net/bnx2x: 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, 18 Jan 2017 01:23:20 -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: Harish Patil CC: Rasesh Mody Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- drivers/net/bnx2x/bnx2x.h | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 5cefea4..59064d8 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -18,6 +18,7 @@ #include #include +#include #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN #ifndef __LITTLE_ENDIAN @@ -1419,8 +1420,7 @@ bnx2x_reg_write8(struct bnx2x_softc *sc, size_t offset, uint8_t val) { PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%02x", (unsigned long)offset, val); - *((volatile uint8_t*) - ((uintptr_t)sc->bar[BAR0].base_addr + offset)) = val; + rte_write8(val, ((uint8_t *)sc->bar[BAR0].base_addr + offset)); } static inline void @@ -1433,8 +1433,8 @@ bnx2x_reg_write16(struct bnx2x_softc *sc, size_t offset, uint16_t val) #endif PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%04x", (unsigned long)offset, val); - *((volatile uint16_t*) - ((uintptr_t)sc->bar[BAR0].base_addr + offset)) = val; + rte_write16(val, ((uint8_t *)sc->bar[BAR0].base_addr + offset)); + } static inline void @@ -1448,8 +1448,7 @@ bnx2x_reg_write32(struct bnx2x_softc *sc, size_t offset, uint32_t val) PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsigned long)offset, val); - *((volatile uint32_t*) - ((uintptr_t)sc->bar[BAR0].base_addr + offset)) = val; + rte_write32(val, ((uint8_t *)sc->bar[BAR0].base_addr + offset)); } static inline uint8_t @@ -1457,8 +1456,7 @@ bnx2x_reg_read8(struct bnx2x_softc *sc, size_t offset) { uint8_t val; - val = (uint8_t)(*((volatile uint8_t*) - ((uintptr_t)sc->bar[BAR0].base_addr + offset))); + val = rte_read8((uint8_t *)sc->bar[BAR0].base_addr + offset); PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%02x", (unsigned long)offset, val); @@ -1476,8 +1474,7 @@ bnx2x_reg_read16(struct bnx2x_softc *sc, size_t offset) (unsigned long)offset); #endif - val = (uint16_t)(*((volatile uint16_t*) - ((uintptr_t)sc->bar[BAR0].base_addr + offset))); + val = rte_read16(((uint8_t *)sc->bar[BAR0].base_addr + offset)); PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsigned long)offset, val); @@ -1495,8 +1492,7 @@ bnx2x_reg_read32(struct bnx2x_softc *sc, size_t offset) (unsigned long)offset); #endif - val = (uint32_t)(*((volatile uint32_t*) - ((uintptr_t)sc->bar[BAR0].base_addr + offset))); + val = rte_read32(((uint8_t *)sc->bar[BAR0].base_addr + offset)); PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsigned long)offset, val); @@ -1560,11 +1556,9 @@ bnx2x_reg_read32(struct bnx2x_softc *sc, size_t offset) #define DPM_TRIGGER_TYPE 0x40 /* Doorbell macro */ -#define BNX2X_DB_WRITE(db_bar, val) \ - *((volatile uint32_t *)(db_bar)) = (val) +#define BNX2X_DB_WRITE(db_bar, val) rte_write32_relaxed((val), (db_bar)) -#define BNX2X_DB_READ(db_bar) \ - *((volatile uint32_t *)(db_bar)) +#define BNX2X_DB_READ(db_bar) rte_read32_relaxed(db_bar) #define DOORBELL_ADDR(sc, offset) \ (volatile uint32_t *)(((char *)(sc)->bar[BAR1].base_addr + (offset))) -- 2.5.5