From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2094A45D0B; Fri, 15 Nov 2024 07:08:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8994242F9B; Fri, 15 Nov 2024 07:07:59 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 58A2A42E52 for ; Fri, 15 Nov 2024 07:07:54 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2e9b55b83d2so325750a91.3 for ; Thu, 14 Nov 2024 22:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731650873; x=1732255673; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tQawHTmbtoY6t5NAOxwdaIE9rtPh8CNfJCbHOiYg/iw=; b=133CJK4TexxTOwkcO9pkHmINkwm0RNfWxxC6hXpIyveXgv6I2dKVFTKvEbLFTtANze +6Gt8JoHXboGLCS+uX0G0EMPboR/t433y6vGb2YGq/TsZqlVoPn4MwbFC0QjegL9VSLm AW9beeM8nJwqQ+hz3gJvqsritKhm1UPM4Vb4qVjMifV7Lu9cqXMuC+ljHE1O1hH9D3Yk punPVia9t5NtED74YpiwTKn05eLvDvS79W6IBkIW2sg5gc728BFJrh4WjyJN5IKQ0HJ3 FTVG018y02DSwQYUtwhtupRmIvT/R0SgGHqG0JCCaCJS/I+2IGaeps08tFyX6zE4A5m0 OgRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731650873; x=1732255673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tQawHTmbtoY6t5NAOxwdaIE9rtPh8CNfJCbHOiYg/iw=; b=uBuuWZOYfxC9cqGI8E+t6vD/EFNUPNhj3R3TrXPP7slkDswasyNDs6bFR6Zuk+3igp SRHu1wBpLR//L3/cm378wBjcmQjlgxIuh1Rc3HXFURt/o5lbM/PPYK61DoZqQ+sffqgL FciGvyQ8d9doDBwnnbbDzUUi9hxHITXQOhTcEN7ErAd5N2Rz6AFodvxIBaZwLo858cMF +eF4WvttuYy7NRZT7Z/I0Ivq3whLXApwoAadu+BnbRLe2F44PI4R9EcxVK9mD0NFajM0 MrdAO6sUyMWUkG18ItoBDhLv1bV2WEAveDCPGxZ+itQlehGycnz9CNs1+f8NIh2qyphL XMBg== X-Gm-Message-State: AOJu0YwYgxUD7mdOmp3bf+gglN4ZvCF1RyDtn01bE9aWYhxD+5i+902r fvZGQ6f1RRKPA27+Sh7M7UtsjU0+n3kyJEkt7l9U45sfTpef5/wbXTScNEW8VdUVoWOA0xLXT1j y X-Google-Smtp-Source: AGHT+IFKkZYjFohcO8ns8S+3xBsewPkZRXKYz85aQki3raMskw+H9jNYf7tdgwBTAyrFPFEGLcHO/g== X-Received: by 2002:a17:90b:3eca:b0:2e2:c421:894b with SMTP id 98e67ed59e1d1-2ea154f7474mr1909043a91.14.1731650873505; Thu, 14 Nov 2024 22:07:53 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea06f4856esm2123781a91.23.2024.11.14.22.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 22:07:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ian Stokes , Bruce Richardson Subject: [PATCH 05/16] net/i40e: remove duplicate code Date: Thu, 14 Nov 2024 22:05:42 -0800 Message-ID: <20241115060738.313190-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241115060738.313190-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org There are two branches in the cascading if/else that have same condition and code; remove one. Update the code to follow DPDK style where all statements in if should have brackets if any leg requires them. Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ Signed-off-by: Stephen Hemminger --- drivers/net/i40e/i40e_fdir.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 47f79ecf11..6861bea99a 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -599,18 +599,16 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, } else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP) { len = fill_ip4_head(fdir_input, raw_pkt, IPPROTO_UDP, len, ether_type); - } else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP) { - len = fill_ip4_head(fdir_input, raw_pkt, IPPROTO_UDP, - len, ether_type); - } else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6) + } else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6) { len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_ESP, len, ether_type); - else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP) + } else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP) { len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_UDP, len, ether_type); - else if (cus_pctype->index == I40E_CUSTOMIZED_IPV6_L2TPV3) + } else if (cus_pctype->index == I40E_CUSTOMIZED_IPV6_L2TPV3) { len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_L2TP, len, ether_type); + } } else { PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); return -1; -- 2.45.2