From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0080.outbound.protection.outlook.com [104.47.34.80]) by dpdk.org (Postfix) with ESMTP id 4B234FA35 for ; Wed, 18 Jan 2017 02:23: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=PwKLpZtBp8UPzc+KRePKPyAinFeZZ3YSq8hqfJv8nME=; b=H0TrGHrL22kYHEJNmsLHT63FVgAnfGksvSMjBPTYfSB1NjqlVSh3nsnyE4EQWqC8FZDe2puwoOdQjmlbIPjNswc0Z0el+3naqgk4m0Cce2ouihvbnaWvAhoEnhOEiv+/tJLgosJso2pcMMg9H5EMoUu4+9dghdMSOrj9AoJI4fI= 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:44 +0000 From: Jerin Jacob To: CC: , , , , , , Helin Zhang , Jerin Jacob Date: Wed, 18 Jan 2017 06:51:37 +0530 Message-ID: <1484702502-25451-25-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: 9dc00b01-75f6-4f3d-a43c-08d43f40a6a3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 3:ptxGC22zezhKhi4QbmsfCUY4QqhP2px2cn2u98FpVqRsqIfm+eSfgsI2KiKbNo3l1RFTLbEweJnj8skf/Cm5xXZtX0DllgAfETwSElOYDRaKFOnkGqjisZoGIRRQhak6nDLygxnCDSZtSGTTgenXGbRPX/RjCCw9o5SSJL4XVRw6hZ6qw/agtvwJWg5H+ufJ1of+DNOsnCSREtV6YWyJSb2RPTb+Z7SANvU7LYkXFndmQnfFa6Dhqbah0f8z9k0SsPahmLOV+RPB2QqQ8EXkhA== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 25:41SFrJkirj/pXYlegMA9Xb1Im5I/cY48+e/sUaOH51/MWR8csbFOY+QvRcHbOtvgn2T//SCF/UM4nq1l9BdzzIoCHrG7idWJjlk/cT5FsoiSZLvTxGXJFKiQU5W1b66POrlbOoNVS8FQcYR8Exo4z4Qic/Bus4A62bfEcPve08d6unLSdyk/sMwlp8w5zv8E1xqb6tp3MHTiaajco7JFGwfS0pCtyLvN8DR/g8gcATNFW2fRdrfrHvlaKQmpgdxPxeQ8Kjvzf7X4dVeavyZVlWLLeItGGE8e+sBLNyUchy1JYrZdqTB0DttQRaJRhB8F7m0QzgG4P87wiHsO6TVVEF0DdkhOj3kVTS4ZuZrWdyLVA2OQEvJdKGd26DZzqpHIKpee8mQsxmG39F99GkXz1hMrs3mZjhI66wQek7axUxCbkpVRk3PTkJiCvaDB7OygZQkvAnDNF0L62z19ntY3kmgwqIgcjT3YyIrc53EXHdFBTltdMvB68+DA29poJxkkgzx+EQoBeff6sbsZRtaOiIH2uLERMzw/GGRpFBjoM7xvXKmoWEpmcsTCttKtAeL5OaxrJIExlnZ6A45nhfxiWyKth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IAe2Hi2fZMyY1+nD6jes= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148)(6042181); SRVR:BY1PR0701MB1721; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 4:xHZmiaI/KoSpW4Ox1TRydLGwrc4hqsbqCQqBINDplJiT7Hta8r82m0xAxAPuQIL9gJF1lHE+S+HOBxUz9byskaJlYXTaccGhK2vnO47w8k2X8a7laOCgMZGi8Bko0ctLwZq5HbM9JhpJFeug348yymWWIFjv+kDTIPTPdvct9SWjx1aXBVgQywt6Zai0nldMLCUeJu89md5IVUFJUGSZ/d4AILCBefNA7VAshKduAZMQogNy2rX6SJdhcU1NTmKVGkgnVtHHaeA5/NOjJ1KnxSvjV+00vM1knmdHP1/QNi/jsIVQUFuz77RtZo1Y5Ti9SsVrlEmQzFRUoy/OFeZGF/iwgQK+ShBcjp7RkL9DyQo2mipxer4bw7xcCQWA/8n3elGu/bcox76G8bipgnaj098LPeVKW1PyfGWMT47Qw98ImRaOswXvErAwIA6GZjTKxc2BYz2YOtrKDMOKB3N4p/Qv7K7HUT85sJy/KdDqD31py3iOTwLgaRr6VAQ9/SRWaKCo5QZDuwGl6ZvqC1O5jLMCNx+i5PxhQLhbk3rWz1tUYtYwU0py0rgrMWztAGkUlzGhqfuZhSI9ahAluIm4yeDEv2V66o+M5bNbjZansDzNmxv2sDlPwS14oll7jgr1AJH3awfO2FgqPxEtRG/wTX9jyncoO6rX8rKj/JYEoxI= X-Forefront-PRVS: 01917B1794 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(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)(575784001)(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-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1721; 23:bV0WuL83oOOlt4e6Q8Z2tS6XN8n82mCuihkPWfY?= =?us-ascii?Q?9arnK2ZEYbddnTJGqCjYsITK73zn7fC2cSEeqQ3Sy00LNgz7ER/XAjgPhWFs?= =?us-ascii?Q?70K0TJwV2J7fITgGwwkuCQp9vn0JoWwN2BOR7XwL2guwOKoBaGzWemHn/kGK?= =?us-ascii?Q?MyNFRKDxbbYbgFBS1gX0fPCrfGdLtCD21AfAF0qUbyIvYyjfiwzK78p4G6LS?= =?us-ascii?Q?vFHl6CPF4SKkPd2D7SEPvI8/lyDHohzDFw3vEzGUr+hMs8PjoaUGnDzDEaAr?= =?us-ascii?Q?H4K6jftEww56KYoaY4/7TWwTIG+imtPl6JfHS4arxIgrKXKcTs006xEBnp7o?= =?us-ascii?Q?MmW6Nl8UK182QmKbUOC1CsWUhQyQ3p5gbp1GY0Oj1ia1hkvOJ6qmHMagGCyA?= =?us-ascii?Q?VtwzGOt8LwhwUH57IQm637HPuIe3oJ7gfobTa+DO0XsfXtQFGu6OREskeCmY?= =?us-ascii?Q?qzJLRJNj+1ncugU4bF3P5BlFroIawIxgInFjXg/boJNrpZpJQUD1mSeIGdN6?= =?us-ascii?Q?/6pAHpV0tcaG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D/yWDlK95tK8Pifu2vqY04dGT38SWBvkcPCBu1xedtLSTFjq6npJC+Q4NkSHwwKOrcEWlOvWJPg6Pwp/RDOnIbYA0+VgSEinCoPJgB9eDfObUrAgEQhW3GoRD7iuec2apm/A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2017 01:23:44.2236 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1721 Subject: [dpdk-dev] [PATCH v5 24/29] net/ixgbe: 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: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: Helin Zhang CC: Konstantin Ananyev Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- drivers/net/ixgbe/base/ixgbe_osdep.h | 11 +++++++---- drivers/net/ixgbe/ixgbe_rxtx.c | 13 +++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index 77f0af5..9b874b8 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -44,6 +44,7 @@ #include #include #include +#include #include "../ixgbe_logs.h" #include "../ixgbe_bypass_defines.h" @@ -121,16 +122,18 @@ typedef int bool; #define prefetch(x) rte_prefetch0(x) -#define IXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg))) +#define IXGBE_PCI_REG(reg) rte_read32(reg) static inline uint32_t ixgbe_read_addr(volatile void* addr) { return rte_le_to_cpu_32(IXGBE_PCI_REG(addr)); } -#define IXGBE_PCI_REG_WRITE(reg, value) do { \ - IXGBE_PCI_REG((reg)) = (rte_cpu_to_le_32(value)); \ -} while(0) +#define IXGBE_PCI_REG_WRITE(reg, value) \ + rte_write32((rte_cpu_to_le_32(value)), reg) + +#define IXGBE_PCI_REG_WRITE_RELAXED(reg, value) \ + rte_write32_relaxed((rte_cpu_to_le_32(value)), reg) #define IXGBE_PCI_REG_ADDR(hw, reg) \ ((volatile uint32_t *)((char *)(hw)->hw_addr + (reg))) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 00013c6..bbf6ba4 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -326,7 +326,7 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* update tail pointer */ rte_wmb(); - IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, txq->tx_tail); + IXGBE_PCI_REG_WRITE_RELAXED(txq->tdt_reg_addr, txq->tx_tail); return nb_pkts; } @@ -904,7 +904,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u", (unsigned) txq->port_id, (unsigned) txq->queue_id, (unsigned) tx_id, (unsigned) nb_tx); - IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, tx_id); + IXGBE_PCI_REG_WRITE_RELAXED(txq->tdt_reg_addr, tx_id); txq->tx_tail = tx_id; return nb_tx; @@ -1639,7 +1639,8 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, /* update tail pointer */ rte_wmb(); - IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, cur_free_trigger); + IXGBE_PCI_REG_WRITE_RELAXED(rxq->rdt_reg_addr, + cur_free_trigger); } if (rxq->rx_tail >= rxq->nb_rx_desc) @@ -2043,8 +2044,8 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, if (!ixgbe_rx_alloc_bufs(rxq, false)) { rte_wmb(); - IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, - next_rdt); + IXGBE_PCI_REG_WRITE_RELAXED(rxq->rdt_reg_addr, + next_rdt); nb_hold -= rxq->rx_free_thresh; } else { PMD_RX_LOG(DEBUG, "RX bulk alloc failed " @@ -2215,7 +2216,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, rxq->port_id, rxq->queue_id, rx_id, nb_hold, nb_rx); rte_wmb(); - IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, prev_id); + IXGBE_PCI_REG_WRITE_RELAXED(rxq->rdt_reg_addr, prev_id); nb_hold = 0; } -- 2.5.5