From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0044.outbound.protection.outlook.com [104.47.42.44]) by dpdk.org (Postfix) with ESMTP id 45FDFF91C for ; Thu, 12 Jan 2017 10:20:12 +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=l3cCEPwxjJ4rRT+xPvIuxXWtyo1IoknHs3eylvpQeLY=; b=n/DaITU6f73Kx3eoaTDO4mnnUlBr0ShcT6AReJIvr3xvIX6w6IS570zNoubfa7FTqzHN1ZxNKe3VlR0EBwq8TT9dS0BsRA5x1JNKVOFiq/TZEPzNAwS43oz4pMMw1sJ0HwBCT2OkzFs6ua3uZkNpcVR3TIRX/TEpSpW+iYLAGmU= 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:20:06 +0000 From: Jerin Jacob To: CC: , , , , , , John Daley , Nelson Escobar , Jerin Jacob Date: Thu, 12 Jan 2017 14:47:18 +0530 Message-ID: <1484212646-10338-22-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: 38dbfa1d-4e9f-4d37-e248-08d43acc3535 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:9iqJbIWJnWDDeGI3t6WhxPCxqW4b0qBNgder87rbhDJuAsWZCmvGmNzfCMZetcss2truAFd5RxWOvRS+z8UCW0LyJ2O7SHO8ZTX42xl2AihCXNuhJbEgdIkevtdDVt9bGpzSOaoj8z4HzwU1yOeeUXyaz9E+fF801wKuuLq+DJezTQzyRnmbipTBml2uqliSs+zphtakrENlZhfsTvCGwJb/h+UpFECFIcOaCeF9MOTierrAb8jPRON85sTqz8/ilL2LjlwasFkm122DrZYGfg== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 25:9ItT7bc65JTd2W5Ea3+Rxwu5l9Bm6Q1YnZmiuGDlxIfnyBrLak7isZi+6Pfx/Pp2UrhYmgPATs6NhqIEae14yuFWZgQeLN5Ymux8M3o2Ghgo9/rNkaIzefKZFJq0wMBK2++seKx1tyRpYtiumf1QwMBcxPgSkfymq442TwbIHUwm0EyRSExXyvK3bJwj8o9B5DPZBpiO6mk1/kEM/x4+skk6xcbYBhx/C0S73Vq0D4B4yuXT3sh/TQkjr0+GjBSQ8BnjVERUzvYt44PcUe7U1WIQG7DxG/LLjHZJTPhVw9cxM4TbiDg7TjCM1DQ6kktU881IB72Qk1ztLULkvTMqxiHT2acqhehUAmHdUdn/k0eD9s4pbOfOdGv64RR98/dIj+BIzvsdTJPgtnYmAin1WGLTeku0Lh+fDfGWGckse6OyI8glO48Xt7xMaU+H5AZxlfkVlxTjWsuB+mfd3EZjLw5WEz/R34aUQQcZeiD3ofvr8B7K5ft5DHjZFrJVPK43z2h135gnDP4cinUp3Fa1PQWJV4hsqvgMs1T4fI0BzBad3B16UjJ6cw9mnzo981Wote0PuAoV674oTrqAsJAzuNpKd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gdnsS06XG9OFq26+52diwC4ZB8o1NvlZsHc1Ik4dMgcGuLnZ6ASLq9yVuiaFY05ZPnkdxJTaqlg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(95692535739014); 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:MMal+KrY9YVTWG1Z7xLrYnRs7xFeNHjf+PXGvr7H8A3X/VhWByXzWFMHYbX3vQKvIFMq88at8XtyzG0+h5BPnkSxeRFEU0KZaIdQWSu2AyQUD21lKbzWXMIupFyqV670C4qCt0ParojfShZXi4sXFDw4tC54aRx6zMUGaZ/CjggbMjojAWFYreHYEhiCJBhDv9wfUgzHHc93K+BgtY6GaCNCVCAo12URBtKNli2abiRv7BDlzJb+0iekLA1bTFvjVn+e/HkR/9z+tgPq8C2EjyPqVaPz3DnwokbHgMp7VXZfta1Qtzoh4iBvFhiDwjDs7gznMdXdzvxoqsREePqnVULUuWuPQc4PhWBgraxT5Tmb/hBqKExETOwkekuaMCRFm5c2U77z38OmWGVPkydN0EyEWTiSBitUxbzr3BZ6IWRqmCCGT1TIC3J2W99VMDVQTlOvAn02YahfHrqXbdndJabp0gyHTQMve48IGtfmcCXRx9Zu03KbPKn94vbC59m5Rx5meATC5zfOpccFzfHrYGerh/XDDI9/C0FIPkk3tUF2L4IFVDguCNPSBvWGMiNry7fFUFaBeqOLG2Wz9nmCqfYNICbfGz+UNxFI3hFXDK3dqkyigny0cKtrcQhsQHkiH+W5azokbiCEOqeFAt6yDA== 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:l3Ejg8u+W8EfgfKeeEcQU4urPp+zVaIqzOCO+CL?= =?us-ascii?Q?JKRfuygj0a2Yj0FCdMKMU8VBSlQhjdCWTyuZz3JzOCTKZp1apMoudg/DBMcp?= =?us-ascii?Q?b6m/CzSErbrgBDLcZpSKzgaoMSmDLprzSSiXrGKYcCGggAHUyADy841hOfdW?= =?us-ascii?Q?3Su90Wuedle//wTxb2W0frIz2HfiZvCdoNqxhYJcdq5GRKih0i2+mOXGrF4H?= =?us-ascii?Q?9ipHg5LR6BY8eihAagNJv8DzIIUop10T4pee7mE/Qdr6RREWeUuhAoQ0FWTy?= =?us-ascii?Q?qiLHiskyBIJ9YxWQmGsTBMU7rbn9eplNYBAH9ZCN+wIbX1DdBW83Lt9p09qS?= =?us-ascii?Q?3WHmAeV6EMWYPU8vIGibBKAHsoyBLxuGELcb/F9FPGPFNGIQO11NJJnvl2j2?= =?us-ascii?Q?YwU829skIC49ARi8PtDPU5pfYVLh6NViIoKfJ0W+4QHZ3t1auRoDBSnc4ndu?= =?us-ascii?Q?ssnnnDQj5/0vP2Q9iuUDxeo9nre+0+62KWyuMjMEs32cR+yPb1DqdDRjEsQp?= =?us-ascii?Q?qXQ4MGKnXJn99AI4jeheXV5QZCvxNmo8xXev5L7ge7ZmScTsHh35gHbGHIOS?= =?us-ascii?Q?PsWKpj4IcMuxkrsb05IJPaF/6136kM5581LQmf83ztzQ5ny2SZwxRXprLzNq?= =?us-ascii?Q?Vl2VX3Ykn9+CYglM+o6pLB7Vv6TXo6SDZL4GOWlH+zXRQWA4bckk0rhzSC/0?= =?us-ascii?Q?omvPiC0ifwY2Zwfj5aZC/YKe1olYQd4y3n8w++sETQGajyItwq6S1EQ6nAnP?= =?us-ascii?Q?RL1+oHeqMAjacymzpz2Al7X7fW6AJ6FaL6cXAZRauozAlJW8gNSu9Gpyt69L?= =?us-ascii?Q?72SOnYjRVmP+KM9zKNMsnU6FQ3brhfX/+5WVTWYQxigSgBvrgety0a5V6vf9?= =?us-ascii?Q?QZ+tJESkmgoFcTGXhZ+PK1TzHA8bgwzmPPI9jHr/APbETbHTnbh/bmSxuaCM?= =?us-ascii?Q?Vmr1bFGNGh7lZGLt9t1HeZP2yNJh6Fh8M+VaTBGQGgOK1Jvmjuus4W1alIhn?= =?us-ascii?Q?cAaII9/KOC5tCps5tCChDQMYmqoM3LsmAl1IXduDWl/kicmravpoXaaF4CdA?= =?us-ascii?Q?WNy86/ljWmDlFaPew/zl0N0C7ZwUt6mk2bGDKROfS4p5QJdhq22vw6qZXZa4?= =?us-ascii?Q?6MaAuZRm5pek2ykLSB1Rlo1T9+pfx8BiY1CoPBgFEraZnGqXekeQf5faXnS7?= =?us-ascii?Q?KqyKz2G7PmW3DW3Nq1cEtMi8pi6slvLWL9LRm16HpxtRZzRgwVPPGlNoaZeU?= =?us-ascii?Q?akZKUR8u4lCrUlR6VmDTQInepRkmmipVNIStSxDI1DCjacgFtyw6OO8k4RvV?= =?us-ascii?Q?q9cKeb6YKtZq8V+/IO4rgKO0=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 6:uT01iu76h+nak4R7KdIKseJ7ktmK5WkFPzHV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aWkEOdPxghe5dxcfpPbFUbGofzUottZ9J7yWP3JEu9SFmplcIZnDL2V94kUrdZ5/qf4bx2aIPWF3RDzV+H0ShGSNocsHn7UvnJW46lP1PkdR7JZclT2v5F8UTHZJQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2017 09:20:06.5045 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v3 21/29] net/enic: 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:20:12 -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: John Daley CC: Nelson Escobar Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- drivers/net/enic/enic_compat.h | 27 +++++++++++++++++++-------- drivers/net/enic/enic_rxtx.c | 9 +++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h index 5dbd983..fc58bb4 100644 --- a/drivers/net/enic/enic_compat.h +++ b/drivers/net/enic/enic_compat.h @@ -41,6 +41,7 @@ #include #include #include +#include #define ENIC_PAGE_ALIGN 4096UL #define ENIC_ALIGN ENIC_PAGE_ALIGN @@ -95,42 +96,52 @@ typedef unsigned long long dma_addr_t; static inline uint32_t ioread32(volatile void *addr) { - return *(volatile uint32_t *)addr; + return rte_read32(addr); } static inline uint16_t ioread16(volatile void *addr) { - return *(volatile uint16_t *)addr; + return rte_read16(addr); } static inline uint8_t ioread8(volatile void *addr) { - return *(volatile uint8_t *)addr; + return rte_read8(addr); } static inline void iowrite32(uint32_t val, volatile void *addr) { - *(volatile uint32_t *)addr = val; + rte_write32(val, addr); +} + +static inline void iowrite32_relaxed(uint32_t val, volatile void *addr) +{ + rte_write32_relaxed(val, addr); } static inline void iowrite16(uint16_t val, volatile void *addr) { - *(volatile uint16_t *)addr = val; + rte_write16(val, addr); } static inline void iowrite8(uint8_t val, volatile void *addr) { - *(volatile uint8_t *)addr = val; + rte_write8(val, addr); } static inline unsigned int readl(volatile void __iomem *addr) { - return *(volatile unsigned int *)addr; + return rte_read32(addr); +} + +static inline unsigned int readl_relaxed(volatile void __iomem *addr) +{ + return rte_read32_relaxed(addr); } static inline void writel(unsigned int val, volatile void __iomem *addr) { - *(volatile unsigned int *)addr = val; + rte_write32(val, addr); } #define min_t(type, x, y) ({ \ diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index f762a26..382d1ab 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -380,10 +380,11 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rte_mb(); if (data_rq->in_use) - iowrite32(data_rq->posted_index, - &data_rq->ctrl->posted_index); + iowrite32_relaxed(data_rq->posted_index, + &data_rq->ctrl->posted_index); rte_compiler_barrier(); - iowrite32(sop_rq->posted_index, &sop_rq->ctrl->posted_index); + iowrite32_relaxed(sop_rq->posted_index, + &sop_rq->ctrl->posted_index); } @@ -550,7 +551,7 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } post: rte_wmb(); - iowrite32(head_idx, &wq->ctrl->posted_index); + iowrite32_relaxed(head_idx, &wq->ctrl->posted_index); done: wq->ring.desc_avail = wq_desc_avail; wq->head_idx = head_idx; -- 2.5.5