From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by dpdk.org (Postfix) with ESMTP id 5C1996A95 for ; Wed, 15 Apr 2015 17:20:18 +0200 (CEST) Received: by pdbqd1 with SMTP id qd1so55964828pdb.2 for ; Wed, 15 Apr 2015 08:20:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WIB6EqkpOyHN9nh5QqjLsSp2dxJnQbdQrc722RxuL/s=; b=PMfVomS6UD1+PhMzpBsl9tOoOWi3yDpFImyHI8Ex4jx0uYgTrUwQGl8mkiUmmGcMUh vvWlJFkQVdmomH0HL9nhxiXW0rgVeJKDXMqJHOHZRQLrIOtEmHd1u5+Y7zGFaaI1w7Lv 46DVbqpdcmLAaLTg8d8zAz/ZscCJ/7DZGss58EXFRODaWdqJK0U5OgBf/Z7lgiSK6351 46y/yukiN2uJiv9C40d9URKQXwxPXOGIc9S3PWWI5OtIJfSSHrdwMnYEgss146CzbWAk mLCGnKWBwq1B9n0mx1HG3SUj/W3J5AfR73209JqxF8lNL/hcU7eS2ZqsY7QhExJ0CskO v4iw== X-Gm-Message-State: ALoCoQkcCvL6VlVQGs5zXrWzlhZvBONGjG+XkM081HhEBZZws6edpF4jXeZDFD2eQgOYlKu50plt X-Received: by 10.66.237.35 with SMTP id uz3mr47777368pac.46.1429111217692; Wed, 15 Apr 2015 08:20:17 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id sm7sm4459057pac.45.2015.04.15.08.20.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Apr 2015 08:20:16 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Wed, 15 Apr 2015 08:20:16 -0700 Message-Id: <1429111219-8789-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429111219-8789-1-git-send-email-stephen@networkplumber.org> References: <1429111219-8789-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 2/5] virtio: don't enable/disable rx modes unless supported X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2015 15:20:18 -0000 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