From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0041.outbound.protection.outlook.com [104.47.42.41]) by dpdk.org (Postfix) with ESMTP id 6A964F94B for ; Tue, 17 Jan 2017 08:15:57 +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=FZHo9sKiQC4UNeAOy9UzYmf8xSwF5zcTVVSKln9elQ75B8OKIP15s2a3CdOxIwWSwYXNe46WAGFVgm0kTNfmsKHc/T/4WZTaDYTTKs/GKYGF4bQchlEMKLqL3pSgdH0Tfr6TyFvwULcYteeYPItkp9/orHNASWZV0iLUPivDR00= 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:15:51 +0000 From: Jerin Jacob To: CC: , , , , , , Harish Patil , Rasesh Mody , Jerin Jacob Date: Tue, 17 Jan 2017 12:43:52 +0530 Message-ID: <1484637244-7548-18-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: 2951fb34-23f0-467c-5e52-08d43ea8ad6e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 3:NFjn5VdZecWoSLsKqsyIfQenKTJVSuLnvLLPUvNSM/dbOu8BWG1LxveUvVb2vdaNVaEWE7Mo73dW2iAAdl6ngilDJjm8SQZPbBNBcdkg/W5srMjzZ2l1/0fDlw6Hd8eBOHWLvSZN2x3flaqXGfu/Re3/ZRjITnYoaBNQ7YSlJraBjMxf/fIFxmOTaSK/Tkt71byhSD2/g9AzZbc3iJlBs/IiCA4Ll0ji90vn4CDU/TRt827Mhv447K2C6ebYrTuLrH091m6t/4u3CsGrx7nDYw== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 25:nnnHRQa7berp1+HR9fFAs65bnnaEahcUNWRPvmXYDsVDEwgHEhm1u3XI4FtUMM+ajv6bqPyfMijTyqLCrsV5HSS+uJ0EHB8QfLFj3mr/uYmjYzomtUJlDAEJQb0QqOsaQjL/V1BoSfqGlDL/9Erx48XTYRD22vJHZViO7Ebm4oOqXNbFBJw6GJUTy2AT5Ox62Ru+kZ+RpTzfXJsxpQsBox8qoA99Q5byLN61mFLQhSp/Gb2Z05xlG3cvbmmKpKEd6WYrr4t1IvvRh3RGJB0W69NQ2KoyLiVwyIz/XJBbnrKma9Bi2D3yfO1HbxJwxKxPxY4Oq9U4gzQzBhKd35IvSP2g/EiXjOlhatKLmQfm/f2DxHJ23P4049+FdZONUJage7goEcJgLD2jsIfI0rkPAyOsXkHY5SIg4PB5gfHTtjx1QuWe5UE5TXgAep+nxM4OYDIgNVLgrJx0nmdkm4a38cV7t/Vl4h9zWhCz+eFh6Lnwsi5O4j3qgIUiBtO22R3eeKvHegch3eLnUl74rl1LgYmsUHCPmiHKaLNUzPwKB98Db8qbxS9zejuEwFBf5ccakk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CRVK15YT4Vw3edrNBo6O/MjGGLcHOE901AeyOG8/dfjZSMsqXWH5OOVq3zbGzESrarzt6b+1s8grm9rXYJrCFjW1FKVk01ZA4SucXCqIHh22xYPlU1TnckWgXzQ= 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)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:BY1PR0701MB1724; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 4:zcD9DtVobsreDhg7wYyb+/c3XNiZCP33TfZe/GlxNPKAcBzonRF3zWDXSfJ/StM/AYBChAKw+FurnKXuTmur/EO6HQVy9ISCWAR/3agS8qCg9ji1IbERNX287klX8FxY5z0GosAAXVaZdnj9N89+D7XUcehY01M8uDILYIXleLuvtKq6hO1y9762X3LCA0AvHWNaDQ18mm7jYhr7Gy1/2j1m9ZWJKcqn0dvsJsuhyqZt1svWWcj27uBl2Hyjp/FG4SfteLK9n7LqF09DIjoOGsC+/JD6zATRMUDoIlUHb6xWFzLLXVHcZuO9OoaJRnM5NyvjUvizlPa55nCZANPP80/QPkFymw8bDBR4AcyZW7xCGhR1vJy1drOkBpXL5MdxVr62Wn1oFjMrXtUZ2VapHiXaB8EH0eCIulVLNPY6S69p4YzynjKdLZNKizMCjYLPMDQBxMKghfWxU+A6EbaP+FcRHFx6Zv75zdPjjj4Yzit4XiQgXhEIENM1r+1sgs1Yma14jcez6Q925Leah1RstcCL/rAbPeaKemNhbF62noQGZ5LxuJcRN96IETsVprBxZjF/u65M1bFioFc+N8KWRSuzDgT8fIbOdiUqOOHmFXI= 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)(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)(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:lT1auea0uMWOCp92PIFMQQ3BwBnS85c1w+uz8bK?= =?us-ascii?Q?jCawzKIM7Jr5erIR+PREDqx1DfYz6qQAYFhFpYyVecTEJ8s0Ptk9sGbCL5pO?= =?us-ascii?Q?XlhUgR5+Fc6nMLvEdIDQqYmUWAnC7f140Wct3a+dX4pwxEpgqMJ4yYb5zW44?= =?us-ascii?Q?5RqEuwNVNvxxBodcG4icOSuPXXZmzAeeEq0GSsAmL6CAYwzL6nlUJtkQpsDW?= =?us-ascii?Q?8jCGMF5mO+/daL/LVjvNUzxDUt5ewVf2JjN3gkDJBNiSrhlmizJ9ulQlji1S?= =?us-ascii?Q?vd3MPT528J3qs4TZFaKsnQBgqjZ6jMbzx2ocS/kq0y5aTruUIrbY5vN13AEx?= =?us-ascii?Q?j8IlgOaxJNujltycMXjHT01Hioc82/ammazcx5/HT/t27ym6GcsiqQxd/ObJ?= =?us-ascii?Q?KM24Qtj8AnpJMG7zHHivx5m1bnF/Ts1MjJGlHBxaE0/R2G2fLz8+fo+C6mIu?= =?us-ascii?Q?Il0Yr0huwWNfUDoScXj7IKkdmqs2AbHd9BDdRaHEWTexFtXmL0Zf9Hj89E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bwJfgxwiZnzmob/qzT7Ki5F92BcV9v70J0l8p6sw2Mkhwm8abtBrlu+wsbNKOBRDQbhCXAEJA5DatbXA8YZEHza67+4jn7FhLMifnqZaVeIJZBi1ZAQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 07:15:51.5182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1724 Subject: [dpdk-dev] [PATCH v4 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: Tue, 17 Jan 2017 07:15:58 -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