From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20079.outbound.protection.outlook.com [40.107.2.79]) by dpdk.org (Postfix) with ESMTP id 078101D7 for ; Tue, 22 May 2018 08:56:51 +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:X-MS-Exchange-SenderADCheck; bh=qXecoRleJanO/LLjq0fY/cGJFVA5fvnjzqY11/konMU=; b=yA0a7iMspTiAQkvbxLzCp+i+RGduiJs6jKfv3/rPeZORxPVts/hkRKqgb9hi1oJVlCIfMqIsjd41PBOkGUD4hk28xa30lYOQRMO/1Qaa/D8ydnCDpI4tYMo/cxv1Oh3nsJl8fnf9/+g2ZIIgJg0O/y2N8m9SPhHGIaqRhzbc9DY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by HE1PR0501MB2043.eurprd05.prod.outlook.com (2603:10a6:3:35::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 06:56:48 +0000 From: Yongseok Koh To: shahafs@mellanox.com, adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com Cc: dev@dpdk.org, Yongseok Koh Date: Mon, 21 May 2018 23:56:30 -0700 Message-Id: <20180522065631.23204-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: CO2PR04CA0143.namprd04.prod.outlook.com (2603:10b6:104::21) To HE1PR0501MB2043.eurprd05.prod.outlook.com (2603:10a6:3:35::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2043; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 3:/1mO/+R6+68/prJX2bGM291KH+N/BkWdp0cGlPDLVSEIBGRhjiCb+LnavfC92Bhh1rwxb50xG57+aOJuVWROWoiEWs0u/IFJGtnDoBqiW4FgeAg+2lOkOpUDTpNnr6hCMwg1EEs4iRXE3M6m/43AW9CN5ydL41yk3/46DsDqpNLz0LLRbU4rUZSyU8Ku+71SqFtD8mYoyKE3okkaQYhmrBjXUjUMxDczaiGEKFOrk6WnXmy+UaECFTxikdfGjvAD; 25:MZ2jwFGbvMP4u6BN5f+W93UC7r0CcQ1nx1LJHcXL9LlZrZJeBzB5q+76LPu3YNbXCQzankgU7TxGHnVJhrTKET3pcEsVpcLFHSoW+Yjl2XhL7Qk0RCBeDZbKFCNQEKI+64Sejh/xBRWVvJwq/HyL+Woe5IG/G+imsVWQoZko3kmPhPJ3L6kggsG/oeV7jtzWILQ6zhL2sDiZt2uQXbkyPDY2qdW7OK6/L16rEJCrHHxAKHGliBixHuX69o6SNbFhLCjvII7+BAq0WLc2+XrWsOFuoRpBe46lOcEd2koqy/lM8GUH1AqArGF29PI0yIvl7l0QW/r59vXWWCk9uW4ANA==; 31:aHxuqLnQl35u1C1AkkX+0ksNwmI6fFiQJNklfEUo6B039m88LaaFy0H1NV5vPZ4XJe8nTQbuJab1g+eNpvVLYMtNfkFtiH4K2tX0xxOeE3vZpsSg8Rg4wCQwJFnaAKQuB6yWUBKh+TOnXjKCo2DnNkhv9dAo28beCbhIRcbVNd6MtYQNHnxpzJPFJRjh43BxQSK4IBjcKens0Ch7kbrUlk0Fm2uwSMvpIhEvPQNA9GQ= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2043: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 20:gcffn813Yctux3myTycMntBNX2toeOG4BjSRrGC8dc/NwipZyPT3JsVVsVHLb9bMlEAOByNi5lNmcge5OVtGYPorJedSfR+zbp+BJ9P8h95Vq5/oRSIo2V+ig3H0eqV9J+XBP4YVtkBWd2Mt5Yqb80JMYIqzfLUMJaZjuhcfPeNRM5taJxTipIscmGJ9noF+NjzoVvN/xmwAWp+zaCpVQZ09rA+Tf3ufKFFm3YXZOooZNCkZvNlwNBRowRRROnRQzC8PPEH3oYFYWELyPFsq3Qp8sDsCc/u6idS86V87621GYt+QBqyC9vB9Uo4dWs7u5b2Gczyees5yp8ehbyFC+HTLt4wp+4cHOE6CgNk74yQiGSw2d5N6gU7QfX5frzv7+ZWYjcKkhD5ndVmn9oSvpHBN900ZxZ9irtXN3eDFzTLu/SP3abjl/QreUgKNsdX2nEbt2c+OeStiZILmjVUM6pTNB2mIQc5IqDkW+dJQxHavVhBhC+QHXVfXu5Kgar8m; 4:PSS1fVSXcxCOiLuZOU97JrgctfG5mTTx5hAAqVuHTusHqalQ6OQ9DKHSSOlAt5jrL2pR6RKe5ygG30q8PQpo12z5NUHEVCISjCG5CGUvgrljTlaL1aXRixrQTVTC/HKBMiphwU+/KF1wl08X69jzd87rvhJO+bO5ryPoO+WwoHv5Z6DS3Rn/qdIvU/sU8av8mlyuLeEvPNCJw+rA3zSQ/RL1RB3hqy0QwcSGIWviykCtZ+hDtJNUu4whq3iPGfGxragGGNPnDZ8SWv6LKn/qAw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:HE1PR0501MB2043; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2043; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(39380400002)(396003)(366004)(189003)(199004)(68736007)(97736004)(16586007)(316002)(36756003)(478600001)(21086003)(25786009)(2906002)(69596002)(956004)(47776003)(105586002)(106356001)(107886003)(1076002)(55016002)(7736002)(66066001)(305945005)(50226002)(53936002)(476003)(575784001)(81166006)(86362001)(4326008)(50466002)(16526019)(5660300001)(52116002)(48376002)(8936002)(26005)(486006)(6666003)(6116002)(8676002)(51416003)(81156014)(3846002)(386003)(2616005)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2043; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2043; 23:qVzZnmVEp3avhcz5rAuWX8ffjLZTacHIgav32/Z?= =?us-ascii?Q?9mieZQ+YCwjeUkFAaEExHRB9jvk2yAuyyIBnSWjnolnCKcbkb34OhhSPa00K?= =?us-ascii?Q?i1WMjPYA5nQlVvA91ZWXD4c2t77H+aW/qPmpV3Q3lugPvrdMEnFKfZ/qYAmE?= =?us-ascii?Q?w30jZclqVUhZiHPEz/GRYVheROhyHjUo+1chFZ72NXxNra421/Vzovs4fVV+?= =?us-ascii?Q?r+drKSiuhaP7sfI3j2we4YxM0o9qICpW+dKKgTeBRADE4OUVVkd7tKyzOl9W?= =?us-ascii?Q?foOwafvK5hAdA61zieqqHBkRIhCTCaw/eizsfh3lkuKIKq7eEkpehxR4A2yM?= =?us-ascii?Q?7CAfiEkUe4csbf/jOGGxlyTNljCGWtZYYguqAVOVs1Ve+xPiFxtbEEUQuTw2?= =?us-ascii?Q?G/tU20aEGAx/r5546BQXLBIo//cB9su4Bjr4nJYApD7hv2utDlB384/JZ1DI?= =?us-ascii?Q?n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id5HKpFikEXiYEXom4yHCtbkFmJDUV+Ra1hxteMdejyC9X2DNaXTKASC X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 6:nDcxC602C1EkoF765bXY0W1An1mg1NJeqFXiZdzeLg4GAMLHcJq+R5tLV1IMHyQPQZrfX6++M+jFhYFX6CVNwHWpZkZTBiWMO8a2l1z2+QzTje00ZRntDCJSqJO47pGvqEmQMCA82wHxwCjjIuy0X6nbyGkGWtichRvFtCXl2lBRYQczPAETa7kr20gZOZs2n3F5ErgQ0pFJEZNgID5L0RV7fSFvEfagyiYizbVxD52/eeFmLx6m2aS51ibsx4Jz5eCdGzMVAqYOtXP67nL2xFIPUyR+qp0lPSady/RSQPJxPlBJM5KGb/h7DQhbXOGmsFE/w2AIC6ltuEococ7OnvCpn8zhEPcFyInOc/jlpyUyItD1DFrOm4Zhe67Ady6mLsnRiQ87tDXidNeYozAenalsM8KaY0HHvrIoR5HF2z1n6n4X+0zcoI0WFpvJqv+jJqjueW4E1d8afo5uayCoKg==; 5:ybRNleFV7L9ZpMtwFvi1bX0IpfOtDfWJClD26N7K5MJBuKCfRCCj8AVo9P3o2U00eow7DdLU5q9rzWHKzC2JTQCL+7/03Fusy0NbdgnSiJHPkib1ttpXQR20wEc8RqKx9utvbvv2JMzYKW6l1g0HM6lZH0CEOGNX0Od7L0E4afY=; 24:V/4ickkN6/6KeNcgALdF18/6ymei/p0WzUdFEDZNATYUxRJYTicsJ/eFglUubQfdKu1p2FZDNJUpNUfjZICXZgfJrhkl0Ok9nLTJ12mntQM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 7:RQFEiiv4a5UCyA0TUuYyZ8ZThULK6VNhA8oN3YNceiMjQIZozlb52235JM4FGCI6d6pA3AFyzdkxvOYfI68Gk7+2wKub17a8xinmuv6rDNXgEUap9gPigzb6hpEUG9fqisPtSpSDeq1obX7imed3lqUfIIbUG6k7HZalabaKf4a5fVJWRSRxzh6Pdv/uh98FFXle3EXhiMKsf42QrlmBdz6F/70A3ZPtDpGG+ePIoOtmDk7b/rgaZq8F2p2yqMVM X-MS-Office365-Filtering-Correlation-Id: ade7ded0-4060-4b47-88b3-08d5bfb13135 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 06:56:48.4594 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ade7ded0-4060-4b47-88b3-08d5bfb13135 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2043 Subject: [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix setting offsets for SW parser 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, 22 May 2018 06:56:52 -0000 Since ConnectX-5, SW parser just complements HW parser. SW parser starts to engage only if HW parser can't reach a header. For the older devices, HW parser will not kick in if any of SWP offsets is set. Therefore, all of the L3 offsets should be set regardless of HW offload. As IPv6 doesn't have header checksum, the mbuf can't have PKT_TX_[OUTER_]IP_CKSUM if outer or inner L3 is IPv6. And if inner packet isn't IP, the inner offsets shouldn't be set. Fixes: 5f8ba81c4228 ("net/mlx5: support generic tunnel offloading") Signed-off-by: Yongseok Koh Acked-by: Xueming Li --- v2: * add missing 'Acked-by' tag. drivers/net/mlx5/mlx5_rxtx.h | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index a6017f0dd..1e4b2fdb9 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -655,10 +655,13 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, uint8_t *offsets, uint8_t *swp_types) { uint64_t tunnel = buf->ol_flags & PKT_TX_TUNNEL_MASK; - uint16_t idx; - uint16_t off; + const uint64_t csum_flags = buf->ol_flags & PKT_TX_L4_MASK; + const uint64_t inner_ip = + buf->ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6); const uint64_t ol_flags_mask = PKT_TX_L4_MASK | PKT_TX_IPV6 | PKT_TX_OUTER_IPV6; + uint16_t idx; + uint16_t off; if (likely(!tunnel || !txq->swp_en || (tunnel != PKT_TX_TUNNEL_UDP && tunnel != PKT_TX_TUNNEL_IP))) @@ -674,20 +677,28 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, if (tunnel == PKT_TX_TUNNEL_UDP) idx |= 1 << 9; *swp_types = mlx5_swp_types_table[idx]; - /* swp offsets. */ - off = buf->outer_l2_len + (vlan ? 4 : 0); /* Outer L3 offset. */ - if (tso || (buf->ol_flags & PKT_TX_OUTER_IP_CKSUM)) - offsets[1] = off >> 1; - off += buf->outer_l3_len; /* Outer L4 offset. */ - if (tunnel == PKT_TX_TUNNEL_UDP) - offsets[0] = off >> 1; - off += buf->l2_len; /* Inner L3 offset. */ - if (tso || (buf->ol_flags & PKT_TX_IP_CKSUM)) - offsets[3] = off >> 1; - off += buf->l3_len; /* Inner L4 offset. */ - if (tso || ((buf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) || - ((buf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM)) - offsets[2] = off >> 1; + /* + * Set offsets for SW parser. Since ConnectX-5, SW parser just + * complements HW parser. SW parser starts to engage only if HW parser + * can't reach a header. For the older devices, HW parser will not kick + * in if any of SWP offsets is set. Therefore, all of the L3 offsets + * should be set regardless of HW offload. + */ + off = buf->outer_l2_len + (vlan ? 4 : 0); + offsets[1] = off >> 1; /* Outer L3 offset. */ + if (tunnel == PKT_TX_TUNNEL_UDP) { + off += buf->outer_l3_len; + offsets[0] = off >> 1; /* Outer L4 offset. */ + } + if (inner_ip) { + off += buf->l2_len; + offsets[3] = off >> 1; /* Inner L3 offset. */ + if (csum_flags == PKT_TX_TCP_CKSUM || tso || + csum_flags == PKT_TX_UDP_CKSUM) { + off += buf->l3_len; + offsets[2] = off >> 1; /* Inner L4 offset. */ + } + } } /** -- 2.11.0