From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0053.outbound.protection.outlook.com [104.47.0.53]) by dpdk.org (Postfix) with ESMTP id 28DC71B267 for ; Tue, 31 Oct 2017 19:22:03 +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=DfKkCmrowEs0ZkeVL0g5adqbDK6V000uPYjn2FQ0SXI=; b=qXx94LeHV/rk7qwxjrZ1Lu6v6bNTq3hezZ5KDFUDTFEmBUFnxim6wGOoFnK8PYLV2pMpx+n4vUSFfKl9TE+lsfrRqZopLxc2zAdruXNHjHXm/L0ih9uCMMVczZuua+TQyBCwCm2+Pun/ZYqFeQ3m2KG6IOXohyG3Nhms31gBNyI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR0502MB3664.eurprd05.prod.outlook.com (2603:10a6:803:f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Tue, 31 Oct 2017 18:22:00 +0000 From: Matan Azrad To: Adrien Mazarguil Cc: dev@dpdk.org, Ophir Munk Date: Tue, 31 Oct 2017 18:21:33 +0000 Message-Id: <1509474093-31388-9-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1509474093-31388-1-git-send-email-matan@mellanox.com> References: <1509358049-18854-1-git-send-email-matan@mellanox.com> <1509474093-31388-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0801CA0074.eurprd08.prod.outlook.com (2603:10a6:800:7d::18) To VI1PR0502MB3664.eurprd05.prod.outlook.com (2603:10a6:803:f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6548ea64-9df1-44ac-6e5a-08d5208c47c7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(2017052603199); SRVR:VI1PR0502MB3664; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3664; 3:/NqhtLq8xKs9HFgoC7Zxa/Jm9TE/Jrxn+H+fyrYQEoy2fiCjOX2Qm2+1hiHijv1owLC4GGS2RiUnFjxEdmaX5bgAuqw6EkpvV2Rs/BpNpdamxjvZX28ZG0ZvAY862fT433B0+nb9g4GxUZMIWbF/0NKpoBr467R7OoNV2ceLx+IsChSlf3Z4s4GIStv5VtB1hC3oC7n61GHhtlGp6MLSGSpBwlfbgGb18NqZFo6KDZn3r7BeidCzyLbLEq4ChZYl; 25:EaV7+TodzMvDL66GXe34adk3ZflT0SqrzodGVQpA7MLXwntiF3LfVPy0AB769JawnZd39tAvztW5K/R0cFrBR9Y+xyPmZskof3OrLeOUq1wTaw8c/1yd0HZg50/HyZIrAwBLxkApyLCwLcJT+YHmA5CNZNkdagk2Dtce5PFecCa0kvQo4ShZrQt2U8nvmVOb5yQ7xtngja9fGxB2MYOFWixSdFsxDFCbpJzTMDEv5H2LaP6TAgUlaeYO5fs1yn9+3e9iA/pMEI6cn8KVSfAggY5CnM3jucjUxs2ZNgV9mU7Cq62Xt1+05t3ERCGUYPVbzZMDQ4/ZAJ8aOC+lTLJgbQ==; 31:sA3WsdhcURsYmFppeK0yeaOGzQIPl+8P2cdYm/vkykitESM/3Ti0FSC8a+t7WXBd2T1GfjI/WqkhQW438odfDTJvvaAjynbZN6fY0QTtScmqKaceMHlYj84Zo/aBPZeJp97KPnFxo0lzHijHGBA4WIfCTNAjBl3lns9GOrGjX4gUx8hNUznnJNNNi3J3NHLANkbUmNCqLkWOOQM1xbpNSwzxv1pc306o77jFcErRMoc= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3664: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3664; 20:MXtrgFUAicv2/1kJ69wv/cfJQK7ILPLBQ8uURKV95lU6wzPblu+hfNYLUou/qvR8kA3BeJ/aC6G9wDB46XsYIBfBtin5p/J38R39Vc7Ia1U4eqtqQ7Icylohs5G84eV5fTpdMezN2CWtUnKrPuHyWSxT0J+8Z5jEGK6LVNNvBdxmfZMQd7aB47XD3KajQfd8MxuG8fFVLhpkoyGFGvK7elArzjBcr622bBTjAW7tFLQsrbPZI2PMJWG8UMnj07Dv57H0Jw6X+OHEVpDmWVHqLoYWm211GxavCrQXkNlxgkwwlfeXyxGq1K9K2+MpVqrFdnEW7FxvEIAUrIq7OtURvZEExzd7kwPVgCkSvMlDTCRjx+M5TlESX3LJhe9MNf5+L1/+op/D+vLqj1nPAwqZRxMaytkjRwCckIcsFoO2KKEm72fLrNB2iWJZftFJyGhu/T8wRSVJxry70AQFe6JVu4z4pnS02q5mZJjJ98mDOMlObqlYtfDJkZXm9xn2U8lI; 4:JUC93jPoNLQZhE2u77tJWKfOaY31/SwDzaAXFK3EbRnIpKp6vl+bx8c/yG0kSDZy2IvzcJ3FCEJonb0lCc0HZZZZuCgTB0MvuYiupGPWtwIfvjgaihPwYwwKlGXtnPtKKj8V1MK4b6JuGGgbe0Tke62JWVSFXzRB/sO7Zeh2k555W+Fn4PpWM9lmRbA3H4r3puoHU++lHIfteWW0SxNdjTOJnhMMGZm2SPQAhj7eF9jRiUZBUnsmErbKKFaTfKn3PObD5On/trcN8eOEHlHhgc+1r3t5GGs23uQeXuo/xH1Ju7JGX+7JrFwTqdj4E7yPZm5WbWiVyazF4u9gvHeUdg== 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)(20161123555025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0502MB3664; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0502MB3664; X-Forefront-PRVS: 04772EA191 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(39860400002)(376002)(189002)(199003)(50466002)(97736004)(66066001)(478600001)(189998001)(36756003)(33026002)(25786009)(7736002)(316002)(107886003)(16586007)(4326008)(86362001)(50226002)(53936002)(16526018)(101416001)(106356001)(5660300001)(2906002)(5003940100001)(69596002)(47776003)(6116002)(3846002)(68736007)(105586002)(81156014)(8936002)(81166006)(21086003)(305945005)(55016002)(4720700003)(2950100002)(76176999)(50986999)(6916009)(6666003)(48376002)(8676002)(33646002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3664; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; VI1PR0502MB3664; 23:hNitIFMNvwoZnozAhNZbxz45YSQyy01jDln/s1L?= =?us-ascii?Q?rrlx0/bc2zn4Kn2bMzAdamTJnOWdJxP+PSx+NcXOfF23PNZLC5UDETz/H2Xa?= =?us-ascii?Q?04j0OqcXELq8z6HaUDHSPYdt1uvfFKq5jHLAOh1RWYM4G6zZz/oKabb8vchd?= =?us-ascii?Q?mAEoKO+gkxj4yHZbqep7fjPNGhkM+yaSNUE8pIqaIl+sv3bcv6OrPPnqPaaJ?= =?us-ascii?Q?5r5WdebvqAw7yqY9V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: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2017 18:22:00.8774 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6548ea64-9df1-44ac-6e5a-08d5208c47c7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3664 Subject: [dpdk-dev] [PATCH v4 8/8] 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: Tue, 31 Oct 2017 18:22:03 -0000 Replace most of the memory barriers by IO memory 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 register store should be protected by memory barrier since it is targeted to the PCI memory domain. Limit pre byte count store IO memory barrier for systems with cache line size smaller than 64B (TXBB size). This patch improves Tx performance by 0.2MPPS for one segment 64B packets via 1 queue with 1 core test. Signed-off-by: Matan Azrad --- drivers/net/mlx4/mlx4_rxtx.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index bd6d888..fc7a922 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -169,7 +169,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)) { @@ -197,14 +197,9 @@ struct pv { } while (1); if (unlikely(pkts == 0)) return 0; - /* - * Update CQ. - * To prevent CQ overflow we first update CQ consumer and only then - * the ring consumer. - */ + /* Update CQ. */ cq->cons_index = cons_index; *cq->set_ci_db = rte_cpu_to_be_32(cq->cons_index & MLX4_CQ_DB_CI_MASK); - rte_wmb(); sq->tail = sq->tail + nr_txbbs; /* Update the list of packets posted for transmission. */ elts_comp -= pkts; @@ -321,6 +316,7 @@ struct pv { * 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 +327,7 @@ struct pv { * data, and end up sending the wrong data. */ rte_io_wmb(); +#endif /* RTE_CACHE_LINE_SIZE */ dseg->byte_count = byte_count; } else { /* @@ -471,8 +468,7 @@ struct pv { 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. */ ctrl->fence_size = (WQE_ONE_DATA_SEG_SIZE >> 4) & 0x3f; @@ -534,7 +530,7 @@ struct pv { * 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