From: Qi Zhang Date: Thu, 16 Sep 2021 09:52:56 +0000 (+0800) Subject: net/ice/base: allow to enable LAN and loopback in switch X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2e826e6462d44efb9869669a6a46a5a8884b509c;p=dpdk.git net/ice/base: allow to enable LAN and loopback in switch Currently shared code API does not allow to set/unset lb_en and lan_en flags for advanced rules during their creation. Because of that we have to use a workaround in switchdev which is to update rule immediately after its creation. This change will allow us to set/unset those flags right away. Signed-off-by: Wojciech Drewek Signed-off-by: Qi Zhang Acked-by: Junfeng Guo --- diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 43ad018118..1fee790c25 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -8913,7 +8913,12 @@ 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_LAN_ENABLE; + if (!rinfo->flags_info.act_valid) + act |= ICE_SINGLE_ACT_LAN_ENABLE; + else + act |= rinfo->flags_info.act & (ICE_SINGLE_ACT_LAN_ENABLE | + ICE_SINGLE_ACT_LB_ENABLE); + switch (rinfo->sw_act.fltr_act) { case ICE_FWD_TO_VSI: act |= (rinfo->sw_act.fwd_id.hw_vsi_id << diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index 980bae5806..a2b3c80107 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -250,12 +250,23 @@ struct ice_rule_query_data { u16 vsi_handle; }; +/* This structure allows to pass info about lb_en and lan_en + * flags to ice_add_adv_rule. Values in act would be used + * only if act_valid was set to true, otherwise dflt + * values would be used. + */ +struct ice_adv_rule_flags_info { + u32 act; + u8 act_valid; /* indicate if flags in act are valid */ +}; + struct ice_adv_rule_info { enum ice_sw_tunnel_type tun_type; struct ice_sw_act_ctrl sw_act; u32 priority; u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */ u16 fltr_rule_id; + struct ice_adv_rule_flags_info flags_info; }; /* A collection of one or more four word recipe */