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.richard...@intel.com> > > Signed-off-by: Stephen Hemminger <step...@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 >