From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0046.outbound.protection.outlook.com [104.47.34.46]) by dpdk.org (Postfix) with ESMTP id 19479F975 for ; Wed, 18 Jan 2017 02:23:15 +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=g0o/tvJKHSM46tRE1HctwCgb56lfeorKET+rKlVHTVU=; b=U6Kps/lIeM/84HYY3MaP0dVkXiH2+DssliExnh4aBtSLANIioAzBWWv+hSqbE0Y6oa96MKQMyrDShVszuNyL3TdP79SCedsmF4y2VDC9DOfcP9iUN1L5MIuTbqLwa0S2EHAAabrgKuHYXyKqfBaK5eCIFzM2mVWm5x6ReAAb/cQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from jerin.caveonetworks.com (111.93.218.67) by BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Wed, 18 Jan 2017 01:23:10 +0000 From: Jerin Jacob To: CC: , , , , , , Stephen Hurd , Ajit Khaparde , Jerin Jacob Date: Wed, 18 Jan 2017 06:51:29 +0530 Message-ID: <1484702502-25451-17-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1484702502-25451-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1484637244-7548-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484702502-25451-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: MA1PR01CA0115.INDPRD01.PROD.OUTLOOK.COM (10.174.56.159) To BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) X-MS-Office365-Filtering-Correlation-Id: 914c6c6b-03ca-492f-8fe4-08d43f4092ca X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 3:3oSoPOe7d3jXghoZiJmPk40td5YAY/LmTHc/z3ltxwct54gfoxdu5roBd0ULMm/+cbA91C1oUnC9a+p5yVW2iNan4UEJxGaVeeWpF7K5kOAe7VfJWfy7plmtNIyYIk42n/GBP1eub8kbdSqZaJhh1OmPfHZzAvDhAl/flwj89QkKYzHA/gpqSxfHCcDJhHXniK7apnvvepsjh+ot8MvSP3VB/m3P3tqZszbY8H+VbvpROidUA1+IV+Wym18xFbC5g7PrH20FMi/t9VQF2YmdeA==; 25:os/opnDVsi1bATtrThwwEurKF2WUXN9uPzAfpGXozhYfZvXgRzYg7TwW+w4PsGSV/vvkdO+WgzMCgvrFFBv5uxAfx1rZgXehVsfXoKnljHUJQ/SuJUGH0CsjKNHDE12svHFLp0Ye42Cx4pcpt0YHG6jtvk8RaHW//c4aUyMr381NzBHybnoNPQzRT1icHDAQr/3O3jdcjto8ayawBPGgrouWijT3OPk+MkZCDHg2Myhf2opuncg4y+Xd8qwQq5+FGSOrz///pJmn2ENd5O2sKE9T7gj7U5IzqSdv9BIWioyxHDrOFqycUIkrcQNQoL0uLAVkX3D2tkqxUBktCDlsjSdoSs2CdfmrMf7FX7ohTmhe03d78vncN7/CX/wF8oz96rIQQHYltsa8wsNHaCjtyt+MGchZZtV0FGJ9Bcq7ebC/6EvjYb/t15CuPpdcYXxMKis0Bu991MsJCsD5nwdPng== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 31:j4/2cYaP8j/Blo7YxCxzM6PGfLiAYDuPtHqlv9N5/ULOPLN+SQ+LO94Lv6OzkVTF6e0wb9bWJSCmkE2sE/NqQdfwsFMV8wEePbZVZPlWYt+IMGdXaEw1F/RKGjEmwEcGlBsG3ngmtAq561rFiYXsKyJYFwyyRsv1iOs9AdqLClCJCuF4xR4iIiKRHR1SqtoXUE+kiUkzFfq/WJkjj/0kW/FppEiMLjeDN/c/jGIaYBi28SuTDwL07ahIPlCDNjz6; 20:a81fu4GsWTIA0bmP5uoaTAgwT6rixeCeJziD8yEGSjbH9IDSNF5c6ARDo6rqDtZ8w4kU16mMgGnBdKJGY2Ri7eBr3pv+WBwdUYrHifZvf2AzeFyH+9MbObztg/oiW4AoXxiVARJdWbFWu48NwmrhZRqJPlMRYj3wUtvA1ISqOTLZ4s1Raff13q3JulHlFF9TXjL/XH3UedeW4i1Fz1EsA7XSmXI3bGul0Wtzk5007DA/JSwLbGK5DcgeZSCiqgLwGMhi2OeP3I9GFFZkDBrlM3yazKLfns9dQO7ADcTnOQXSBnWsfKxgel6k01FgAlI1jXn3DlIZF0NCLVislrXiyHqZChR0BzXEQaBuElfL9SovsuNcaarQfXIth8tTjN1+C86wQKKyEydPDdEQYhWjLaFtskE5R61mmt84SFBDNIizqIaZdKNEoebX2KfKHXCm48N7RDhCk/l+q8bWPKNC4IF33l7czSTi55zmS0EjEObN4gX1DckgiUb1vN/wvAC3k6ZzgWuNGj7zMFDhr+4ynBwzcTq7jVwxvSQ1PF+yVKUYwVK0zZwbQcSs+jouxCkEtT4o/JQUrPVwq/hd08NLsz4a9Uhct54h9hErC8UxMNQ= 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)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148); SRVR:BY1PR0701MB1721; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 4:itAgacnzmmvLo+z9O4m3ZiQUE8wiExNIaaeupm57Ijb6VsAAyv9YI7M1rlRyz3gp9wJhOFQQgQ5BW8ioMWMzBHSu9HCxl8qamoO5ZOibny/R/Gnvg9N7i9uQ2ojhg8SwHbmD8aRuhjxUqibI6KXZEAUf2PgMs6B3Xj9mmCadqJ642tEMIZfSA+6oDgWTs08ARl5qx48ozxIapvEGIFLAyaAC2L+k2hb/BTtYLhcxEYTsBz6iAFQjls2JAsNI7igYDq38V3gGF1Xp+SKkJSYobe3Vg3ElFNW+Bk79p0+jsUx6JkPh8na++NrnzrYpj6hIcfYKaGyFDgN5p1PKPRHInZ/At0HlnUUY9SNsN3T/NUossRNtYO349eCOl65UljAMgIi59dNhBT+FVhcaQTHLsTK8xksehptcIWJ4J8mc/cYPiFbudgKyFJ8LaAFNC4S+XWeb1MZZypw2vrDHJ56Vf1Nxg7gkr+wyHfeN0J5MwBsliLW5i/W3bx3dmYzDMqZveQoa/lKSf2fxCt2G1ExNxt1LOjDSmg8CRez9c+0UAQYIk/8/qrGXhw4ue/lKL9zbOuaSL0B+0fDlxvcnqd7JMzEQ7MSfUSoBqXP4Sn4jt2a1/HF0OVMzawdFHwnMkPx7 X-Forefront-PRVS: 01917B1794 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(4326007)(6506006)(50986999)(97736004)(47776003)(107886002)(25786008)(189998001)(54906002)(66066001)(92566002)(101416001)(38730400001)(81156014)(81166006)(6486002)(2906002)(42186005)(53936002)(50226002)(8676002)(2351001)(68736007)(305945005)(53416004)(3846002)(50466002)(6666003)(105586002)(33646002)(6116002)(4001430100002)(5660300001)(6512007)(48376002)(69596002)(76176999)(42882006)(5003940100001)(5009440100003)(36756003)(7736002)(110136003)(6916009)(106356001)(2950100002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1721; H:jerin.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-Ex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TaTSsxnlMwDULbb3DvN5JZ0Xm3KFqcPz2EAS0LkAwBsQ7VqAdI3+TzJltndzacsNemm+PI7LfJWQRhZhL41bkP3D2Ra+R/g9ThpdeOciO88jqyjhuCd8t0qQzhjPYJI5ysGYL5O/j/hpUwWU=; 24:7jjnrWkzavjcvMeR1UINY3DtvsRB7ZsjgQrjikstznrUGmDf1a12bMmgneZocOYvDkATzsmeBj/DyzdAAMjIcuqStLzf68R8Aqad0AMTfJo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 7:UzGu3o63TxTFqbF0iuq6z5jzoBnPyKiuyTJc/gqeMTpNsozoRfm1xp3zRPw95GN50xmmrmcKSQqO+zsrzXbl9t2J00MmYlONhrggez6ta+mqiTWlxbE6o5y0mMkS+FIn6DFDuHZ1ZZqQtxo0LqokfGH9NmfEprAbpChHL5j0yPTTkWd7H/Megt6RQjR6jGlbhOZfr3vSG7FEqOXrRfuVUn6Ks7CRnpAS4DbyIlQxILFMyU/0Bmy9uVvg3RICslnB+OjuHa3lZFir10PooQneYOCiKl6SRectR0Atlu0WkpO6gwmlayaIBNiQi5ByeVAZv0jZXLgcqtcqVoXPodUSkaubT30YQoqAtdg+ZOD0ChQfV6k5yLd/E05ZabL89l6fmfa6POKNTULPugunc7nCtFwi/ptDhMl2/bi59x7ZLqK4AIHeOx87X6sVjgAotR7Wq0zivcGsXamZND0Uv60ztQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2017 01:23:10.6431 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1721 Subject: [dpdk-dev] [PATCH v5 16/29] net/bnxt: 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: Wed, 18 Jan 2017 01:23:16 -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: Stephen Hurd CC: Ajit Khaparde Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- drivers/net/bnxt/bnxt_cpr.h | 13 ++++++++----- drivers/net/bnxt/bnxt_hwrm.c | 8 +++++--- drivers/net/bnxt/bnxt_txr.h | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h index f9f2adb..83e5376 100644 --- a/drivers/net/bnxt/bnxt_cpr.h +++ b/drivers/net/bnxt/bnxt_cpr.h @@ -34,6 +34,8 @@ #ifndef _BNXT_CPR_H_ #define _BNXT_CPR_H_ +#include + #define CMP_VALID(cmp, raw_cons, ring) \ (!!(((struct cmpl_base *)(cmp))->info3_v & CMPL_BASE_V) == \ !((raw_cons) & ((ring)->ring_size))) @@ -50,13 +52,14 @@ #define DB_CP_FLAGS (DB_KEY_CP | DB_IDX_VALID | DB_IRQ_DIS) #define B_CP_DB_REARM(cpr, raw_cons) \ - (*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_REARM_FLAGS | \ - RING_CMP(cpr->cp_ring_struct, raw_cons))) + rte_write32((DB_CP_REARM_FLAGS | \ + RING_CMP(((cpr)->cp_ring_struct), raw_cons)), \ + ((cpr)->cp_doorbell)) #define B_CP_DIS_DB(cpr, raw_cons) \ - rte_smp_wmb(); \ - (*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_FLAGS | \ - RING_CMP(cpr->cp_ring_struct, raw_cons))) + rte_write32((DB_CP_FLAGS | \ + RING_CMP(((cpr)->cp_ring_struct), raw_cons)), \ + ((cpr)->cp_doorbell)) struct bnxt_ring; struct bnxt_cp_ring_info { diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 07e7124..3849d1a 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -50,6 +50,8 @@ #include "bnxt_vnic.h" #include "hsi_struct_def_dpdk.h" +#include + #define HWRM_CMD_TIMEOUT 2000 /* @@ -72,19 +74,19 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg, /* Write request msg to hwrm channel */ for (i = 0; i < msg_len; i += 4) { bar = (uint8_t *)bp->bar0 + i; - *(volatile uint32_t *)bar = *data; + rte_write32(*data, bar); data++; } /* Zero the rest of the request space */ for (; i < bp->max_req_len; i += 4) { bar = (uint8_t *)bp->bar0 + i; - *(volatile uint32_t *)bar = 0; + rte_write32(0, bar); } /* Ring channel doorbell */ bar = (uint8_t *)bp->bar0 + 0x100; - *(volatile uint32_t *)bar = 1; + rte_write32(1, bar); /* Poll for the valid bit */ for (i = 0; i < HWRM_CMD_TIMEOUT; i++) { diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h index 4c16101..5b09711 100644 --- a/drivers/net/bnxt/bnxt_txr.h +++ b/drivers/net/bnxt/bnxt_txr.h @@ -34,12 +34,12 @@ #ifndef _BNXT_TXR_H_ #define _BNXT_TXR_H_ +#include + #define MAX_TX_RINGS 16 #define BNXT_TX_PUSH_THRESH 92 -#define B_TX_DB(db, prod) \ - rte_smp_wmb(); \ - (*(uint32_t *)db = (DB_KEY_TX | prod)) +#define B_TX_DB(db, prod) rte_write32((DB_KEY_TX | (prod)), db) struct bnxt_tx_ring_info { uint16_t tx_prod; -- 2.5.5