From: Qi Zhang Date: Thu, 23 Apr 2020 13:07:04 +0000 (+0800) Subject: net/ice/base: fix DCF switch rule X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a7b645debc2fe20c3ecb2ef5cb94c40ae49f59d3;p=dpdk.git net/ice/base: fix DCF switch rule 1. ln_en bit should not be turned on, since we only support Rx VEB. 2. lan_en bit need to be turned on for a DCF switch rule, otherwise any Tx packet that hit on a rule will be dropped. Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe") Cc: stable@dpdk.org Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 7e33df84ac..957142a105 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -2163,6 +2163,13 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi) { fi->lb_en = false; fi->lan_en = false; + + if ((fi->flag & ICE_FLTR_RX) && + (fi->fltr_act == ICE_FWD_TO_VSI || + fi->fltr_act == ICE_FWD_TO_VSI_LIST) && + fi->lkup_type == ICE_SW_LKUP_LAST) + fi->lan_en = true; + if ((fi->flag & ICE_FLTR_TX) && (fi->fltr_act == ICE_FWD_TO_VSI || fi->fltr_act == ICE_FWD_TO_VSI_LIST || @@ -6771,6 +6778,7 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw, return status; ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM); + tmp_fltr.flag = m_entry->rule_info.sw_act.flag; tmp_fltr.fltr_rule_id = cur_fltr->fltr_rule_id; tmp_fltr.fltr_act = ICE_FWD_TO_VSI_LIST; tmp_fltr.fwd_id.vsi_list_id = vsi_list_id; @@ -6933,7 +6941,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, s_rule = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, rule_buf_sz); if (!s_rule) return ICE_ERR_NO_MEMORY; - act |= ICE_SINGLE_ACT_LB_ENABLE | ICE_SINGLE_ACT_LAN_ENABLE; + act |= ICE_SINGLE_ACT_LAN_ENABLE; switch (rinfo->sw_act.fltr_act) { case ICE_FWD_TO_VSI: act |= (rinfo->sw_act.fwd_id.hw_vsi_id << @@ -7098,6 +7106,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle, return status; ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM); + tmp_fltr.flag = fm_list->rule_info.sw_act.flag; tmp_fltr.fltr_rule_id = fm_list->rule_info.fltr_rule_id; fm_list->rule_info.sw_act.fltr_act = ICE_FWD_TO_VSI; tmp_fltr.fltr_act = ICE_FWD_TO_VSI; diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 1794301368..72bb22395b 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1267,6 +1267,7 @@ ice_switch_parse_dcf_action(const struct rte_flow_action *actions, } rule_info->sw_act.src = rule_info->sw_act.vsi_handle; + rule_info->sw_act.flag = ICE_FLTR_RX; rule_info->rx = 1; rule_info->priority = 5;