From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0060.outbound.protection.outlook.com [104.47.33.60]) by dpdk.org (Postfix) with ESMTP id 17D6FF96D for ; Thu, 12 Jan 2017 10:19:48 +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=NhsWr3kKpT/zNrMZ0nEk1XZFC36jiucxc5b7kyQkuVaLiOPzGC07xjdwUQdDJ/+i613ohu5isafWMvStr2AjsYl3CC0EORVssK9SHbmV3RFCa8L7awezwLUNZN3ok/tTICRFmD/gMbBhYSCKz+dK0MoRVGGk4WsnASrHCVbHt5w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Thu, 12 Jan 2017 09:19:41 +0000 From: Jerin Jacob To: CC: , , , , , , Harish Patil , Rasesh Mody , Jerin Jacob Date: Thu, 12 Jan 2017 14:47:14 +0530 Message-ID: <1484212646-10338-18-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484212646-10338-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: BY2PR06CA0007.namprd06.prod.outlook.com (10.166.106.145) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 5d9a6a9f-3411-4ff4-d0ab-08d43acc2701 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:u8amE/VZ2ZedFhXEYyHc9nWgvOu6TJDOyGGgQmIh9bseqcFC6+jFwLfSs2OaSpyZvchxd4gs9pTfgeACWWbwDILv0zUXoUJQnVxJZwoc+bWwtbAM/+DKPSMv4LPRnA5aq2jivPMEcfzoBKwjYvfU/Aw7RoeNnPjt10iFjZkZptW+GXtV4H3hoKRypV/vSW7zC9kjGjcgFibxvg/NM2DtehfjcC0U/WjngiBKfQCIMyotsxyTxwHTq1My20N+T3ebNfJFiWoqxFSeDH/MkDPyDA==; 25:eSO/SU+l8Uf2CzaFDa88bIBnKXr33Zl9xJ2Srbi/e020DXNym8AaTWTk2zTRVmhz4VPdcPVY3O6exiAWM/2bEDS3K0bFee3sWSaGEzWVCmVAm8fi4johEYCfpnCYuxkdkZuTklvRKNvhGiF0MbpCifHWbJxpkGbFop2W9KCIk3Pewuzo72c4DIOfICZfZIuDV0YDIYsUif4VXk263YoXvPtQVYK7nutEhBIKR0DOFSzcf+4K0edDZrn4TVs5VdGsrF8u5BhRqbqwqJOVOuHOLRctEsF9cKWcdcmQY2kV/DpnrsoUhN1WXasz9WtJX5GHej2QIdO3gYDEPeqiDc6gLyQlsMXMLUOzi4N9i96TPBa3Du5m5FGbzrdWKEJbDjsK7Brc4f+CFXu2WJqFVXnnyBEvMk/iIDW1kMf6ol2H4rQtjVuscDReqehJ9l3Ka9LzNDfdmtV/v39W9PYBX8zJcQ== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:dn0EjaKV6MhERVB3fTQRRnVE6j+lNB0I+TjIDVGnpzVwGMwybN4eO7eu2DZ4Mrj7Jdhs/oN5jvUhwxCY9R56ZllT7J6oQinl62XEj6NnAFjQs9UahFoqR5SwPlAoMWd3eET0c/TbwM8k9kFkxVRohlNR2PAs3+Mqxfz85WVnNpRC158QfhoLgLUwQkzNbmTNNVLCwDZMDAIXpMkXHDOK8ij6dhUXnCxDr3rjWuCJ/bkDnb/PiYzLcw1pzPbKgYZBuc+iYQwur4oWiv/L15/PaA==; 20:gS2OZrSXdJAWCRRzH4kto7O7p/0SCBzbd8dODKOPeeM/ciVAE6kSNMzVE2RgyBVAFo5Ov7Ar6R6tD+qDzOv9xvrIevt6Jhg9i7ruB5zAO+JlvPFcBTaW7CJLaoE5aOPLv/xyhz3jTEFsEJ0+Wwz9rGFIk/MmvPIKHVbXqERy4VsRVD8865MbZz2JTzw1BKo79Z5R+6wA4bkl0jTvh3FA35YIH/g+4ozmP9UOR/EBuPcoiuErbqsVH+2ISKmDrZI9hBdE9TNiI0VVZwsHrHIfJf8WysmgdQie8Fr8WmVbLiSJf6OIELsPswd3CGLEcpXLKS+/Axw43hd1Egll0u58nwQef5XfFZ/eg0enPK0SG3zJv+ziCVfXS2fwGU5es9ZKJVWJrPDNlV70h/KRsgRRMRtp32GOA+XLTbOofxUifntIPlQrxAtO9pXyQT0DsOuzAA1J3vtdhEw2NZsfl3WP52nalNZ9ZOo6YBhBalChVggx5pxMKrkfyWTxaD0BVgBYRJzQqNLXwQM4NO52qnVUvNgd4n5r6eID6VG9ql5E9NZrCoiHQ52cmPfAVDvNz9GfckR3xbqNSup1yC3TOeTc3FFOjdK78yFb2FMW41ntlWc= 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)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:inTXNMFuG3ZZaImzAckEetW8yT4U9KzeFAq406Py/spVMAL1E/Y0KduoC1woPbYnAi0GntX19ljgQyqQnikzZi9NdaUhT9suAPdyP5V9XUGyJpjQo8OaQM3nVyuzdf74KZw/hVX7bsFcYfr0qKeA0jaf5jTpY9rULmcjvkiPLfxb77GBjAHS8yd1XLgsMbr9Ukx1FBsqaPoX+ajkhE3k39zAEi+n13ZlCxFGfJg9eG3x8LkKVlfa5r0ov94j//BC9r54CPqUGNYFxx4SRk1jE98WWttQiCP5ZAlzfKHGWTQYCWGcwc1xDvWZVJDzuDNwx3dJggb5/fmXlY8enANA1Xyd16KuNWoKEMi6p6va75Y8InYUX7xfrLHYj5BM/epv1dMnoAvlbtOuIH1z6r8IILK5h/xsq/uImINMzjUsiiadC59ee0BJrMabOcEsI7zpqXY/Mjzl4zGKcAUZc6KYEuVL+vSdX+owxSDBF5RY8PQeQJWQKHZAJJiN3GmAMn0/nxaJg5QB7+V6iRJXkegN4Q801/N6joUusHJzzwuJ2cVXVW+hQY9wkt91Bv3oCiTWXWbVXBcjQNyLMUawPhB/0kFJvEaaR6i8J16q3HrEH7U= X-Forefront-PRVS: 018577E36E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(199003)(2950100002)(53416004)(76506005)(92566002)(105586002)(69596002)(2351001)(42186005)(68736007)(106356001)(42882006)(6916009)(305945005)(2906002)(7736002)(50466002)(48376002)(36756003)(5660300001)(110136003)(4326007)(97736004)(107886002)(189998001)(50226002)(6666003)(6506006)(38730400001)(101416001)(54906002)(33646002)(5009440100003)(4001430100002)(6486002)(66066001)(5003940100001)(6116002)(3846002)(47776003)(25786008)(81166006)(6512007)(81156014)(76176999)(50986999)(8676002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.caveonetworks.com; 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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:F1APl+HvvDoSQ+knBEOZEyy9dX4+4SO/EqbYYoc?= =?us-ascii?Q?pLm3DMFJMbljaUicD0z9jhBjKPth1cocRdUAnQQK/BZ3KNIYWdDINtzKgGe1?= =?us-ascii?Q?wc3uH35kNFlCQZ8PkptN+UeAYkSXGRBkLe9vrYpppZ423t98AvMmvSViA9fW?= =?us-ascii?Q?AVTgDDqOBkw016xs50KbiM+ydWlyFJxYWh0HeeESY5z3HFCW+s2uUxWHAjiR?= =?us-ascii?Q?efZl/VcYXMIbQla43eiisCS0sUkarA7yalmStATPmVAbyxHlJGGKpV0Qx89q?= =?us-ascii?Q?J+xzo6yKAWKjkyE+8BFKRc4CMNUr11pibdUhroeur1Dx2ummlM6HlmH9rDFv?= =?us-ascii?Q?D/Bd0wnYohFat8CwC7PoymJqsnhadimwO5FFEwkhVZ8T9b2ZW23NA3fiHYYG?= =?us-ascii?Q?9eE4iDz1X2QHKD1pAOQ3WEX4waIjbqNBvtOF06Ri21sfcHbL86oFt0YvtAw9?= =?us-ascii?Q?5QNEaS7DysPNZzyNDgw1ky0mzNluUKPGXgMBba4LbkydJ9RTJY+1XNaAHHuC?= =?us-ascii?Q?jlrtITQAJJdyvCW7cYN6XXdn2xK/GViYX514ITG9OgCWTys2K0dLpXrAC0YK?= =?us-ascii?Q?NeiAth5/j60W+6i8d1/iJxELDdU1C5LDU2JiUvB8ks2X2hV8vFJ/Ws/E3nH0?= =?us-ascii?Q?JFPQ+oCd1JbyB9k8wWPSP/2GhllUTkglVfnSb3YTCjUAqlTwDZ7DXv3mc/MV?= =?us-ascii?Q?pG8ux1akKVP9ekKWfq9O+VtkpMSl5Iv203l4QGSxc20y+e8zr3vjIGK8+/X9?= =?us-ascii?Q?FgcWAgKO9yDuYbq5z28FcdT+PQarKHQeiIrMShpStwodj5zpVzoIAjMCnXYX?= =?us-ascii?Q?hyfpepTr5htaqGhWWuI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S0iXxY2rXRIfyj90tuolrgNK+Uja/U6P+rP2ZcV21Re7d7DbksnWBzXR1c9YmnRAvcld/dPx/wuxbEsMVyL/BYH+6CQeMzodHgb1Hv8kKEcZvAPkzD0ilVpJhV5e7Kt2FZU+NQ==; 24:hXTqJ7GknvqbeIYgIEbxsv4dNKCS1SDJYYoQ08FLrQdjWUzWn0b8oHaiEtZcy1mzl3KMGV59UhX6RUiUzAANnjVZm1DiNF/oQUNKWoOqBRs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:OVZ0iRwfqB0F40C0aztmBoQqg0f8XFv4xp6QpEdHxQbslxBI6G0W6LHDhhNvvJRkhqeJZJa68J5SuhZeznjBcN5UpP3hxBBcQ8xhpc3pSl409TXi1htUBIjXSaLq7nMpJ5Wr1mjHTeOm35HuXvTSh47TEn9OCvsra4TYOST9mINnS93DXMNlpjuUIDbc7BRkiF6drnxFiD1W7J1/zJDXyFtlu65EzMiPcWO5g9cOdpt2LVMMwfM+Rlb0memclX3ZSCX+R9lJ9wV7IMvNrrIrbqan4vkNgBfyxbIRzPPusVnq8uVhTaLiYg3O8tWDVztyTNOKxOWQTRJPL1WyjxG95/rZ9Tr+SgHP2KOuaCmNb59nZjEjl5eHgHu+z2s/APLhiWkci5RD5I8J9cev2sDNN1vWasUvxuToj8/dhJifeCxPggha6ex0mzKzV+WDkaNV48JLZUD9fkIZeD8C3YrVeA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2017 09:19:41.9444 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v3 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: Thu, 12 Jan 2017 09:19:48 -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