[dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported

2015-06-12 Thread Ouyang, Changchun


> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Thursday, June 11, 2015 11:53 PM
> To: Ouyang, Changchun
> Cc: dev at dpdk.org; Stephen Hemminger; Stephen Hemminger
> Subject: [PATCH 2/5] virtio: don't enable/disable rx modes unless supported
> 
> From: Stephen Hemminger 
> 
> If negotiation with host says that controlling Rx mode is not supported, then
> don't try.
> 
> Signed-off-by: Stephen Hemminger 

Acked-by: Changchun Ouyang



[dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported

2015-06-11 Thread Stephen Hemminger
From: Stephen Hemminger 

If negotiation with host says that controlling Rx mode is
not supported, then don't try.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_ethdev.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 77f18a0..3476ad3 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/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



[dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported

2015-04-16 Thread Ouyang, Changchun


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 15, 2015 11:20 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless
> supported
> 
> 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 

Acked-by: Changchun Ouyang 


[dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported

2015-04-15 Thread Stephen Hemminger
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 
---
 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