From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A63642E52; Thu, 13 Jul 2023 07:19:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0877B40EE7; Thu, 13 Jul 2023 07:19:34 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4136940DDA; Thu, 13 Jul 2023 07:19:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689225572; x=1720761572; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OSkaxZlHEXaiCtrW3klWVkAYj/4jguBUJNjODnYH/Ps=; b=kxdEl3fBlsvn3SLbwg17v/Ihb7v/VZHsPek7RWZkHzBGpMNfuwDFqFdT 4HK5Z+w0iqT0q4tqoeL89MaiZFdjKhCwj8bRFdgCtVDSjQO/Sq5mOiEFD kOPwEFROjiGFrwdZV1QTkuze07yRE249H+xx26U/0WjnrwYprZ1/iMYD0 30sl09N2OSPuaagWxjEUC7kZPMSwe2O49Qa4SKFwHBcbaPCsPgtt12cNn PQ+eVVZCN0gOVkRiIiexYsg10pUgzHJqACuz//5W46EUTh8T4505jx36U NWWkT90pKe5aro+J2bU/1Fa0Ge2TCxGWBkohgFBHDS6fOjPJNkVELzHVe Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="368623648" X-IronPort-AV: E=Sophos;i="6.01,201,1684825200"; d="scan'208";a="368623648" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 22:19:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="672134018" X-IronPort-AV: E=Sophos;i="6.01,201,1684825200"; d="scan'208";a="672134018" Received: from unknown (HELO localhost.localdomain) ([10.239.252.104]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 22:19:29 -0700 From: Kaisen You To: dev@dpdk.org Cc: qiming.yang@intel.com, yidingx.zhou@intel.com, Kaisen You , stable@dpdk.org Subject: [PATCH] app/test:add NIC parameter exception handling Date: Thu, 13 Jul 2023 13:17:16 +0800 Message-Id: <20230713051716.2579821-1-kaisenx.you@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add NIC exception parameter handling to dpdk_test process, program exits when carrying unbound vfio NIC parameters. Fixes: 50247fe03fe0 ("test/timer: exercise new APIs in secondary process") Cc: stable@dpdk.org Signed-off-by: Kaisen You --- app/test/test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/test/test.c b/app/test/test.c index fb073ff795..c927adba81 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -20,6 +20,7 @@ extern cmdline_parse_ctx_t main_ctx[]; #endif #include +#include #include #include #include @@ -111,6 +112,9 @@ main(int argc, char **argv) char *tests[argc]; /* store an array of tests to run */ int test_count = 0; int i; + uint16_t count; + uint16_t port_id; + uint16_t nb_ports; #endif char *extra_args; int ret; @@ -157,6 +161,20 @@ main(int argc, char **argv) prgname = argv[0]; + count = 0; + RTE_ETH_FOREACH_DEV(port_id) { + count++; + } + nb_ports = count; + if (nb_ports == 0) { + if (rte_errno == EBUSY) + printf("Requested device cannot be used: %d\n", rte_errno); + else + printf("No probed ethernet devices: %d\n", rte_errno); + ret = 0; + goto out; + } + #ifdef RTE_LIB_TIMER ret = rte_timer_subsystem_init(); if (ret < 0 && ret != -EALREADY) { -- 2.25.1