From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30061.outbound.protection.outlook.com [40.107.3.61]) by dpdk.org (Postfix) with ESMTP id 89EB71B232 for ; Mon, 9 Oct 2017 20:47:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ghyhlwGEu+GRqqYUJDVNTYF28sFUshVZLbNDCLRXHjo=; b=Cgrk6aBGnOewQTgEvMuaKg07f+yBoe520roqLNsD6oxPFxrtD3Kp5oEE7Vo6fDu/7Oa3XgaErxizM5Wy014jmV127Sqm+BPO0JexQ1mIH95YLm2FefNHrm9ZKiTcv8cxyHIbNdbfTqpL/VyzAtSS47uW4ZkbPSSJItArBN+A46E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by VI1PR0501MB2046.eurprd05.prod.outlook.com (2603:10a6:800:36::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 9 Oct 2017 18:47:15 +0000 From: Yongseok Koh To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com Cc: dev@dpdk.org, Yongseok Koh Date: Mon, 9 Oct 2017 11:46:54 -0700 Message-Id: <15260a8e5c5eebe5879290f0c676cb85a4d03ca3.1507574643.git.yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: <20171005230032.7548-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: MWHPR2201CA0009.namprd22.prod.outlook.com (2603:10b6:301:28::22) To VI1PR0501MB2046.eurprd05.prod.outlook.com (2603:10a6:800:36::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e5611ee-fe73-411a-9f0e-08d50f4629a4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:VI1PR0501MB2046; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2046; 3:XcUyhOoBNXzKq8PjqSPPGihs4Mt9xGdcPug1rriE6P/jxDGDwCnK2ddEUN3d4048VPF/3OPiAdVT7/hIhC/kbh1/0yubIrJxSUCKd4N8RlnqnYpetW7WS4UmoOIPQxK4M+q+31dLCpX0KxxWSP5Pt+twEd4nvk1/CBbsXSDHA3Uhi9rhv8vn9kN9HE9gTirTFpM4PZqgYV9N9vCtA8465sDJ7RwWgCEz5D+DmHG7FjafipVj1bxieDgU4goq1yT4; 25:/C9UuLq9BSs5v1GyU4qXt8f/HQSHwM1fDLZnUuDrCpYmhwN0zZng2q5N8KKS61afdA7uCZQPm049c3ZQ8LtZWWJS5RsMVh2N+jywdKj+uew7w2rEPN4jmB29zF1clod7jpRnMlHPOVhiB9NqkLlVVrKvmbC/l4GqWw0hIKy5pU+YutxRntVqXjiAAGMH+OUT+4P+17wmqJIgtKu3Z6G4coedIISt/BiTmoH7w+BtNZ2HvQDl2i0GHSo4deKReqyJFVYA9EGu2IYKpZmqEG0ZCTYU6dt6/MxPT/RwHVg+6aGGWEPZPpvkItbJ8AvyRTlfEMlfRD8GoYlOCVsBvyuFQw==; 31:gOCIloFdR1oKVad8/IrHmpXmSCYSms4/w6AIVJNTpFiUPr5HiDLxXrIX82O6k+PrGqXTDF/xF0Y1zvPxn6J+/b86B7mMOZOq/y0BqjAdyVd5blGNafrSJMnElXlgFKM0u3b0R2ROwtpKMFVTKJ/XO7dJRzJjIZSI/8+uzE3oWiDlFI8I8D9lPivvJtClgNDcDA41hln61kZ+cb6oVmXx1EDjTP9qK0yAlLWuzVUHDl0= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2046: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2046; 20:Ocl0OOdAw/z1iL/hpW78VF/7gT851qoibZ2CBsCYv7I++pJNjcOFWkkR+LMKsuI7qxRESCvnX2T5lcVUJw0gja2T+aZG0D42Vf+fmxdwojqxq6+WoSYFi9BhAMQcaagXTsQTFqHGOogcgkD0+ZIqei+XpFY6fAdP8tQt3ILqKN46Y+Arn9Rp6pFOuAVjsp9kPtOUGo7hyknnc/cfjPb/vxsRlmVCHAXqkGrRm4T0j3Sw9g4SsfJ6KhcC70cPgKcoGLoJok/WYSDzwBJ6l7mHHbHx9rALHwMRMx6/+LwLbKbuqFNzYPN8+GkfO97J49td2hzV1k8QuKC/uIXJGYXwiDmLi9KL1FsEs90XTG+nb3IQ7XH9StOvYDZaaIPjeQ671IyzO75HnLXEItNrSLafCSGQxt9JhoiFzjisYOy31V6zRQKq3xJnDjF0PKEJCqPCc/99YNS0kgu/nWp6ejSUlVJLxQ+8/J6Kml1JFQRb+ZhhPaohcWNQIephWZD46Tg8; 4:1WIiD3TtEIGy6xLTmnEB26/uovcyZqCYB9HAwohwkrkCH4f7VvVlqvWpb+sHY7Kg5KGJ4U5gjD2TH9kRuQdRHRlZLbTq2kCzXBmdAtj0a0dTv72s8UYUdnz6NXqQW0Ijg0+AE0iLGbZkNsAidszhrsU/joy7jOt3jQEfoaVsS3IQW4BhWjsDHZx4eeK8cYc3E4kKVc+tQFFdXU6nbDxClNehM4CgRLBo77SK/1XHZTli0HyfTwHCxkyiLXw5ojh/ X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0501MB2046; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0501MB2046; X-Forefront-PRVS: 045584D28C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(39860400002)(376002)(199003)(189002)(50226002)(16586007)(50986999)(97736004)(36756003)(316002)(25786009)(8936002)(6116002)(48376002)(105586002)(81166006)(33646002)(3846002)(101416001)(76176999)(107886003)(68736007)(118296001)(4326008)(2906002)(50466002)(21086003)(66066001)(305945005)(86362001)(81156014)(69596002)(47776003)(8676002)(106356001)(16526018)(5660300001)(5003940100001)(7736002)(55016002)(478600001)(2950100002)(189998001)(53936002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2046; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2046; 23:hkAvi38hbHoqUw8I7wUH/UDjomxLMdArdjpKhie?= =?us-ascii?Q?iECcgjbBquHTrOLxseUiXw9nOXG4RWZkD9JURSZSvwO451o9J6fxL84KfI/Z?= =?us-ascii?Q?s++7Hqj3Rrv3AhBZ3eFE1z+dUXnk4oUw0rKxazzZY8YLBz7hW1kktTGp5Q3E?= =?us-ascii?Q?JNA++STjgB+aLVp1iYsLUgH6O774abcDX9LvnCfsJMqHby6cYM9KUlcn+DQI?= =?us-ascii?Q?oGCI6sF1M7Im+RCMX1mSR6nncqDtlY3DnCbMUF3h8ssKxaKk7V8w9O94Qnmv?= =?us-ascii?Q?Dc5mXrN27gvQkHlSIc/TJ+jokb0295iuWDr0dOwFvcWPZ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5LheHd3DaARU920WvtjytfQpBaxHonpMEFcIIEU2XX/7DgQjZg9jR7img4sxMjFX06m8EJsdeiNOxMYTG+YT3d/nDc+uKN9csdhl2aUCjoAhTjnPgvtka7NP2GDY4Yy5U9Nnoq3NoRuGNQsKRWc290qKrLGZr1OUTqNclvbTvsyI/WyUNK8xNAfjET1zdCyXsItL8sTuc7cLMzOiHcy2vnbKaUUC2lcriRY7GHCC77p64rGvkmwz/reUoTVdQMsm/aOPbZ7Jghv8VmMBVFNM1nXAewhIZVOcAKNrbktopJRlywDQvQIAA2tvJpH8YiQ==; 5:9lv9n1g302S7ayDKch5i/Zm8dbqvFwlma5q2av16NT7p0kntSdQcXueW3aug1DzLDowAjR5DY7Bnj2P5EReVIp8snXPkfzRdk7b7ikVrX+GB7FugXZyqLCuM35chodSqvdx55eEYh6jNPVMAk80wsgEY1qoXWgxqk5drZMdXC1s=; 24:JcEDfGXg9V0+o4dazFHcayvdF3CZqLh3GTnzI4HOAJuucUyg/bUjuejY2gdV+p54qOG6spEDanQIg7VWGCgzgHGV8pnc4qrVhUwQXW8AsLI=; 7:oshpI4udsQbbOACbIZe+utl3zpYoRr/VoDu7fVtPzk0QEJapX5pSbcmTV3EWgHDMEPkW1lN5KqeBUKRDP7Fmb443gXSRwBg8gucSiA3kmhk8tGof6OFfVqacryCJkQkB92Eq85/Aq2z9XH9pLM3HPoo9auq0E3Za8fnSWGarzGFaxmFgrVHX1pVRTnaUD/e8VHwN38svs8S5cSDybmNLQMexkHitNRQG7P5B8Yzv21U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2017 18:47:15.1855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2046 Subject: [dpdk-dev] [PATCH v2 1/7] net/mlx5: cleanup memory barriers 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: Mon, 09 Oct 2017 18:47:18 -0000 Updating a consumer index to HW doesn't require a memory barrier in case that there's no updated data to be posted to HW, but a compiler barrier is sufficient. rte_wmb() is replaced with rte_io_wmb() when it makes changes visible to HW, not other core. Signed-off-by: Yongseok Koh Acked-by: Shahaf Shuler Acked-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_rxtx.c | 4 ++-- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 9389383f6..275cd6a4b 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -1928,9 +1928,9 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) return 0; /* Update the consumer index. */ rxq->rq_ci = rq_ci >> sges_n; - rte_wmb(); + rte_io_wmb(); *rxq->cq_db = rte_cpu_to_be_32(rxq->cq_ci); - rte_wmb(); + rte_io_wmb(); *rxq->rq_db = rte_cpu_to_be_32(rxq->rq_ci); #ifdef MLX5_PMD_SOFT_COUNTERS /* Increment packets counter. */ diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index a96a21ab7..827cb3c9f 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -504,7 +504,7 @@ mlx5_tx_complete(struct mlx5_txq_data *txq) txq->cq_ci = cq_ci; txq->elts_tail = elts_tail; /* Update the consumer index. */ - rte_wmb(); + rte_compiler_barrier(); *txq->cq_db = rte_cpu_to_be_32(cq_ci); } diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c index 6d337ecd3..e8f0626a6 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c @@ -567,7 +567,7 @@ rxq_replenish_bulk_mbuf(struct mlx5_rxq_data *rxq, uint16_t n) wq[i].addr = rte_cpu_to_be_64((uintptr_t)elts[i]->buf_addr + RTE_PKTMBUF_HEADROOM); rxq->rq_ci += n; - rte_wmb(); + rte_io_wmb(); *rxq->rq_db = rte_cpu_to_be_32(rxq->rq_ci); } @@ -1259,7 +1259,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n) rcvd_pkt += n; } } - rte_wmb(); + rte_compiler_barrier(); *rxq->cq_db = rte_cpu_to_be_32(rxq->cq_ci); return rcvd_pkt; } -- 2.11.0