[v2,36/38] net/sfc: use switch port ID as representor ID

Message ID 20211011144857.446802-37-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: support port representors |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Oct. 11, 2021, 2:48 p.m. UTC
  From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>

Representor IDs must be unique for each representor. VFs, which are
currently used, are not unique as they may repeat in combination with
different PCI controllers and PFs. On the other hand, switch port IDs
are unique, so they are a better fit for this role.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/net/sfc/sfc_repr.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c
index b4ff4da60a..6ec83873ab 100644
--- a/drivers/net/sfc/sfc_repr.c
+++ b/drivers/net/sfc/sfc_repr.c
@@ -899,7 +899,6 @@  static const struct eth_dev_ops sfc_repr_dev_ops = {
 
 struct sfc_repr_init_data {
 	uint16_t		pf_port_id;
-	uint16_t		repr_id;
 	uint16_t		switch_domain_id;
 	efx_mport_sel_t		mport_sel;
 	efx_pcie_interface_t	intf;
@@ -957,7 +956,7 @@  sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params)
 	}
 
 	ret = sfc_repr_proxy_add_port(repr_data->pf_port_id,
-				      repr_data->repr_id,
+				      srs->switch_port_id,
 				      dev->data->port_id,
 				      &repr_data->mport_sel);
 	if (ret != 0) {
@@ -984,7 +983,7 @@  sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params)
 	dev->process_private = sr;
 
 	srs->pf_port_id = repr_data->pf_port_id;
-	srs->repr_id = repr_data->repr_id;
+	srs->repr_id = srs->switch_port_id;
 	srs->switch_domain_id = repr_data->switch_domain_id;
 
 	dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
@@ -1012,7 +1011,7 @@  sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params)
 
 fail_alloc_sr:
 	(void)sfc_repr_proxy_del_port(repr_data->pf_port_id,
-				      repr_data->repr_id);
+				      srs->switch_port_id);
 
 fail_create_port:
 fail_mae_assign_switch_port:
@@ -1065,7 +1064,6 @@  sfc_repr_create(struct rte_eth_dev *parent,
 	if (dev == NULL) {
 		memset(&repr_data, 0, sizeof(repr_data));
 		repr_data.pf_port_id = parent->data->port_id;
-		repr_data.repr_id = entity->vf;
 		repr_data.switch_domain_id = switch_domain_id;
 		repr_data.mport_sel = *mport_sel;
 		repr_data.intf = entity->intf;