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 AE92C42E21; Sat, 8 Jul 2023 17:27:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 878B340A8A; Sat, 8 Jul 2023 17:27:02 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 728D140156 for ; Sat, 8 Jul 2023 17:27:01 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1b8bbce9980so18282145ad.2 for ; Sat, 08 Jul 2023 08:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688830020; x=1691422020; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=CXDXXLDV/IqOMKXFWCzi6k/Jfy1WIqndtm4Ec7Horjk=; b=q9MYlv9sqVjZkuror6dtD9lL3REhFtNBho0hTrQe3iKfdMk5xiAY88mmoTME+BIANg RxYse0YpzA576HpNaGQl4TvNzvG2U1YavJ5XG4P/3dqQQ2RyCDRapiAzQFs2an0TUu21 /X1/nnvRsaYd1kaMtljMxgF9UaOnrvfMCXOp0y1FH/gfu/K3R5xOKtIedD/2enOCEtbc lGW+dP2FccU/hobtei0Pajx6P1O+AFFp33nXhOm7frssVNnBoxL3mqEdsRrwTErDXeuN x3MwO+8Jt13ZVd2Sd3iSctVyftI1eOV+5iLTgtDfedi4rFDMhc5EPz0vz9RGlVDcSJ/B Z7jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688830020; x=1691422020; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CXDXXLDV/IqOMKXFWCzi6k/Jfy1WIqndtm4Ec7Horjk=; b=GkNEzKI1t0uhqMn+Cpjp2HOkkjuP08DTOc8R8UpwZ2PeKoVWLQGv4Oh2ZrYeNfGn1E gJA5yn2/VVNAlfS0WpuJu7p3uA9X9RS9Ra5h5NZ4Jv/d8jDDObr0oua3/WDy8tBAPuM+ pIW7f3pBJ2lX1RNrBAw0QX67s0gmrE4oNrKo23NJrwBf1RYbMUSg73/3jPfyyXFKqYiI PnMaokjV7Tsp/0tr4qoPTUdGhlCkJcvUpOnXmi6LKwy4q+rmE08E0jY9UyNPKUq1nI8B jOg2HIUz4KWh0JIT3SRnGCVceXIAsAPELyz8XuN0G6NBDdGEdLTQTLjHHW6Adzg5phbl 5/Ng== X-Gm-Message-State: ABy/qLY/MhDWNuGG9z7BMsTtU6y1En+zfOB/vAVVyOj4nNYy2aSw+jMr amA6+E65dMYs9tsMMFV/oJnL/A== X-Google-Smtp-Source: APBJJlF6R1ikkPhJjmackR7zjVMYJ8QWjNS8/qwQj6YAud1DEaFeyLDZh6enUnyUt0lUfRM3A4/6tw== X-Received: by 2002:a17:902:c94a:b0:1b8:a74e:56ae with SMTP id i10-20020a170902c94a00b001b8a74e56aemr7127977pla.40.1688830020338; Sat, 08 Jul 2023 08:27:00 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id u9-20020a170902bf4900b001b80de83b10sm5027028pls.301.2023.07.08.08.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jul 2023 08:27:00 -0700 (PDT) Date: Sat, 8 Jul 2023 08:26:58 -0700 From: Stephen Hemminger To: "Sevincer, Abdullah" Cc: Thomas Monjalon , "dev@dpdk.org" , "jerinj@marvell.com" , "Pattan, Reshma" Subject: Re: [PATCH v17] app/procinfo: display eventdev xstats Message-ID: <20230708082658.76f28dcf@hermes.local> In-Reply-To: References: <20230525164127.3046135-1-abdullah.sevincer@intel.com> <20230525184731.3056328-1-abdullah.sevincer@intel.com> <20230525130713.3ecf0ded@hermes.local> <3736714.CbtlEUcBR6@thomas> <20230707075543.46a36fc4@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Sat, 8 Jul 2023 15:11:45 +0000 "Sevincer, Abdullah" wrote: > >+Has new coverity issue. > >+The reason is the boolean is set every time because it gets every time. > > >+Looks like code goes over eventdev_var[] even if no eventdevs are present. > >+Should only look for the number of eventdevs > > Thanks Stephen, I will add a condition at the top of the function like: > > evdevs = rte_event_dev_count(); > if (!evdevs) > return 0; > > This will ensure if there is no eventdev device function returns. > > I will also change the for loop to iterate only with the count of evdevs like: > for (i = 0; i < evdevs; i++) {....... instead of for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) {. > > I still need that flag to be set when a user sets a value from command line for a queue or port. > The flag is needed to display and exit from the program. > > if (process_eventdev_xstats()) > return 0; > Maybe something like this: PS: also shortened variable names for clarity diff --git a/app/proc-info/main.c b/app/proc-info/main.c index be63eace6909..e3d2578c39dc 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -2045,18 +2045,13 @@ xstats_reset(uint8_t dev_id, } -static int -process_eventdev_xstats(void) +static unsigned int +eventdev_xstats(void) { - int i; - int j; - int processing_eventdev_xstats = 0; - - for (i = 0; i < RTE_EVENT_MAX_DEVS; i++) { - - if (!processing_eventdev_xstats) - processing_eventdev_xstats = 1; + unsigned int count = 0; + int i, j; + for (i = 0; i < rte_event_dev_count(); i++) { if (eventdev_var[i].dump_xstats) { int ret = rte_event_dev_dump(i, stdout); @@ -2106,12 +2101,10 @@ process_eventdev_xstats(void) eventdev_var[i].queues[j]); } } + ++count; } - if (processing_eventdev_xstats) - return 1; - - return 0; + return count; } int @@ -2164,7 +2157,7 @@ main(int argc, char **argv) return 0; } - if (process_eventdev_xstats()) + if (eventdev_xstats() > 0) return 0; nb_ports = rte_eth_dev_count_avail();