From patchwork Wed May 18 13:36:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, YuanX" X-Patchwork-Id: 111267 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F133CA0503; Wed, 18 May 2022 07:47:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB9C340698; Wed, 18 May 2022 07:47:01 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 4634040685; Wed, 18 May 2022 07:47:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652852820; x=1684388820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ORAQE75HF9rFNAjrvCmsoOd579E1k3gIVeP/HKcuSKI=; b=C9CJTE/B3drtmN5aSJ8p77X5aTS8P4huAQTMTZ2VXXXyIVlwETn1fNBL U1H+fJ5qrlWYsCuOLTYdM88mjNA5fwtT8fSPEdc6TSyDLKh2QLkcVhRRQ w2yj5vK69SOsPzTjMBS/wsXk81ITSsx9dyCnNroLAesjhQIP6sAYA6Ej9 Zu0rR7TWxIiEIN8xBgge2jZepyqYwWqMtqHzbsFBv3e0oxceD/CO77drZ MG4cuveYhafPqvuwHaPqOnWX7qQnRM/LQMAOowLutV0Llr/ZUKAog69sg i8eyj8fickOvdkUyZlquZX4GDmBOQ0qY61AEdPnuqW04aae1S+Oy4W9DS Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="253539313" X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="253539313" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 22:46:58 -0700 X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="569272663" Received: from unknown (HELO localhost.localdomain) ([10.239.251.55]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 22:46:56 -0700 From: Yuan Wang To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, jiayu.hu@intel.com, xingguang.he@intel.com, yuanx.wang@intel.com, stable@dpdk.org Subject: [PATCH v2] examples/vhost: fix floating point exception when no VMDq Date: Wed, 18 May 2022 21:36:33 +0800 Message-Id: <20220518133633.1634902-1-yuanx.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220411163451.572814-1-yuanx.wang@intel.com> References: <20220411163451.572814-1-yuanx.wang@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If the VMDQ limits is 0, a divide-by-zero error occurs. This patch replaces throwing a floating point exception with a normal error message. Fixes: d19533e86f ("examples/vhost: copy old vhost example") Cc: stable@dpdk.org Signed-off-by: Yuan Wang Reviewed-by: Chenbo Xia --- examples/vhost/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index c4d46de1c5..48d9f3802f 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -400,6 +400,10 @@ port_init(uint16_t port) return retval; } + if (dev_info.max_vmdq_pools == 0) { + RTE_LOG(ERR, VHOST_PORT, "Failed to get VMDQ info.\n"); + return -1; + } rxconf = &dev_info.default_rxconf; txconf = &dev_info.default_txconf;