From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20076.outbound.protection.outlook.com [40.107.2.76]) by dpdk.org (Postfix) with ESMTP id 43A872BB0 for ; Tue, 22 May 2018 08:56:54 +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=0ss/i3egDDepAuYY3zhcJjnwwR+qSgJIpq8WD9hmqJ8=; b=yyixD1rBsTOedlaRuhiRtDnMejd5hJi7d5JLHfYBrHL/U2biHwCJKi8SPcf2HLXpTVGvUWeKKuf7wuXyUQtnOHfT0YajMW6IN8Z+cVwKfRBFelwRtVybwV17WWxUpdEnDbU81P8875fURkw76qMw/wFBOuEjiPXctH7PXl2dTj4= 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:50 +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:31 -0700 Message-Id: <20180522065631.23204-2-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180522065631.23204-1-yskoh@mellanox.com> References: <20180522065631.23204-1-yskoh@mellanox.com> 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:kq+nhTrp9bY6EI0U5u+RWTaMJR67ZLjwsoy1eftsdU+oRv2kzkPVsjA+ZWGg2sa0Nn4to48NzWiFcgKmrUxZhhDV6AtTuvslUuGHQd3XluMK92yLu/UNo1WI1lZQtzUg3Pl5aI5n9qXtbjdKzETnuJZMi6bfIUVM2a8/s+gkBEAKI6ZxeupzdiPUCbn++vB4DaMZbXTX1ergkRfWXeAgeVFGMS7hp4t1EW8ZhI/Ir3nWF9xVTn7SjkBjYNGcocJo; 25:llLUkkXgPdOoeoIOGHyD71auZBHphFqGkcidgat53tRAiNbRdABtkDiKJpEp2L8s57mMrfUNZz4t6lqr/BkS8q3y1kT1rvS77FCP2p7Ylp6B/Tv41o4lhXTDaJeF00zukgqOfq8V55tb5YT4mNn29snTNjLU33WtDKQWsKQjif4xWISSzBqOhFkly18fEQO/rW2+gSdYuq9kJBKRPE7dp4dhxjQbQlTvnT+23NsAlYwoU/ArUELiCUyxgzUPcW6awBbOGLtVfjVxvcUDIhjGUvVwr1QpK/m0qoGRqGdVW8GH4TE4pSMdYN/PU6eg8ZoPKcCYgVlvKh9kGtgtSuyBWQ==; 31:qqJuN+djHpxWO03o2lBk+z/tykTs+l7BEKT7w/q3/qBA5j8JA+1laf6+HdZPUCon61R3YALu9Q7VZ52APxvETWzSoINsUBvw4SVq37DxoEXutrljiGNimFAubf/3IbJHsVCxzCxFW3GAQJ38JWXM0EiuF/0sKexnmtBWm9yOS556HNIvZWFcx22X5wWf4qzS4RsNCyWi98K2MuG6ZoEVXIWHVhhYuCcLBRBVdiCZHRY= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2043: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 20:DMw1njn8Pw4rnehAJo1yd9/YGiyxni8cYWhxJ46tgy+7MnJ7LB1r5qEWSx4gLkOdIzxp/GjnaU3q6/JrLrz3X2bgoHNeECCZHSxN3WjMjYbm0kt3HlTWA/NJW7vHHdxAURWfqygkiQnZeB1muSQIh8UFM3N/U208dDP44m0tsN27Wj6pAxB2Teb8XaiwWk0YUdesu4WhZw7U0DuXOTngBE78oKXzKW83Y3fSGSv2Q3eTz6Lqm0XXKBGbCJUbKDh45PsaEL59JufdabpdLfYbOG/TzsF0vR2QTSAL8dM48Sc7Nq3DiZ/9us/aP8PpWI/RBE0k93YqVt25D0fQgZOBdvxS3EipVJQNhYrYA9p46Yve2z4nKAzVAm7z8jPCU993QaauX7AtSneA+y7106OMCseEAh4aPz3q9WIt7/kXXVG5nrpZIl8aQNXC3ED+Bi7oO2/bC9zK9I0a7DGd4B+WSNcVBDCU4WrO/lOSM2pVcyJgWZ1B3tt1tx1Y1UbVZer3; 4:v+0wBaKh5YTcGmijHplng3kUSABAJvPsaJtq30YKbu78c2XWzOsB8+SQ+V8Gh7sjaLWA/cDuQwIljzBWTJANvi9ATmuP1bPUzlTq6pPPAvZQ+H7niLiw+hKiF2RyKe40AXB78pzJDY4yLFobc3O5pcEPgrduBBjnb/GVlG/lxS1uiVza6VX3iTmeEWCAlLvpEbbYpQ7xGpOcYQ/0+mFBdtcXeo3rUypB/VvXKZE+4bL/ZwQg+3xvVoDJspetCqIZbWr2xxG+F0RsBstYB244epu6V4PDBxwOGK8L1b16kBL+wCberM5drFVfJWnP5Jz/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); 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)(979002)(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)(81166006)(446003)(86362001)(4326008)(50466002)(16526019)(5660300001)(52116002)(48376002)(8936002)(26005)(11346002)(486006)(6666003)(76176011)(6116002)(8676002)(51416003)(81156014)(3846002)(386003)(2616005)(7696005)(969003)(989001)(999001)(1009001)(1019001); 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:IcphHBhauAJ0upvElaeOOToq7tqKMhFDHCCQUvA?= =?us-ascii?Q?fq7MNE1M1CxbttzB/5+W6vvMt0NjlepVUmMizvbFmDxBU3RU92g7zVkLtJGR?= =?us-ascii?Q?rwi2BpGrCmfgtwAXJi75gLrb7nwxd9uBaDaE0YJbvAs1RmJodaaeygEF/azB?= =?us-ascii?Q?NmdmDWSS0vvv78++jba7G8NM9BXkQiE1+hrqzV1vOFfTJHJd0Yu70UAh1/Rq?= =?us-ascii?Q?X/n740KphPIG1o+IZzx+80OxYYWs6k/TxNuneRoMJpfg8KXX631XeOHr+/yL?= =?us-ascii?Q?efSvUEGxmSHtWM+wWceeZ6q0S7mkaw6pi87KC3yb0Z80HO37pIc+Pnmc1uMl?= =?us-ascii?Q?A3XeDYAfvBjUH0XGFcHkSngIORoez/bCXFqzE8okiREU23eMtRYO1jjSUJ8+?= =?us-ascii?Q?drQPNTBr0m68qaQSAStfJWBtKpFhe45x4f5nFeI8q7k7i1ReLe6y9EWLBNlo?= =?us-ascii?Q?tidS92PeRejQRHyJRSLxibKGDb0RhNGlVQao2caC0ZppRezvr59jEiwg3B54?= =?us-ascii?Q?QBe14nw50rApWn4TEXSwuu59/7bo7qEjOSVLbywa0RPW1aPZ7rVkNHaqpNml?= =?us-ascii?Q?LhRAeaBDojgo/kJj1gYCO/j/izPhN7dDb0gGlFNRTXUaI5t/15BKSgevdSwW?= =?us-ascii?Q?k8JkcjLYAF2vBPGpuJz38ppZkCrK0FFHwZIo4ESSSnPKFW1XTw4qRNn6xRfd?= =?us-ascii?Q?AWuge9U0aOWHr2RmwI2ga+wOxxJ2hRCoga0JIV7Y9vfbQWpdS0AJbdlzWb+1?= =?us-ascii?Q?CIoV9tNZk8sqiN4lUZyS0yh9wm0l1ueizcLmquaiUjTZnYj7HKN9QP/JOBEo?= =?us-ascii?Q?f0u2dftFhqol47N0IBIizQGtuxbtyBajgin/0n4hfY8Fj6quXqRgPdAMMLLk?= =?us-ascii?Q?ZNBO475euxyoIZEOro0D5ndHYkGLwkiRG92YgglK5opj2drOBUDEdPJ8gK9p?= =?us-ascii?Q?3nI086IWV6/tczLh5ZYPXDszaqwwlyroEygyAwsZl4qiTsOeXLKH8wF0wgLn?= =?us-ascii?Q?lBfBsbZPIv4xctYKYPaSmA5B0xPTq0Uy5oOH7lKHZxL3K98ER97FDvSywUTl?= =?us-ascii?Q?w4jMECR9Xeu1FzptTLVUCE2sAvYFepwlZn/nzSY7bYAFweARgTpziL3/qvj/?= =?us-ascii?Q?vGENPzXG9ZLtDHf/4LtM1H0CrP7rdHVDfwl+RKY2KhBpAkZa3CiLPSx5xKoN?= =?us-ascii?Q?zyQJajdA4Wu1YQEBwD2J3jNjaxwANeBesEyNrovLtluLa2zXcBcGO7hAL+DK?= =?us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grAagFMVfW70543JqaM57DcacC/bKyp9ULM5KZskOpTLY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 7:oKqr1e1g9BIBM2AFAlwbDbAH1j/Nj974XcbwvCG/Jn2qTN2+kPfGCgmYG366NJaQvVAPN16csNK4krOcQDHD7vfjgSkwnkSBhY/uXdndQgSrdnoDpgEopnwZPq6jff3AJNHlnv+codTMCAMLofRqm6S8COAfG2KA/9QYiw5LuEj39gGAJPybssjJHwywIaPsl5WDuY7pH3X644QSevsoN4poeiVZtM5NTvUJpKRmJ9FhSRkMXbTg3NHMuQXVgpRh X-MS-Office365-Filtering-Correlation-Id: b5297a72-c28c-4cca-5803-08d5bfb13283 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 06:56:50.6471 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5297a72-c28c-4cca-5803-08d5bfb13283 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 2/2] net/mlx5: remove redundant checks 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:54 -0000 Signed-off-by: Yongseok Koh Acked-by: Xueming Li --- v2: * add missing 'Acked-by' tag. drivers/net/mlx5/mlx5_rxtx.c | 6 ++---- drivers/net/mlx5/mlx5_rxtx.h | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index cdd373e3e..527859461 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -522,7 +522,6 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) uint16_t ehdr; uint8_t cs_flags; uint8_t tso = txq->tso_en && (buf->ol_flags & PKT_TX_TCP_SEG); - uint8_t is_vlan = !!(buf->ol_flags & PKT_TX_VLAN_PKT); uint32_t swp_offsets = 0; uint8_t swp_types = 0; uint16_t tso_segsz = 0; @@ -566,11 +565,10 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) rte_prefetch0( rte_pktmbuf_mtod(*(pkts + 1), volatile void *)); cs_flags = txq_ol_cksum_to_cs(buf); - txq_mbuf_to_swp(txq, buf, tso, is_vlan, - (uint8_t *)&swp_offsets, &swp_types); + txq_mbuf_to_swp(txq, buf, (uint8_t *)&swp_offsets, &swp_types); raw = ((uint8_t *)(uintptr_t)wqe) + 2 * MLX5_WQE_DWORD_SIZE; /* Replace the Ethernet type by the VLAN if necessary. */ - if (is_vlan) { + if (buf->ol_flags & PKT_TX_VLAN_PKT) { uint32_t vlan = rte_cpu_to_be_32(0x81000000 | buf->vlan_tci); unsigned int len = 2 * ETHER_ADDR_LEN - 2; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 1e4b2fdb9..5d9a7dffd 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -651,10 +651,10 @@ mlx5_tx_dbrec(struct mlx5_txq_data *txq, volatile struct mlx5_wqe *wqe) */ static __rte_always_inline void txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, - uint8_t tso, uint64_t vlan, - uint8_t *offsets, uint8_t *swp_types) + uint8_t *offsets, uint8_t *swp_types) { - uint64_t tunnel = buf->ol_flags & PKT_TX_TUNNEL_MASK; + const uint64_t vlan = buf->ol_flags & PKT_TX_VLAN_PKT; + const uint64_t tunnel = buf->ol_flags & PKT_TX_TUNNEL_MASK; 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); @@ -663,8 +663,8 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, uint16_t idx; uint16_t off; - if (likely(!tunnel || !txq->swp_en || - (tunnel != PKT_TX_TUNNEL_UDP && tunnel != PKT_TX_TUNNEL_IP))) + if (likely(!txq->swp_en || (tunnel != PKT_TX_TUNNEL_UDP && + tunnel != PKT_TX_TUNNEL_IP))) return; /* * The index should have: @@ -684,7 +684,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, * 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); + off = buf->outer_l2_len + (vlan ? sizeof(struct vlan_hdr) : 0); offsets[1] = off >> 1; /* Outer L3 offset. */ if (tunnel == PKT_TX_TUNNEL_UDP) { off += buf->outer_l3_len; @@ -693,7 +693,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, if (inner_ip) { off += buf->l2_len; offsets[3] = off >> 1; /* Inner L3 offset. */ - if (csum_flags == PKT_TX_TCP_CKSUM || tso || + if (csum_flags == PKT_TX_TCP_CKSUM || csum_flags == PKT_TX_UDP_CKSUM) { off += buf->l3_len; offsets[2] = off >> 1; /* Inner L4 offset. */ -- 2.11.0