From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by dpdk.org (Postfix) with ESMTP id B57425927 for ; Fri, 28 Aug 2015 18:23:32 +0200 (CEST) Received: by pacdd16 with SMTP id dd16so67348168pac.2 for ; Fri, 28 Aug 2015 09:23:32 -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=/OhRxF5b2ExMB9BR2PIMfbvhInScKl7Zf2bmxroTBRk=; b=kYInohDzISB+H5lJlmj7Rr1WmwKr9Frtj6aD+TWx/8S1/xumv4CNHh65PVGTrH9U9u m+lyyp0tdhofOzqMh/FmdaQX09r3fROGht3lWW26LUjwNG35GuJ3YTRyXNkQ6DYaUP8f 2vLRYjZOMxzNK0dhQ/KMwnzC3O0rFOg6uXUXLXkivUJDQWnsLjSieSsVFILDoSOEGx2k hHp/j1oqj2FyVU3O2jBF1ECf3KFkeKXmP8LVJ6LGcZrkXkUPZ1E/fWtAR9By7tlBIAX+ 2PuHfjHXNXtnau7Q4uB/o6MffCkvCr1KEMYUTirSxvVp6zLni5bcH2HruOE8tY1ugW4f 2fsQ== X-Gm-Message-State: ALoCoQkMDi0IwncxHzMhqfOKjiNx41M1yQDURLr7XfFG3FTIROht7J3HzcNPvNVrW34+XUM5Taix X-Received: by 10.66.218.135 with SMTP id pg7mr15635638pac.141.1440779011865; Fri, 28 Aug 2015 09:23:31 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id gs2sm6221755pbc.15.2015.08.28.09.23.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Aug 2015 09:23:31 -0700 (PDT) From: Stephen Hemminger To: huawei.xie@intel.com, changchun.ouyang@intel.com Date: Fri, 28 Aug 2015 09:23:37 -0700 Message-Id: <1440779019-10793-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440779019-10793-1-git-send-email-stephen@networkplumber.org> References: <1440779019-10793-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger Subject: [dpdk-dev] [PATCH 1/3] virtio: don't report link state feature unless available 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: Fri, 28 Aug 2015 16:23:33 -0000 From: Stephen Hemminger If host does not support virtio link state (like current DPDK vhost) then don't set the flag. This keeps applications from incorrectly assuming that link state is available when it is not. It also avoids useless "guess what works in the config". Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_ethdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 465d3cd..8c3e924 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1201,6 +1201,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); virtio_negotiate_features(hw); + /* If host does not support status then disable LSC */ + if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) + pci_dev->driver->drv_flags &= ~RTE_PCI_DRV_INTR_LSC; + rx_func_get(eth_dev); /* Setting up rx_header size for the device */ @@ -1394,9 +1398,8 @@ virtio_dev_start(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev = dev->pci_dev; /* check if lsc interrupt feature is enabled */ - if ((dev->data->dev_conf.intr_conf.lsc) && - (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)) { - if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { + if (dev->data->dev_conf.intr_conf.lsc) { + if (!(pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)) { PMD_DRV_LOG(ERR, "link status not supported by host"); return -ENOTSUP; } -- 2.1.4