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 D9BF4423B5; Thu, 12 Jan 2023 12:25:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C868142D25; Thu, 12 Jan 2023 12:25:34 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0547942D22 for ; Thu, 12 Jan 2023 12:25:32 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C9dqDj021081; Thu, 12 Jan 2023 03:23:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=VaR7WbxIF9cfoN5Ylwcy7ifryLIYqVIU5fhRJYKNpHA=; b=i42mHWALqq6PNX4gW3rlx87UXMClZdB9rWT3gnqPeihl+raV7xI3+LO/5d19uoIKjZJP NM34VUYs9YzE4L/9P103VEUjGsee17xZmVGHFMhB5Ob0LN3Uc6q4+1zW3PdvZ1rTBbOY KyCdfFnPRiVfnPr/VI1jsKXL8vK/O89+FO1hMEVq3Tl87f0xpxCoUr8DGezu7rLDa1QW h2TtsJ4UvEn2Oc8g+RqXt/DdZLZcSRJRfsPai+Mncs2VPQDSioBVSGCF5C0MfyTYRhDA qlib1/cp8dbgfCog5vFFqfyTnHC7iGBXeAAvzb7jIke+/gUKjPWU4+JniJrBSm+IImnI Bw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n1k56ysq9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 12 Jan 2023 03:23:12 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 12 Jan 2023 03:23:10 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 12 Jan 2023 03:23:10 -0800 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id C0E273F7055; Thu, 12 Jan 2023 03:22:48 -0800 (PST) From: Ankur Dwivedi To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Ankur Dwivedi Subject: [PATCH v5 2/6] ethdev: add trace points for ethdev Date: Thu, 12 Jan 2023 16:51:36 +0530 Message-ID: <20230112112140.807233-3-adwivedi@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112112140.807233-1-adwivedi@marvell.com> References: <20221222063306.3383695-1-adwivedi@marvell.com> <20230112112140.807233-1-adwivedi@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: YBUh6BSWgphOwxZi1r0D30TxEjF7GxXE X-Proofpoint-GUID: YBUh6BSWgphOwxZi1r0D30TxEjF7GxXE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_07,2023-01-12_01,2022-06-22_01 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 Adds trace points for ethdev functions. Moved the rte_ethdev_trace_rx_burst and rte_ethdev_trace_tx_burst to a new file rte_ethdev_trace_fp_burst.h. This is needed to resolve cyclic dependency between rte_ethdev.h and rte_ethdev_trace_fp.h. Signed-off-by: Ankur Dwivedi --- lib/ethdev/ethdev_private.c | 5 + lib/ethdev/ethdev_trace_points.c | 193 +++++++++++++++++ lib/ethdev/meson.build | 1 + lib/ethdev/rte_ethdev.c | 235 +++++++++++++++++--- lib/ethdev/rte_ethdev.h | 2 +- lib/ethdev/rte_ethdev_trace.h | 285 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev_trace_fp.h | 279 +++++++++++++++++++++++- lib/ethdev/rte_ethdev_trace_fp_burst.h | 44 ++++ lib/ethdev/version.map | 66 ++++++ 9 files changed, 1075 insertions(+), 35 deletions(-) create mode 100644 lib/ethdev/rte_ethdev_trace_fp_burst.h diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index 48090c879a..fd16b25e55 100644 --- a/lib/ethdev/ethdev_private.c +++ b/lib/ethdev/ethdev_private.c @@ -5,6 +5,7 @@ #include #include "rte_ethdev.h" +#include "rte_ethdev_trace_fp.h" #include "ethdev_driver.h" #include "ethdev_private.h" @@ -297,6 +298,8 @@ rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t queue_id, cb = cb->next; } + rte_eth_trace_call_rx_callbacks(port_id, queue_id, rx_pkts, nb_rx, nb_pkts); + return nb_rx; } @@ -312,6 +315,8 @@ rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id, cb = cb->next; } + rte_eth_trace_call_tx_callbacks(port_id, queue_id, tx_pkts, nb_pkts); + return nb_pkts; } diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 2919409a15..4fea76e0ff 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -5,6 +5,7 @@ #include #include +#include RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_configure, lib.ethdev.configure) @@ -29,3 +30,195 @@ RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_burst, RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_burst, lib.ethdev.tx.burst) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_call_rx_callbacks, + lib.ethdev.call_rx_callbacks) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_call_tx_callbacks, + lib.ethdev.call_tx_callbacks) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_init, + lib.ethdev.iterator_init) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_next, + lib.ethdev.iterator_next) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_iterator_cleanup, + lib.ethdev.iterator_cleanup) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next, + lib.ethdev.find_next) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next_of, + lib.ethdev.find_next_of) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next_sibling, + lib.ethdev.find_next_sibling) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_is_valid_port, + lib.ethdev.is_valid_port) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_find_next_owned_by, + lib.ethdev.find_next_owned_by) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_new, + lib.ethdev.owner_new) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_set, + lib.ethdev.owner_set) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_unset, + lib.ethdev.owner_unset) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_delete, + lib.ethdev.owner_delete) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_owner_get, + lib.ethdev.owner_get) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_socket_id, + lib.ethdev.socket_id) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_sec_ctx, + lib.ethdev.get_sec_ctx) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_count_avail, + lib.ethdev.count_avail) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_count_total, + lib.ethdev.count_total) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_name_by_port, + lib.ethdev.get_name_by_port) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_get_port_by_name, + lib.ethdev.get_port_by_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_queue_start, + lib.ethdev.rx_queue_start) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_queue_stop, + lib.ethdev.rx_queue_stop) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_queue_start, + lib.ethdev.tx_queue_start) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_queue_stop, + lib.ethdev.tx_queue_stop) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_speed_bitflag, + lib.ethdev.speed_bitflag) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_rx_offload_name, + lib.ethdev.rx_offload_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_tx_offload_name, + lib.ethdev.tx_offload_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_capability_name, + lib.ethdev.capability_name) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_link_up, + lib.ethdev.set_link_up) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_link_down, + lib.ethdev.set_link_down) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_reset, + lib.ethdev.reset) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_is_removed, + lib.ethdev.is_removed) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_rx_hairpin_queue_setup, + lib.ethdev.rx.hairpin_queue_setup) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_hairpin_queue_setup, + lib.ethdev.tx.hairpin_queue_setup) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_hairpin_bind, + lib.ethdev.hairpin_bind) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_hairpin_unbind, + lib.ethdev.hairpin_unbind) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_hairpin_get_peer_ports, + lib.ethdev.hairpin_get_peer_ports) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_buffer_drop_callback, + lib.ethdev.tx_buffer_drop_callback) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_buffer_count_callback, + lib.ethdev.tx_buffer_count_callback) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_buffer_set_err_callback, + lib.ethdev.tx_buffer_set_err_callback) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_buffer_init, + lib.ethdev.tx_buffer_init) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_tx_done_cleanup, + lib.ethdev.tx_done_cleanup) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_promiscuous_enable, + lib.ethdev.promiscuous_enable) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_promiscuous_disable, + lib.ethdev.promiscuous_disable) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_promiscuous_get, + lib.ethdev.promiscuous_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_allmulticast_enable, + lib.ethdev.allmulticast_enable) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_allmulticast_disable, + lib.ethdev.allmulticast_disable) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_allmulticast_get, + lib.ethdev.allmulticast_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_link_get, + lib.ethdev.link_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_link_get_nowait, + lib.ethdev.link_get_nowait) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_link_speed_to_str, + lib.ethdev.link_speed_to_str) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_link_to_str, + lib.ethdev.link_to_str) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_stats_get, + lib.ethdev.stats_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_stats_reset, + lib.ethdev.stats_reset) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_xstats_get_id_by_name, + lib.ethdev.xstats_get_id_by_name) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_xstats_get_names_by_id, + lib.ethdev.xstats_get_names_by_id) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_xstats_get_names, + lib.ethdev.xstats_get_names) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_xstats_get_by_id, + lib.ethdev.xstats_get_by_id) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_xstats_get, + lib.ethdev.xstats_get) + +RTE_TRACE_POINT_REGISTER(rte_eth_trace_xstats_reset, + lib.ethdev.xstats_reset) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_tx_queue_stats_mapping, + lib.ethdev.set_tx_queue_stats_mapping) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_set_rx_queue_stats_mapping, + lib.ethdev.set_rx_queue_stats_mapping) + +RTE_TRACE_POINT_REGISTER(rte_ethdev_trace_fw_version_get, + lib.ethdev.fw_version_get) diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build index 39250b5da1..f5c0865023 100644 --- a/lib/ethdev/meson.build +++ b/lib/ethdev/meson.build @@ -24,6 +24,7 @@ headers = files( 'rte_ethdev.h', 'rte_ethdev_trace.h', 'rte_ethdev_trace_fp.h', + 'rte_ethdev_trace_fp_burst.h', 'rte_dev_info.h', 'rte_flow.h', 'rte_flow_driver.h', diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 5d5e18db1e..40897ad94d 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -27,8 +27,9 @@ #include #include -#include "rte_ethdev_trace.h" #include "rte_ethdev.h" +#include "rte_ethdev_trace.h" +#include "rte_ethdev_trace_fp.h" #include "ethdev_driver.h" #include "ethdev_profile.h" #include "ethdev_private.h" @@ -258,6 +259,7 @@ rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str) end: iter->cls = rte_class_find_by_name("eth"); + rte_eth_trace_iterator_init(devargs_str); rte_devargs_reset(&devargs); return 0; @@ -274,6 +276,8 @@ rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str) uint16_t rte_eth_iterator_next(struct rte_dev_iterator *iter) { + uint16_t id; + if (iter == NULL) { RTE_ETHDEV_LOG(ERR, "Cannot get next device from NULL iterator\n"); @@ -297,8 +301,11 @@ rte_eth_iterator_next(struct rte_dev_iterator *iter) /* A device is matching bus part, need to check ethdev part. */ iter->class_device = iter->cls->dev_iterate( iter->class_device, iter->cls_str, iter); - if (iter->class_device != NULL) - return eth_dev_to_id(iter->class_device); /* match */ + if (iter->class_device != NULL) { + id = eth_dev_to_id(iter->class_device); + rte_eth_trace_iterator_next(iter, id); + return id; /* match */ + } } while (iter->bus != NULL); /* need to try next rte_device */ /* No more ethdev port to iterate. */ @@ -316,6 +323,7 @@ rte_eth_iterator_cleanup(struct rte_dev_iterator *iter) if (iter->bus_str == NULL) return; /* nothing to free in pure class filter */ + rte_eth_trace_iterator_cleanup(iter); free(RTE_CAST_FIELD(iter, bus_str, char *)); /* workaround const */ free(RTE_CAST_FIELD(iter, cls_str, char *)); /* workaround const */ memset(iter, 0, sizeof(*iter)); @@ -324,12 +332,18 @@ rte_eth_iterator_cleanup(struct rte_dev_iterator *iter) uint16_t rte_eth_find_next(uint16_t port_id) { + rte_eth_trace_find_next(port_id); + while (port_id < RTE_MAX_ETHPORTS && rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED) port_id++; - if (port_id >= RTE_MAX_ETHPORTS) + if (port_id >= RTE_MAX_ETHPORTS) { + rte_eth_trace_find_next(RTE_MAX_ETHPORTS); return RTE_MAX_ETHPORTS; + } + + rte_eth_trace_find_next(port_id); return port_id; } @@ -347,10 +361,15 @@ uint16_t rte_eth_find_next_of(uint16_t port_id, const struct rte_device *parent) { port_id = rte_eth_find_next(port_id); + + rte_eth_trace_find_next_of(port_id); + while (port_id < RTE_MAX_ETHPORTS && rte_eth_devices[port_id].device != parent) port_id = rte_eth_find_next(port_id + 1); + rte_eth_trace_find_next_of(port_id); + return port_id; } @@ -358,6 +377,9 @@ uint16_t rte_eth_find_next_sibling(uint16_t port_id, uint16_t ref_port_id) { RTE_ETH_VALID_PORTID_OR_ERR_RET(ref_port_id, RTE_MAX_ETHPORTS); + + rte_eth_trace_find_next_sibling(port_id, ref_port_id); + return rte_eth_find_next_of(port_id, rte_eth_devices[ref_port_id].device); } @@ -372,10 +394,13 @@ int rte_eth_dev_is_valid_port(uint16_t port_id) { if (port_id >= RTE_MAX_ETHPORTS || - (rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED)) + (rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED)) { + rte_ethdev_trace_is_valid_port(port_id, 0); return 0; - else + } else { + rte_ethdev_trace_is_valid_port(port_id, 1); return 1; + } } static int @@ -395,6 +420,7 @@ rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id) rte_eth_devices[port_id].data->owner.id != owner_id) port_id = rte_eth_find_next(port_id + 1); + rte_eth_trace_find_next_owned_by(port_id, owner_id); return port_id; } @@ -413,6 +439,7 @@ rte_eth_dev_owner_new(uint64_t *owner_id) *owner_id = eth_dev_shared_data->next_owner_id++; rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); + rte_ethdev_trace_owner_new(*owner_id); return 0; } @@ -476,6 +503,7 @@ rte_eth_dev_owner_set(const uint16_t port_id, ret = eth_dev_owner_set(port_id, RTE_ETH_DEV_NO_OWNER, owner); rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); + rte_ethdev_trace_owner_set(port_id, owner, ret); return ret; } @@ -493,6 +521,7 @@ rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id) ret = eth_dev_owner_set(port_id, owner_id, &new_owner); rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); + rte_ethdev_trace_owner_unset(port_id, owner_id, ret); return ret; } @@ -526,6 +555,7 @@ rte_eth_dev_owner_delete(const uint64_t owner_id) rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); + rte_ethdev_trace_owner_delete(owner_id, ret); return ret; } @@ -555,6 +585,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) rte_memcpy(owner, ðdev->data->owner, sizeof(*owner)); rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); + rte_ethdev_trace_owner_get(port_id, owner); return 0; } @@ -570,14 +601,21 @@ rte_eth_dev_socket_id(uint16_t port_id) if (socket_id == SOCKET_ID_ANY) rte_errno = 0; } + rte_ethdev_trace_socket_id(port_id, socket_id); return socket_id; } void * rte_eth_dev_get_sec_ctx(uint16_t port_id) { + void *ctx; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, NULL); - return rte_eth_devices[port_id].security_ctx; + ctx = rte_eth_devices[port_id].security_ctx; + + rte_ethdev_trace_get_sec_ctx(port_id, ctx); + + return ctx; } uint16_t @@ -591,6 +629,7 @@ rte_eth_dev_count_avail(void) RTE_ETH_FOREACH_DEV(p) count++; + rte_ethdev_trace_count_avail(count); return count; } @@ -602,6 +641,7 @@ rte_eth_dev_count_total(void) RTE_ETH_FOREACH_VALID_DEV(port) count++; + rte_ethdev_trace_count_total(count); return count; } @@ -622,6 +662,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, char *name) * because it might be overwritten by VDEV PMD */ tmp = eth_dev_shared_data->data[port_id].name; strcpy(name, tmp); + rte_ethdev_trace_get_name_by_port(port_id, name); return 0; } @@ -644,6 +685,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) RTE_ETH_FOREACH_VALID_DEV(pid) if (!strcmp(name, eth_dev_shared_data->data[pid].name)) { *port_id = pid; + rte_ethdev_trace_get_port_by_name(name, *port_id); return 0; } @@ -745,7 +787,11 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id) return 0; } - return eth_err(port_id, dev->dev_ops->rx_queue_start(dev, rx_queue_id)); + ret = eth_err(port_id, dev->dev_ops->rx_queue_start(dev, rx_queue_id)); + + rte_ethdev_trace_rx_queue_start(port_id, rx_queue_id, ret); + + return ret; } int @@ -778,7 +824,11 @@ rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id) return 0; } - return eth_err(port_id, dev->dev_ops->rx_queue_stop(dev, rx_queue_id)); + ret = eth_err(port_id, dev->dev_ops->rx_queue_stop(dev, rx_queue_id)); + + rte_ethdev_trace_rx_queue_stop(port_id, rx_queue_id, ret); + + return ret; } int @@ -818,7 +868,11 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id) return 0; } - return eth_err(port_id, dev->dev_ops->tx_queue_start(dev, tx_queue_id)); + ret = eth_err(port_id, dev->dev_ops->tx_queue_start(dev, tx_queue_id)); + + rte_ethdev_trace_tx_queue_start(port_id, tx_queue_id, ret); + + return ret; } int @@ -851,12 +905,17 @@ rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id) return 0; } - return eth_err(port_id, dev->dev_ops->tx_queue_stop(dev, tx_queue_id)); + ret = eth_err(port_id, dev->dev_ops->tx_queue_stop(dev, tx_queue_id)); + + rte_ethdev_trace_tx_queue_stop(port_id, tx_queue_id, ret); + + return ret; } uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex) { + rte_eth_trace_speed_bitflag(speed, duplex); switch (speed) { case RTE_ETH_SPEED_NUM_10M: return duplex ? RTE_ETH_LINK_SPEED_10M : RTE_ETH_LINK_SPEED_10M_HD; @@ -902,6 +961,8 @@ rte_eth_dev_rx_offload_name(uint64_t offload) } } + rte_ethdev_trace_rx_offload_name(offload, name); + return name; } @@ -918,6 +979,8 @@ rte_eth_dev_tx_offload_name(uint64_t offload) } } + rte_ethdev_trace_tx_offload_name(offload, name); + return name; } @@ -934,6 +997,8 @@ rte_eth_dev_capability_name(uint64_t capability) } } + rte_ethdev_trace_capability_name(capability, name); + return name; } @@ -1554,26 +1619,36 @@ int rte_eth_dev_set_link_up(uint16_t port_id) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; if (*dev->dev_ops->dev_set_link_up == NULL) return -ENOTSUP; - return eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev)); + ret = eth_err(port_id, (*dev->dev_ops->dev_set_link_up)(dev)); + + rte_ethdev_trace_set_link_up(port_id, ret); + + return ret; } int rte_eth_dev_set_link_down(uint16_t port_id) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; if (*dev->dev_ops->dev_set_link_down == NULL) return -ENOTSUP; - return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev)); + ret = eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev)); + + rte_ethdev_trace_set_link_down(port_id, ret); + + return ret; } int @@ -1628,9 +1703,12 @@ rte_eth_dev_reset(uint16_t port_id) "Failed to stop device (port %u) before reset: %s - ignore\n", port_id, rte_strerror(-ret)); } - ret = dev->dev_ops->dev_reset(dev); - return eth_err(port_id, ret); + ret = eth_err(port_id, dev->dev_ops->dev_reset(dev)); + + rte_ethdev_trace_reset(port_id, ret); + + return ret; } int @@ -1653,6 +1731,8 @@ rte_eth_dev_is_removed(uint16_t port_id) /* Device is physically removed. */ dev->state = RTE_ETH_DEV_REMOVED; + rte_ethdev_trace_is_removed(port_id, ret); + return ret; } @@ -2151,7 +2231,13 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id, if (ret == 0) dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_HAIRPIN; - return eth_err(port_id, ret); + + ret = eth_err(port_id, ret); + + rte_eth_trace_rx_hairpin_queue_setup(port_id, rx_queue_id, nb_rx_desc, + conf, ret); + + return ret; } int @@ -2340,7 +2426,12 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id, if (ret == 0) dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_HAIRPIN; - return eth_err(port_id, ret); + + ret = eth_err(port_id, ret); + + rte_eth_trace_tx_hairpin_queue_setup(port_id, tx_queue_id, nb_tx_desc, conf, ret); + + return ret; } int @@ -2365,6 +2456,8 @@ rte_eth_hairpin_bind(uint16_t tx_port, uint16_t rx_port) " to Rx %d (%d - all ports)\n", tx_port, rx_port, RTE_MAX_ETHPORTS); + rte_eth_trace_hairpin_bind(tx_port, rx_port, ret); + return ret; } @@ -2390,6 +2483,7 @@ rte_eth_hairpin_unbind(uint16_t tx_port, uint16_t rx_port) " from Rx %d (%d - all ports)\n", tx_port, rx_port, RTE_MAX_ETHPORTS); + rte_eth_trace_hairpin_unbind(tx_port, rx_port, ret); return ret; } @@ -2426,6 +2520,8 @@ rte_eth_hairpin_get_peer_ports(uint16_t port_id, uint16_t *peer_ports, RTE_ETHDEV_LOG(ERR, "Failed to get %d hairpin peer %s ports\n", port_id, direction ? "Rx" : "Tx"); + rte_eth_trace_hairpin_get_peer_ports(port_id, peer_ports, len, direction, ret); + return ret; } @@ -2433,6 +2529,7 @@ void rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent, void *userdata __rte_unused) { + rte_eth_trace_tx_buffer_drop_callback(pkts, unsent); rte_pktmbuf_free_bulk(pkts, unsent); } @@ -2444,6 +2541,7 @@ rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent, rte_pktmbuf_free_bulk(pkts, unsent); *count += unsent; + rte_eth_trace_tx_buffer_count_callback(pkts, unsent, *count); } int @@ -2458,6 +2556,9 @@ rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer, buffer->error_callback = cbfn; buffer->error_userdata = userdata; + + rte_eth_trace_tx_buffer_set_err_callback(buffer); + return 0; } @@ -2477,6 +2578,8 @@ rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size) buffer, rte_eth_tx_buffer_drop_callback, NULL); } + rte_eth_trace_tx_buffer_init(buffer, size, ret); + return ret; } @@ -2495,7 +2598,12 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt) /* Call driver to free pending mbufs. */ ret = (*dev->dev_ops->tx_done_cleanup)(dev->data->tx_queues[queue_id], free_cnt); - return eth_err(port_id, ret); + + ret = eth_err(port_id, ret); + + rte_eth_trace_tx_done_cleanup(port_id, queue_id, free_cnt, ret); + + return ret; } int @@ -2516,7 +2624,11 @@ rte_eth_promiscuous_enable(uint16_t port_id) diag = (*dev->dev_ops->promiscuous_enable)(dev); dev->data->promiscuous = (diag == 0) ? 1 : 0; - return eth_err(port_id, diag); + diag = eth_err(port_id, diag); + + rte_eth_trace_promiscuous_enable(port_id, dev->data->promiscuous, diag); + + return diag; } int @@ -2539,7 +2651,11 @@ rte_eth_promiscuous_disable(uint16_t port_id) if (diag != 0) dev->data->promiscuous = 1; - return eth_err(port_id, diag); + diag = eth_err(port_id, diag); + + rte_eth_trace_promiscuous_disable(port_id, dev->data->promiscuous, diag); + + return diag; } int @@ -2550,6 +2666,8 @@ rte_eth_promiscuous_get(uint16_t port_id) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; + rte_eth_trace_promiscuous_get(port_id, dev->data->promiscuous); + return dev->data->promiscuous; } @@ -2570,7 +2688,11 @@ rte_eth_allmulticast_enable(uint16_t port_id) diag = (*dev->dev_ops->allmulticast_enable)(dev); dev->data->all_multicast = (diag == 0) ? 1 : 0; - return eth_err(port_id, diag); + diag = eth_err(port_id, diag); + + rte_eth_trace_allmulticast_enable(port_id, dev->data->all_multicast, diag); + + return diag; } int @@ -2592,7 +2714,11 @@ rte_eth_allmulticast_disable(uint16_t port_id) if (diag != 0) dev->data->all_multicast = 1; - return eth_err(port_id, diag); + diag = eth_err(port_id, diag); + + rte_eth_trace_allmulticast_disable(port_id, dev->data->all_multicast, diag); + + return diag; } int @@ -2603,6 +2729,8 @@ rte_eth_allmulticast_get(uint16_t port_id) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; + rte_eth_trace_allmulticast_get(port_id, dev->data->all_multicast); + return dev->data->all_multicast; } @@ -2629,6 +2757,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link) *eth_link = dev->data->dev_link; } + rte_eth_trace_link_get(port_id, eth_link); + return 0; } @@ -2655,12 +2785,16 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link) *eth_link = dev->data->dev_link; } + rte_eth_trace_link_get_nowait(port_id, eth_link); + return 0; } const char * rte_eth_link_speed_to_str(uint32_t link_speed) { + rte_eth_trace_link_speed_to_str(link_speed); + switch (link_speed) { case RTE_ETH_SPEED_NUM_NONE: return "None"; case RTE_ETH_SPEED_NUM_10M: return "10 Mbps"; @@ -2700,6 +2834,8 @@ rte_eth_link_to_str(char *str, size_t len, const struct rte_eth_link *eth_link) return -EINVAL; } + rte_eth_trace_link_to_str(len, eth_link); + if (eth_link->link_status == RTE_ETH_LINK_DOWN) return snprintf(str, len, "Link down"); else @@ -2715,6 +2851,7 @@ int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; @@ -2730,7 +2867,12 @@ rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats) if (*dev->dev_ops->stats_get == NULL) return -ENOTSUP; stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; - return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats)); + + ret = eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats)); + + rte_eth_trace_stats_get(port_id, stats, ret); + + return ret; } int @@ -2750,6 +2892,8 @@ rte_eth_stats_reset(uint16_t port_id) dev->data->rx_mbuf_alloc_failed = 0; + rte_eth_trace_stats_reset(port_id); + return 0; } @@ -2833,6 +2977,7 @@ rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name, for (idx_xstat = 0; idx_xstat < cnt_xstats; idx_xstat++) { if (!strcmp(xstats_names[idx_xstat].name, xstat_name)) { *id = idx_xstat; + rte_eth_trace_xstats_get_id_by_name(port_id, xstat_name, *id); return 0; }; } @@ -2986,6 +3131,8 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, return -1; } xstats_names[i] = xstats_names_copy[ids[i]]; + rte_eth_trace_xstats_get_names_by_id(port_id, &xstats_names[i], + ids[i]); } free(xstats_names_copy); @@ -3025,6 +3172,8 @@ rte_eth_xstats_get_names(uint16_t port_id, cnt_used_entries += cnt_driver_entries; } + rte_eth_trace_xstats_get_names(port_id, xstats_names, size, cnt_used_entries); + return cnt_used_entries; } @@ -3174,6 +3323,9 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, } values[i] = xstats[ids[i]].value; } + + rte_eth_trace_xstats_get_by_id(port_id, ids, values, size); + return size; } @@ -3221,6 +3373,9 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, for ( ; i < count + xcount; i++) xstats[i].id += count; + for (i = 0; i < n; i++) + rte_eth_trace_xstats_get(port_id, xstats[i], i); + return count + xcount; } @@ -3229,13 +3384,19 @@ int rte_eth_xstats_reset(uint16_t port_id) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; /* implemented by the driver */ - if (dev->dev_ops->xstats_reset != NULL) - return eth_err(port_id, (*dev->dev_ops->xstats_reset)(dev)); + if (dev->dev_ops->xstats_reset != NULL) { + ret = eth_err(port_id, (*dev->dev_ops->xstats_reset)(dev)); + + rte_eth_trace_xstats_reset(port_id, ret); + + return ret; + } /* fallback to default */ return rte_eth_stats_reset(port_id); @@ -3268,24 +3429,37 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id, uint8_t stat_idx) { - return eth_err(port_id, eth_dev_set_queue_stats_mapping(port_id, + int ret; + + ret = eth_err(port_id, eth_dev_set_queue_stats_mapping(port_id, tx_queue_id, stat_idx, STAT_QMAP_TX)); + + rte_ethdev_trace_set_tx_queue_stats_mapping(port_id, tx_queue_id, stat_idx, ret); + + return ret; } int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id, uint8_t stat_idx) { - return eth_err(port_id, eth_dev_set_queue_stats_mapping(port_id, + int ret; + ret = eth_err(port_id, eth_dev_set_queue_stats_mapping(port_id, rx_queue_id, stat_idx, STAT_QMAP_RX)); + + rte_ethdev_trace_set_rx_queue_stats_mapping(port_id, rx_queue_id, + stat_idx, ret); + + return ret; } int rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; @@ -3299,8 +3473,13 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) if (*dev->dev_ops->fw_version_get == NULL) return -ENOTSUP; - return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev, + + ret = eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size)); + + rte_ethdev_trace_fw_version_get(port_id, fw_version, fw_size, ret); + + return ret; } int diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 96d0650d0c..6340a84c10 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -172,7 +172,7 @@ extern "C" { #include #include -#include "rte_ethdev_trace_fp.h" +#include "rte_ethdev_trace_fp_burst.h" #include "rte_dev_info.h" extern int rte_eth_dev_logtype; diff --git a/lib/ethdev/rte_ethdev_trace.h b/lib/ethdev/rte_ethdev_trace.h index 1491c815c3..bc3b3d2a1b 100644 --- a/lib/ethdev/rte_ethdev_trace.h +++ b/lib/ethdev/rte_ethdev_trace.h @@ -88,6 +88,291 @@ RTE_TRACE_POINT( rte_trace_point_emit_u16(port_id); ) +RTE_TRACE_POINT( + rte_eth_trace_iterator_init, + RTE_TRACE_POINT_ARGS(const char *devargs), + rte_trace_point_emit_string(devargs); +) + +RTE_TRACE_POINT( + rte_eth_trace_iterator_next, + RTE_TRACE_POINT_ARGS(struct rte_dev_iterator *iter, uint16_t id), + rte_trace_point_emit_ptr(iter); + rte_trace_point_emit_string(iter->bus_str); + rte_trace_point_emit_string(iter->cls_str); + rte_trace_point_emit_u16(id); +) + +RTE_TRACE_POINT( + rte_eth_trace_iterator_cleanup, + RTE_TRACE_POINT_ARGS(struct rte_dev_iterator *iter), + rte_trace_point_emit_ptr(iter); + rte_trace_point_emit_string(iter->bus_str); + rte_trace_point_emit_string(iter->cls_str); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_owner_new, + RTE_TRACE_POINT_ARGS(uint64_t owner_id), + rte_trace_point_emit_u64(owner_id); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_owner_set, + RTE_TRACE_POINT_ARGS(const uint16_t port_id, + const struct rte_eth_dev_owner *owner, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u64(owner->id); + rte_trace_point_emit_string(owner->name); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_owner_unset, + RTE_TRACE_POINT_ARGS(const uint16_t port_id, + const uint64_t owner_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u64(owner_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_owner_delete, + RTE_TRACE_POINT_ARGS(const uint64_t owner_id, int ret), + rte_trace_point_emit_u64(owner_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_socket_id, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int socket_id), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(socket_id); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_rx_queue_start, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t rx_queue_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(rx_queue_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_rx_queue_stop, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t rx_queue_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(rx_queue_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_tx_queue_start, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t tx_queue_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(tx_queue_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_tx_queue_stop, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t tx_queue_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(tx_queue_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_eth_trace_speed_bitflag, + RTE_TRACE_POINT_ARGS(uint32_t speed, int duplex), + rte_trace_point_emit_u32(speed); + rte_trace_point_emit_int(duplex); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_rx_offload_name, + RTE_TRACE_POINT_ARGS(uint64_t offload, const char *name), + rte_trace_point_emit_u64(offload); + rte_trace_point_emit_string(name); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_tx_offload_name, + RTE_TRACE_POINT_ARGS(uint64_t offload, const char *name), + rte_trace_point_emit_u64(offload); + rte_trace_point_emit_string(name); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_capability_name, + RTE_TRACE_POINT_ARGS(uint64_t capability, const char *name), + rte_trace_point_emit_u64(capability); + rte_trace_point_emit_string(name); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_set_link_up, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_set_link_down, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_reset, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_eth_trace_rx_hairpin_queue_setup, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t rx_queue_id, + uint16_t nb_rx_desc, const struct rte_eth_hairpin_conf *conf, + int ret), + uint32_t peer_count = conf->peer_count; + uint32_t tx_explicit = conf->tx_explicit; + uint32_t manual_bind = conf->manual_bind; + uint32_t use_locked_device_memory = conf->use_locked_device_memory; + uint32_t use_rte_memory = conf->use_rte_memory; + uint32_t force_memory = conf->force_memory; + + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(rx_queue_id); + rte_trace_point_emit_u16(nb_rx_desc); + rte_trace_point_emit_ptr(conf); + rte_trace_point_emit_u32(peer_count); + rte_trace_point_emit_u32(tx_explicit); + rte_trace_point_emit_u32(manual_bind); + rte_trace_point_emit_u32(use_locked_device_memory); + rte_trace_point_emit_u32(use_rte_memory); + rte_trace_point_emit_u32(force_memory); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_eth_trace_tx_hairpin_queue_setup, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t tx_queue_id, + uint16_t nb_tx_desc, const struct rte_eth_hairpin_conf *conf, + int ret), + uint32_t peer_count = conf->peer_count; + uint32_t tx_explicit = conf->tx_explicit; + uint32_t manual_bind = conf->manual_bind; + uint32_t use_locked_device_memory = conf->use_locked_device_memory; + uint32_t use_rte_memory = conf->use_rte_memory; + uint32_t force_memory = conf->force_memory; + + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(tx_queue_id); + rte_trace_point_emit_u16(nb_tx_desc); + rte_trace_point_emit_ptr(conf); + rte_trace_point_emit_u32(peer_count); + rte_trace_point_emit_u32(tx_explicit); + rte_trace_point_emit_u32(manual_bind); + rte_trace_point_emit_u32(use_locked_device_memory); + rte_trace_point_emit_u32(use_rte_memory); + rte_trace_point_emit_u32(force_memory); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_eth_trace_hairpin_bind, + RTE_TRACE_POINT_ARGS(uint16_t tx_port, uint16_t rx_port, int ret), + rte_trace_point_emit_u16(tx_port); + rte_trace_point_emit_u16(rx_port); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_eth_trace_hairpin_unbind, + RTE_TRACE_POINT_ARGS(uint16_t tx_port, uint16_t rx_port, int ret), + rte_trace_point_emit_u16(tx_port); + rte_trace_point_emit_u16(rx_port); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_eth_trace_tx_buffer_set_err_callback, + RTE_TRACE_POINT_ARGS(struct rte_eth_dev_tx_buffer *buffer), + rte_trace_point_emit_ptr(buffer); + rte_trace_point_emit_ptr(buffer->error_callback); + rte_trace_point_emit_ptr(buffer->error_userdata); +) + +RTE_TRACE_POINT( + rte_eth_trace_promiscuous_enable, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int promiscuous, int diag), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(promiscuous); + rte_trace_point_emit_int(diag); +) + +RTE_TRACE_POINT( + rte_eth_trace_promiscuous_disable, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int promiscuous, int diag), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(promiscuous); + rte_trace_point_emit_int(diag); +) + +RTE_TRACE_POINT( + rte_eth_trace_allmulticast_enable, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int all_multicast, int diag), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(all_multicast); + rte_trace_point_emit_int(diag); +) + +RTE_TRACE_POINT( + rte_eth_trace_allmulticast_disable, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int all_multicast, int diag), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(all_multicast); + rte_trace_point_emit_int(diag); +) + +RTE_TRACE_POINT( + rte_eth_trace_link_speed_to_str, + RTE_TRACE_POINT_ARGS(uint32_t link_speed), + rte_trace_point_emit_u32(link_speed); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_set_rx_queue_stats_mapping, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t rx_queue_id, + uint8_t stat_idx, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(rx_queue_id); + rte_trace_point_emit_u8(stat_idx); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_set_tx_queue_stats_mapping, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t tx_queue_id, + uint8_t stat_idx, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(tx_queue_id); + rte_trace_point_emit_u8(stat_idx); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT( + rte_ethdev_trace_fw_version_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, char *fw_version, size_t fw_size, + int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_string(fw_version); + rte_trace_point_emit_size_t(fw_size); + rte_trace_point_emit_int(ret); +) + #ifdef __cplusplus } #endif diff --git a/lib/ethdev/rte_ethdev_trace_fp.h b/lib/ethdev/rte_ethdev_trace_fp.h index 40084d1929..9f1d3d5a1b 100644 --- a/lib/ethdev/rte_ethdev_trace_fp.h +++ b/lib/ethdev/rte_ethdev_trace_fp.h @@ -17,26 +17,293 @@ extern "C" { #include +#include "rte_ethdev.h" + RTE_TRACE_POINT_FP( - rte_ethdev_trace_rx_burst, + rte_eth_trace_call_rx_callbacks, RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t queue_id, - void **pkt_tbl, uint16_t nb_rx), + struct rte_mbuf **rx_pkts, uint16_t nb_rx, + uint16_t nb_pkts), rte_trace_point_emit_u16(port_id); rte_trace_point_emit_u16(queue_id); - rte_trace_point_emit_ptr(pkt_tbl); + rte_trace_point_emit_ptr(rx_pkts); rte_trace_point_emit_u16(nb_rx); + rte_trace_point_emit_u16(nb_pkts); ) RTE_TRACE_POINT_FP( - rte_ethdev_trace_tx_burst, + rte_eth_trace_call_tx_callbacks, RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t queue_id, - void **pkts_tbl, uint16_t nb_pkts), + struct rte_mbuf **tx_pkts, uint16_t nb_pkts), rte_trace_point_emit_u16(port_id); rte_trace_point_emit_u16(queue_id); - rte_trace_point_emit_ptr(pkts_tbl); + rte_trace_point_emit_ptr(tx_pkts); rte_trace_point_emit_u16(nb_pkts); ) +RTE_TRACE_POINT_FP( + rte_eth_trace_find_next, + RTE_TRACE_POINT_ARGS(uint16_t port_id), + rte_trace_point_emit_u16(port_id); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_find_next_of, + RTE_TRACE_POINT_ARGS(uint16_t port_id), + rte_trace_point_emit_u16(port_id); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_find_next_sibling, + RTE_TRACE_POINT_ARGS(uint16_t port_id_start, uint16_t ref_port_id), + rte_trace_point_emit_u16(port_id_start); + rte_trace_point_emit_u16(ref_port_id); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_is_valid_port, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int is_valid), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(is_valid); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_find_next_owned_by, + RTE_TRACE_POINT_ARGS(uint16_t port_id, + const uint64_t owner_id), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u64(owner_id); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_owner_get, + RTE_TRACE_POINT_ARGS(const uint16_t port_id, + struct rte_eth_dev_owner *owner), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u64(owner->id); + rte_trace_point_emit_string(owner->name); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_get_sec_ctx, + RTE_TRACE_POINT_ARGS(uint16_t port_id, void *ctx), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_ptr(ctx); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_count_avail, + RTE_TRACE_POINT_ARGS(uint16_t count), + rte_trace_point_emit_u16(count); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_count_total, + RTE_TRACE_POINT_ARGS(uint16_t count), + rte_trace_point_emit_u16(count); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_get_name_by_port, + RTE_TRACE_POINT_ARGS(uint16_t port_id, char *name), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_string(name); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_get_port_by_name, + RTE_TRACE_POINT_ARGS(const char *name, uint16_t port_id), + rte_trace_point_emit_string(name); + rte_trace_point_emit_u16(port_id); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_is_removed, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_hairpin_get_peer_ports, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t *peer_ports, + size_t len, uint32_t direction, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_ptr(peer_ports); + rte_trace_point_emit_size_t(len); + rte_trace_point_emit_u32(direction); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_tx_buffer_drop_callback, + RTE_TRACE_POINT_ARGS(struct rte_mbuf **pkts, uint16_t unsent), + rte_trace_point_emit_ptr(pkts); + rte_trace_point_emit_u16(unsent); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_tx_buffer_count_callback, + RTE_TRACE_POINT_ARGS(struct rte_mbuf **pkts, uint16_t unsent, + uint64_t count), + rte_trace_point_emit_ptr(pkts); + rte_trace_point_emit_u16(unsent); + rte_trace_point_emit_u64(count); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_tx_buffer_init, + RTE_TRACE_POINT_ARGS(struct rte_eth_dev_tx_buffer *buffer, uint16_t size, + int ret), + rte_trace_point_emit_ptr(buffer); + rte_trace_point_emit_u16(size); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_tx_done_cleanup, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt, + int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(queue_id); + rte_trace_point_emit_u32(free_cnt); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_promiscuous_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int promiscuous), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(promiscuous); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_allmulticast_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int all_multicast), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(all_multicast); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_link_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, struct rte_eth_link *link), + uint16_t link_duplex = link->link_duplex; + uint16_t link_autoneg = link->link_autoneg; + uint16_t link_status = link->link_status; + + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(link->link_speed); + rte_trace_point_emit_u16(link_duplex); + rte_trace_point_emit_u16(link_autoneg); + rte_trace_point_emit_u16(link_status); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_link_get_nowait, + RTE_TRACE_POINT_ARGS(uint16_t port_id, struct rte_eth_link *link), + uint16_t link_duplex = link->link_duplex; + uint16_t link_autoneg = link->link_autoneg; + uint16_t link_status = link->link_status; + + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(link->link_speed); + rte_trace_point_emit_u16(link_duplex); + rte_trace_point_emit_u16(link_autoneg); + rte_trace_point_emit_u16(link_status); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_link_to_str, + RTE_TRACE_POINT_ARGS(size_t len, const struct rte_eth_link *link), + uint16_t link_duplex = link->link_duplex; + uint16_t link_autoneg = link->link_autoneg; + uint16_t link_status = link->link_status; + + rte_trace_point_emit_size_t(len); + rte_trace_point_emit_u32(link->link_speed); + rte_trace_point_emit_u16(link_duplex); + rte_trace_point_emit_u16(link_autoneg); + rte_trace_point_emit_u16(link_status); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_stats_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, struct rte_eth_stats *stats, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_ptr(stats); + rte_trace_point_emit_u64(stats->rx_nombuf); + rte_trace_point_emit_u64(stats->ipackets); + rte_trace_point_emit_u64(stats->opackets); + rte_trace_point_emit_u64(stats->ibytes); + rte_trace_point_emit_u64(stats->obytes); + rte_trace_point_emit_u64(stats->imissed); + rte_trace_point_emit_u64(stats->ierrors); + rte_trace_point_emit_u64(stats->oerrors); + rte_trace_point_emit_int(ret); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_stats_reset, + RTE_TRACE_POINT_ARGS(uint16_t port_id), + rte_trace_point_emit_u16(port_id); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_xstats_get_id_by_name, + RTE_TRACE_POINT_ARGS(uint16_t port_id, const char *xstat_name, + uint64_t id), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_string(xstat_name); + rte_trace_point_emit_u64(id); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_xstats_get_names_by_id, + RTE_TRACE_POINT_ARGS(uint16_t port_id, + struct rte_eth_xstat_name *xstats_names, uint64_t ids), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_string(xstats_names->name); + rte_trace_point_emit_u64(ids); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_xstats_get_names, + RTE_TRACE_POINT_ARGS(uint16_t port_id, + struct rte_eth_xstat_name *xstats_names, + unsigned int size, int cnt_used_entries), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_string(xstats_names->name); + rte_trace_point_emit_u32(size); + rte_trace_point_emit_int(cnt_used_entries); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_xstats_get_by_id, + RTE_TRACE_POINT_ARGS(uint16_t port_id, const uint64_t *ids, + uint64_t *values, unsigned int size), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_ptr(ids); + rte_trace_point_emit_ptr(values); + rte_trace_point_emit_u32(size); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_xstats_get, + RTE_TRACE_POINT_ARGS(uint16_t port_id, struct rte_eth_xstat xstats, + int i), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u64(xstats.id); + rte_trace_point_emit_u64(xstats.value); + rte_trace_point_emit_u32(i); +) + +RTE_TRACE_POINT_FP( + rte_eth_trace_xstats_reset, + RTE_TRACE_POINT_ARGS(uint16_t port_id, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_int(ret); +) + #ifdef __cplusplus } #endif diff --git a/lib/ethdev/rte_ethdev_trace_fp_burst.h b/lib/ethdev/rte_ethdev_trace_fp_burst.h new file mode 100644 index 0000000000..899b4ed070 --- /dev/null +++ b/lib/ethdev/rte_ethdev_trace_fp_burst.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2022 Marvell International Ltd. + */ + +#ifndef _RTE_ETHDEV_TRACE_FP_BURST_H_ +#define _RTE_ETHDEV_TRACE_FP_BURST_H_ + +/** + * @file + * + * API for ethdev burst trace support + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_rx_burst, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t queue_id, + void **pkt_tbl, uint16_t nb_rx), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(queue_id); + rte_trace_point_emit_ptr(pkt_tbl); + rte_trace_point_emit_u16(nb_rx); +) + +RTE_TRACE_POINT_FP( + rte_ethdev_trace_tx_burst, + RTE_TRACE_POINT_ARGS(uint16_t port_id, uint16_t queue_id, + void **pkts_tbl, uint16_t nb_pkts), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u16(queue_id); + rte_trace_point_emit_ptr(pkts_tbl); + rte_trace_point_emit_u16(nb_pkts); +) + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_ETHDEV_TRACE_FP_BURST_H_ */ diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 17201fbe0f..c7ba2e3dc8 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -298,6 +298,72 @@ EXPERIMENTAL { rte_flow_get_q_aged_flows; rte_mtr_meter_policy_get; rte_mtr_meter_profile_get; + + # added in 23.03 + __rte_eth_trace_allmulticast_disable; + __rte_eth_trace_allmulticast_enable; + __rte_eth_trace_allmulticast_get; + __rte_eth_trace_call_rx_callbacks; + __rte_eth_trace_call_tx_callbacks; + __rte_eth_trace_find_next; + __rte_eth_trace_find_next_of; + __rte_eth_trace_find_next_owned_by; + __rte_eth_trace_find_next_sibling; + __rte_eth_trace_hairpin_bind; + __rte_eth_trace_hairpin_get_peer_ports; + __rte_eth_trace_hairpin_unbind; + __rte_eth_trace_iterator_cleanup; + __rte_eth_trace_iterator_init; + __rte_eth_trace_iterator_next; + __rte_eth_trace_link_get; + __rte_eth_trace_link_get_nowait; + __rte_eth_trace_link_speed_to_str; + __rte_eth_trace_link_to_str; + __rte_eth_trace_promiscuous_disable; + __rte_eth_trace_promiscuous_enable; + __rte_eth_trace_promiscuous_get; + __rte_eth_trace_rx_hairpin_queue_setup; + __rte_eth_trace_speed_bitflag; + __rte_eth_trace_stats_get; + __rte_eth_trace_stats_reset; + __rte_eth_trace_tx_buffer_count_callback; + __rte_eth_trace_tx_buffer_drop_callback; + __rte_eth_trace_tx_buffer_init; + __rte_eth_trace_tx_buffer_set_err_callback; + __rte_eth_trace_tx_done_cleanup; + __rte_eth_trace_tx_hairpin_queue_setup; + __rte_eth_trace_xstats_get; + __rte_eth_trace_xstats_get_by_id; + __rte_eth_trace_xstats_get_id_by_name; + __rte_eth_trace_xstats_get_names; + __rte_eth_trace_xstats_get_names_by_id; + __rte_eth_trace_xstats_reset; + __rte_ethdev_trace_capability_name; + __rte_ethdev_trace_count_avail; + __rte_ethdev_trace_count_total; + __rte_ethdev_trace_fw_version_get; + __rte_ethdev_trace_get_name_by_port; + __rte_ethdev_trace_get_port_by_name; + __rte_ethdev_trace_get_sec_ctx; + __rte_ethdev_trace_is_removed; + __rte_ethdev_trace_is_valid_port; + __rte_ethdev_trace_owner_delete; + __rte_ethdev_trace_owner_get; + __rte_ethdev_trace_owner_new; + __rte_ethdev_trace_owner_set; + __rte_ethdev_trace_owner_unset; + __rte_ethdev_trace_reset; + __rte_ethdev_trace_rx_offload_name; + __rte_ethdev_trace_rx_queue_start; + __rte_ethdev_trace_rx_queue_stop; + __rte_ethdev_trace_set_link_down; + __rte_ethdev_trace_set_link_up; + __rte_ethdev_trace_set_rx_queue_stats_mapping; + __rte_ethdev_trace_set_tx_queue_stats_mapping; + __rte_ethdev_trace_socket_id; + __rte_ethdev_trace_tx_offload_name; + __rte_ethdev_trace_tx_queue_start; + __rte_ethdev_trace_tx_queue_stop; }; INTERNAL { -- 2.25.1