From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f181.google.com (mail-qk0-f181.google.com [209.85.220.181]) by dpdk.org (Postfix) with ESMTP id C08657F6D for ; Thu, 11 Jun 2015 17:53:30 +0200 (CEST) Received: by qkx62 with SMTP id 62so4869817qkx.3 for ; Thu, 11 Jun 2015 08:53:30 -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=zGHmMOaPb0upFbqPRA9ERO4bikQHfhJvM5XJy3l+w3c=; b=ASxO1B3P4ahWjHPtpAOtwBpiOGY0fQzS08o1eZwCcO8dJY3HAgKwlZkhRiCcppkKao 70cPwoeasCTM3DFG/GLqdFT3AQJbxEW6Xvin00dZQ7M/3MjHz6ySs0Z5rxtCrQRoebkp dsYz0epb2//lgQhsrW0KxmT3BB1GJ08TQiiHxnI9WJBQJKxIm91j457PPTwPbNR4EbMo llmR6vfJ2v0Jt0A4JIL9/fvMAMO/JZkab3lB8GREH65V/t67ay1UfUjX+4cq4g+4uEYR RuqpHfg+qwJPQno6Vg7jArvyVmVPodqAzAqUTiDIib2tkH2jWIm2DzFsMj10HmjVb89a t3LQ== X-Gm-Message-State: ALoCoQk6a9r216cKehXanbqbBeid4crecrcAwfODyDzJWrg7xJ5lpElg1a18Xr38dyOj40GluzKv X-Received: by 10.55.17.103 with SMTP id b100mr19772647qkh.71.1434038010391; Thu, 11 Jun 2015 08:53:30 -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 v13sm405348qhd.31.2015.06.11.08.53.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jun 2015 08:53:29 -0700 (PDT) From: Stephen Hemminger To: changchun.ouyang@intel.com Date: Thu, 11 Jun 2015 08:53:24 -0700 Message-Id: <1434038007-8964-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434038007-8964-1-git-send-email-stephen@networkplumber.org> References: <1434038007-8964-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger 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: Thu, 11 Jun 2015 15:53:31 -0000 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