From: Ivan Dyukov Date: Tue, 22 Sep 2020 21:18:01 +0000 (+0300) Subject: net/virtio: set default speed unknown X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b415b7a06856b148ace29ffcc6e9740a12b9ec33;p=dpdk.git net/virtio: set default speed unknown rte_ethdev states new rule for NICs: they should return UNKNOWN speed if speed is unknown and interface is up, in case of down interface, NONE speed should be returned. Signed-off-by: Ivan Dyukov Reviewed-by: Maxime Coquelin --- diff --git a/doc/guides/nics/virtio.rst b/doc/guides/nics/virtio.rst index 0daf25b22d..33ce0c247e 100644 --- a/doc/guides/nics/virtio.rst +++ b/doc/guides/nics/virtio.rst @@ -361,7 +361,7 @@ Below devargs are supported by the PCI virtio driver: It is used to specify link speed of virtio device. Link speed is a part of link status structure. It could be requested by application using rte_eth_link_get_nowait function. - (Default: 10000 (10G)) + (Default: 0xffffffff (Unknown)) #. ``vectorized``: @@ -422,7 +422,7 @@ Below devargs are supported by the virtio-user vdev: It is used to specify link speed of virtio device. Link speed is a part of link status structure. It could be requested by application using rte_eth_link_get_nowait function. - (Default: 10000 (10G)) + (Default: 0xffffffff (Unknown)) #. ``vectorized``: diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index abfa632285..164cab0c18 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -74,6 +74,10 @@ New Features * Added SR-IOV PF support +* **Updated Virtio driver.** + + * Changed default link speed to unknown. + * **Extended flow-perf application.** * Started supporting user order instead of bit mask: diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index f2117675b3..674feebfc0 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1670,7 +1670,6 @@ virtio_configure_intr(struct rte_eth_dev *dev) return 0; } -#define SPEED_UNKNOWN 0xffffffff #define DUPLEX_UNKNOWN 0xff /* reset device and renegotiate features if needed */ static int @@ -1727,7 +1726,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2], hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]); - if (hw->speed == SPEED_UNKNOWN) { + if (hw->speed == ETH_SPEED_NUM_UNKNOWN) { if (vtpci_with_feature(hw, VIRTIO_NET_F_SPEED_DUPLEX)) { config = &local_config; vtpci_read_dev_config(hw, @@ -1740,8 +1739,6 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) hw->duplex = config->duplex; } } - if (hw->speed == SPEED_UNKNOWN) - hw->speed = ETH_SPEED_NUM_10G; if (hw->duplex == DUPLEX_UNKNOWN) hw->duplex = ETH_LINK_FULL_DUPLEX; PMD_INIT_LOG(DEBUG, "link speed = %d, duplex = %d", @@ -1893,7 +1890,7 @@ int eth_virtio_dev_init(struct rte_eth_dev *eth_dev) { struct virtio_hw *hw = eth_dev->data->dev_private; - uint32_t speed = SPEED_UNKNOWN; + uint32_t speed = ETH_SPEED_NUM_UNKNOWN; int vectorized = 0; int ret; @@ -2552,6 +2549,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet if (!hw->started) { link.link_status = ETH_LINK_DOWN; + link.link_speed = ETH_SPEED_NUM_NONE; } else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { PMD_INIT_LOG(DEBUG, "Get link status from hw"); vtpci_read_dev_config(hw, @@ -2559,6 +2557,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet &status, sizeof(status)); if ((status & VIRTIO_NET_S_LINK_UP) == 0) { link.link_status = ETH_LINK_DOWN; + link.link_speed = ETH_SPEED_NUM_NONE; PMD_INIT_LOG(DEBUG, "Port %d is down", dev->data->port_id); } else {