From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0078.outbound.protection.outlook.com [104.47.42.78]) by dpdk.org (Postfix) with ESMTP id 127BE37B0 for ; Tue, 17 Jan 2017 08:16:13 +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=niQt4VUU/G98nA2p+MSX7iSgkm6hWH7m6iRJ2UBfXRRUK1JeYU44yP+ypQ9ocE+QB1pDThLPaoPOToUFBIHsfOnoVb+UwXhxO4iy9/yFwnPGcvCFAxbQwHI9quMftdsK1T9tpxAaKZquCQQgW9tk1sK5K2yHU31XsnofcLVh9ZY= 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:16:08 +0000 From: Jerin Jacob To: CC: , , , , , , John Daley , Nelson Escobar , Jerin Jacob Date: Tue, 17 Jan 2017 12:43:56 +0530 Message-ID: <1484637244-7548-22-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: 4fea4dfa-4367-4fec-785f-08d43ea8b75d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 3:QtlDJY7wsOwRdu2a3fYtL5P9QcdQYicAGg4Q0Y/OKMClLPh+I9A7RJ9LISYBzYdgXVmGHVdiStAk+sRJZayRtayc2t+V6qiFHy8GpytlckeXxzk75wfm2h4T6jEIL/6ZShgUs3YNepaY8xCJsO86lrkuqw9owxIGlaiKrLA3C1elmAd96E/Yz22FrXrW3mDRJNNdNQ7XWaN5vUcophxaVVKk2sCjJYOC31jQXJM57bTMsDJUQ/Mx032KylsI6KSZPV41sDQ5F9FHDI/ZY1QWRA== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 25:voMSBQBXyfe863247FH/sxIWQhTAUuZJHNOHqBSzYgJ+QeMATPVtKNoqj80ZjTOssvW4FC4xNEO6yF7gF4zFM2NLk8DzR4pvQ3Y1A1lph1OqR5/8FY+5jQ7SlVJ8McV41im+6WMN5NgA8VF7x8cA5oVN3rIee/tvD858BH0Tr3tx7e7emrQOvB6DaN12hagkSj2p94xutsCzZrQ+JlbUNH0SQqa3gRrTGbUfEFmRIje1ioc1rVCwiuyIzxe5zl9qQtlDyCcgNIPtD3WaSnZWls2Z+yadoMC0AaYsRowGJyapqbbf399WG+8UsFyQQkEqb5sY+npkWbVRHFfLmr6E5lE0r5D+0np3z2tDWd2p1LVzHlEQ//0JbizbxhviTj53elnVnJz15KzQot+CSx2Rt2lGE7zJV9NpZgEq+z9zt6QdrVBY+h3DAwZP7jGJrzya+8yV+s19+noR8vGAK8M2OCxLbpSZqRkovu/iMiK9sq3CPuf6f6e6ZbVnVc4rPYojbdToqexq4FlFrtsNmMabkF7wMugHRLctEQfGLchL1HifurFSMlXRu0zzi6L0AHGxWZLzDzDiSdZiZdfurL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pMCOEZKAspvkfOlBQI54gywh3J5VDAJhloGQDefrWhBGrtvpONzdnwkUcgjUienInTztjgClsj4WCqHcV5xPOav0534o5nvJP51S5xx8I= 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)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:BY1PR0701MB1724; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 4:ldru/exi8ZnEf4Mlm7tXrGsfSWYgfFSN+nlPcaJkCjP+4vcYBY9IDcjCqO0kdtIVOQ23MhEpbRfzQAU7oJ46UTdxJ7irXu0cQyKAhhKPZWfwXTlIOiavaowYVGoVj54Woibz9SZiNXiJgRktaMt8SGEt8PiTJAlcnNUautJUgbVEGEgVyh1QDaaLbzjNLAqSA5J2zj+5GlrBGceiBXCoFm8zEF1W/h9Iy9qx5xinFaqtRtD1sM+J14+yQAJRAbSIfTBjSZAKmCnxyXq3mOIV94odwfQYiOrDhJWCNiCWG5lG4/8tDHoXjE8ATaJ36BpuZPimCqImyiyi9RrwnfPZyt6ecvi1NvL25I8dw63JEzoanCe0bPkXHsyh3Ay+JaHovYh3a7WaaF61eCYvaEdEvXSiDp8vWVC8PeTVqEKMgHrNdvxj3x4eTEqvcuq8vKVtXDBDWaeg6DFtNsmWcNDO5XLQloqYuKHyLtR/Z60GfvCngqXKvYXDongGrZDRpIrJnrDKyqqUEH9tMVPaYMWBPK1F/iDHzWHIELKWCCoCuXt/f9YY/f2WpnjKi0ofKYM4xvuuy2xyakHu0/h4v3c9tw2W9JOrS/DoQWZ84sicos4wwaSuO/J3ZzjHZhHAw82OSt0uKx7kE32YK+gA5UXXdw== 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)(6666003)(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:NvLQWgvBY48KmLJDapD1CM4wV/DlJoGDufDSUAm?= =?us-ascii?Q?CC4CnHt0ckeUvEahrY1KEssNKB5NY56Tw5JqOD54vZBVv6bAUSge8PrEX1O/?= =?us-ascii?Q?tDd7VA4DMYYT4hXMUo14RX5vIJhBglKf5F8wDIJGPv9QF6dx4xZfYeXN+R1a?= =?us-ascii?Q?KHhSxQGp4OlvQJcYOL9/SPKeJQQFxoJzf2hIz5OWGV5A/pGuJ0LktCttm0Hx?= =?us-ascii?Q?gi5fi/ut7+3EpS0RT7P10NQbLoqjOZajdw4jr3zupqahTrcIXZegBEgh5Tdj?= =?us-ascii?Q?U+KUWGoamRWJfiEZOu1Qe6LoSfpiRqPl3GY8KGhBFSq+TroT9BV2em3lr7aq?= =?us-ascii?Q?n7c50llG0PrMHrF4nir4Bcb+38XS69yKqjD5/yBVcVztNRvyUK/7kQFOMOmH?= =?us-ascii?Q?8feqvzcNQ+fgvceFmCGmJkq/3Le1ChWFkxI/Pr88IQkPAc6rGGXsSS8IZMAD?= =?us-ascii?Q?tnDyxUqLyM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YozLVOh501R9/AyickNn9maEeW+dsSMVNDVY5X34T3yO0dTXKtYNdjooI1m27KvuPcsol4/oCvtxVY2mMHYHgMkHTkk1h2WCsC3L9zt4Fu/0W4FMxejuqjiGfuE2cNQeDHWN2tkv/4jqfVicVzISI/3YOmK91jW4IfsIR7huZ8lQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 07:16:08.0366 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1724 Subject: [dpdk-dev] [PATCH v4 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: Tue, 17 Jan 2017 07:16:13 -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