From: Stephen Hemminger <stephen@networkplumber.org>
To: huawei.xie@intel.com, changchun.ouyang@intel.com
Cc: dev@dpdk.org, Stephen Hemminger <shemming@brocade.com>
Subject: [dpdk-dev] [PATCH 1/3] virtio: don't report link state feature unless available
Date: Fri, 28 Aug 2015 09:23:37 -0700 [thread overview]
Message-ID: <1440779019-10793-2-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1440779019-10793-1-git-send-email-stephen@networkplumber.org>
From: Stephen Hemminger <shemming@brocade.com>
If host does not support virtio link state (like current DPDK vhost)
then don't set the flag. This keeps applications from incorrectly
assuming that link state is available when it is not. It also
avoids useless "guess what works in the config".
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/virtio/virtio_ethdev.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 465d3cd..8c3e924 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1201,6 +1201,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
virtio_negotiate_features(hw);
+ /* If host does not support status then disable LSC */
+ if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS))
+ pci_dev->driver->drv_flags &= ~RTE_PCI_DRV_INTR_LSC;
+
rx_func_get(eth_dev);
/* Setting up rx_header size for the device */
@@ -1394,9 +1398,8 @@ virtio_dev_start(struct rte_eth_dev *dev)
struct rte_pci_device *pci_dev = dev->pci_dev;
/* check if lsc interrupt feature is enabled */
- if ((dev->data->dev_conf.intr_conf.lsc) &&
- (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
- if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
+ if (dev->data->dev_conf.intr_conf.lsc) {
+ if (!(pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
PMD_DRV_LOG(ERR, "link status not supported by host");
return -ENOTSUP;
}
--
2.1.4
next prev parent reply other threads:[~2015-08-28 16:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-28 16:23 [dpdk-dev] [PATCH 0/3] virtio: patches for 2.1+ Stephen Hemminger
2015-08-28 16:23 ` Stephen Hemminger [this message]
2015-08-31 2:54 ` [dpdk-dev] [PATCH 1/3] virtio: don't report link state feature unless available Ouyang, Changchun
2015-08-28 16:23 ` [dpdk-dev] [PATCH 2/3] virtio: fix Coverity unsigned warnings Stephen Hemminger
2015-08-31 1:38 ` Ouyang, Changchun
2015-08-31 16:44 ` Stephen Hemminger
2015-08-28 16:23 ` [dpdk-dev] [PATCH 3/3] virtio: fix possible NULL dereference Stephen Hemminger
2015-08-31 1:07 ` Ouyang, Changchun
2015-10-21 14:18 ` [dpdk-dev] [PATCH 0/3] virtio: patches for 2.1+ Thomas Monjalon
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=1440779019-10793-2-git-send-email-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=changchun.ouyang@intel.com \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.com \
--cc=shemming@brocade.com \
/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).