net/sfc: use switch port ID as representor ID
authorViacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Mon, 11 Oct 2021 14:48:55 +0000 (17:48 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 12 Oct 2021 16:44:11 +0000 (18:44 +0200)
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

index a9dab6f..2500b14 100644 (file)
@@ -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 @@ fail_mac_addrs:
 
 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;