From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10067.outbound.protection.outlook.com [40.107.1.67]) by dpdk.org (Postfix) with ESMTP id AEE8B1B2FE for ; Mon, 30 Oct 2017 11:08:04 +0100 (CET) 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=Q73ToT8SZ5ySqHFkQjGA74weqKBQd16K6p+V//WyqHQ=; b=agqarNjQXPEOhkexeXqAkUtVx4k7yTKMOxE2RrZQf+ex4ocCgAIcuRTVLk8i+mxPcVId1NVRm+UFdk783UMSQzgX3ljqvjSXu4Yi4hSf/NTtUtPHaCRbT+fbvl5YYniEdik56hjn6HtPSIt/iYcve+vEM++YJrb1MITiNsZyK/k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0502MB3662.eurprd05.prod.outlook.com (2603:10a6:803:f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Mon, 30 Oct 2017 10:08:02 +0000 From: Matan Azrad To: Adrien Mazarguil Cc: dev@dpdk.org, Ophir Munk Date: Mon, 30 Oct 2017 10:07:28 +0000 Message-Id: <1509358049-18854-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1509358049-18854-1-git-send-email-matan@mellanox.com> References: <1508768520-4810-1-git-send-email-ophirmu@mellanox.com> <1509358049-18854-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0217.eurprd08.prod.outlook.com (2603:10a6:802:15::26) To VI1PR0502MB3662.eurprd05.prod.outlook.com (2603:10a6:803:f::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07ffff03-3fee-426a-a313-08d51f7e1bc0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(2017052603199); SRVR:VI1PR0502MB3662; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3662; 3:6c3+bdasKZI9iC8a/eNQ9h1Ra8Cin5qXyqe5nqCMwxS3PH8wL/FKMAQTelq8uMkf1AL1GYyE9o0yN3n9vflv6UBABKEzQOyCObvx/QsK9MYnRxQkdAkWMDHpGU+m8b611eKMIqSMcYjGlRQh6al/uCY5YtPLoNzwHxK7qt3H3CW040fmqNcgO1IgpiC5z+XzKaKydSL+Sbaofk7fv0WO4jszyzuPO0P8e1wVxSrHF9PorrDf0zhDl4BlLqKXwQy3; 25:Bqh3MHa9tCgvLDWMV6cFoQvEXGLjx72T3mtoOUQSMs5GA3L4optUMeWqqoWGWV62Q2EZf8KzaJhnHmWgyx+hyCSgrjMouBFmrt35Fy7W775hY0zfJwzZ9KdHxj3snrB6oqz8rfvFi+FnEUXUdJrXoa7rPdFyEblTE51soI86IarX1AvDr/rgCQnPcUuQjuBGv3xM9iULRQmRFotPcMSvltFBnIW4XrSNXRRAjptcERJwn6avdJxtA8n3oA7GLxqDZrsz+t5lCRUzFpeTWuNBUCV2kbVpeVz3uojXhdXw9VjlwEwgLx6+Wotq2EJzs6wBo3y2TrlX/dbaFVAjqJCi+g==; 31:wTOZOL6JHPRsZkQJD4J0dRayFIIVuWZANpmaYpgiYwH9yGn7qBcibO0K0CrwVhksiQ+LMqXSF1ZApGX0FLPggzXjvuW5U9BqSjQnwT6Jwuq8+3yw0lhrOtxHKyMO0Iil8giDylz2FBEGWSfT799RLOh+2G1D3lDwupO3pYg43vFHfUMTtxkk+vSs01BPIaqKujL4UmnMl2lQQtXuCNPs9/SbcGmi6XZ8AYj7IIRb48Y= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3662: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3662; 20:7idBpJD5cEPVCLgoEjG8mF/bT9qmfnPS8EPeZ+MaR+ApQgq/3yISXJUUIguMEgHfPBA8mQH/xk7908mcDlsMAKaLMlK+xNxFfVATJYiBpPw9RDczZYUaTJqhFHSqdlbx42HKFdilM2dKX6kjoIx+Dl0Q7cVpHP9alzOEnPjMxBtLNo5oaCxL4Vkk3+F58vmO7OrGoya8OpXol/pwfCSXRRcpORM0bc6GwRGsGSs2AOBjisp/iMPBKjXVP02Bk9uHV4xUgKTO/5oWyy9od/ff4QUhe5qdzZeQSpi+C3K4sKGJMGnlQxQYNxnnc+5wVrEivKuutC36pFPL340mFuwD/KG0ZvBw/0fCXhSd77XoXYV95GF0AAULTuaKzzRwbXu9qB0HesDtIzroWbAJn18pp3sp8NRXCWwy6cRBjzTAo/w1z8YIodPYwlO+EmdxTb/cbp1fi9UwLgPo6kRIkE61X54ijJcGV/+DVS+zNmIxLu/MQPQ3uMhZTQxcmUfTY/UB; 4:hFW6WcFlnBkbomR1A5+HbjJ1l+v17BHA8IxuBqvKsc/+qawpQyDstK8W7YLt3Jd9clGhVjjqKGF96k3EOpKnIdfr4q/VklSd3PN7BAxGJtcSRDEw/yOQDjFxlreOkr2NWDbyFx84vbbZz8arP7KsZ+yNByHVefEQIjdWpv4bf5vCq28krzeki+Zg3d3Ka9QIQ4n+83DGeWlkvCOkwRokQJbK9/zB0+xq06eOQqDg3JIc0nwU+Kkt3Yq/LKuIV4QZWw9taeAPMI9skmZymEQWMfAwqjR2KCCVKuV+e6Kiov3mXirIHmkuMl6KdEz7Pv81+pL6OssRi66J/0cyFhG62Q== X-Exchange-Antispam-Report-Test: UriScan:(60795455431006)(788757137089); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231020)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0502MB3662; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0502MB3662; X-Forefront-PRVS: 0476D4AB88 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(376002)(346002)(199003)(189002)(16526018)(97736004)(66066001)(47776003)(21086003)(5660300001)(4326008)(50226002)(316002)(53936002)(55016002)(4720700003)(6666003)(16586007)(6916009)(48376002)(36756003)(50466002)(2906002)(7736002)(305945005)(2950100002)(106356001)(101416001)(6116002)(3846002)(69596002)(68736007)(33026002)(81156014)(81166006)(8676002)(105586002)(189998001)(33646002)(107886003)(478600001)(8936002)(5003940100001)(25786009)(86362001)(76176999)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3662; 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; VI1PR0502MB3662; 23:DhaXW0aD/kv9/5BvsRxYR7zHNsHgFOR+e7/uuKw?= =?us-ascii?Q?P0Eix6VCaiOLXsEEKeVeiJMfKYXrl4YBs3zvlcLvmJzX54gzo2JTyQWjjQQn?= =?us-ascii?Q?GRW2UtR4tQlTV+Hw66SFWck+pEjeUficSHOAXlzb5NjuJhmjlMEAct6VnAae?= =?us-ascii?Q?Pzlk5qTAnok5VgOs78LTezOQfLZs9G9erjJv3PTgluJ05S6CHWhRZpCgWVhK?= =?us-ascii?Q?UMcmqqUO125Ykhi+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PM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2017 10:08:02.8805 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07ffff03-3fee-426a-a313-08d51f7e1bc0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3662 Subject: [dpdk-dev] [PATCH v3 6/7] net/mlx4: mitigate Tx path 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, 30 Oct 2017 10:08:06 -0000 Replace most of the memory barriers by compiler barriers since they are all targeted to the DRAM; This improves code efficiency for systems which force store order between different addresses. Only the doorbell record store should be protected by memory barrier since it is targeted to the PCI memory domain. Limit pre byte count store compiler barrier for systems with cache line size smaller than 64B (TXBB size). Signed-off-by: Matan Azrad --- drivers/net/mlx4/mlx4_rxtx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index 8ea8851..482c399 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -168,7 +168,7 @@ struct pv { /* * Make sure we read the CQE after we read the ownership bit. */ - rte_rmb(); + rte_io_rmb(); #ifndef NDEBUG if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_CQE_OPCODE_ERROR)) { @@ -203,7 +203,7 @@ struct pv { */ cq->cons_index = cons_index; *cq->set_ci_db = rte_cpu_to_be_32(cq->cons_index & MLX4_CQ_DB_CI_MASK); - rte_wmb(); + rte_io_wmb(); sq->tail = sq->tail + nr_txbbs; /* Update the list of packets posted for transmission. */ elts_comp -= pkts; @@ -321,6 +321,7 @@ static int handle_multi_segs(struct rte_mbuf *buf, * control segment. */ if ((uintptr_t)dseg & (uintptr_t)(MLX4_TXBB_SIZE - 1)) { +#if RTE_CACHE_LINE_SIZE < 64 /* * Need a barrier here before writing the byte_count * fields to make sure that all the data is visible @@ -331,6 +332,7 @@ static int handle_multi_segs(struct rte_mbuf *buf, * data, and end up sending the wrong data. */ rte_io_wmb(); +#endif /* RTE_CACHE_LINE_SIZE */ dseg->byte_count = byte_count; } else { /* @@ -469,8 +471,7 @@ static int handle_multi_segs(struct rte_mbuf *buf, break; } #endif /* NDEBUG */ - /* Need a barrier here before byte count store. */ - rte_io_wmb(); + /* Never be TXBB aligned, no need compiler barrier. */ dseg->byte_count = rte_cpu_to_be_32(buf->data_len); /* Fill the control parameters for this packet. */ @@ -533,7 +534,7 @@ static int handle_multi_segs(struct rte_mbuf *buf, * setting ownership bit (because HW can start * executing as soon as we do). */ - rte_wmb(); + rte_io_wmb(); ctrl->owner_opcode = rte_cpu_to_be_32(owner_opcode | ((sq->head & sq->txbb_cnt) ? MLX4_BIT_WQE_OWN : 0)); -- 1.8.3.1