net/sfc: implement port representor link update

Implement the callback by reporting link down if the representor
is not started, otherwise report link up with undefined link speed.

Link speed is undefined since representors can pass traffic to each
other even if the PF link is down.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
This commit is contained in:
Igor Romanov 2021-10-11 17:48:39 +03:00 committed by Ferruh Yigit
parent 75f080fdf7
commit 1dfb92a529

View File

@ -463,6 +463,24 @@ sfc_repr_dev_infos_get(struct rte_eth_dev *dev,
return 0;
}
static int
sfc_repr_dev_link_update(struct rte_eth_dev *dev,
__rte_unused int wait_to_complete)
{
struct sfc_repr *sr = sfc_repr_by_eth_dev(dev);
struct rte_eth_link link;
if (sr->state != SFC_ETHDEV_STARTED) {
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;
}
return rte_eth_linkstatus_set(dev, &link);
}
static int
sfc_repr_ring_create(uint16_t pf_port_id, uint16_t repr_id,
const char *type_name, uint16_t qid, uint16_t nb_desc,
@ -760,6 +778,7 @@ static const struct eth_dev_ops sfc_repr_dev_ops = {
.dev_stop = sfc_repr_dev_stop,
.dev_close = sfc_repr_dev_close,
.dev_infos_get = sfc_repr_dev_infos_get,
.link_update = sfc_repr_dev_link_update,
.rx_queue_setup = sfc_repr_rx_queue_setup,
.rx_queue_release = sfc_repr_rx_queue_release,
.tx_queue_setup = sfc_repr_tx_queue_setup,