DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, Ian Stokes <ian.stokes@intel.com>
Subject: Re: [PATCH 05/16] net/i40e: remove duplicate code
Date: Fri, 15 Nov 2024 11:00:32 +0000	[thread overview]
Message-ID: <Zzcp0Fj9Gx5Hp5rg@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20241115060738.313190-6-stephen@networkplumber.org>

On Thu, Nov 14, 2024 at 10:05:42PM -0800, Stephen Hemminger wrote:
> 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.
> 

Not actually DPDK style, that is just something that checkpatch recommends
because it is kernel style. DPDK style guide says[1] "Braces that are not
necessary should be left out."
That said, most legs of this if-else block have it so ok to have that
change included for consistency.

[1] https://doc.dpdk.org/guides/contributing/coding_style.html#control-statements-and-loops

> Link: https://pvs-studio.com/en/blog/posts/cpp/1183/

Fixes: 2ab5c84605f0 ("net/i40e: fix ESP flow creation")

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  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
> 

  reply	other threads:[~2024-11-15 11:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15  6:05 [PATCH 00/16] small bug fixes from PVS studio bug list Stephen Hemminger
2024-11-15  6:05 ` [PATCH 01/16] common/cnxk: remove duplicate condition Stephen Hemminger
2024-11-15  6:16   ` [EXTERNAL] " Anoob Joseph
2024-11-15  6:05 ` [PATCH 02/16] net/cpfl: avoid calling log (printf) with null Stephen Hemminger
2024-11-15  6:05 ` [PATCH 03/16] raw/cnxk_gpio: fix file descriptor leak Stephen Hemminger
2024-11-15  6:05 ` [PATCH 04/16] net/ntnic: remove dead code Stephen Hemminger
2024-11-15  6:05 ` [PATCH 05/16] net/i40e: remove duplicate code Stephen Hemminger
2024-11-15 11:00   ` Bruce Richardson [this message]
2024-11-15  6:05 ` [PATCH 06/16] eal: fix out of bounds access in devargs Stephen Hemminger
2024-11-15  6:05 ` [PATCH 07/16] net/qede: fix missing debug string Stephen Hemminger
2024-11-15  6:05 ` [PATCH 08/16] examples/ptpclient: replace rte_memcpy with assignment Stephen Hemminger
2024-11-15  6:05 ` [PATCH 09/16] examples/ptpclient: fix self memcmp Stephen Hemminger
2024-11-15  6:05 ` [PATCH 10/16] net/octeon_ep: remove duplicate code Stephen Hemminger
2024-11-15  6:05 ` [PATCH 11/16] net/hinic: fix flow type bitmask overflow Stephen Hemminger
2024-11-15  6:05 ` [PATCH 12/16] crypto/dpaa2_sec: fix bitmask truncation Stephen Hemminger
2024-11-15  6:05 ` [PATCH 13/16] crypto/dpaa_sec: " Stephen Hemminger
2024-11-15  6:05 ` [PATCH 14/16] event/dpaa: " Stephen Hemminger
2024-11-15  6:05 ` [PATCH 15/16] net/dpaa: " Stephen Hemminger
2024-11-15  6:05 ` [PATCH 16/16] net/dpaa2: " Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zzcp0Fj9Gx5Hp5rg@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ian.stokes@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).