From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 7E7B31B489 for ; Fri, 4 Jan 2019 14:28:44 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0FBB88318; Fri, 4 Jan 2019 13:28:43 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DA3B5C1A1; Fri, 4 Jan 2019 13:28:42 +0000 (UTC) From: Kevin Traynor To: Bruce Richardson Cc: Kevin Laatz , dpdk stable Date: Fri, 4 Jan 2019 13:24:53 +0000 Message-Id: <20190104132455.15170-71-ktraynor@redhat.com> In-Reply-To: <20190104132455.15170-1-ktraynor@redhat.com> References: <20190104132455.15170-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 04 Jan 2019 13:28:43 +0000 (UTC) Subject: [dpdk-stable] patch 'telemetry: fix using ports of different types' has been queued to LTS release 18.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2019 13:28:44 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/11/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >>From 36cbc96d2a5c667884e98af79a531eeb128398f7 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 19 Dec 2018 11:59:50 +0000 Subject: [PATCH] telemetry: fix using ports of different types [ upstream commit fff6df7bf58e8907c710832738a26d8d67c8256c ] Different NIC ports can have different numbers of xstats on them, which means that we can't just use the xstats list from the first port registered in the telemetry library. Instead, we need to check the type of each port - by checking its ops structure pointer - and register each port type once with the metrics lib. Fixes: fdbdb3f9ce46 ("telemetry: add initial connection socket") Signed-off-by: Bruce Richardson Acked-by: Kevin Laatz --- lib/librte_telemetry/rte_telemetry.c | 40 ++++++++++++++----- lib/librte_telemetry/rte_telemetry_internal.h | 2 +- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c index 016431f12..7fb247eaa 100644 --- a/lib/librte_telemetry/rte_telemetry.c +++ b/lib/librte_telemetry/rte_telemetry.c @@ -559,5 +559,5 @@ rte_telemetry_send_ports_stats_values(uint32_t *metric_ids, int num_metric_ids, ret = rte_telemetry_update_metrics_ethdev(telemetry, - port_ids[i], telemetry->reg_index); + port_ids[i], telemetry->reg_index[i]); if (ret < 0) { TELEMETRY_LOG_ERR("Failed to update ethdev metrics"); @@ -659,4 +659,9 @@ static int32_t rte_telemetry_initial_accept(struct telemetry_impl *telemetry) { + struct driver_index { + const void *dev_ops; + int reg_index; + } drv_idx[RTE_MAX_ETHPORTS]; + int nb_drv_idx = 0; uint16_t pid; int ret; @@ -664,16 +669,33 @@ rte_telemetry_initial_accept(struct telemetry_impl *telemetry) RTE_ETH_FOREACH_DEV(pid) { - telemetry->reg_index = rte_telemetry_reg_ethdev_to_metrics(pid); - break; - } + int i; + /* Different device types have different numbers of stats, so + * first check if the stats for this type of device have + * already been registered + */ + for (i = 0; i < nb_drv_idx; i++) { + if (rte_eth_devices[pid].dev_ops == drv_idx[i].dev_ops) { + telemetry->reg_index[pid] = drv_idx[i].reg_index; + break; + } + } + if (i < nb_drv_idx) + continue; /* we found a match, go to next port */ - if (telemetry->reg_index < 0) { - TELEMETRY_LOG_ERR("Failed to register ethdev metrics"); - return -1; + /* No match, register a new set of xstats for this port */ + ret = rte_telemetry_reg_ethdev_to_metrics(pid); + if (ret < 0) { + TELEMETRY_LOG_ERR("Failed to register ethdev metrics"); + return -1; + } + telemetry->reg_index[pid] = ret; + drv_idx[nb_drv_idx].dev_ops = rte_eth_devices[pid].dev_ops; + drv_idx[nb_drv_idx].reg_index = ret; + nb_drv_idx++; } telemetry->metrics_register_done = 1; if (selftest) { - ret = rte_telemetry_socket_messaging_testing(telemetry->reg_index, + ret = rte_telemetry_socket_messaging_testing(telemetry->reg_index[0], telemetry->server_fd); if (ret < 0) @@ -1300,5 +1322,5 @@ rte_telemetry_socket_messaging_testing(int index, int socket) telemetry->server_fd = socket; - telemetry->reg_index = index; + telemetry->reg_index[0] = index; TELEMETRY_LOG_INFO("Beginning Telemetry socket message Selftest"); rte_telemetry_socket_test_setup(telemetry, &send_fd, &recv_fd); diff --git a/lib/librte_telemetry/rte_telemetry_internal.h b/lib/librte_telemetry/rte_telemetry_internal.h index de7afda30..c298c3919 100644 --- a/lib/librte_telemetry/rte_telemetry_internal.h +++ b/lib/librte_telemetry/rte_telemetry_internal.h @@ -37,5 +37,5 @@ typedef struct telemetry_impl { int thread_status; uint32_t socket_id; - int reg_index; + int reg_index[RTE_MAX_ETHPORTS]; int metrics_register_done; TAILQ_HEAD(, telemetry_client) client_list_head; -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-04 13:23:09.173298225 +0000 +++ 0071-telemetry-fix-using-ports-of-different-types.patch 2019-01-04 13:23:07.000000000 +0000 @@ -1,8 +1,10 @@ -From fff6df7bf58e8907c710832738a26d8d67c8256c Mon Sep 17 00:00:00 2001 +From 36cbc96d2a5c667884e98af79a531eeb128398f7 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 19 Dec 2018 11:59:50 +0000 Subject: [PATCH] telemetry: fix using ports of different types +[ upstream commit fff6df7bf58e8907c710832738a26d8d67c8256c ] + Different NIC ports can have different numbers of xstats on them, which means that we can't just use the xstats list from the first port registered in the telemetry library. Instead, we need to check the type of each port - @@ -10,7 +12,6 @@ with the metrics lib. Fixes: fdbdb3f9ce46 ("telemetry: add initial connection socket") -Cc: stable@dpdk.org Signed-off-by: Bruce Richardson Acked-by: Kevin Laatz