@@ -202,11 +202,12 @@ static struct ice_lag *ice_lag_find_primary(struct ice_lag *lag)
202202 * @act: rule action
203203 * @recipe_id: recipe id for the new rule
204204 * @rule_idx: pointer to rule index
205+ * @direction: ICE_FLTR_RX or ICE_FLTR_TX
205206 * @add: boolean on whether we are adding filters
206207 */
207208static int
208209ice_lag_cfg_fltr (struct ice_lag * lag , u32 act , u16 recipe_id , u16 * rule_idx ,
209- bool add )
210+ u8 direction , bool add )
210211{
211212 struct ice_sw_rule_lkup_rx_tx * s_rule ;
212213 u16 s_rule_sz , vsi_num ;
@@ -231,9 +232,16 @@ ice_lag_cfg_fltr(struct ice_lag *lag, u32 act, u16 recipe_id, u16 *rule_idx,
231232
232233 act |= FIELD_PREP (ICE_SINGLE_ACT_VSI_ID_M , vsi_num );
233234
234- s_rule -> hdr .type = cpu_to_le16 (ICE_AQC_SW_RULES_T_LKUP_RX );
235235 s_rule -> recipe_id = cpu_to_le16 (recipe_id );
236- s_rule -> src = cpu_to_le16 (hw -> port_info -> lport );
236+ if (direction == ICE_FLTR_RX ) {
237+ s_rule -> hdr .type =
238+ cpu_to_le16 (ICE_AQC_SW_RULES_T_LKUP_RX );
239+ s_rule -> src = cpu_to_le16 (hw -> port_info -> lport );
240+ } else {
241+ s_rule -> hdr .type =
242+ cpu_to_le16 (ICE_AQC_SW_RULES_T_LKUP_TX );
243+ s_rule -> src = cpu_to_le16 (vsi_num );
244+ }
237245 s_rule -> act = cpu_to_le32 (act );
238246 s_rule -> hdr_len = cpu_to_le16 (DUMMY_ETH_HDR_LEN );
239247 opc = ice_aqc_opc_add_sw_rules ;
@@ -266,9 +274,27 @@ ice_lag_cfg_dflt_fltr(struct ice_lag *lag, bool add)
266274{
267275 u32 act = ICE_SINGLE_ACT_VSI_FORWARDING |
268276 ICE_SINGLE_ACT_VALID_BIT | ICE_SINGLE_ACT_LAN_ENABLE ;
277+ int err ;
278+
279+ err = ice_lag_cfg_fltr (lag , act , lag -> pf_recipe , & lag -> pf_rx_rule_id ,
280+ ICE_FLTR_RX , add );
281+ if (err )
282+ goto err_rx ;
269283
270- return ice_lag_cfg_fltr (lag , act , lag -> pf_recipe ,
271- & lag -> pf_rule_id , add );
284+ act = ICE_SINGLE_ACT_VSI_FORWARDING | ICE_SINGLE_ACT_VALID_BIT |
285+ ICE_SINGLE_ACT_LB_ENABLE ;
286+ err = ice_lag_cfg_fltr (lag , act , lag -> pf_recipe , & lag -> pf_tx_rule_id ,
287+ ICE_FLTR_TX , add );
288+ if (err )
289+ goto err_tx ;
290+
291+ return 0 ;
292+
293+ err_tx :
294+ ice_lag_cfg_fltr (lag , act , lag -> pf_recipe , & lag -> pf_rx_rule_id ,
295+ ICE_FLTR_RX , !add );
296+ err_rx :
297+ return err ;
272298}
273299
274300/**
@@ -284,7 +310,7 @@ ice_lag_cfg_drop_fltr(struct ice_lag *lag, bool add)
284310 ICE_SINGLE_ACT_DROP ;
285311
286312 return ice_lag_cfg_fltr (lag , act , lag -> lport_recipe ,
287- & lag -> lport_rule_idx , add );
313+ & lag -> lport_rule_idx , ICE_FLTR_RX , add );
288314}
289315
290316/**
@@ -310,7 +336,7 @@ ice_lag_cfg_pf_fltrs(struct ice_lag *lag, void *ptr)
310336 dev = ice_pf_to_dev (lag -> pf );
311337
312338 /* interface not active - remove old default VSI rule */
313- if (bonding_info -> slave .state && lag -> pf_rule_id ) {
339+ if (bonding_info -> slave .state && lag -> pf_rx_rule_id ) {
314340 if (ice_lag_cfg_dflt_fltr (lag , false))
315341 dev_err (dev , "Error removing old default VSI filter\n" );
316342 if (ice_lag_cfg_drop_fltr (lag , true))
@@ -319,7 +345,7 @@ ice_lag_cfg_pf_fltrs(struct ice_lag *lag, void *ptr)
319345 }
320346
321347 /* interface becoming active - add new default VSI rule */
322- if (!bonding_info -> slave .state && !lag -> pf_rule_id ) {
348+ if (!bonding_info -> slave .state && !lag -> pf_rx_rule_id ) {
323349 if (ice_lag_cfg_dflt_fltr (lag , true))
324350 dev_err (dev , "Error adding new default VSI filter\n" );
325351 if (lag -> lport_rule_idx && ice_lag_cfg_drop_fltr (lag , false))
@@ -2149,7 +2175,7 @@ void ice_lag_rebuild(struct ice_pf *pf)
21492175
21502176 ice_lag_cfg_cp_fltr (lag , true);
21512177
2152- if (lag -> pf_rule_id )
2178+ if (lag -> pf_rx_rule_id )
21532179 if (ice_lag_cfg_dflt_fltr (lag , true))
21542180 dev_err (ice_pf_to_dev (pf ), "Error adding default VSI rule in rebuild\n" );
21552181
0 commit comments