Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 29d7aa1

Browse files
WojDrewgregkh
authored andcommitted
ice: Flush FDB entries before reset
[ Upstream commit fbcb968 ] Triggering the reset while in switchdev mode causes errors[1]. Rules are already removed by this time because switch content is flushed in case of the reset. This means that rules were deleted from HW but SW still thinks they exist so when we get SWITCHDEV_FDB_DEL_TO_DEVICE notification we try to delete not existing rule. We can avoid these errors by clearing the rules early in the reset flow before they are removed from HW. Switchdev API will get notified that the rule was removed so we won't get SWITCHDEV_FDB_DEL_TO_DEVICE notification. Remove unnecessary ice_clear_sw_switch_recipes. [1] ice 0000:01:00.0: Failed to delete FDB forward rule, err: -2 ice 0000:01:00.0: Failed to delete FDB guard rule, err: -2 Fixes: 7c945a1 ("ice: Switchdev FDB events support") Reviewed-by: Mateusz Polchlopek <[email protected]> Signed-off-by: Wojciech Drewek <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3b66266 commit 29d7aa1

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

drivers/net/ethernet/intel/ice/ice_eswitch_br.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,13 @@ ice_eswitch_br_switchdev_event(struct notifier_block *nb,
582582
return NOTIFY_DONE;
583583
}
584584

585-
static void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge)
585+
void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge)
586586
{
587587
struct ice_esw_br_fdb_entry *entry, *tmp;
588588

589+
if (!bridge)
590+
return;
591+
589592
list_for_each_entry_safe(entry, tmp, &bridge->fdb_list, list)
590593
ice_eswitch_br_fdb_entry_notify_and_cleanup(bridge, entry);
591594
}

drivers/net/ethernet/intel/ice/ice_eswitch_br.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@ void
116116
ice_eswitch_br_offloads_deinit(struct ice_pf *pf);
117117
int
118118
ice_eswitch_br_offloads_init(struct ice_pf *pf);
119+
void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge);
119120

120121
#endif /* _ICE_ESWITCH_BR_H_ */

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -518,25 +518,6 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked)
518518
pf->vf_agg_node[node].num_vsis = 0;
519519
}
520520

521-
/**
522-
* ice_clear_sw_switch_recipes - clear switch recipes
523-
* @pf: board private structure
524-
*
525-
* Mark switch recipes as not created in sw structures. There are cases where
526-
* rules (especially advanced rules) need to be restored, either re-read from
527-
* hardware or added again. For example after the reset. 'recp_created' flag
528-
* prevents from doing that and need to be cleared upfront.
529-
*/
530-
static void ice_clear_sw_switch_recipes(struct ice_pf *pf)
531-
{
532-
struct ice_sw_recipe *recp;
533-
u8 i;
534-
535-
recp = pf->hw.switch_info->recp_list;
536-
for (i = 0; i < ICE_MAX_NUM_RECIPES; i++)
537-
recp[i].recp_created = false;
538-
}
539-
540521
/**
541522
* ice_prepare_for_reset - prep for reset
542523
* @pf: board private structure
@@ -573,8 +554,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
573554
mutex_unlock(&pf->vfs.table_lock);
574555

575556
if (ice_is_eswitch_mode_switchdev(pf)) {
576-
if (reset_type != ICE_RESET_PFR)
577-
ice_clear_sw_switch_recipes(pf);
557+
rtnl_lock();
558+
ice_eswitch_br_fdb_flush(pf->eswitch.br_offloads->bridge);
559+
rtnl_unlock();
578560
}
579561

580562
/* release ADQ specific HW and SW resources */

0 commit comments

Comments
 (0)