diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c index 0669780f86..170f110048 100644 --- a/drivers/net/sfc/sfc_repr.c +++ b/drivers/net/sfc/sfc_repr.c @@ -841,6 +841,8 @@ sfc_repr_dev_close(struct rte_eth_dev *dev) (void)sfc_repr_proxy_del_port(srs->pf_port_id, srs->repr_id); + sfc_mae_clear_switch_port(srs->switch_domain_id, srs->switch_port_id); + dev->rx_pkt_burst = NULL; dev->tx_pkt_burst = NULL; dev->dev_ops = NULL; diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c index 5c10e8fc74..8f1ee97fa8 100644 --- a/drivers/net/sfc/sfc_switch.c +++ b/drivers/net/sfc/sfc_switch.c @@ -489,6 +489,7 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id, uint16_t switch_port_id) { struct sfc_mae_switch_domain *domain; + struct sfc_mae_switch_port *port; rte_spinlock_lock(&sfc_mae_switch.lock); @@ -504,6 +505,17 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id, domain->mae_admin_port = NULL; } + TAILQ_FOREACH(port, &domain->ports, switch_domain_ports) { + if (port->id == switch_port_id) { + /* + * Invalidate the field to prevent wrong + * look-ups from flow rule handling path. + */ + port->ethdev_port_id = RTE_MAX_ETHPORTS; + break; + } + } + rte_spinlock_unlock(&sfc_mae_switch.lock); return 0; }