From patchwork Tue Jul 27 05:14:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenbo Xia X-Patchwork-Id: 96306 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9291DA0C4B; Tue, 27 Jul 2021 07:26:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12409410ED; Tue, 27 Jul 2021 07:26:40 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 6013B410EC; Tue, 27 Jul 2021 07:26:38 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10057"; a="199598039" X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="199598039" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2021 22:26:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="662480058" Received: from npg-dpdk-virtio-xiachenbo-nw.sh.intel.com ([10.67.119.100]) by fmsmga006.fm.intel.com with ESMTP; 26 Jul 2021 22:26:35 -0700 From: Chenbo Xia To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, stable@dpdk.org Date: Tue, 27 Jul 2021 13:14:41 +0800 Message-Id: <20210727051441.40332-1-chenbo.xia@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/virtio: fix uninitialized duplex mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Maxime Coquelin --- 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",