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 5C39EA04C7; Tue, 15 Sep 2020 07:30:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7FD01C0C6; Tue, 15 Sep 2020 07:30:52 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 2004A160 for ; Tue, 15 Sep 2020 07:30:47 +0200 (CEST) IronPort-SDR: vKloMkQ8GqcGDJt08GmqqZ5/cdqsasGHELX3BrmzM1lNP8jIUfW6EHMn/ANxvZf1bfrIrfBfxY ySEjXXCRIb9w== X-IronPort-AV: E=McAfee;i="6000,8403,9744"; a="244034961" X-IronPort-AV: E=Sophos;i="5.76,428,1592895600"; d="scan'208";a="244034961" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2020 22:30:47 -0700 IronPort-SDR: P2Dl1b5br5y8zRgdh7K3VEnhgs/mOa8X+V+swc0N8c24xP8Ak2p8WeOpsZ3bbvWSX2+NUX/+x8 WoNwLezXN9Yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,428,1592895600"; d="scan'208";a="482623817" Received: from dpdk-zhirun-dev.sh.intel.com ([10.67.118.201]) by orsmga005.jf.intel.com with ESMTP; 14 Sep 2020 22:30:45 -0700 From: Zhirun Yan To: qi.z.zhang@intel.com, dev@dpdk.org Cc: yahui.cao@intel.com, xiao.w.wang@intel.com, simei.su@intel.com, junfeng.guo@intel.com, Zhirun Yan Date: Tue, 15 Sep 2020 13:27:01 +0800 Message-Id: <20200915052702.3194061-2-zhirun.yan@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200915052702.3194061-1-zhirun.yan@intel.com> References: <20200908073939.4099976-1-zhirun.yan@intel.com> <20200915052702.3194061-1-zhirun.yan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 1/2] net/ice: refactor FDIR set conf 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" The original set conf function in FDIR was very long. Refactor to increase readability to make it clearer and allow for more convenient further changes. No functional change here. Signed-off-by: Zhirun Yan --- drivers/net/ice/ice_fdir_filter.c | 53 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index c4b7265ce..a65523781 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -943,30 +943,9 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field) } } -static int -ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow, - uint64_t input_set, enum ice_fdir_tunnel_type ttype) +static void +ice_fdir_input_set_hdrs(enum ice_fltr_ptype flow, struct ice_flow_seg_info *seg) { - struct ice_flow_seg_info *seg; - struct ice_flow_seg_info *seg_tun = NULL; - enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX]; - bool is_tunnel; - int i, ret; - - if (!input_set) - return -EINVAL; - - seg = (struct ice_flow_seg_info *) - ice_malloc(hw, sizeof(*seg)); - if (!seg) { - PMD_DRV_LOG(ERR, "No memory can be allocated"); - return -ENOMEM; - } - - for (i = 0; i < ICE_FLOW_FIELD_IDX_MAX; i++) - field[i] = ICE_FLOW_FIELD_IDX_MAX; - ice_fdir_input_set_parse(input_set, field); - switch (flow) { case ICE_FLTR_PTYPE_NONF_IPV4_UDP: ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_UDP | @@ -1038,6 +1017,34 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow, PMD_DRV_LOG(ERR, "not supported filter type."); break; } +} + +static int +ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow, + uint64_t input_set, enum ice_fdir_tunnel_type ttype) +{ + struct ice_flow_seg_info *seg; + struct ice_flow_seg_info *seg_tun = NULL; + enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX]; + bool is_tunnel; + int i, ret; + + if (!input_set) + return -EINVAL; + + seg = (struct ice_flow_seg_info *) + ice_malloc(hw, sizeof(*seg)); + if (!seg) { + PMD_DRV_LOG(ERR, "No memory can be allocated"); + return -ENOMEM; + } + + for (i = 0; i < ICE_FLOW_FIELD_IDX_MAX; i++) + field[i] = ICE_FLOW_FIELD_IDX_MAX; + + ice_fdir_input_set_parse(input_set, field); + + ice_fdir_input_set_hdrs(flow, seg); for (i = 0; field[i] != ICE_FLOW_FIELD_IDX_MAX; i++) { ice_flow_set_fld(seg, field[i], -- 2.25.1