From patchwork Wed Apr 26 04:52:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianfeng Tan X-Patchwork-Id: 23888 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 1C5445951; Wed, 26 Apr 2017 06:52:15 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 5C00D37B1; Wed, 26 Apr 2017 06:52:08 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2017 21:52:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,252,1488873600"; d="scan'208";a="961148199" Received: from dpdk06.sh.intel.com ([10.239.129.195]) by orsmga003.jf.intel.com with ESMTP; 25 Apr 2017 21:52:06 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: yuanhan.liu@linux.intel.com, maxime.coquelin@redhat.com, thomas@monjalon.net, Jianfeng Tan , stable@dpdk.org Date: Wed, 26 Apr 2017 04:52:51 +0000 Message-Id: <1493182371-34295-4-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493182371-34295-1-git-send-email-jianfeng.tan@intel.com> References: <1493182371-34295-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [PATCH 3/3] net/virtio: fix link status always being down X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The virtio port link status will always be DOWN: The commit aa9f06061765 ("net/virtio: fix link status always being up") introduces a flag to help checking the status. If this flag is not set, status will be always down. However, in dev start, this flag is set after link status update, then we miss the chance to change the status to UP in dev start. To fix this bug, we simply move the link status update after the flag setting so that the status can be correctly updated. Fixes: aa9f06061765 ("net/virtio: fix link status always being up") Cc: stable@dpdk.org Signed-off-by: Jianfeng Tan --- drivers/net/virtio/virtio_ethdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index e79748e..cd87c0e 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1742,9 +1742,6 @@ virtio_dev_start(struct rte_eth_dev *dev) } } - /* Initialize Link state */ - virtio_dev_link_update(dev, 0); - /*Notify the backend *Otherwise the tap backend might already stop its queue due to fullness. *vhost backend will have no chance to be waked up @@ -1773,8 +1770,12 @@ virtio_dev_start(struct rte_eth_dev *dev) txvq = dev->data->tx_queues[i]; VIRTQUEUE_DUMP(txvq->vq); } + hw->started = 1; + /* Initialize Link state */ + virtio_dev_link_update(dev, 0); + return 0; }