From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0081.outbound.protection.outlook.com [104.47.33.81]) by dpdk.org (Postfix) with ESMTP id 2D7BBD4CE for ; Tue, 27 Dec 2016 10:52:41 +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=fA98RHqiLOA6sYewIk/wXtmNjxazG/S1ppPNsdvd354=; b=WVJbnyUavQYeanmiVEZMdNPnGvTNDn2rDXv+KNyYsF9vKSQFsyv+sDHsrp6o9C+WQmJmXaxazbCAerz5uVmLi/Z0VFd4UjjUHNHO8Lc3GbEMIrDttPkSVOBzlT8HarSNcfFdZSpOYrdh+7AsY3Tp1o60HTS4A2DrI/bDodstUkA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (202.83.56.97) by BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Tue, 27 Dec 2016 09:52:36 +0000 From: Jerin Jacob To: CC: , , , , , , Harish Patil , Rasesh Mody , Jerin Jacob Date: Tue, 27 Dec 2016 15:19:32 +0530 Message-ID: <1482832175-27199-27-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.83.56.97] X-ClientProxiedBy: PN1PR01CA0001.INDPRD01.PROD.OUTLOOK.COM (10.164.137.8) To BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) X-MS-Office365-Filtering-Correlation-Id: 0cd8fd78-6bcb-47b7-23dc-08d42e3e18a8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 3:6hjFFxTXzbm4sj/CSRbML0n6EEn9aTxmTTs4/Uhzu60PIRVzuKPp/IrjuYkDoEVUBNDfulbblnbycM7wB7yci/EWCNLmC6nw+z0WYWU8Ncx0LL7+u+tF5aXkycSOWgGU/EFmZUGtyjHmhyVwZXQxwKsUWBwaKE7RP5gRBzwL8ZbNa3pHDEUYRGfIlXh5BqYyEYpBU+XMP1v+oXzQLAeTloAES3zkwo6SsNJoFRVLxzZNETJYYtNpQJNHQYULuXrEyiVHqkp99zeULa6xkOJq9g==; 25:5GWg1+vVyIDRv9n72/BJjZcmFnbxgOVQU8CPdPHhtpmNIcMExHr62jln5MGSjJyDal79EsQBYFQkGPSuzXu+6/7j9KTDzkI2RVKNz6BJ0kfBQPVTSuxpMeAzE72FH+peQPyinfM1ieobxGQXuFkKa48OZvbKv1wGZraOTkD1HTWQ3tQKUtF75CmN0cZSkt8OQj9OcF+nHoI7GOq6RFZGbpVa2KLi0ABkBYdAxd5DMghau55mTAb9alJlerVxj6FF4uF1+TfTL+p0V70VTVcNS1YgFHcoOuIDpmoHjV+GZgbqgBQ1W4ZIev7gqTb1RJFfakO8J7v3NK41bZjOCBW6c1IMBKVCSbyRZQczaXm3oLm/cyswLOcSozNaWFQMJbd2FpHIwCQeum2biR8j0YUZK+W9fFjtTga354EF/OqIk+YaJBKb7zaoBcQMJbzl8BjK+MK9aL/oH1QogQDQ36JYFw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 31:Hfeo+czn7Fmrq74RSouyxjoPGKaLgSiBFAI/Em4ablYcD+D96f2uw5czp+YV7CYyFXJhRz5nrZJSZA7O3lm5FyYLTpuVkEVxbZlym4wxBQlo/HYIRh0+8qRn6hkDD9g8YmlX+IfwZHD+Il9MP4BmIRlxCFEhOB/4Sby+eRYj4UwbCXNfeCibqXref5rsACWbKL5b6oF7rm2/FQ7cGHzEwh4JD+Dnly9KGT7VgEtlO3hR+Jg4nz2cmznXYEgAT/ei; 20:Tlh0+thuklSoDe3BTwFD4KZwPD1LpQXKVcHtrSYaTTXN/1IzG19OSnNJrzv7F75oP07cexc+NiQKtCCzZiKN73IPmG/Jfu1UUkZ6J4W3QOOACuiG1FCf5H6j9GFocngKweg8OuEkwA+Ax5mpAo0HdEuWyPr7hXfYrj5By8jbLBYqDXmNi0qfxacgja1E63vTmjiifSeWeebRXelnxc9u+yXc8fACLys4cvA4oMCRmTwLFsb1mQGRQnY9FKhLSV6NpaZZsBtohdLMid2xoU3vkxegrb7iG9bNZgSgcHyvT3mLjli6pYlfa4IM8COpfoqklaza71P91LxKvQYWk63c5tHi9X+gmOtkpm4JF0gtUHU+H70lS3/kuql5Dz1xLS/8DSHBvgXImzRW6KGQ0bu6M1Dp4C4C78so4cD54gQ1qMBLmF2PZ7vVRk4bqnxx65qcgxY1E5ouksXfPW6RBcGFB4kFd+UGgNyI4rpGCkhago3i1+8Kr3JIqZp5vvDiM9b3kQqykxNoltRPmjTpOZXV3da9+V4sqhefjW3Z0AaIXUdCAWzDrniJkQnPIsrTx8ZPS9sAWZFLLvqZHZoXAGnKDsS8ydzEWLElulIjD/21/TY= 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)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123558021)(20161123564025)(20161123562025)(6072148); SRVR:BLUPR0701MB1713; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 4:sz49sxH2GwIevQSPcZJ6M1tClLBqqU3kZ1ZtiTY+WdD2LFnhKptbzziyeMBz8rdYSTd+hXDRA4mnp3lClyrZdVC2msHPUOmuCV91P/RdmoVah4LI1a+z2xNnLhlWJKmr72e9FkvFSkE+ZvqBwu0XRtQSnEl8F8qJa6eshA62C9HltNdx2tMCQJ7cQFLl4NxHoGMgPg9KkgCKFxIgJ939Ut46/6KvWaBbDOaaxFM/j757mxzMZdLCXFkXXthcDmELcYoy+FszF1hAVQ38ozXdooWw1s7A/bPoKElDzZ6MT9MsPIxJQQd+Cg9M2qlyBOaPbGYlkHK7lYeTo5Bdl6r2oVP1qUcZhzYEMXrR74XdV5zyYDB/KiporJ37swAsikQQ2Lr3tjXqYZx5Ed9zka8gs8gvoeoaItQpYAM0W/H2ajhXdmV3930yWxv6mvhPiQm2YW56jICtRldVeoy02SckDlnVnsK8Q/9nw77tI9IzcakbrMisn872Y59whHmxS97F4oD+3cGQBeiW6ryeIDjZnK3L57RxojF+QHowQoVk6Ub6Gxpw9//5pQEHUCljUWUs6cPXYPC9BvolGh0f9qyZIrL3jAZXEKClVcH+2EGYVT6DjS/A8jm3jSj2Y7UkSRj9yvrQ6GYuiEJqJAgv9GWd3w== X-Forefront-PRVS: 0169092318 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(199003)(36756003)(68736007)(106356001)(97736004)(50226002)(5660300001)(6916009)(47776003)(42882006)(2950100002)(6666003)(189998001)(25786008)(105586002)(33646002)(107886002)(48376002)(38730400001)(7736002)(92566002)(6486002)(6506006)(6512006)(110136003)(50466002)(305945005)(2351001)(50986999)(76176999)(4001430100002)(3846002)(4326007)(6116002)(5003940100001)(42186005)(81156014)(81166006)(101416001)(8676002)(2906002)(575784001)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1713; H:localhost.localdomain.localdomain; 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; BLUPR0701MB1713; 23:7j22uzsOueW6r8y3PWyN6WxW+rVz21viOpNuM8Y?= =?us-ascii?Q?1/QDw/g3+n0tTkfE1fovIS+SF7mIMp88FUCtFc4s6AiE+vAYqf2B1x04YyLo?= =?us-ascii?Q?qlSWvI2FtS3m30++c0XE5dLALOvwRbmwg2foOyrDojQQGu3gzg7zANdQKpZT?= =?us-ascii?Q?Tr2Kv4EJpbrG5gxJIfHi/MkzkT3y63t1rGEdfoFs+yO9GloqnOnkWxuStz0t?= =?us-ascii?Q?KrxxTswRb/K7Ov6YMGFnfbnBSQCDZ3BTaBbyN5GZ5PRWmbg3XAXPVCndbZBl?= =?us-ascii?Q?JsD0vSMlkszCRypniaFZY3iVnc0Yup4W+ydv5OdVx+waQvG4fPMte+8M/jd1?= =?us-ascii?Q?QOtQAy0B/K+eu6P3zFiUHv4pFrhssjnBxOO6Re58uDfm4SbCYON8m11erzAY?= =?us-ascii?Q?3TWwLCSMz4uZ+Kd8Nge+r2pGCMo/wTryt2j6287R1vwzoHLdSnGb8fOD88Wq?= =?us-ascii?Q?M9GDd9NGV3wXgi1TWyG5zQ3Z9BqTtwqW7v63T/OetC4O7d8QCtB5YOFutIf0?= =?us-ascii?Q?oMyC11oZG6yVeBOqcAXEWIgyLX5+yz2MO66ls5kQdQNLWt3Wlx17Y7NIRnHb?= =?us-ascii?Q?x7OsgXwP7nKvjSaNyPqHKO9mHMyYI+0zUbMpeg+uVoJIxIiJuoK+uaQg2ELK?= =?us-ascii?Q?RkX+RYNq4F8BNGRSbgFpXBV2wSJ9z16ZqaaCVOJ5/eXX8RC0stMxLwDXWXs9?= =?us-ascii?Q?ZDb2HJqavLYBH5A3y3MKVPacq5s8ImMPzrbTfyN8UFkrnz4m8VTN/IaP4LhX?= =?us-ascii?Q?1EgiCL0x4vnf9PZvjAucWCuHmC6hMJKDVZodXW6PoGku92NZaxhJW1WVEoQy?= =?us-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C1K6sqRE5JDqMLF5PtDMVcMzWw==; 24:bsW2lMYiHQUyBrxKUHVDIa4o7zqbvP/lG45fNY9N73eKh/rtm1ZB0G34Iq/hMf0YEiOZIU9/zPVHwLg0p9dl/fgfL+uIzpysnKrjKgqtm/k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 7:/WaMgfdlU22PgKG2SHMUjTpTZeWtZ77A7tjh/+Hw5ngOczzji0LPAcfz7BiQi61GhtPq/t7itKf/CHSoSjxCqnblaCUr5o+9w+kWAgwmQLVjmNnt6+cdhUXjeGIZRJJNosGpxmqrPQmPNrfH/TNDxUkV8mlqlyhQKoTmBvBZxpyUAveNRdnvlZq4iKjyqPSvvOXAUehcWWbz0sdYvZswMfHe9HT/EXs47dbFTQdHHKFCLschFlFX/ymvERdDf5aR+MSR5li0DVNOy2aIVqc/hzg40Hn7EZoMP6Y7qJ3n4IBDcAtUvCzJKZ526EwcVzUzLaVNP1F76kGZs8cYIegjx5QoAZY1S6mlh76c3Wuoowj3iQdtdS6sHdAz8ZRxWr5bT9m0/7x67ObR3lB4h0j52YwK8cJdNipC7a43w6OzcubHCGDfnMJ0dUMcGIJ4cNoeSM0Ry92UPvinrrknMnzGBg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2016 09:52:36.9264 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1713 Subject: [dpdk-dev] [PATCH v2 26/29] net/qede: 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, 27 Dec 2016 09:52:41 -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/qede/base/bcm_osal.h | 20 +++++++++++--------- drivers/net/qede/base/ecore_int_api.h | 28 +++++++++++++++++++++++----- drivers/net/qede/base/ecore_spq.c | 3 ++- drivers/net/qede/qede_rxtx.c | 2 +- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 0b446f2..33d43c6 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -18,6 +18,7 @@ #include #include #include +#include /* Forward declaration */ struct ecore_dev; @@ -113,18 +114,18 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *, /* HW reads/writes */ -#define DIRECT_REG_RD(_dev, _reg_addr) \ - (*((volatile u32 *) (_reg_addr))) +#define DIRECT_REG_RD(_dev, _reg_addr) rte_read32(_reg_addr) #define REG_RD(_p_hwfn, _reg_offset) \ DIRECT_REG_RD(_p_hwfn, \ ((u8 *)(uintptr_t)(_p_hwfn->regview) + (_reg_offset))) -#define DIRECT_REG_WR16(_reg_addr, _val) \ - (*((volatile u16 *)(_reg_addr)) = _val) +#define DIRECT_REG_WR16(_reg_addr, _val) rte_write16((_val), (_reg_addr)) -#define DIRECT_REG_WR(_dev, _reg_addr, _val) \ - (*((volatile u32 *)(_reg_addr)) = _val) +#define DIRECT_REG_WR(_dev, _reg_addr, _val) rte_write32((_val), (_reg_addr)) + +#define DIRECT_REG_WR_RELAXED(_dev, _reg_addr, _val) \ + rte_write32_relaxed((_val), (_reg_addr)) #define REG_WR(_p_hwfn, _reg_offset, _val) \ DIRECT_REG_WR(NULL, \ @@ -134,9 +135,10 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *, DIRECT_REG_WR16(((u8 *)(uintptr_t)(_p_hwfn->regview) + \ (_reg_offset)), (u16)_val) -#define DOORBELL(_p_hwfn, _db_addr, _val) \ - DIRECT_REG_WR(_p_hwfn, \ - ((u8 *)(uintptr_t)(_p_hwfn->doorbells) + (_db_addr)), (u32)_val) +#define DOORBELL(_p_hwfn, _db_addr, _val) \ + DIRECT_REG_WR_RELAXED((_p_hwfn), \ + ((u8 *)(uintptr_t)(_p_hwfn->doorbells) + \ + (_db_addr)), (u32)_val) /* Mutexes */ diff --git a/drivers/net/qede/base/ecore_int_api.h b/drivers/net/qede/base/ecore_int_api.h index fc873e7..a0d6a43 100644 --- a/drivers/net/qede/base/ecore_int_api.h +++ b/drivers/net/qede/base/ecore_int_api.h @@ -120,19 +120,37 @@ static OSAL_INLINE void __internal_ram_wr(void *p_hwfn, } #ifdef ECORE_CONFIG_DIRECT_HWFN +static OSAL_INLINE void __internal_ram_wr_relaxed(struct ecore_hwfn *p_hwfn, + void OSAL_IOMEM * addr, + int size, u32 *data) +#else +static OSAL_INLINE void __internal_ram_wr_relaxed(void *p_hwfn, + void OSAL_IOMEM * addr, + int size, u32 *data) +#endif +{ + unsigned int i; + + for (i = 0; i < size / sizeof(*data); i++) + DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i], + data[i]); +} + +#ifdef ECORE_CONFIG_DIRECT_HWFN static OSAL_INLINE void internal_ram_wr(struct ecore_hwfn *p_hwfn, - void OSAL_IOMEM *addr, - int size, u32 *data) + void OSAL_IOMEM * addr, + int size, u32 *data) { - __internal_ram_wr(p_hwfn, addr, size, data); + __internal_ram_wr_relaxed(p_hwfn, addr, size, data); } #else static OSAL_INLINE void internal_ram_wr(void OSAL_IOMEM *addr, - int size, u32 *data) + int size, u32 *data) { - __internal_ram_wr(OSAL_NULL, addr, size, data); + __internal_ram_wr_relaxed(OSAL_NULL, addr, size, data); } #endif + #endif struct ecore_hwfn; diff --git a/drivers/net/qede/base/ecore_spq.c b/drivers/net/qede/base/ecore_spq.c index 0d744dd..6e5ce5d 100644 --- a/drivers/net/qede/base/ecore_spq.c +++ b/drivers/net/qede/base/ecore_spq.c @@ -248,7 +248,8 @@ static enum _ecore_status_t ecore_spq_hw_post(struct ecore_hwfn *p_hwfn, /* make sure the SPQE is updated before the doorbell */ OSAL_WMB(p_hwfn->p_dev); - DOORBELL(p_hwfn, DB_ADDR(p_spq->cid, DQ_DEMS_LEGACY), *(u32 *)&db); + DOORBELL(p_hwfn, DB_ADDR(p_spq->cid, DQ_DEMS_LEGACY), + *(u32 *)&db); /* make sure doorbell is rang */ OSAL_WMB(p_hwfn->p_dev); diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 2e181c8..e1e9956 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -1246,7 +1246,7 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) txq->tx_db.data.bd_prod = bd_prod; rte_wmb(); rte_compiler_barrier(); - DIRECT_REG_WR(edev, txq->doorbell_addr, txq->tx_db.raw); + DIRECT_REG_WR_RELAXED(edev, txq->doorbell_addr, txq->tx_db.raw); rte_wmb(); /* Check again for Tx completions */ -- 2.5.5