From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0064.outbound.protection.outlook.com [104.47.0.64]) by dpdk.org (Postfix) with ESMTP id 749D9DE0; Thu, 31 Aug 2017 18:27:19 +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=4RAh43SLpSk14fbIzU4iFHeVTowyfLef+HHu2KGZpG4=; b=Nt6OqdpPASynDMaagXLygaAMGaZJrPeltkYrnm+d7e2y4lhsWRjzlrYZaBDtHxGd+J7CJVPGdq9FdUXXJMpO2G/B+YwVjI7rUgJ2IOkW2aDOz+div4GSv3P6EbEFqSgcgd67l7pIM2q5jRGEvuymerJ3jEYjTdaJim2FifIjWuo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by DB6PR0501MB2037.eurprd05.prod.outlook.com (2603:10a6:4:6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 16:27:16 +0000 From: Yongseok Koh To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com Cc: dev@dpdk.org, Yongseok Koh , stable@dpdk.org, Shahaf Shuler Date: Thu, 31 Aug 2017 09:27:06 -0700 Message-Id: <20170831162706.30899-1-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: BN6PR11CA0022.namprd11.prod.outlook.com (2603:10b6:405:2::32) To DB6PR0501MB2037.eurprd05.prod.outlook.com (2603:10a6:4:6::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2338f1c-e4b3-44a7-91b1-08d4f08d25b7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR0501MB2037; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2037; 3:/PMQIVezsEYRKpKH6or4CRn/BZSOJaxh98RP6KVOJeV3coQmO3dtgi6vVvudSI6K8GRjVbpQLm0UFbEVX42W5aiI2py5RtIa5Bj/CwMcUJSpEsr00YOlM/pU+HSLTIE3gGou8jwCgeOKetepuJuwOXO9pQQWcIVYIraeMrAx7BliRTrM1bnXWrM2APm5DVJ11X+F0J6LbLtNWIMhbSn2s3iF4VwFKZzneiiptCS9cl8w8XFXBDJJJcOEnlVYKJVM; 25:2DNfpPNcmo2/Tk10IKNr0fhcgKHAAe5RTxDppE6iRZ/udygKEhKhqBJT26he7KikLlpqVCQYBNfzG9OLPKXWWhzaeKvbDhq4pdVcCuS6tCPmJZ2nmstfaLETAEdfDwiBVwpYxY7ByAso7ewAN2aekfFLggs9pFFAixmGHKqxQWJhxEHm3IVeP6HkIcdkaYpnykisHDSEGYZE3WLktK1E8ky4iF7E2D9ADuqlaLKKiJOrrIX30MKJRDu0kbDOnQaziWEU+M+M9xHlBDJoSxUW9Dq9CliNsT3d6C/lCOf8vw7QuZZewamkeyW8uO/1WMMMTOlV58qtdoFY4eTXNynnsQ==; 31:FYLB20NRWS+8izWf/S3lNgj9FmQoFKXQuNhARSfZ6f2BzgxOHxzSkAcFa1agjyS5hWG0cuBVlI4DHmdLz7rD03KteBGt+lhI+Bb3gRRo15emGIfkQ0wG5Umo3ZqB2Y6E7XxN8Xh0dlD+4LxbFJLDVipq8BFyzhqn0YrEU07W3uQ5X3OaUwMJiQVK2VuZJhGQ5ZfA96TpOvIsXlP6x5ocFvtY+qLmUYeKBstLGsSzn68= X-MS-TrafficTypeDiagnostic: DB6PR0501MB2037: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2037; 20:fQ7ywRAUIwqdHCHkSBAAgIMGVZq1vLUQJbaLkSrsOpJ0HZTtOpWQcOscmGGmZCLhPtKRiHqbicheB40eLqfV/RDMUg3pLE+jxpeXvnOLNff7Vod6DlAoGSsE+hB1P5jM5mBNP70WeMrpK6K/B78OL96bkhaXczxMCcEkjsrIDyFsaTRjdirXZMu2SCGtSPEl8PdH1eWopx2pcB41A4O84QjUY3wMslUWYMIJlfL9VYy1GBC1YktHMJX9+MVyYmBPn3msVZZa07wXmClJsf/9no7Gz0ETuMQ8hFUSn2baeU83DB4OY92jDBy2pQst9ETZMJBbGi5uxCe3GxzTAtxkV/dG1AyRtoReXDLJx/kp7W2moQQ/J7sKYR0qQEAU7Ec0KuHbTK5cqV3+L6xDKSrsdBMFX8B+RQKfyFXZ42F5G2uPWavS1beLO4T564JTwJ7jt35cqB3VHMOazpdLT2g36+pLVHTv0vccb3gUjoNSmsxwnH6cm6r1bawCpMc260MO; 4:CGwCiNAE0kZmIsHyzC3OYdKsnWBG2cq1agEIJfe7VLBfESRYja2i8Z9Y3KvqMrNVnwPMpP7GE83NHMRwvtMIwKsp1BvOk4zSa+X5rDntvfI0Yzg0vsnMDINhvvVosavH6cgNPdG9Dk0XaFHQWt9rIzBqOgHg0Ik3i/YCLkxbPjGpzZs9h9T9EESt9mWZmFYRpZp7TFHbM1UZpYwCOq4KjhMwCHwy2J7dFZV+XGSDUMGVsw5BKy7fczS1RkKziIhu 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)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123558100)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0501MB2037; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0501MB2037; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(199003)(189002)(54906002)(81166006)(53936002)(105586002)(81156014)(7736002)(55016002)(33646002)(106356001)(4326008)(107886003)(110136004)(25786009)(36756003)(50226002)(478600001)(8676002)(305945005)(69596002)(42186005)(189998001)(6666003)(2906002)(97736004)(5003940100001)(5660300001)(86362001)(66066001)(50986999)(21086003)(3846002)(6116002)(1076002)(47776003)(48376002)(7350300001)(50466002)(101416001)(68736007)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2037; 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; DB6PR0501MB2037; 23:bS0yxBzbi5UUQFg1n6+Dx9A4OSxVrCuwB85s0WY?= =?us-ascii?Q?lqVi4jL0Zrg0+e+cfjUDjZ8gs2mW2AN608rXlckUy6C91FtyMnTQgqKAF0jR?= =?us-ascii?Q?NTg7K3ey8tbWABg+Owkwfpo7c4OupqrDLrPCWqVlhfQS/szbySG5uvnCZZ4f?= =?us-ascii?Q?bRo9OMKhrudfY0aW9I73WU+FyX62j5/ld0fgzZKs7kycURoZSnvEwt8ZIaM+?= =?us-ascii?Q?x4gmQ8ySzyAVBQWn0+UDwrdq6hsnIBXufh4QKajLtRbavSYmO78GNtNND1EA?= =?us-ascii?Q?7QRGQOwcbrLC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; DB6PR0501MB2037; 6:mTgFqdIzIOnijH1DrLFSI2zi3Fj6yYX0k0etJ5p1WBx2VGsYpMiyLgHTOFkpT/4z9iZlAGJYuGzHl5+Y32KAvVaKV/RHMKe6NnxZ/AZgHCDpF3kCvpKSqMjyK30bQLa0HOxIi1X8a8fdmMiQzHdTWPp7V3TTJ/KclrRaLkIfUQlG96LUZyCUEJ7z+Qxbei6D3YkGC9LboZU0Nsb2GM9tyEZ4cxG/gxtAmfA8fM2Yu8ckmmWUa6WFa91C0ArYQlYi1F1HzlsfsSQuREeMV8T4+XUymEt/ZIVTwouoY4ZS6ibf0hV1sQmor2HCm272xRSziHb/fDk3YI7iCf26RqWVvQ==; 5:HpF7PzsXDy5kegJPU4UgyiWQ57JzV5GNJd8UnwbuTI8YPUqVS59T6lM2dPFM3BZEoP5W+DTmzcb7BVM7veDYZr2vLuO2Pr1lfolGj4S2i2u3ZOwrNN/XiTiBAu2/8uwNIqDsFPMfRD4xCgr4pIA7bQ==; 24:RpKgZr5RfHbUbQsz1A4Q0J6WzhOZZ+PSTTHLp5l4Paq992bliHbNjDYJFsXNhEofBS9snR7zUHiNj0stJlfjoqAU7NR3dxL4DSo0mDrDFzk=; 7:D3OtdZkJEgYd6n9XIqMYOAJzF8BjQc/ALN7D+3kzOezNwjdE/+OY5gnexloMYCgqpy02eRtBXP2BDN4fF+8ws4HOFTKnuEROq5fhryG/AB9XA9KvmafIyVh8T8ogeodnVP3FIM2axrq9jpLrIYdSET5C7Ms5eQkLh65WV2RCMdH70T4K7Fw0Yk9uwGu58NhnqPJ1jHJ7+8ap6OLbbkETGVVhCbYmm5Xq9n/OsJxiv0E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 16:27:16.5705 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2037 Subject: [dpdk-dev] [PATCH] net/mlx5: fix calculating TSO inline size 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, 31 Aug 2017 16:27:19 -0000 Tx descriptor for TSO embeds packet header to be replicated. If Tx inline is enabled, there could be additional packet data inlined with 4B inline header ahead. And between the header and additional inlined packet data, there may be padding to make the inline part aligned to MLX5_WQE_DWORD_SIZE. In calculating the total size of inlined data, the size of inline header and padding is missing. Fixes: 3f13f8c23a7c ("net/mlx5: support hardware TSO") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler Signed-off-by: Yongseok Koh --- drivers/net/mlx5/mlx5_rxtx.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index fe9e7eac0..f89fa40b5 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -454,6 +454,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) length -= pkt_inline_sz; addr += pkt_inline_sz; } + raw += MLX5_WQE_DWORD_SIZE; if (txq->tso_en) { tso = buf->ol_flags & PKT_TX_TCP_SEG; if (tso) { @@ -486,7 +487,6 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) copy_b = tso_header_sz - pkt_inline_sz; /* First seg must contain all headers. */ assert(copy_b <= length); - raw += MLX5_WQE_DWORD_SIZE; if (copy_b && ((end - (uintptr_t)raw) > copy_b)) { uint16_t n = (MLX5_WQE_DS(copy_b) - @@ -499,14 +499,11 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) (void *)addr, copy_b); addr += copy_b; length -= copy_b; + /* Include padding for TSO header. */ + copy_b = MLX5_WQE_DS(copy_b) * + MLX5_WQE_DWORD_SIZE; pkt_inline_sz += copy_b; - /* - * Another DWORD will be added - * in the inline part. - */ - raw += MLX5_WQE_DS(copy_b) * - MLX5_WQE_DWORD_SIZE - - MLX5_WQE_DWORD_SIZE; + raw += copy_b; } else { /* NOP WQE. */ wqe->ctrl = (rte_v128u32_t){ @@ -524,19 +521,20 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) } /* Inline if enough room. */ if (inline_en || tso) { + uint32_t inl; uintptr_t end = (uintptr_t) (((uintptr_t)txq->wqes) + (1 << txq->wqe_n) * MLX5_WQE_SIZE); unsigned int inline_room = max_inline * RTE_CACHE_LINE_SIZE - - (pkt_inline_sz - 2); + (pkt_inline_sz - 2) - + !!tso * sizeof(inl); uintptr_t addr_end = (addr + inline_room) & ~(RTE_CACHE_LINE_SIZE - 1); unsigned int copy_b = (addr_end > addr) ? RTE_MIN((addr_end - addr), length) : 0; - raw += MLX5_WQE_DWORD_SIZE; if (copy_b && ((end - (uintptr_t)raw) > copy_b)) { /* * One Dseg remains in the current WQE. To @@ -549,12 +547,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) break; max_wqe -= n; if (tso) { - uint32_t inl = - htonl(copy_b | MLX5_INLINE_SEG); - - pkt_inline_sz = - MLX5_WQE_DS(tso_header_sz) * - MLX5_WQE_DWORD_SIZE; + inl = htonl(copy_b | MLX5_INLINE_SEG); rte_memcpy((void *)raw, (void *)&inl, sizeof(inl)); raw += sizeof(inl); -- 2.11.0