From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0082.outbound.protection.outlook.com [104.47.41.82]) by dpdk.org (Postfix) with ESMTP id CF8F8F947 for ; Tue, 27 Dec 2016 10:51:50 +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=j1UrY+cVfryQ4Iphx69yuwhdIWUzJHDLMLyeZOYeIsA=; b=LQa8/NMpaR8RI1+0yeQ+K2QiHwRQ5U3K5cLIXbh4/8uCBKiKqJ+uAf1pD/5B122g5oGfDZWJlxCCfd2iMggUeUrBe3vw7nom3P+i7K9YRDDeMENhSyvbP0pXVeKNibLQjkpZzeIOh4uhLZg3AHLMjO+mhJitUWcTT1bMJfHYBjU= 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:51:45 +0000 From: Jerin Jacob To: CC: , , , , , , Stephen Hurd , Ajit Khaparde , Jerin Jacob Date: Tue, 27 Dec 2016 15:19:22 +0530 Message-ID: <1482832175-27199-17-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: 38472fd8-adb4-40ec-c31f-08d42e3dfa19 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 3:JKYNd8HPBfXfNs0yUVeSaMd42YhP6ate9ONq5QIcKk5RWYZhGbPNVHGuDKwf+Dwailhf3HYjMMnUWs126ooc3KgzKihtNYmnvEHLm6Ky0JvghCmj0yqH7Veg98wrYkEVqPXOlVhiolgyDV9VxMIIlle5jXCgLNM2dgmd0TQVjQInAuCBFZTgGt9xMocXIxj5dSQIYfiYvO9+/n64a96sBosjaObIX7tdK1KCu56khdmTaeBTCmYFCpvNPyhjdjS0eRNUjC4cZTzPyDqufZABsQ==; 25:MamFB8+SdTtlA7T7/0Qs2KatKS/P8eQyS7Z5lzVdR5HWKvFG9d7i1hYn9ZYdFTEd4tPH+JvyxappVo595WeMkHS+lXwN8ItxSMr5d0aABisaIRd+f6pFXMQk57MBxnJamnTKcf+tI9QOtYgC4Ex1QIGegmZiPYgjgAaj4hr57DK/gB02MKNTTzbtTP8uWfVht33N82CxlgxedxGYRrdDKuaxk+tcZH19Ubc6ETAcrmkKUQ4DsZ00NbX3HmdZ0DcqYY66I6w+hm/yfD183WgzkkS5nZpzms0g+1cKBXPDuiOjuRTEYMauJ3nmDL+avLEWeU88BYpeVWRWKGZN2QgKempv5KqFMB2XzsmcEtkygjnd2DS9s/INq9u4t7LXjSg0BIAGJdkn0KhOCoH+cZTDBdUeF8k6m+5AI0dwWdDI2ipXn3k4J8pqTfhu8L+12nZ7GoaDuYghyrIFF4/iLu+Fsg== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 31:Yymovn+q3CL9V1KQfy8EVkyCfCbQHbpA8l+XZKdvpWXIAsvWSPbTf7Ik5+ZRhygGMUzlHM3/qRs8axKSUxxntwHrrS7Sf1EQwqd+NAJY2g0UDGan/UG1aup1gXMF0uwtULL0uuSoUcQmrSu1DZYeJ0cEc8431W1Al0CJk7vSJvkhosbeG7XRHQAnqXnCd/PjoHndoyKdIVJktWZIobOKLNmsv+AVK2gbs8Y3aKV3OwdJVVQTVLoywnVovHhSqeSM; 20:1mV1mMV9kjwQTfctzN0FrWZXkq2P8ZZH+AU2+XIK2PrzkEnLCVJvdSYJ00OdU71zYoATAR/Jm8OWiRwfpVUU06dcPMftymo+W8pu+C0rwpuqZKT4a+yt5pJUilyJIiRYi2Otl4aC8NFsHjK/6J/Q/mdH7z/KiIKIx0/uUWqnO6Fvy/DDWOrcOK+fZQgPBWeqX6TWTa4nApfnnixplMaujLaxx6CmO0rUeg3Ivj+XVUUNDSIBnOQabGz8s2ReHhZDdqhOlbfYvUjobbz/CUWuEiocIJjDbhv+2HR75RcPz3Nbc5a67PfhqkmvWfqPzcqsRTmNLbhtR+kTYOfURpK9k2VH1En3EsX38qNaWcFkZOPD3PD9XzDRypc1xFACaQRSu/y5S7dX1AmCH+U92jib2BRsrnECaB0Lls4kO1jxo/Wdke1VDRv1rvEArrE7SNSUZbX4kvMHlsEnAaDKsV8d2PUVF4nRhMRZ3HSPqCSiwAkuvAq/GrWVTweIqGjxu5vzYGMpeRxKTIEqtEQYbAsochN2PqyotDWtsN6lUFe8/MdfUGwtRXtJobkbQgh/Z2SbdVYT7d4aslT/nX+0ZAKOnR7O8FNrM+oWqIVmDQE4ims= 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:4z5d8h/xKo19ivZTNt8sJFNzWC87VP/XbkEEL06/TRE7eGy7NQiCrbBJh3r6SeCoPnJSAKhSAIpNKIqBG2OQCxo3XstVRH1bhRt9Su3Jy0w8tqxwO0+/Av6yIcyOoEYZT3gcR0QRcmH0SyJY1xZOLvTUV3iN+ZPjsNBEAAApILFhuC2WKdcF2hNCBs8eivLCDwEG9spPSL/r43ArdyFwuj1XDlF8o8IYpdtylIolyPIezRMimSDILOqt6lgUS3S/HgPSPuAn61TiCr2A4WTI3P83tLfTCskTn2Z5V8vhRqBXokpPpkLScWEYCGUNPQlGVPUmlGwsmx9sfe7VG5CXVITTpugwZE9kFulnJnMUY8C03zwaKHC+2x8HJAs7oOgZRB2al4UCf570ijZ1NrFo+GwYMBo3klw4NU07atjsjKxhdDG97RwcIHDvGC3smRmzvh9RPeh0K4sBn/T7mO5mwIFYm6QaWRHIpsd9Ii8GvWUmkM7nNcCO66D8l099swxc/tdOdXvfjXLmOlfw/Olzak+MmXZFCVE4utbho9hocpJ0212q4cvabXA9ougJF+GMEu+LNh6p0TzSFcFZ8AjyYStTg2iJWRJlAsPfxiL5wWEOuOkHKvmCXuD110ISATxevdud4XmH0TTd/AMrvBPI/w== X-Forefront-PRVS: 0169092318 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(199003)(189002)(4001430100002)(3846002)(4326007)(6116002)(50986999)(76176999)(5003940100001)(6506006)(6512006)(6486002)(92566002)(2351001)(50466002)(110136003)(305945005)(8676002)(66066001)(2906002)(101416001)(81156014)(81166006)(42186005)(50226002)(68736007)(106356001)(36756003)(97736004)(33646002)(107886002)(48376002)(105586002)(38730400001)(7736002)(6916009)(5660300001)(42882006)(47776003)(25786008)(189998001)(2950100002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1713; H:localhost.localdomain.localdomain; 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; BLUPR0701MB1713; 23:Kx1czVpM/6KEEt9OQcTqkq42cIZpZnqmVpjzD8b?= =?us-ascii?Q?Oo5Ku4M9VOSvXZMkZv9q+U/VPW0Ha+Fk7qd+5nIIFn8F1M1K+r1vONv+wlic?= =?us-ascii?Q?+fpyZmH0cZxlyNMyH4YswkcEP+XWUO+NIPRQ+p867lJSVWvSmetaVCVNYd57?= =?us-ascii?Q?2UIzeQdhJ1oAkRmtBGVqphIvQo/p57RAy0HU0ylvMnePAtl2yiOfnAS9VbSi?= =?us-ascii?Q?vNahJnnO3BQ/pJQxiDaMJSaEkl8ondzHqgXPgM4xL77Zklw2hslBmfABpGjs?= =?us-ascii?Q?hIG6UfgCikRCRtYg+9C5xmq479THPd+9IWF8arEuI8uyFy+Hgik9g9BI+3w3?= =?us-ascii?Q?7T3+Q75pS5rSP4z6sUc8CdQKXAcP1rXwfof9N3lvdqbASkA0tDq4G1J+kLjH?= =?us-ascii?Q?UsTbmHtB8f/ZV6E+ztJEfbwqSEqPkldVrMqdcS962MKfxhV5+Ops4PvLeK2G?= =?us-ascii?Q?csqgwx2j0Ib5H8aw2bCfKTbms9URwXtLRM/tkUn6zIE/7xhFPfYMcNAqmeMv?= =?us-ascii?Q?LA3LQtJgKJtfbwQDbji64H2mCZ1Fho4wVqX7MJ9NOT7kzF5slARc2A1X2egR?= =?us-ascii?Q?QxLT8OcSzZUDbDVf3dmxD2W/JpCRPuxgsalZ5+FwrONGQT6c79Wv2cPS5PjW?= =?us-ascii?Q?yW7YuolLS/oqk00Q8Ddq7lnNyojVA0njkQ+uYGBtpwSgpdldSx/9ldFyHpoM?= =?us-ascii?Q?T3/jTEoHFFc2OyGUyqamUfPO12CF8FX8VNAO9GEFx3wenZoEaziLk/JuAiCk?= =?us-ascii?Q?xVGDBOC6xVFGdAbhA0B/nkN12bbYIZX5TDN6rsf6K1IjwJtB8zg+Tq5UquNX?= =?us-ascii?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73Qg==; 24:OBu7nQmNibaau/25m/n9nsO1TFIuu3NMItmt0W4DW/M2M3DKGSJvhNDaL7PNqxF8f4+RZNXPqLdfo6rsOadvcQsBZyS2YvjThxwOsjg1whs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 7:Lj8L+C9tWGyht1n0SGtc6/g6BirAIHqob5xfBB24qGrzXef1IqXlQDDbnFot52iToQYRI8dUXRBaoVPr2tsmaYUZkabPoTkwF4WghzThhHY3NLdJMqD4FbJBvid0q3jLbfl8oH0sOYwZefpObnGJ3/kHmdo9k3JYSWMnS+4lTniIaukgvIPBxC6Yz69i8t2j1GHOWwKlr4ERRlbXNB5swKTH2aIsX6fqP2p2zD1NGeiQASmOu4tY6Jpud2gWGE51q84iOS1qOB6PdiBmRCLHRRk9drSZK0ANsaI3ehzzOey4AR0h+ylZEUGXOJCwJnDX4wvGnH7DkQ+Nr7wUQ9AwO0VVLoy9lavt4vzuCfSZar364eYQTFyrbdyG5K4CoRQ+CkbeuRfRXS4S2m6zuMmwO3p93hwU+aCRnV53pbMwDujfInT7+qAypujrXkOt1hMP1btjUcv57DnLyITx7i0+pQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2016 09:51:45.9640 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1713 Subject: [dpdk-dev] [PATCH v2 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: Tue, 27 Dec 2016 09:51:51 -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 | 7 +++++-- drivers/net/bnxt/bnxt_txr.h | 6 +++--- 3 files changed, 16 insertions(+), 10 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..c182152 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,7 +74,7 @@ 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++; } @@ -80,11 +82,12 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, void *msg, 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