From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0052.outbound.protection.outlook.com [104.47.40.52]) by dpdk.org (Postfix) with ESMTP id 7E49F2BB9 for ; Tue, 17 Jan 2017 08:15:52 +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=A85OFz5Zyly6jbDTlY4uTadsXF5GbzxEaBbZNSorTSEUTW84U+NXw8AEfMMIBwN7gIMeM+rk8JmJ4ZS9esT4KZ6RXgGJh+0ParTFbVUoMoXBdhFjcFgiBSltWci4fbCCzv23j3WW+igK2fUhiH13DW+FxvU3xwZmG/jT+MGT0TY= 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:15:45 +0000 From: Jerin Jacob To: CC: , , , , , , Stephen Hurd , Ajit Khaparde , Jerin Jacob Date: Tue, 17 Jan 2017 12:43:51 +0530 Message-ID: <1484637244-7548-17-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: 445349a6-95ee-4ac0-2df0-08d43ea8a9e4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 3:aJiccv46KJGHEDPB3CkixYwpPLtdyX6App9likqAaxEQwQeTjKvJJYy+pjKjWNX4o8NjVpOxWu13Q58q2AE9DEndpWWTqa7KK8VsfuWAg14DAbsm1CyrZxgJa303usF2kUkPcL6HibD2CihMheABxGhyRz2O3hKKZmZBS9uGMztst6pTxAHhsWYSKNVkpxf0IO5fgwOfttNgUA85iSQO1kBaCU5IU9PSDrzXtxt5G9pCTiBbGGti5k/kJ2wJ6sHBHbUD+QrQQnzid9AOLRXQgw==; 25:aWBsrNmP13aNMCJQeRGrWnwJ6JbyluE8f3cCmJRl3A8v3XNyrwryAhPklOZfjZSQcL72jdawhuatv8jxLKQcYHsavDdud+7Svqle+HbzZBE5wFvNOvhk9mjplue5QL7vF7vHMJdL+Xe2APDjeim6ctfkwhkFhAWLTJohtF7N+z34UOnzsd04eUen51HwNYZRn/zKHNYTsfDrUy4JnwkzoFpHNsQVE1SA4tszWLfKB/7oG0lhP4g0X87iugdtN5C1NhAt1NGNjlynPMgFSpBG5rUrPl6sQMfcc2JTTbI989+IO3Pia+4y4fCQD9vk8PkG8pNJDE3+Ht5DRqPlwKcK9yKp5/wqa1q47Ytvh4eW1rt5x8WRXOcoJOZrRLh57tfepmUx8aMnTbYx3Wg+0b4u1frDA1FvuvNsCW2TBxigjw7xa3No7ZuTRt5nLVqYihzDABLNS8eXCp2L5WIm7dqMgg== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 31:TAjHbinHaOz21UCCKU8OndETq2cVxMVAEeyU3eBhQFWNHcN5LuG9SgBW5xM5o5DQcDuimaT+ZBtXixqnoOHHZp7CfvRN0H47J9nvcYMviN8mmgyTW+o1kqBXioqOYobUHq7xTINhdvyWwSiRE5de58FdYsWc8+Psgdku8WsiLCrB1Ci4VMHmpbTIwVrF3a68nmNn5/YagQSqWOsK9hjqL1rEniCN+Xx1VAbjv8T4tHh1FINOmWAbG7X7drzYZAuY; 20:NvqcgZV7sauu4c+SvmOa4Q0PmaEXoJaRsxX4HyL0qKa1aHnebHZHAq/B+FN1OmEWPnFnoSPhw9r1B1+xKY78D+2/Oov6XVhlNgLBgYdZESTUnDZ2tOkx14fAXrBbJ98Ya9yynx6Yo3dHpIQHI0FNM2FOwnAa/ZJAjy6pK+nSK+OgN7GGr+C4dX5tUqjgtqmttPVTmufkOnNvxOJ2x8OQ6vJ3Dccgn6en6kVk9lqWTrFqxGUIID/5wcVZ7sNKw8tWfc5oP62zImYDBFEnsmxVFEAQ3hnqsoeL1ZmmAgpAEZN0romMw5bXxh4m16UhTs91GoMEi+c7EQsZ5VU9HTN7l8aRam712SXh2EUABVIiWKyVKIjmnjVVcdXeNe3TYvfwg564Q7dpbWFcnssxJpOp+b2PBBG47SRvAsRjo3net04e8r1KoSPjW4bxnX11GlKWLrx8Kh84nm0LHe385Z/KSU/1AMRkD1LzjSfd3WX0M3AwOBaIjJvlJOqZ/IvRHEzlEfAfpRmz5RTbn89hRkTw5GQdowtvWbG5fphGvwC3RUHCr4BeZIPhRRwUFXoXSGwbEVp79afP3E2Dsi1JlKeb8E1X1upG/WhwNDpcx+KueNM= 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)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:BY1PR0701MB1724; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 4:obwtrNADZeNyBHRfnILTTnUOcc0/ot1JpWYIhTrSmTBh098S8ZbwXUMLuSWXgOXItzjP2ECf3SGSkNkErDgSQLNPpiCeEzDVdLCGSm/whBCQDUZYWGy63ld/k+sL1dVR806wnBEb2V6YiKszWiuEPDfSS4kyI8v9D+l1tHatZLIeadSjzw3jbB+kNhiUkoNh9eyqwySOIVYY1awLgFSvcO0NzCEbbNl6xGBFbhQkDe0/Vyck3I6rPN0Lq/fKQNorb4SsriffUeMeXNmBxGd2OCzm1l7AdME5kUiw9imQO10nhy3ZqOIlmKVsk58rd0YJijVDQvrD2L0hc96zzXhl3UX471tXXWD/MsmA5ttNgj94HKnMVdPM7hSgfCV6Q+/5bU4RFl/2wPwZR1MALHHC/6KnwUCb0gm9f0XL8kHpwKSv8o+TPHrVuxLAUNTt05SobvTTbzGjlRYz4VY8JdHYiaIwonhkDyA1VaYXAYaFprcfzzUoV/hApuoE+IVeuodU6w9Wx+Lc7bbQmVY3Z9SrInRzehT4WMUoCt68W5LGmQewvbrN5yqXvX0DTfM0yN7aeD7WZruKCUuqbb9PTncHLbnfIksx1G391J1NPQpWGOM= 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: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wc867iFQXz5dBaxfsQni4/taIaVRW89et3h9ksB3X7rXQV+MSnbr1LkUA6cia3Grx0EgYv3j0SlYhQSLYnUXURFgafjejwbFYFfvlWyJ9k4LZf5T5rJOX7wERcdLA==; 24:Ss+iaTlfxAmUtkYR3vNWPmftz2hg+aVffa9iH9jWMPAwcphgxsOxxd4nT0EkyEXyl7ed7gyDcUrp8CgqdMY6VWM/3/kvHwK9Bc16GsrwXTo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 7:KM/2EKhQmKEntsP5jg3fJep9KZLHSfkKpQabRvph1K6KM/hITfzvwrVk2uWJ3DzbUIImWOsJBn/qYOe+1qHobV9IW7l5331urgIkjw/TTUPZzFejnxKzsHR/VGfqBp8J1/jW7qtVTjIpdQ5ILOKtPNrhj1Al91I71NMgGOEAyICY30ds2jpE9aLA1uGMgum1NqxQHf4IYOO/rQoGJgXlMGFvhdf/IOYkNYSWY5GSkoBHv+sOgFJulwIm7cKiVAXcU1et15NfFJhfVmWqRKIMlmmMgqYFTLUfFT90W1GMDBNyoTxAPvmvWca5dMCrjvQodYsKH0cRZLIBBSkRp5pUOEk1wbayDU0s1cvjND8YGw6kzQZ7WRQOrbLPlV3NloNQPGV2daeocWI/c0dhrjZfP3c7ttb79cMgrxNdWdgAk/d+mI6mDJrBwDkUzwP7UEsw0EDk5eRXiOFF7xPy4k2Xpw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 07:15:45.5324 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1724 Subject: [dpdk-dev] [PATCH v4 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, 17 Jan 2017 07:15:53 -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