X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsfc%2Fsfc_repr.c;h=9d88d554c1ba261d7bb70ef53fd18e374fbf518f;hb=369ce46248c0605d31bd29ebaa4474309a875176;hp=412799f8307e07041b5bb8ec1b110a382e1787a4;hpb=6764c3bbdfa2397c745c9b665411f1cd2ed5f06a;p=dpdk.git diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c index 412799f830..9d88d554c1 100644 --- a/drivers/net/sfc/sfc_repr.c +++ b/drivers/net/sfc/sfc_repr.c @@ -405,7 +405,7 @@ sfc_repr_check_conf(struct sfc_repr *sr, uint16_t nb_rx_queues, } switch (conf->rxmode.mq_mode) { - case ETH_MQ_RX_RSS: + case RTE_ETH_MQ_RX_RSS: if (nb_rx_queues != 1) { sfcr_err(sr, "Rx RSS is not supported with %u queues", nb_rx_queues); @@ -420,7 +420,7 @@ sfc_repr_check_conf(struct sfc_repr *sr, uint16_t nb_rx_queues, ret = -EINVAL; } break; - case ETH_MQ_RX_NONE: + case RTE_ETH_MQ_RX_NONE: break; default: sfcr_err(sr, "Rx mode MQ modes other than RSS not supported"); @@ -428,7 +428,7 @@ sfc_repr_check_conf(struct sfc_repr *sr, uint16_t nb_rx_queues, break; } - if (conf->txmode.mq_mode != ETH_MQ_TX_NONE) { + if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) { sfcr_err(sr, "Tx mode MQ modes not supported"); ret = -EINVAL; } @@ -553,8 +553,8 @@ sfc_repr_dev_link_update(struct rte_eth_dev *dev, sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &link); } else { memset(&link, 0, sizeof(link)); - link.link_status = ETH_LINK_UP; - link.link_speed = ETH_SPEED_NUM_UNKNOWN; + link.link_status = RTE_ETH_LINK_UP; + link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; } return rte_eth_linkstatus_set(dev, &link); @@ -899,9 +899,11 @@ 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; + uint16_t pf; + uint16_t vf; }; static int @@ -939,6 +941,9 @@ sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params) switch_port_request.ethdev_mportp = ðdev_mport_sel; switch_port_request.entity_mportp = &repr_data->mport_sel; switch_port_request.ethdev_port_id = dev->data->port_id; + switch_port_request.port_data.repr.intf = repr_data->intf; + switch_port_request.port_data.repr.pf = repr_data->pf; + switch_port_request.port_data.repr.vf = repr_data->vf; ret = sfc_repr_assign_mae_switch_port(repr_data->switch_domain_id, &switch_port_request, @@ -951,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) { @@ -978,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; @@ -1006,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: @@ -1015,17 +1020,42 @@ fail_mae_assign_switch_port: } int -sfc_repr_create(struct rte_eth_dev *parent, uint16_t representor_id, - uint16_t switch_domain_id, const efx_mport_sel_t *mport_sel) +sfc_repr_create(struct rte_eth_dev *parent, + struct sfc_repr_entity_info *entity, + uint16_t switch_domain_id, + const efx_mport_sel_t *mport_sel) { struct sfc_repr_init_data repr_data; char name[RTE_ETH_NAME_MAX_LEN]; + int controller; int ret; + int rc; struct rte_eth_dev *dev; - if (snprintf(name, sizeof(name), "net_%s_representor_%u", - parent->device->name, representor_id) >= - (int)sizeof(name)) { + controller = -1; + rc = sfc_mae_switch_domain_get_controller(switch_domain_id, + entity->intf, &controller); + if (rc != 0) { + SFC_GENERIC_LOG(ERR, "%s() failed to get DPDK controller for %d", + __func__, entity->intf); + return -rc; + } + + switch (entity->type) { + case RTE_ETH_REPRESENTOR_VF: + ret = snprintf(name, sizeof(name), "net_%s_representor_c%upf%uvf%u", + parent->device->name, controller, entity->pf, + entity->vf); + break; + case RTE_ETH_REPRESENTOR_PF: + ret = snprintf(name, sizeof(name), "net_%s_representor_c%upf%u", + parent->device->name, controller, entity->pf); + break; + default: + return -ENOTSUP; + } + + if (ret >= (int)sizeof(name)) { SFC_GENERIC_LOG(ERR, "%s() failed name too long", __func__); return -ENAMETOOLONG; } @@ -1034,9 +1064,11 @@ sfc_repr_create(struct rte_eth_dev *parent, uint16_t representor_id, if (dev == NULL) { memset(&repr_data, 0, sizeof(repr_data)); repr_data.pf_port_id = parent->data->port_id; - repr_data.repr_id = representor_id; repr_data.switch_domain_id = switch_domain_id; repr_data.mport_sel = *mport_sel; + repr_data.intf = entity->intf; + repr_data.pf = entity->pf; + repr_data.vf = entity->vf; ret = rte_eth_dev_create(parent->device, name, sizeof(struct sfc_repr_shared),