patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/virtio: fix link status always being up' has been queued to LTS release 16.11.2
Date: Fri, 21 Apr 2017 14:19:47 +0800	[thread overview]
Message-ID: <1492755587-28967-22-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1492755587-28967-1-git-send-email-yuanhan.liu@linux.intel.com>

Hi,

FYI, your patch has been queued to LTS release 16.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 04/26/17.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From def1983375f9f81222a972957ee5e5e014389808 Mon Sep 17 00:00:00 2001
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date: Fri, 14 Apr 2017 14:36:45 +0800
Subject: [PATCH] net/virtio: fix link status always being up

[ backported from upstream commit aa9f060617653bac99f41dedfd518b7034374139 ]

The virtio port link status will always be UP, even the port is stopped:

    testpmd> port stop 0
    Stopping ports...
    Checking link statuses...
    Port 0 Link Up - speed 10000 Mbps - full-duplex
    Done

The link status is queried by link_update callback when LSC is disabled.
Which in turn queries the "status" field.  However, the "status" is
read-only. I couldn't think of some proper ways to change the status
without doing device reset.

Instead of doing (the heavy) reset at stop, this patch introduced a flag,
which is set to 1 and 0 on start and stop, respectively. When it's set to
0, the link status is set to DOWN unconditionally.

Fixes: a85786dc816f ("virtio: fix states handling during initialization")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 7 ++++++-
 drivers/net/virtio/virtio_pci.h    | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index ff3f781..d2256f7 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1581,6 +1581,7 @@ virtio_dev_start(struct rte_eth_dev *dev)
 		txvq = dev->data->tx_queues[i];
 		VIRTQUEUE_DUMP(txvq->vq);
 	}
+	hw->started = 1;
 
 	return 0;
 }
@@ -1636,6 +1637,7 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
 static void
 virtio_dev_stop(struct rte_eth_dev *dev)
 {
+	struct virtio_hw *hw = dev->data->dev_private;
 	struct rte_eth_link link;
 
 	PMD_INIT_LOG(DEBUG, "stop");
@@ -1643,6 +1645,7 @@ virtio_dev_stop(struct rte_eth_dev *dev)
 	if (dev->data->dev_conf.intr_conf.lsc)
 		rte_intr_disable(&dev->pci_dev->intr_handle);
 
+	hw->started = 0;
 	memset(&link, 0, sizeof(link));
 	virtio_dev_atomic_write_link_status(dev, &link);
 }
@@ -1659,7 +1662,9 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet
 	link.link_duplex = ETH_LINK_FULL_DUPLEX;
 	link.link_speed  = SPEED_10G;
 
-	if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
+	if (hw->started == 0) {
+		link.link_status = ETH_LINK_DOWN;
+	} else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
 		PMD_INIT_LOG(DEBUG, "Get link status from hw");
 		vtpci_read_dev_config(hw,
 				offsetof(struct virtio_net_config, status),
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index d83a685..40f7e42 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -249,6 +249,7 @@ struct virtio_hw {
 	uint64_t    req_guest_features;
 	uint64_t    guest_features;
 	uint32_t    max_queue_pairs;
+	uint16_t    started;
 	uint16_t    vtnet_hdr_size;
 	uint8_t	    vlan_strip;
 	uint8_t	    use_msix;
-- 
1.9.0

      parent reply	other threads:[~2017-04-21  6:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21  6:19 [dpdk-stable] patch 'mk: fix quoting for ARM mtune argument' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/cxgbe: fix possible null pointer dereference' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/i40e: fix allocation check' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/i40e: fix VF link speed' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/i40e: add missing 25G " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/i40e: fix hash input set on X722' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/thunderx: fix stats access out of bounds' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/ena: cleanup if refilling of Rx descriptors fails' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/bonding: allow configuring jumbo frames without slaves' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/mlx4: fix Rx after mbuf alloc failure' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/i40e: ensure vector mode is not used with QinQ' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'vhost: fix use after free' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/virtio-user: fix address on 32-bit system' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'vhost: fix dequeue zero copy' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'crypto/qat: fix AES-GCM authentication length' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'crypto/qat: fix IV zero physical address' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix AEAD tests when AAD is zero' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix padding calculation' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'kni: fix possible memory leak' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'test/mempool: free mempool on exit' " Yuanhan Liu
2017-04-21  6:19 ` [dpdk-stable] patch 'net/virtio: fix queue notify' " Yuanhan Liu
2017-04-21  6:19 ` Yuanhan Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492755587-28967-22-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).