From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14D5EA0508; Thu, 7 Apr 2022 04:59:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 229C94289A; Thu, 7 Apr 2022 04:59:06 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id AB1F44288C for ; Thu, 7 Apr 2022 04:59:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649300343; x=1680836343; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+eAhVcRSNZ3sMRA9fMgoQLkjhcReYedZEaj1wpLS28w=; b=iHc5sP8QYCA34l3gQglEnMnYevITnn71nVVSnFhufNd4btp5jyOdxipn dXagiv8FRTjLDtoJncL8thcLA2qMlLM8B5yDFkfFVvlihQGDgD99cQRo+ DR04BEsQ3mwVzEVknFsbfloMM83JoAAmqSuitqCT6/yWYSPN/aF5KH+Yw zDGR5UvL16l1kwerpFCIKpNUwRjri3YEGjuyDCJupYbhcW4HrZiAKyjZI myK2p5qLbXdhcAW2+WVuEufd7EWeW+n0NkyYdlGdzq3vVy7ZtUcsy9LpQ /CVnQ0gycKNFBZ9RdG3yT0/PeIcHPgS1kGPbA+V1yL6kWY5vw6z9r6a3u Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="248738385" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="248738385" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:59:03 -0700 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="570850623" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:59:00 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Alvin Zhang , Steven Zou , Kevin Liu Subject: [PATCH 17/39] net/ice/base: support custom DDP buildin recipe Date: Thu, 7 Apr 2022 10:56:44 +0000 Message-Id: <20220407105706.18889-18-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220407105706.18889-1-kevinx.liu@intel.com> References: <20220407105706.18889-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Alvin Zhang Add control flag and data pointer for custom DDP package buildin recipe. Init the data pointer of buildin recipe. Support dumping buildin recipe lookup info. Signed-off-by: Steven Zou Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/base/ice_common.c | 25 +++++++++++++++ drivers/net/ice/base/ice_switch.c | 52 ++++++++++++++++++++++++++++++- drivers/net/ice/base/ice_type.h | 2 ++ 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index db87bacd97..5d5ce894ff 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -732,6 +732,28 @@ ice_aq_set_mac_cfg(struct ice_hw *hw, u16 max_frame_size, struct ice_sq_cd *cd) return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); } +static int ice_buildin_recipe_init(struct ice_hw *hw) +{ + struct ice_switch_info *sw = hw->switch_info; + struct ice_sw_recipe *recipe; + + sw->buildin_recipes = ice_malloc(hw, + sizeof(sw->buildin_recipes[0]) * ICE_MAX_NUM_RECIPES); + + if (!sw->buildin_recipes) + return ICE_ERR_NO_MEMORY; + + recipe = &sw->buildin_recipes[10]; + recipe->is_root = 1; + + recipe->lkup_exts.n_val_words = 1; + recipe->lkup_exts.field_mask[0] = 0x00ff; + recipe->lkup_exts.fv_words[0].off = 8; + recipe->lkup_exts.fv_words[0].prot_id = 32; + + return ICE_SUCCESS; +} + /** * ice_init_fltr_mgmt_struct - initializes filter management list and locks * @hw: pointer to the HW struct @@ -752,6 +774,8 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw) INIT_LIST_HEAD(&sw->vsi_list_map_head); sw->prof_res_bm_init = 0; + ice_buildin_recipe_init(hw); + status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list); if (status) { ice_free(hw, hw->switch_info); @@ -822,6 +846,7 @@ ice_cleanup_fltr_mgmt_single(struct ice_hw *hw, struct ice_switch_info *sw) ice_free(hw, recps[i].root_buf); } ice_rm_sw_replay_rule_info(hw, sw); + ice_free(hw, sw->buildin_recipes); ice_free(hw, sw->recp_list); ice_free(hw, sw); } diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index b0c50c8f40..d9bb1e7c31 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6910,6 +6910,47 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = { { ICE_VLAN_IN, ICE_VLAN_OL_HW }, }; +static u16 buildin_recipe_get(struct ice_switch_info *sw, + struct ice_prot_lkup_ext *lkup_exts) +{ + int i; + + if (!sw->buildin_recipes) + return ICE_MAX_NUM_RECIPES; + + for (i = 10; i < ICE_MAX_NUM_RECIPES; i++) { + struct ice_sw_recipe *recp = &sw->buildin_recipes[i]; + struct ice_fv_word *a = lkup_exts->fv_words; + struct ice_fv_word *b = recp->lkup_exts.fv_words; + u16 *c = recp->lkup_exts.field_mask; + u16 *d = lkup_exts->field_mask; + bool found = true; + u8 p, q; + + if (!recp->is_root) + continue; + + if (recp->lkup_exts.n_val_words != lkup_exts->n_val_words) + continue; + + for (p = 0; p < lkup_exts->n_val_words; p++) { + for (q = 0; q < recp->lkup_exts.n_val_words; q++) { + if (a[p].off == b[q].off && + a[p].prot_id == b[q].prot_id && + d[p] == c[q]) + break; + } + if (q >= recp->lkup_exts.n_val_words) { + found = false; + break; + } + } + if (found) + return i; + } + return ICE_MAX_NUM_RECIPES; +} + /** * ice_find_recp - find a recipe * @hw: pointer to the hardware structure @@ -6922,8 +6963,15 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts, { bool refresh_required = true; struct ice_sw_recipe *recp; + u16 buildin_rid; u8 i; + if (hw->use_buildin_recipe) { + buildin_rid = buildin_recipe_get(hw->switch_info, lkup_exts); + if (buildin_rid < ICE_MAX_NUM_RECIPES) + return buildin_rid; + } + /* Walk through existing recipes to find a match */ recp = hw->switch_info->recp_list; for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) { @@ -9457,8 +9505,10 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw, struct ice_switch_info *sw; sw = hw->switch_info; - if (!sw->recp_list[remove_entry->rid].recp_created) + if (!sw->buildin_recipes[remove_entry->rid].is_root && + !sw->recp_list[remove_entry->rid].recp_created) return ICE_ERR_PARAM; + list_head = &sw->recp_list[remove_entry->rid].filt_rules; LIST_FOR_EACH_ENTRY(list_itr, list_head, ice_adv_fltr_mgmt_list_entry, list_entry) { diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index d81984633a..48144ea065 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -1107,6 +1107,7 @@ struct ice_switch_info { u16 max_used_prof_index; ice_declare_bitmap(prof_res_bm[ICE_MAX_NUM_PROFILES], ICE_MAX_FV_WORDS); + struct ice_sw_recipe *buildin_recipes; }; /* Port hardware description */ @@ -1263,6 +1264,7 @@ struct ice_hw { ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX); u8 dvm_ena; __le16 io_expander_handle; + u8 use_buildin_recipe; }; /* Statistics collected by each port, VSI, VEB, and S-channel */ -- 2.33.1