From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28E0CA0564; Mon, 23 Mar 2020 08:16:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 469F61C0C1; Mon, 23 Mar 2020 08:15:08 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 341111C0AA for ; Mon, 23 Mar 2020 08:14:54 +0100 (CET) IronPort-SDR: 4vYzOh2TgEcvrYFHny4yqDuTziQIrj/HvnfbZ2O3hBFswRYmQ3LVoubDvvSf7dKMaQwWRue6dA /xv1CqvoD0QQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 00:14:53 -0700 IronPort-SDR: e8oM1FZ4zgZ3+Z/6dJd34gD+/E0zma9V1Wvsge1le8/GipgLUWHE3/ux8/vePWSQwhxvOB77lo gCeJPqasOs+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="246111524" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2020 00:14:52 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Tony Nguyen , Paul M Stillwell Jr Date: Mon, 23 Mar 2020 15:17:32 +0800 Message-Id: <20200323071759.13075-10-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200323071759.13075-1-qi.z.zhang@intel.com> References: <20200309114357.31800-1-qi.z.zhang@intel.com> <20200323071759.13075-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 09/36] net/ice/base: refactor a function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/ice/base/ice_flex_pipe.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index c18ccea48..5dd7a0d38 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; } } -- 2.13.6