From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 01D5BA0096 for ; Wed, 5 Jun 2019 10:58:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C2FB1B9CC; Wed, 5 Jun 2019 10:58:57 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5DBA71B9C5 for ; Wed, 5 Jun 2019 10:58:55 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 911AE85540; Wed, 5 Jun 2019 08:58:54 +0000 (UTC) Received: from [10.36.112.53] (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D0CD60A35; Wed, 5 Jun 2019 08:58:51 +0000 (UTC) To: Leyi Rong , qi.z.zhang@intel.com Cc: dev@dpdk.org, Victor Raj , Paul M Stillwell Jr References: <20190604054248.68510-1-leyi.rong@intel.com> <20190604054248.68510-8-leyi.rong@intel.com> From: Maxime Coquelin Message-ID: <6dbb719f-0a20-e147-a5b2-eb1f3679631c@redhat.com> Date: Wed, 5 Jun 2019 10:58:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190604054248.68510-8-leyi.rong@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 05 Jun 2019 08:58:54 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 07/49] net/ice/base: replay advanced rule after reset 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" On 6/4/19 7:42 AM, Leyi Rong wrote: > Code added to replay the advanced rule per VSI basis and remove the > advanced rule information from shared code recipe list. > > Signed-off-by: Victor Raj > Signed-off-by: Paul M Stillwell Jr > Signed-off-by: Leyi Rong > --- > drivers/net/ice/base/ice_switch.c | 81 ++++++++++++++++++++++++++----- > 1 file changed, 69 insertions(+), 12 deletions(-) > > diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c > index c53021aed..ca0497ca7 100644 > --- a/drivers/net/ice/base/ice_switch.c > +++ b/drivers/net/ice/base/ice_switch.c > @@ -3033,6 +3033,27 @@ ice_rem_sw_rule_info(struct ice_hw *hw, struct LIST_HEAD_TYPE *rule_head) > } > } > > +/** > + * ice_rem_adv_rule_info > + * @hw: pointer to the hardware structure > + * @rule_head: pointer to the switch list structure that we want to delete > + */ > +static void > +ice_rem_adv_rule_info(struct ice_hw *hw, struct LIST_HEAD_TYPE *rule_head) > +{ > + struct ice_adv_fltr_mgmt_list_entry *tmp_entry; > + struct ice_adv_fltr_mgmt_list_entry *lst_itr; > + > + if (LIST_EMPTY(rule_head)) > + return; Is it necessary? If the list is empty, LIST_FOR_EACH_ENTRY will not loop and status will be returned: #define LIST_FOR_EACH_ENTRY_SAFE(pos, tmp, head, type, member) \ LIST_FOR_EACH_ENTRY(pos, head, type, member) with: #define LIST_FOR_EACH_ENTRY(pos, head, type, member) \ for ((pos) = (head)->lh_first ? \ container_of((head)->lh_first, struct type, member) : \ 0; \ (pos); \ (pos) = (pos)->member.next.le_next ? \ container_of((pos)->member.next.le_next, struct type, \ member) : \ 0) > + LIST_FOR_EACH_ENTRY_SAFE(lst_itr, tmp_entry, rule_head, > + ice_adv_fltr_mgmt_list_entry, list_entry) { > + LIST_DEL(&lst_itr->list_entry); > + ice_free(hw, lst_itr->lkups); > + ice_free(hw, lst_itr); > + } > +} > > /** > * ice_rem_all_sw_rules_info > @@ -3049,6 +3070,8 @@ void ice_rem_all_sw_rules_info(struct ice_hw *hw) > rule_head = &sw->recp_list[i].filt_rules; > if (!sw->recp_list[i].adv_rule) > ice_rem_sw_rule_info(hw, rule_head); > + else > + ice_rem_adv_rule_info(hw, rule_head); > } > } > > @@ -5687,6 +5710,38 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id, > return status; > } > > +/** > + * ice_replay_vsi_adv_rule - Replay advanced rule for requested VSI > + * @hw: pointer to the hardware structure > + * @vsi_handle: driver VSI handle > + * @list_head: list for which filters need to be replayed > + * > + * Replay the advanced rule for the given VSI. > + */ > +static enum ice_status > +ice_replay_vsi_adv_rule(struct ice_hw *hw, u16 vsi_handle, > + struct LIST_HEAD_TYPE *list_head) > +{ > + struct ice_rule_query_data added_entry = { 0 }; > + struct ice_adv_fltr_mgmt_list_entry *adv_fltr; > + enum ice_status status = ICE_SUCCESS; > + > + if (LIST_EMPTY(list_head)) > + return status; Ditto, it should be removed. > + LIST_FOR_EACH_ENTRY(adv_fltr, list_head, ice_adv_fltr_mgmt_list_entry, > + list_entry) { > + struct ice_adv_rule_info *rinfo = &adv_fltr->rule_info; > + u16 lk_cnt = adv_fltr->lkups_cnt; > + > + if (vsi_handle != rinfo->sw_act.vsi_handle) > + continue; > + status = ice_add_adv_rule(hw, adv_fltr->lkups, lk_cnt, rinfo, > + &added_entry); > + if (status) > + break; > + } > + return status; > +} > > /** > * ice_replay_vsi_all_fltr - replay all filters stored in bookkeeping lists > @@ -5698,23 +5753,23 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id, > enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle) > { > struct ice_switch_info *sw = hw->switch_info; > - enum ice_status status = ICE_SUCCESS; > + enum ice_status status; > u8 i; > > + /* Update the recipes that were created */ > for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) { > - /* Update the default recipe lines and ones that were created */ > - if (i < ICE_MAX_NUM_RECIPES || sw->recp_list[i].recp_created) { > - struct LIST_HEAD_TYPE *head; > + struct LIST_HEAD_TYPE *head; > > - head = &sw->recp_list[i].filt_replay_rules; > - if (!sw->recp_list[i].adv_rule) > - status = ice_replay_vsi_fltr(hw, vsi_handle, i, > - head); > - if (status != ICE_SUCCESS) > - return status; > - } > + head = &sw->recp_list[i].filt_replay_rules; > + if (!sw->recp_list[i].adv_rule) > + status = ice_replay_vsi_fltr(hw, vsi_handle, i, head); > + else > + status = ice_replay_vsi_adv_rule(hw, vsi_handle, head); > + if (status != ICE_SUCCESS) > + return status; > } > - return status; > + > + return ICE_SUCCESS; > } > > /** > @@ -5738,6 +5793,8 @@ void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw) > l_head = &sw->recp_list[i].filt_replay_rules; > if (!sw->recp_list[i].adv_rule) > ice_rem_sw_rule_info(hw, l_head); > + else > + ice_rem_adv_rule_info(hw, l_head); > } > } > } >