From: Qi Zhang Date: Mon, 23 Mar 2020 07:17:32 +0000 (+0800) Subject: net/ice/base: refactor a function X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=88ea6b3b7ae6223782fe5a03714e07baa55a696a;p=dpdk.git net/ice/base: refactor a function Refactor function ice_prof_bld_xlt2, a switch statement is better suited for this situation and eliminates the need for the "found" variable. Signed-off-by: Tony Nguyen Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index c18ccea48f..5dd7a0d38d 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -4051,19 +4051,13 @@ ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld, struct ice_chs_chg *tmp; LIST_FOR_EACH_ENTRY(tmp, chgs, ice_chs_chg, list_entry) { - bool found = false; - - if (tmp->type == ICE_VSIG_ADD) - found = true; - else if (tmp->type == ICE_VSI_MOVE) - found = true; - else if (tmp->type == ICE_VSIG_REM) - found = true; - - if (found) { - struct ice_xlt2_section *p; - u32 id; + struct ice_xlt2_section *p; + u32 id; + switch (tmp->type) { + case ICE_VSIG_ADD: + case ICE_VSI_MOVE: + case ICE_VSIG_REM: id = ice_sect_id(blk, ICE_XLT2); p = (struct ice_xlt2_section *) ice_pkg_buf_alloc_section(bld, id, sizeof(*p)); @@ -4074,6 +4068,9 @@ ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld, p->count = CPU_TO_LE16(1); p->offset = CPU_TO_LE16(tmp->vsi); p->value[0] = CPU_TO_LE16(tmp->vsig); + break; + default: + break; } }