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 12E09A034F; Mon, 11 Oct 2021 18:14:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D213E410EE; Mon, 11 Oct 2021 18:14:41 +0200 (CEST) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) by mails.dpdk.org (Postfix) with ESMTP id 20526410E5 for ; Mon, 11 Oct 2021 18:14:40 +0200 (CEST) Received: by mail-io1-f42.google.com with SMTP id q205so20427562iod.8 for ; Mon, 11 Oct 2021 09:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8U2roxLC9I/MnVKIlZ5ON0a+FTLtCEVSL/1fhz7hugI=; b=bCiHCOYzLmjb0KOrQq/VKEphCXZsZndS9aXTpePICDgWHM3cC+hS8r1dkaTHX2Gi84 bD5Zgqi6iZdqH/L9faMMm88IEp1sYmAI3ia4sBAhkFgpm8glQVhQzz3L/3X41dRbk23/ XfMfeSltWmXm/T8aq8fLpJJR+thZ6TEzJ7a2zPHo3ErUlev4UzEJmJO4QzvyyZQgtg0S 3NZ8YvUk2bohQOc6nC2Lqo/RHUpmbCtybKqCkAteFf8Ku0u0cNkYN1L3+3R2Yp5Cc4uh TEyh14r/gUKF7eyJRuqjsuisxWYXNW6Qfe/LM23X8ThopKYySOuHKwY191JFUUEbAFtx ixZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8U2roxLC9I/MnVKIlZ5ON0a+FTLtCEVSL/1fhz7hugI=; b=V+VlH5WDXsGZ2JAsU2DzB1bQFIRQrlVT9W8hZDaPUE/OmQTALCd287btNlb+l+DtCN YWMQ/K139pdJdtmL27SKcOb5naWCs2V1vHFJb5qeKUZueoo5zRkJyxlOVprvhkJnraj3 WvdPZ6wQJlASC7/iR+iV/C2aQdLp2YmKboixnU+27eo7NJ8DiY7mWxnXMJ46hRvrqJvz FP5v5DepArHMQe6C1EfYEstQ04joMZ+uUIrmkFp6hJN4Sgmw0DdP9clvNYvPT7LMRJpu yv+R5LR3ZgFnhoXf59x+sKa3p6UGVKRU00THHBq7dTw8Z34SDv/hFWzYzbOTUwvywlss Z3oA== X-Gm-Message-State: AOAM531H9s18s4E1n4FtBgxC69Cunj8eJFFFOyrv7D/2B0E/L9I+vy+H zJCmy06P4sm+6Hb4kyPvztcwtjaq+ejks3SyOBI= X-Google-Smtp-Source: ABdhPJwB0xhTkuZU/LOA0f9Mp8AFHoxgHvbuEz4Ejn66bU6yT9feROXhPDJv3QZVidXYnmftCxIJZeN4joazRLwFiGs= X-Received: by 2002:a5d:88d7:: with SMTP id i23mr19171680iol.38.1633968879376; Mon, 11 Oct 2021 09:14:39 -0700 (PDT) MIME-Version: 1.0 References: <20211007125734.2326512-1-ganapati.kundapura@intel.com> In-Reply-To: <20211007125734.2326512-1-ganapati.kundapura@intel.com> From: Jerin Jacob Date: Mon, 11 Oct 2021 21:44:12 +0530 Message-ID: To: Ganapati Kundapura Cc: dpdk-dev , "Jayatheerthan, Jay" Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1] eventdev/rx-adapter: add telemetry callbacks 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 Sender: "dev" On Thu, Oct 7, 2021 at 6:27 PM Ganapati Kundapura wrote: > > Added telemetry callbacks to get Rx adapter stats, reset stats and > to get rx queue config information. rx -> Rx Change the subject to eventdev/rx_adapter > > Signed-off-by: Ganapati Kundapura > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c > index 9ac976c..fa7191c 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > @@ -23,6 +23,7 @@ > #include "eventdev_pmd.h" > #include "rte_eventdev_trace.h" > #include "rte_event_eth_rx_adapter.h" > +#include Move this to the above block where all <...h> header files are grouped. > > #define BATCH_SIZE 32 > #define BLOCK_CNT_THRESHOLD 10 > @@ -2852,6 +2853,7 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id, > struct rte_event_eth_rx_adapter_stats *stats) > { > struct rte_event_eth_rx_adapter *rx_adapter; > + struct rte_eth_event_enqueue_buffer *buf; > struct rte_event_eth_rx_adapter_stats dev_stats_sum = { 0 }; > struct rte_event_eth_rx_adapter_stats dev_stats; > struct rte_eventdev *dev; > @@ -2887,8 +2889,11 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id, > if (rx_adapter->service_inited) > *stats = rx_adapter->stats; > > + buf = &rx_adapter->event_enqueue_buffer; > stats->rx_packets += dev_stats_sum.rx_packets; > stats->rx_enq_count += dev_stats_sum.rx_enq_count; > + stats->rx_event_buf_count = buf->count; > + stats->rx_event_buf_size = buf->events_size; > > return 0; > } > @@ -3052,3 +3057,146 @@ rte_event_eth_rx_adapter_queue_conf_get(uint8_t id, > > return 0; > } > + > +#define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s) > + > +static int > +handle_rxa_stats(const char *cmd __rte_unused, > + const char *params, > + struct rte_tel_data *d) > +{ > + uint8_t rx_adapter_id; > + struct rte_event_eth_rx_adapter_stats rx_adptr_stats; > + > + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) > + return -1; > + > + /* Get Rx adapter ID from parameter string */ > + rx_adapter_id = atoi(params); > + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter_id, -EINVAL); > + > + /* Get Rx adapter stats */ > + if (rte_event_eth_rx_adapter_stats_get(rx_adapter_id, > + &rx_adptr_stats)) { > + RTE_EDEV_LOG_ERR("Failed to get Rx adapter stats\n"); > + return -1; > + } > + > + rte_tel_data_start_dict(d); > + rte_tel_data_add_dict_u64(d, "rx_adapter_id", rx_adapter_id); > + RXA_ADD_DICT(rx_adptr_stats, rx_packets); > + RXA_ADD_DICT(rx_adptr_stats, rx_poll_count); > + RXA_ADD_DICT(rx_adptr_stats, rx_dropped); > + RXA_ADD_DICT(rx_adptr_stats, rx_enq_retry); > + RXA_ADD_DICT(rx_adptr_stats, rx_event_buf_count); > + RXA_ADD_DICT(rx_adptr_stats, rx_event_buf_size); > + RXA_ADD_DICT(rx_adptr_stats, rx_enq_count); > + RXA_ADD_DICT(rx_adptr_stats, rx_enq_start_ts); > + RXA_ADD_DICT(rx_adptr_stats, rx_enq_block_cycles); > + RXA_ADD_DICT(rx_adptr_stats, rx_enq_end_ts); > + RXA_ADD_DICT(rx_adptr_stats, rx_intr_packets); > + > + return 0; > +} > + > +static int > +handle_rxa_stats_reset(const char *cmd __rte_unused, > + const char *params, > + struct rte_tel_data *d __rte_unused) > +{ > + uint8_t rx_adapter_id; > + > + if (params == NULL || strlen(params) == 0 || ~isdigit(*params)) > + return -1; > + > + /* Get Rx adapter ID from parameter string */ > + rx_adapter_id = atoi(params); > + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter_id, -EINVAL); > + > + /* Reset Rx adapter stats */ > + if (rte_event_eth_rx_adapter_stats_reset(rx_adapter_id)) { > + RTE_EDEV_LOG_ERR("Failed to reset Rx adapter stats\n"); > + return -1; > + } > + > + return 0; > +} > + > +static int > +handle_rxa_get_queue_conf(const char *cmd __rte_unused, > + const char *params, > + struct rte_tel_data *d) > +{ > + uint8_t rx_adapter_id; > + uint16_t rx_queue_id; > + int eth_dev_id; > + char *token, *l_params; > + struct rte_event_eth_rx_adapter_queue_conf queue_conf; > + > + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) > + return -1; > + > + /* Get Rx adapter ID from parameter string */ > + l_params = strdup(params); > + token = strtok(l_params, ","); > + rx_adapter_id = strtoul(token, NULL, 10); > + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter_id, -EINVAL); > + > + token = strtok(NULL, ","); > + if (token == NULL || strlen(token) == 0 || !isdigit(*token)) > + return -1; > + > + /* Get device ID from parameter string */ > + eth_dev_id = strtoul(token, NULL, 10); > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL); > + > + token = strtok(NULL, ","); > + if (token == NULL || strlen(token) == 0 || !isdigit(*token)) > + return -1; > + > + /* Get Rx queue ID from parameter string */ > + rx_queue_id = strtoul(token, NULL, 10); > + if (rx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_rx_queues) { > + RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", rx_queue_id); > + return -EINVAL; > + } > + > + token = strtok(NULL, "\0"); > + if (token != NULL) > + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" > + " telemetry command, igrnoring"); > + > + if (rte_event_eth_rx_adapter_queue_conf_get(rx_adapter_id, eth_dev_id, > + rx_queue_id, &queue_conf)) { > + RTE_EDEV_LOG_ERR("Failed to get Rx adapter queue config"); > + return -1; > + } > + > + rte_tel_data_start_dict(d); > + rte_tel_data_add_dict_u64(d, "rx_adapter_id", rx_adapter_id); > + rte_tel_data_add_dict_u64(d, "eth_dev_id", eth_dev_id); > + rte_tel_data_add_dict_u64(d, "rx_queue_id", rx_queue_id); > + RXA_ADD_DICT(queue_conf, rx_queue_flags); > + RXA_ADD_DICT(queue_conf, servicing_weight); > + RXA_ADD_DICT(queue_conf.ev, queue_id); > + RXA_ADD_DICT(queue_conf.ev, sched_type); > + RXA_ADD_DICT(queue_conf.ev, priority); > + RXA_ADD_DICT(queue_conf.ev, flow_id); > + > + return 0; > +} > + > +RTE_INIT(rxa_init_telemetry) > +{ > + rte_telemetry_register_cmd("/eventdev/rxa_stats", > + handle_rxa_stats, > + "Returns Rx adapter stats. Parameter: rx_adapter_id"); > + > + rte_telemetry_register_cmd("/eventdev/rxa_stats_reset", > + handle_rxa_stats_reset, > + "Reset Rx adapter stats. Parameter: rx_adapter_id"); > + > + rte_telemetry_register_cmd("/eventdev/rxa_queue_conf", > + handle_rxa_get_queue_conf, > + "Returns Rx queue config. Parameter: rxa_id, DevID, que_id"); > +} > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h > index 70ca427..acabed4 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.h > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h > @@ -216,6 +216,10 @@ struct rte_event_eth_rx_adapter_stats { > /**< Eventdev enqueue count */ > uint64_t rx_enq_retry; > /**< Eventdev enqueue retry count */ > + uint64_t rx_event_buf_count; > + /**< Rx event buffered count */ > + uint64_t rx_event_buf_size; Isn't ABI breakage? CI did not warn this. Isn't this a public structure? > + /**< Rx event buffer size */ > uint64_t rx_dropped; > /**< Received packet dropped count */ > uint64_t rx_enq_start_ts; > -- > 2.6.4 >