From patchwork Thu May 3 13:17:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Loftus, Ciara" X-Patchwork-Id: 39315 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ADBC329D6; Thu, 3 May 2018 15:17:12 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 48172DD2 for ; Thu, 3 May 2018 15:17:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 06:17:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="52896109" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga001.jf.intel.com with ESMTP; 03 May 2018 06:17:04 -0700 From: Ciara Loftus To: dev@dpdk.org Date: Thu, 3 May 2018 14:17:03 +0100 Message-Id: <1525353423-22300-1-git-send-email-ciara.loftus@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH v2] net/vhost: Initialise vid to -1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_eth_vhost_get_vid_from_port_id returns a value of 0 if called before the first call to the new_device callback. A vid value >=0 suggests the device is active which is not the case in this instance. Initialise vid to a negative value to prevent this. Signed-off-by: Ciara Loftus Fixes: ee584e9710b9 vhost: add driver on top of the library Cc: stable@dpdk.org Reviewed-by: Maxime Coquelin --- drivers/net/vhost/rte_eth_vhost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index ff5424a..bd42eee 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -94,7 +94,7 @@ struct pmd_internal { char *dev_name; char *iface_name; uint16_t max_queues; - uint16_t vid; + int vid; rte_atomic32_t started; uint8_t vlan_strip; }; @@ -1259,6 +1259,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, data->nb_rx_queues = queues; data->nb_tx_queues = queues; internal->max_queues = queues; + internal->vid = -1; data->dev_link = pmd_link; data->mac_addrs = eth_addr; data->dev_flags = RTE_ETH_DEV_INTR_LSC;