virtio: do not enable/disable Rx modes unless supported

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
This commit is contained in:
Stephen Hemminger 2015-06-11 08:53:24 -07:00 committed by Thomas Monjalon
parent 4ecce8356e
commit e9e414a41a

View File

@ -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;