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 5C564A057B; Thu, 2 Apr 2020 09:34:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2B0FC2C15; Thu, 2 Apr 2020 09:34:44 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E6B362BCE for ; Thu, 2 Apr 2020 09:34:41 +0200 (CEST) IronPort-SDR: Ct92MtMrvS5vkcIDe1KPjCooHd0HEs3uBCdJmcM+BNYVHXjVJ4NFUswmi2//iJ9zCyxyo1rpU1 8EumYJXg1Fqg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 00:34:40 -0700 IronPort-SDR: Tqz6Bec2hmP80RPHUPOJB88ZaikHJHqudJsRWax9fJfG4zHrL0q6oB2T13lOdpZWbwHUiAbXCl owLXahfUeg7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,334,1580803200"; d="scan'208";a="295572155" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 02 Apr 2020 00:34:40 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 2 Apr 2020 00:34:40 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 2 Apr 2020 15:34:38 +0800 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004; Thu, 2 Apr 2020 15:34:38 +0800 From: "Wang, Haiyue" To: "Zhao1, Wei" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Peng, Yuan" , "Lu, Nannan" , "Fu, Qi" , "Xing, Beilei" Thread-Topic: [PATCH v2 12/13] net/ice: enable flow redirect on switch Thread-Index: AQHWCL107RMoxoJYPk+RhIsA3HWDOKhlcHZw Date: Thu, 2 Apr 2020 07:34:38 +0000 Message-ID: References: <20200313020806.21654-1-wei.zhao1@intel.com> <20200402064620.47668-1-wei.zhao1@intel.com> <20200402064620.47668-13-wei.zhao1@intel.com> In-Reply-To: <20200402064620.47668-13-wei.zhao1@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 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 v2 12/13] net/ice: enable flow redirect on switch 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" > -----Original Message----- > From: Zhao1, Wei > Sent: Thursday, April 2, 2020 14:46 > To: dev@dpdk.org > Cc: Zhang, Qi Z ; Peng, Yuan ;= Lu, Nannan > ; Fu, Qi ; Wang, Haiyue ; Xing, Beilei > > Subject: [PATCH v2 12/13] net/ice: enable flow redirect on switch >=20 > Enable flow redirect on switch, currently only > support VSI redirect. >=20 > Signed-off-by: Beilei Xing > --- > drivers/net/ice/ice_switch_filter.c | 74 +++++++++++++++++++++++++++++ > 1 file changed, 74 insertions(+) >=20 > diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_sw= itch_filter.c > index 686f9c3e3..61adb518c 100644 > --- a/drivers/net/ice/ice_switch_filter.c > +++ b/drivers/net/ice/ice_switch_filter.c > @@ -1420,6 +1420,79 @@ ice_switch_query(struct ice_adapter *ad __rte_unus= ed, > return -rte_errno; > } >=20 > +static int > +ice_switch_redirect(struct ice_adapter *ad, > + struct rte_flow *flow, > + struct ice_flow_redirect *rd) > +{ > + struct ice_rule_query_data *rdata =3D flow->rule; > + struct ice_adv_fltr_mgmt_list_entry *list_itr; > + struct ice_adv_lkup_elem *lkups_dp =3D NULL; > + struct LIST_HEAD_TYPE *list_head; > + struct ice_adv_rule_info rinfo; > + struct ice_hw *hw =3D &ad->hw; > + struct ice_switch_info *sw; > + uint16_t lkups_cnt; > + int ret; > + > + sw =3D hw->switch_info; > + if (!sw->recp_list[rdata->rid].recp_created) > + return -EINVAL; > + > + if (rd->type !=3D ICE_FLOW_REDIRECT_VSI) > + return -ENOTSUP; > + > + list_head =3D &sw->recp_list[rdata->rid].filt_rules; > + LIST_FOR_EACH_ENTRY(list_itr, list_head, ice_adv_fltr_mgmt_list_entry, > + list_entry) { > + rinfo =3D list_itr->rule_info; > + if (rinfo.fltr_rule_id =3D=3D rdata->rule_id && > + rinfo.sw_act.fltr_act =3D=3D ICE_FWD_TO_VSI && > + rinfo.sw_act.vsi_handle =3D=3D rd->vsi_handle) { > + lkups_cnt =3D list_itr->lkups_cnt; > + lkups_dp =3D (struct ice_adv_lkup_elem *) > + ice_memdup(hw, list_itr->lkups, > + sizeof(*list_itr->lkups) * > + lkups_cnt, ICE_NONDMA_TO_NONDMA); > + if (!lkups_dp) { > + PMD_DRV_LOG(ERR, "Failed to allocate memory."); > + return -EINVAL; > + } > + > + break; > + } > + } > + > + if (!lkups_dp) > + return 0; > + > + /* Remove the old rule */ > + ret =3D ice_rem_adv_rule(hw, list_itr->lkups, > + lkups_cnt, &rinfo); > + if (ret) { > + PMD_DRV_LOG(ERR, "Failed to delete the old rule %d", > + rdata->rule_id); > + ret =3D -EINVAL; > + goto out; > + } > + > + /* Update VSI context */ > + hw->vsi_ctx[rd->vsi_handle]->vsi_num =3D rd->new_vsi_num; > + > + /* Replay the rule */ > + ret =3D ice_add_adv_rule(hw, lkups_dp, lkups_cnt, > + &rinfo, rdata); > + if (ret) { > + PMD_DRV_LOG(ERR, "Failed to replay the rule"); > + ret =3D -EINVAL; > + goto out; This 'goto out' can be removed. > + } > + > +out: > + ice_free(hw, lkups_dp); > + return ret; > +} > + > static int > ice_switch_init(struct ice_adapter *ad) > { > @@ -1465,6 +1538,7 @@ ice_flow_engine ice_switch_engine =3D { > .create =3D ice_switch_create, > .destroy =3D ice_switch_destroy, > .query_count =3D ice_switch_query, > + .redirect =3D ice_switch_redirect, > .free =3D ice_switch_filter_rule_free, > .type =3D ICE_FLOW_ENGINE_SWITCH, > }; > -- > 2.19.1