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 5239842B9D; Thu, 25 May 2023 19:35:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25FE240DF8; Thu, 25 May 2023 19:35:11 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id 14ECB40DDB for ; Thu, 25 May 2023 19:35:08 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-64d2981e3abso3278b3a.1 for ; Thu, 25 May 2023 10:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685036108; x=1687628108; 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=cI/QxTVepNbh5hCYMcs+D+yHjXUdrWK7rryjURH5NH0=; b=P5YkWBuX3g1TNniTC4sBeeTJP5DT6X/SMO+U/iMPKHytaDHAPQfTc7sFpi64ZsGkOS H8rjiPRF5W449ZPLNO0sG0WEuIc9FAYL8kCLePjMRWZxDOFXIt8hiyRMUG5st6266C9a /s4dCvHdG42FE5G7ivWXIoqK954nVncwCTN0z+jltAOEsQrflegykeFdyyLd5ycTsJhQ qA5ssYI+aYPcr2tGMgzk9ht+PhGMqIrDlCkd1isliB1aei1PT3P51SE/b746VA0A7cIF fxOCOyJebUJQa3S6oU4JZQgPFHRvx8fF5iyOAgmFCMnvc7UKSNp02lSYFHPCZ9QDOZGP HjLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685036108; x=1687628108; 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=cI/QxTVepNbh5hCYMcs+D+yHjXUdrWK7rryjURH5NH0=; b=TQYOs8SmZJ46r885gnPc/F/ISnLuSC2HosOnz3e1x7HPR/zVnMvy5nk4yPGCYnhXfe qENAIPZWzw1HIT0/Nu4ZboBUbxPf7AFOgAXtYejGNFnGrKYdj5kovYuSvHfUK2zE6jq0 tHHm3QaXiDSwOod/Mksuev8UgDQp/+HSyUSZ4vZyOnvD/J68u93gFNaFb85UXa1mmdtk /YrL8u4LzOPiB41UhhNKm9O13BpCkjPymxGeuvuaKgpEUi7GYHpdoIwA9d8mTULZAUEl 9txeFyOB5T0xdztvyXkEatWULcy0reiIToWB5OcD1i94jorAw2rB7vsONU1/XoYnzJi1 u7pA== X-Gm-Message-State: AC+VfDzrnfkE+md9/Qs6N1EfpvR6TN6pHlqVy/aGmR8istpkF2L1kTpO 0JucIXpojiftmK6cX+zrsz/QCg== X-Google-Smtp-Source: ACHHUZ4wFTLrs0+QiSd626cK8McAnLs9j76QUJgXFVnEcNldEKIOUvvx7E2N669UO4nv2VqyA4TxGQ== X-Received: by 2002:a05:6a21:3944:b0:10c:dd4f:faa7 with SMTP id ac4-20020a056a21394400b0010cdd4ffaa7mr8977467pzc.1.1685036108079; Thu, 25 May 2023 10:35:08 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id x1-20020a62fb01000000b0062dedfd3d73sm1459875pfm.95.2023.05.25.10.35.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 10:35:07 -0700 (PDT) Date: Thu, 25 May 2023 10:35:04 -0700 From: Stephen Hemminger To: Abdullah Sevincer Cc: dev@dpdk.org, jerinj@marvell.com, reshma.pattan@intel.com Subject: Re: [PATCH v16] app/procinfo: display eventdev xstats Message-ID: <20230525103504.47375d4d@hermes.local> In-Reply-To: <20230525164127.3046135-1-abdullah.sevincer@intel.com> References: <20230517223724.2417630-1-abdullah.sevincer@intel.com> <20230525164127.3046135-1-abdullah.sevincer@intel.com> 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 Thu, 25 May 2023 11:41:27 -0500 Abdullah Sevincer wrote: > This commit extends proc-info application to > display xstats for the eventdev devices. > > New command line arguments are introduced to > display xstats for eventdev devices. The command > example is like: > > For displaying a specific port stats (e.g. port 1): > ./dpdk-proc-info -- --show-edev-port-xstats=1:0 > > If any xstats parameters for eventdev passed through > proc-info command line, proc-info will only display > requested eventdev data and exit. > > Users should not pass any eventdev xstats parameters > if they desire to dump other proc-info data such as > Rx/Tx descriptor dump. > More information can be found in proc-info app doc. > > Signed-off-by: Abdullah Sevincer I was thinking of helper function and using const strings. Don't need to panic on invalid eventdev. Also the flags could be just bitfield to save some space. Something like this. Untested since I have no hardware with eventdevs. diff --git a/app/proc-info/main.c b/app/proc-info/main.c index f53fab2e3346..d330afd6815e 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -132,11 +132,11 @@ struct eventdev_params { uint16_t queues[MAX_PORTS_QUEUES]; uint16_t num_queues; uint16_t num_ports; - uint32_t shw_all_queues; - uint32_t shw_all_ports; - uint32_t dump_xstats; - uint32_t reset_xstats; - uint32_t shw_device_xstats; + uint8_t shw_all_queues:1, + shw_all_ports:1, + dump_xstats:1, + reset_xstats:1, + shw_device_xstats:1; }; static struct eventdev_params eventdev_var[RTE_EVENT_MAX_DEVS]; @@ -261,71 +261,57 @@ parse_descriptor_param(char *list, struct desc_param *desc) return 0; } -static int -parse_eventdev_dump_xstats_params(char *list) +static uint16_t parse_eventdev(const char *str) { unsigned long evdev_id; char *endp; - evdev_id = strtoul(list, &endp, 0); - - if (*list == '\0' || *endp != '\0' || evdev_id >= RTE_EVENT_MAX_DEVS) { - fprintf(stderr, "Invalid eventdev id: %s\n", list); - return -EINVAL; + evdev_id = strtoul(str, &endp, 0); + if (*str == '\0' || *endp != '\0' || evdev_id >= rte_event_dev_count()) { + fprintf(stderr, "Invalid eventdev id: %s\n", str); + return -1; } + return evdev_id; +} - eventdev_var[evdev_id].dump_xstats = 1; +static int +parse_eventdev_dump_xstats_params(const char *list) +{ + int evdev_id = parse_eventdev(list); - if (evdev_id >= rte_event_dev_count()) - rte_panic("Invalid eventdev id: %s\n", list); + if (evdev_id < 0) + return -EINVAL; + eventdev_var[evdev_id].dump_xstats = 1; return 0; } static int -parse_eventdev_reset_xstats_params(char *list) +parse_eventdev_reset_xstats_params(const char *list) { - unsigned long evdev_id; - char *endp; - - evdev_id = strtoul(list, &endp, 0); + int evdev_id = parse_eventdev(list); - if (*list == '\0' || *endp != '\0' || evdev_id >= RTE_EVENT_MAX_DEVS) { - fprintf(stderr, "Invalid eventdev id: %s\n", list); + if (evdev_id < 0) return -EINVAL; - } eventdev_var[evdev_id].reset_xstats = 1; - - if (evdev_id >= rte_event_dev_count()) - rte_panic("Invalid eventdev id: %s\n", list); - return 0; } static int -parse_eventdev_device_xstats_params(char *list) +parse_eventdev_device_xstats_params(const char *list) { - unsigned long evdev_id; - char *endp; - - evdev_id = strtoul(list, &endp, 0); + int evdev_id = parse_eventdev(list); - if (*list == '\0' || *endp != '\0' || evdev_id >= RTE_EVENT_MAX_DEVS) { - fprintf(stderr, "Invalid eventdev id: %s\n", list); + if (evdev_id < 0) return -EINVAL; - } eventdev_var[evdev_id].shw_device_xstats = 1; - - if (evdev_id >= rte_event_dev_count()) - rte_panic("Invalid eventdev id: %s\n", list); - return 0; } static int -parse_eventdev_queue_xstats_params(char *list) +parse_eventdev_queue_xstats_params(const char *list) { uint16_t queue_id; uint16_t evdev_id; @@ -353,7 +339,7 @@ parse_eventdev_queue_xstats_params(char *list) return -EINVAL; } - if (evdev_id >= rte_event_dev_count()) + rte_panic("invalid event device %hu\n", evdev_id); return 0;