DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported
Date: Wed, 15 Apr 2015 08:20:16 -0700	[thread overview]
Message-ID: <1429111219-8789-3-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1429111219-8789-1-git-send-email-stephen@networkplumber.org>

Don't try to set features related to receiving unless the
appropriate feature bit has ben negotiated with the host.

This solves some of the issues when using virtio on non-KVM/QEMU
hypervisors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_pmd_virtio/virtio_ethdev.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index a38ceed..f0859d8 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -426,6 +426,11 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	int dlen[1];
 	int ret;
 
+	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
+		PMD_INIT_LOG(INFO, "host does not support rx control\n");
+		return;
+	}
+
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
 	ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
 	ctrl.data[0] = 1;
@@ -444,6 +449,11 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	int dlen[1];
 	int ret;
 
+	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
+		PMD_INIT_LOG(INFO, "host does not support rx control\n");
+		return;
+	}
+
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
 	ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
 	ctrl.data[0] = 0;
@@ -462,6 +472,11 @@ virtio_dev_allmulticast_enable(struct rte_eth_dev *dev)
 	int dlen[1];
 	int ret;
 
+	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
+		PMD_INIT_LOG(INFO, "host does not support rx control\n");
+		return;
+	}
+
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
 	ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
 	ctrl.data[0] = 1;
@@ -480,6 +495,11 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
 	int dlen[1];
 	int ret;
 
+	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
+		PMD_INIT_LOG(INFO, "host does not support rx control\n");
+		return;
+	}
+
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
 	ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
 	ctrl.data[0] = 0;
-- 
2.1.4

  parent reply	other threads:[~2015-04-15 15:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15 15:20 [dpdk-dev] [PATCH 0/5] virtio driver fixes and cleanup Stephen Hemminger
2015-04-15 15:20 ` [dpdk-dev] [PATCH 1/5] virtio: remove useless new lines Stephen Hemminger
2015-04-16  3:41   ` Ouyang, Changchun
2015-04-15 15:20 ` Stephen Hemminger [this message]
2015-04-16  3:41   ` [dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported Ouyang, Changchun
2015-04-15 15:20 ` [dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated Stephen Hemminger
2015-04-16  3:45   ` Ouyang, Changchun
2015-04-15 15:20 ` [dpdk-dev] [PATCH 4/5] virtio: fix ring size negotiation Stephen Hemminger
2015-04-16  3:39   ` Ouyang, Changchun
2015-04-16  5:47     ` Stephen Hemminger
2015-04-16  6:26       ` Ouyang, Changchun
2015-04-16  7:38         ` Thomas Monjalon
2015-04-16 17:30           ` Stephen Hemminger
2015-04-16 17:33         ` Stephen Hemminger
2015-04-15 15:20 ` [dpdk-dev] [PATCH 5/5] virtio: clarify feature bit handling Stephen Hemminger
2015-06-10  0:48   ` Stephen Hemminger
2015-06-11  5:56     ` Ouyang, Changchun
2015-06-11 15:53 [dpdk-dev] [PATCH 0/5 v3] virtio: patches Stephen Hemminger
2015-06-11 15:53 ` [dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported Stephen Hemminger
2015-06-12  1:29   ` Ouyang, Changchun

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=1429111219-8789-3-git-send-email-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@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).