diff mbox series

net/virtio: fix uninitialized duplex mode

Message ID 20210727051441.40332-1-chenbo.xia@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series net/virtio: fix uninitialized duplex mode | expand

Checks

Context Check Description
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/checkpatch warning coding style issues

Commit Message

Xia, Chenbo July 27, 2021, 5:14 a.m. UTC
When virtio front-end initializes, the duplex mode should be set
unknown before reading any duplex mode information from configuration
space. This patch fixes the issue that duplex mode is by default set
to zero, which equals ETH_LINK_HALF_DUPLEX. This will lead to duplex
mode being half duplex when fron-end does not have the feature
named VIRTIO_NET_F_SPEED_DUPLEX.

Fixes: 1357b4b36246 ("net/virtio: support Virtio link speed feature")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Maxime Coquelin July 27, 2021, 1:35 p.m. UTC | #1
On 7/27/21 7:14 AM, Chenbo Xia wrote:
> When virtio front-end initializes, the duplex mode should be set
> unknown before reading any duplex mode information from configuration
> space. This patch fixes the issue that duplex mode is by default set
> to zero, which equals ETH_LINK_HALF_DUPLEX. This will lead to duplex
> mode being half duplex when fron-end does not have the feature
> named VIRTIO_NET_F_SPEED_DUPLEX.
> 
> Fixes: 1357b4b36246 ("net/virtio: support Virtio link speed feature")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 72d3dda71f..9061db4e41 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1901,6 +1901,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>  	if (ret < 0)
>  		return ret;
>  	hw->speed = speed;
> +	hw->duplex = DUPLEX_UNKNOWN;
>  
>  	/* Allocate memory for storing MAC addresses */
>  	eth_dev->data->mac_addrs = rte_zmalloc("virtio",
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
Xia, Chenbo July 28, 2021, 6:52 a.m. UTC | #2
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Chenbo Xia
> Sent: Tuesday, July 27, 2021 1:15 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/virtio: fix uninitialized duplex mode
> 
> When virtio front-end initializes, the duplex mode should be set
> unknown before reading any duplex mode information from configuration
> space. This patch fixes the issue that duplex mode is by default set
> to zero, which equals ETH_LINK_HALF_DUPLEX. This will lead to duplex
> mode being half duplex when fron-end does not have the feature
> named VIRTIO_NET_F_SPEED_DUPLEX.
> 
> Fixes: 1357b4b36246 ("net/virtio: support Virtio link speed feature")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index 72d3dda71f..9061db4e41 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1901,6 +1901,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>  	if (ret < 0)
>  		return ret;
>  	hw->speed = speed;
> +	hw->duplex = DUPLEX_UNKNOWN;
> 
>  	/* Allocate memory for storing MAC addresses */
>  	eth_dev->data->mac_addrs = rte_zmalloc("virtio",
> --
> 2.17.1

Applied to next-virtio/main. Thanks!
diff mbox series

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 72d3dda71f..9061db4e41 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1901,6 +1901,7 @@  eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 	if (ret < 0)
 		return ret;
 	hw->speed = speed;
+	hw->duplex = DUPLEX_UNKNOWN;
 
 	/* Allocate memory for storing MAC addresses */
 	eth_dev->data->mac_addrs = rte_zmalloc("virtio",