diff mbox series

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

Message ID 20210827065717.1838258-37-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series net/sfc: support port representors | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Aug. 27, 2021, 6:57 a.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(-)
diff mbox series

Patch

diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c
index d50efe6562..4cbfdbcb66 100644
--- a/drivers/net/sfc/sfc_repr.c
+++ b/drivers/net/sfc/sfc_repr.c
@@ -921,7 +921,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;
@@ -979,7 +978,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) {
@@ -1006,7 +1005,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;
@@ -1034,7 +1033,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:
@@ -1087,7 +1086,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;