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 3D62D45CD8; Mon, 18 Nov 2024 19:22:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C4BA427D1; Mon, 18 Nov 2024 19:22:11 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 7F54C427AD for ; Mon, 18 Nov 2024 19:22:07 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-20c805a0753so164115ad.0 for ; Mon, 18 Nov 2024 10:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954127; x=1732558927; 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=V7xUC9PYxveRctQirXEm9lJjHem+WGRPpU5L1JaKXLU=; b=TuTtSJGo3megmgTrQLeQPjvsAu/3Ld8QGI2Finzjzzlrm06yniMwMTbGtA3QDOQSqE xX/ZHcpTI6zJd0flyttQuoGTPnn3t9PbWG/JHKJxirenxqPeHFgUSIE6ra/dM+3x88YI yoiBW7Zq5hnJCty3PnO4z9B3Jnhk1kNSGcRQHK2QQz0D1ivF5s+eDwS93IP4bqm8diat XMFkzyCAWZkTMG3VakSe+21sYJJISwza6nhl4z5fEjNfgKjHxBtLbYt/7dwR5AOrHKGD 3FjphuCrZLonizxxiYp8FMs6q6lKWpkj3VLvo8Gd2JOUGyPDjbbIibxkjGtXFsGUy/sV KNyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954127; x=1732558927; 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=V7xUC9PYxveRctQirXEm9lJjHem+WGRPpU5L1JaKXLU=; b=vkrHZB8vMGcQroZ7ACbyIKEtB6FR34mxySppLMvWLpeGkF3meDznwNWf5NKCk7qYhw vlab5n+aj4j0Zq2E5x1NjYnnjRjh0H5gpusjo0u+932yaRnarjdIqEHLSWdjRzsmRvMU ALXHDFjjTJVHB567qUxXN9FqjKQLLthnLIwXWdIPmPVBeKwHjJZ2h0bmCmJhaeLlVkmk GGHrSSdUTXUCe2Mos+aMTiWpp+IE23pJUDEYejyH89Bz8s85Yr108hTe1Yj7xvU09If2 zvjgJFH2fVuC1NDJlBXrAyZKyJw8/taZ7EsZOKbYIyscLdr+JgrOvTvabP6k32M2E29V cDQg== X-Gm-Message-State: AOJu0YyyOSobbQuOfb1oO6ECztqZAoUwhGLMbuJDH7i1X7rEpOI3h/ld 4StgdwcbAMbKbdqKYJw8OTozd75QZuRkakeeE5PtQQbquiIoUPE6vYaB5RVBvIHvEikqinlU+L7 u X-Google-Smtp-Source: AGHT+IGaOSvIldCcRFK06KIrMTcPj5IesbzQYMmosbjAVUJJ4PLMMd/tMro12isWwu4fHHnXigwtgA== X-Received: by 2002:a17:903:124a:b0:20c:9d79:cf85 with SMTP id d9443c01a7336-211d0ee9d54mr184259415ad.54.1731954126776; Mon, 18 Nov 2024 10:22:06 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea61869bb2sm2916724a91.12.2024.11.18.10.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:06 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v2 05/19] net/i40e: remove duplicate code Date: Mon, 18 Nov 2024 10:20:46 -0800 Message-ID: <20241118182153.87042-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118182153.87042-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> <20241118182153.87042-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/ Fixes: 2ab5c84605f0 ("net/i40e: fix ESP flow creation") Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson --- 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