From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0057.outbound.protection.outlook.com [104.47.42.57]) by dpdk.org (Postfix) with ESMTP id 89347F96A for ; Thu, 12 Jan 2017 10:20:31 +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=B/+5pCMk3pem717EBdfe70JAY/LLoDJwXLkWZsHIaAo=; b=KVtPg3L/sKO76oECH9L+AcQpn+tM/00+msfICQ36xh+VC1sOfYFr9Vpk1i9hye2uj8pksfWkrWYpPmWw2Sa3X2bUga0x4bHulM8qOB7BzfH/WnV4pOkxCXwxCOOzK0YNV3J1RnaVAr0kFFTJvO9DH06eauPNWFj1iAN+2kPSlOc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Thu, 12 Jan 2017 09:20:25 +0000 From: Jerin Jacob To: CC: , , , , , , Helin Zhang , Jerin Jacob Date: Thu, 12 Jan 2017 14:47:21 +0530 Message-ID: <1484212646-10338-25-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484212646-10338-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: BY2PR06CA0007.namprd06.prod.outlook.com (10.166.106.145) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 875ff944-82e1-4aed-5db5-08d43acc4095 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:UVPwoXBEID+G/khONhJIiNPmdm9jntsGeJ+iDNMuNgUadtZByfokDAMpsp7YDxDX4R9iuYzmCdaaJSQWv/Um2z8VYMbIaxZefeEETxJi/jOXwTLDv+p1b98jpZC9PMuQIHm3FWK6Nhgrd9DOYtyywadcNQmIbiEB2WkY0yVjyr/Hg79kdaHG5tyWSvPVmBLg3+zyGx74UrD1+sk2EwCfHEdEF8HS2tMOoroBxhs440sIjh/0vCu2OS7Hf072hSq+8PPxsGmOncJYT8CwHnII0Q==; 25:TtEVUHH0EqvjelMLf+Yrgzdx/7AKvbu7W27mHbZp9vheDu0dMno3Nh1nuiIKFj4LiFEMetIAwK0WnmvtozigwX8vMIv0CAhucFxOiP0LisEzlb7iVnfHhrcmbH30vBQbAEAUngnYSU0hPaWe44RfO9KaU6nJxaWBEvL1iG6MPfN2joQNSKN74uTqlbPEMLAoOwc2xKu4NhlCSatZriW60tQs/63QvyuaPfHcd6zOarQ4aQ/BIulfTrJAIEY8mt7KrRTPuBoTdlxJjTZpy6aGJsNq0MsOakh8BuJSu8wmqQ6hB6LzLCpT4APAO8ChYwCyrzq1dEXsNY+UCN/astVR/dLwQgsnBzIpUVfCvKEhcff0rSrFktvc+KW19EhXRa+6lLolDY9AbAHF+UN9Wa/d01QLJDExyj9IU8ZHmSVzqdu0zA5XAWRaYIplmzunBfaWf6iHOuIu8fqkxcXTWw8Q1g== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:Hr7TT6fEoA0B/g3oOXsHKWG8124BXDhNkfXJD27c8XTJi6ziJRdj8exXhx5idrb70g+ZQfLT7S3pSrtjFrJkMQ3lE5lVGc+m4DwDLntofX6oe+qNn3Op0+5AsU4HVImt4aEnJ5ZUCOd3RQBY9cNCSL8GqUrHnHjQpkmoUMFW/6bQeMxvmbVLztEnngO3OaPF5P3QxqmJwrqmlasS1rSCjSr0UAnpzqySd4B88H7tSQ6fVqpmx5EcIEFDWHimFreB5Wx6LuZP7CIx/BBEHLI0GA==; 20:aZsUpwkoZcbWYaDmNFrYNstzUfliwQJwoZR03O4EoCALT+61h1vVA3HuWvIfOjom5kvTtb/amW2y5G1mkf9lY+ButFWTf8QKCjzZXdU9804ZYJ5/Po5qon5Zj4qknPfiy0b5r75YgWYXWNN4fvU0Cef2Z+Panun5R2JISJileAluPO90ibKoU2+yPJYnqavDJIv8YKdhPsQ/ZFm1ZKgSwiUrSm9K3sxMI7ROXnOwRUKC4IgzBl4haliiI6FKepcm8DJj+B91Z549pWAvJwpJfJd/rVoRVpXbDPHChZ254DAW/mFygmYiLc/MRqSkGVbYu5LKZfEF0FHzjnOXjrglPJevuFykC/XoU5J0cMmjMf/dd3IHofgf43zzp5CnmqgmQ197H9ZJdJj/S216Et1hdsHjsw+5McAvP7GO20aKmV6GFocYubAOEDTI3o64EyKp2nn4pUIU7mM1+XIcGeNSBHI7g9uXrqUHPyzv64xNAlx0vjDm7bD+gU0+bvwCYzJ3MjYhXSefgGAqtERvKA0xdqSh5fCgttIP9rf5ih5UFW7mAKlX7Yus/9Qb9Qrk0zgSMLJsw9uwyFQ4dEcjQ8sbtHoDfPIgmSnVTs95Yemgyew= 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)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:LreuntXq8m4vxEQgpKHujHbSBCUiBUqgJDngsjfkvwjxY9Xc4s1W+wWXN8rOXRH8iM5YtH/41LaNVKKENYgg90kgXJbS3oOI2XBQJwUR06IePj6EE7/dx2O1KQPdmqFU3mG6MMnrXngOZrq43pBGMacesQH85/kihibEpWP9s9d2zg6rdI9nYxsgWYc3M/zSMy8skvg7hDfTcxN3IXDwQype+zYq/Z2i5ueoKkEd0od8wjP6v0YLRI4Sivlqo2PrII8RkDr9AwTKD+N6AhG80/MJU0oMHjgOBTuWxpqp5pJu30QmdhRIe6Kt27+lknuWVjOsKTUYSklEy6FoXCBJs+heO47YXDb2PltomQOQprOZDNL3zvjIFFgcc2App+wc5VMeJixTuvLGalF6uK04YYj7ePI3G6kR4VS19QJPracfon2l9WADdmQhfKGz6QB6Wdcyg/bS1x1QON3WQdv36rzn1DqS9GyK3iDCZcWhvIhfJUVCf/9MZOD9z+6nE4DFn5DP3LgtYJHD6V2xeLheEAS8iGxiva7DZ6nJXQbp9kO+BGX4NzBC6JnTahjczL89csuE2pgRc+zOgGPzPPwYtdXZFz1EQ7hgjHQ5CkKQwafG0h1jWu3yHqD1j1kj+s7RqNe0fCT018JdHy1372gIrg== X-Forefront-PRVS: 018577E36E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(199003)(2950100002)(53416004)(76506005)(92566002)(105586002)(69596002)(2351001)(42186005)(68736007)(106356001)(42882006)(6916009)(305945005)(2906002)(7736002)(50466002)(48376002)(36756003)(5660300001)(110136003)(575784001)(4326007)(97736004)(107886002)(189998001)(50226002)(6666003)(6506006)(38730400001)(101416001)(54906002)(33646002)(5009440100003)(4001430100002)(6486002)(66066001)(5003940100001)(6116002)(3846002)(47776003)(25786008)(81166006)(6512007)(81156014)(76176999)(50986999)(8676002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.caveonetworks.com; 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; BLUPR0701MB1714; 23:ctOpjowdvGXGgAuYHt3bVs43CMqpGfmrdi8Bwvy?= =?us-ascii?Q?uwZkpBNdlahzdqyhpyiNEG8gz33cuW9WE978dd7i7yszhGuk3a2lWj4WZBAU?= =?us-ascii?Q?ZsKL1hWSVpb9Lc3vn8Ka5eGDMvqNdT/20pA1OHN1JN6AcYor6iv9m1BOsEag?= =?us-ascii?Q?I24nkqXr9fE+4DNblizev6ODUCVoWNBkJaYH6pQC5PkDasAIdeeYwY617Tfo?= =?us-ascii?Q?adqI2SJc7IUkdWIGgcfoCLL7CvAyhxLS4kbfP9UaXdMRkzgqBnE0/DGUjz0U?= =?us-ascii?Q?KIp3w/ZcnLnuyMPOcK9/J44Q50jFpokKpX2LJIEFMqaJbEujs9OD15agHhnn?= =?us-ascii?Q?vYsJDpARUZWhoDuJw8xmuq0QYxWGNa+JSb+56Is1E+k6npLSclGsDZriRpuO?= =?us-ascii?Q?zcdmYlLW8bEbtfeZEpurrUdYGpm4+ByU0SjlADUyCt3FRvBLwI4pgaY57I/q?= =?us-ascii?Q?Oh2fyumBDNxir0x8KIEyI6T9PGmayKx96UYWCcYlFkIcF3u8iwjzpxrv0GcN?= =?us-ascii?Q?N4GybcovcbBIOiQd75hqL6WxQn2tf+ajmjp7ZHITJrR5v/zqc4OK02T2sAiz?= =?us-ascii?Q?/SSZm/EZSi0RDm7kOCm/8qJkz/wogQiRp3GQCtgdCNyxlwQy0fLTqtqFe7Q0?= =?us-ascii?Q?zuRpma142lG2m9tmvDeX05TVu7oPHAuSVwldLgcpYw/Ar7pP3ZROxv33NI/K?= =?us-ascii?Q?M7Bnc5YDQ9yHoCr7miCr1jfcHX7sjcNui/ySmfiJLQIi2ftgTtSJkm3wc9bF?= =?us-ascii?Q?ZMD6huxBqsVCl3f5PMtjcsG0AyYE2sixEY+TrFB0sZZ5yM9gCK9GBpsmhd0w?= =?us-asc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xPDeSbwPkSxCUh7BhCmQpKFZRzFdKYvY=; 5:cyTB1SjmY3ozZny7AjR37FXYUXTki7lJXXS9rgh+n1qPn9Trui37gHSrWYyM1vzCL4ulDZGFcyIzuprrKNYIGBL/NsCDpQAaN8vblz7XAITguH2bENesMrUMYOu6evjsg28TyvwGd642EE+ejdqk1A==; 24:ld9R6MXwSvtHrOorPmop1uJvnWhiwRA8Pi1YCuJD0pXvIS3IeQXuACh+J78RIzXez/hfjLEn/gne3oGckP+9YEfvJipcNze6oyQJrByQae0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:jj+xmaJlIP8ECiesLp8vIQv5TZtgOllIUeOUYkTPZNAmF5O1nO/ugrps3C9VaDXI+AQFoxWk+ubwwE02PAguQ/bFFhIx4SBXFd3O5Kds/pbZLaaby3R/0a5um3uO6b4+4oRixHZE9Mdu7nzHl4tQhts72+aDAhK1e1K2lAlMMlo+PWDNSB7deECc2I8K/VJkuu5UIDXLpssiqIGq83ClgUZ+u0qLZPN9lZxHjzIPBq0yR5Wpz7rjuYHQYKk6xn0l+LiK5ZuJi6nMum0c4QwKCh4XQ0faYdTi6TSKNQImDHHsa0rN0tQEbdCsI50HZrY/jeLVBiwq6QNTiUpxrkDai93dFwb7R5uimGQh49DdV7AdLgKL9xCI6I2nVuLnaKy9HWAtzkBYBpkDTbTo5kCNxNFcRU+fL74dAtmS+6uf2EExsSUMiF2yiXqmvrd+6Ylu/fstwOm7GzRMLqCUgA4ALQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2017 09:20:25.9425 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v3 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: Thu, 12 Jan 2017 09:20:32 -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 0bbc583..d6ca8a0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -325,7 +325,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; } @@ -901,7 +901,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; @@ -1636,7 +1636,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) @@ -2040,8 +2041,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 " @@ -2212,7 +2213,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