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 3F2D2A0C4D; Tue, 2 Nov 2021 01:37:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C37464069F; Tue, 2 Nov 2021 01:37:12 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 549034068F; Tue, 2 Nov 2021 01:37:11 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10155"; a="229871500" X-IronPort-AV: E=Sophos;i="5.87,201,1631602800"; d="scan'208";a="229871500" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 17:06:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,201,1631602800"; d="scan'208";a="558903657" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga004.fm.intel.com with ESMTP; 01 Nov 2021 17:06:40 -0700 Received: from shsmsx604.ccr.corp.intel.com (10.109.6.214) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 1 Nov 2021 17:06:40 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX604.ccr.corp.intel.com (10.109.6.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 2 Nov 2021 08:06:38 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2242.012; Tue, 2 Nov 2021 08:06:38 +0800 From: "Zhang, Qi Z" To: "Yu, DapengX" , "Yang, Qiming" CC: "dev@dpdk.org" , "Wang, Haiyue" , "stable@dpdk.org" Thread-Topic: [PATCH 1/2] net/ice: save meta on switch filter creation Thread-Index: AQHXzvzQ+cSoKoxwIkuEZy1Yvb8bdKvvXAlw Date: Tue, 2 Nov 2021 00:06:37 +0000 Message-ID: <6b5681ab4df141ffa63cd1d289957379@intel.com> References: <20211101084506.513407-1-dapengx.yu@intel.com> In-Reply-To: <20211101084506.513407-1-dapengx.yu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] net/ice: save meta on switch filter creation 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 Sender: "dev" > -----Original Message----- > From: Yu, DapengX > Sent: Monday, November 1, 2021 4:45 PM > To: Yang, Qiming ; Zhang, Qi Z > > Cc: dev@dpdk.org; Wang, Haiyue ; Yu, DapengX > ; stable@dpdk.org > Subject: [PATCH 1/2] net/ice: save meta on switch filter creation >=20 > From: Dapeng Yu >=20 > The meta is abandoned when switch filter is created in original > implementation. >=20 > This patch saved the meta in RTE flow for future use. Can be more specific, it is used for flow replay when handling exception at= flow redirect. Will update during merge. >=20 > Fixes: 47d460d63233 ("net/ice: rework switch filter") > Cc: stable@dpdk.org >=20 > Signed-off-by: Dapeng Yu > --- > drivers/net/ice/ice_switch_filter.c | 69 ++++++++++++++++++++--------- > 1 file changed, 49 insertions(+), 20 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_switch_filter.c > b/drivers/net/ice/ice_switch_filter.c > index 6b0c1bff1e..804cf9b812 100644 > --- a/drivers/net/ice/ice_switch_filter.c > +++ b/drivers/net/ice/ice_switch_filter.c > @@ -180,6 +180,21 @@ struct sw_meta { > struct ice_adv_rule_info rule_info; > }; >=20 > +struct ice_switch_filter_conf { > + bool added; > + > + /* Only when added flag is true, the query data is valid */ > + struct ice_rule_query_data sw_query_data; > + > + /* > + * The lookup elements and rule info are saved here when filter creatio= n > + * succeeds. > + */ > + uint16_t lkups_num; > + struct ice_adv_lkup_elem *lkups; > + struct ice_adv_rule_info rule_info; > +}; > + > static struct ice_flow_parser ice_switch_dist_parser; static struct > ice_flow_parser ice_switch_perm_parser; >=20 > @@ -359,7 +374,7 @@ ice_switch_create(struct ice_adapter *ad, > struct ice_pf *pf =3D &ad->pf; > struct ice_hw *hw =3D ICE_PF_TO_HW(pf); > struct ice_rule_query_data rule_added =3D {0}; > - struct ice_rule_query_data *filter_ptr; > + struct ice_switch_filter_conf *filter_conf_ptr; > struct ice_adv_lkup_elem *list =3D > ((struct sw_meta *)meta)->list; > uint16_t lkups_cnt =3D > @@ -381,18 +396,24 @@ ice_switch_create(struct ice_adapter *ad, > } > ret =3D ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added); > if (!ret) { > - filter_ptr =3D rte_zmalloc("ice_switch_filter", > - sizeof(struct ice_rule_query_data), 0); > - if (!filter_ptr) { > + filter_conf_ptr =3D rte_zmalloc("ice_switch_filter", > + sizeof(struct ice_switch_filter_conf), 0); > + if (!filter_conf_ptr) { > rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_HANDLE, NULL, > "No memory for ice_switch_filter"); > goto error; > } > - flow->rule =3D filter_ptr; > - rte_memcpy(filter_ptr, > - &rule_added, > - sizeof(struct ice_rule_query_data)); > + > + filter_conf_ptr->sw_query_data =3D rule_added; > + > + filter_conf_ptr->lkups =3D list; > + filter_conf_ptr->lkups_num =3D lkups_cnt; > + filter_conf_ptr->rule_info =3D *rule_info; > + > + filter_conf_ptr->added =3D true; > + > + flow->rule =3D filter_conf_ptr; > } else { > rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_HANDLE, NULL, > @@ -400,7 +421,6 @@ ice_switch_create(struct ice_adapter *ad, > goto error; > } >=20 > - rte_free(list); > rte_free(meta); > return 0; >=20 > @@ -411,6 +431,18 @@ ice_switch_create(struct ice_adapter *ad, > return -rte_errno; > } >=20 > +static inline void > +ice_switch_filter_rule_free(struct rte_flow *flow) { > + struct ice_switch_filter_conf *filter_conf_ptr =3D > + (struct ice_switch_filter_conf *)flow->rule; > + > + if (filter_conf_ptr) > + rte_free(filter_conf_ptr->lkups); > + > + rte_free(filter_conf_ptr); > +} > + > static int > ice_switch_destroy(struct ice_adapter *ad, > struct rte_flow *flow, > @@ -418,20 +450,23 @@ ice_switch_destroy(struct ice_adapter *ad, { > struct ice_hw *hw =3D &ad->hw; > int ret; > - struct ice_rule_query_data *filter_ptr; > + struct ice_switch_filter_conf *filter_conf_ptr; >=20 > - filter_ptr =3D (struct ice_rule_query_data *) > + filter_conf_ptr =3D (struct ice_switch_filter_conf *) > flow->rule; >=20 > - if (!filter_ptr) { > + if (!filter_conf_ptr || !filter_conf_ptr->added) { > rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_HANDLE, NULL, > "no such flow" > " create by switch filter"); > + > + ice_switch_filter_rule_free(flow); > + > return -rte_errno; > } >=20 > - ret =3D ice_rem_adv_rule_by_id(hw, filter_ptr); > + ret =3D ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data); > if (ret) { > rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_HANDLE, NULL, > @@ -439,16 +474,10 @@ ice_switch_destroy(struct ice_adapter *ad, > return -rte_errno; > } >=20 > - rte_free(filter_ptr); > + ice_switch_filter_rule_free(flow); > return ret; > } >=20 > -static void > -ice_switch_filter_rule_free(struct rte_flow *flow) -{ > - rte_free(flow->rule); > -} > - > static bool > ice_switch_parse_pattern(const struct rte_flow_item pattern[], > struct rte_flow_error *error, > -- > 2.27.0