From 8758ab4e1fc39e6fe83bb7bbc53e7dd4e2bca0a2 Mon Sep 17 00:00:00 2001 From: Tao Date: Mon, 18 Sep 2023 09:41:00 +0000 Subject: [PATCH] compress stop msg handling to stop graphtrace --- src/dp_port.c | 2 +- src/monitoring/dp_graphtrace.c | 32 ++++++++++++-------------------- tools/dp_graphtrace.c | 2 -- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/dp_port.c b/src/dp_port.c index 12e58f9d1..2aea08046 100644 --- a/src/dp_port.c +++ b/src/dp_port.c @@ -464,7 +464,7 @@ static int dp_vf_init_monitoring_rule_rollback(uint32_t port_id) DP_LOG_PORTID(port->port_id)); return DP_ERROR; } - + return DP_OK; } diff --git a/src/monitoring/dp_graphtrace.c b/src/monitoring/dp_graphtrace.c index 8febcfa22..55db17e9d 100644 --- a/src/monitoring/dp_graphtrace.c +++ b/src/monitoring/dp_graphtrace.c @@ -86,30 +86,22 @@ static int dp_handle_graphtrace_start(const struct dp_graphtrace_mp_request *req } -static int dp_handle_graphtrace_stop(const struct dp_graphtrace_mp_request *request) +static int dp_handle_graphtrace_stop() { int ret; - switch (request->action_params.op_type) { - case DP_GRAPHTRACE_OP_TYPE_SOFTWARE: - dp_graphtrace_disable(); - DPS_LOG_INFO("Graphtrace disabled only for software path"); - return DP_OK; - case DP_GRAPHTRACE_OP_TYPE_OFFLOAD: - if (_dp_graphtrace_hw_enabled) { - dp_graphtrace_disable(); - ret = dp_send_event_hardware_capture_stop_msg(); - if (DP_FAILED(ret)) { - DPS_LOG_ERR("Cannot send hardware capture stop message"); - return ret; - } - dp_graphtrace_set_hw_enabled(false); - DPS_LOG_INFO("Graphtrace disabled for software and offload paths"); - return DP_OK; - } else { - return -EPERM; + dp_graphtrace_disable(); + if (_dp_graphtrace_hw_enabled) { + ret = dp_send_event_hardware_capture_stop_msg(); + if (DP_FAILED(dp_send_event_hardware_capture_stop_msg())) { + DPS_LOG_ERR("Cannot send hardware capture stop message"); + return ret; } + dp_graphtrace_set_hw_enabled(false); + DPS_LOG_INFO("Graphtrace reconfigured to stop hw capturing"); } + DPS_LOG_INFO("Graphtrace disabled"); + return DP_OK; } static __rte_always_inline @@ -130,7 +122,7 @@ void dp_handle_graphtrace_request(const struct rte_mp_msg *mp_msg, struct dp_gra reply->error_code = ret; return; case DP_GRAPHTRACE_ACTION_STOP: - ret = dp_handle_graphtrace_stop(request); + ret = dp_handle_graphtrace_stop(); reply->error_code = ret; return; default: diff --git a/tools/dp_graphtrace.c b/tools/dp_graphtrace.c index a4961f2fc..31924b414 100644 --- a/tools/dp_graphtrace.c +++ b/tools/dp_graphtrace.c @@ -99,7 +99,6 @@ static void dp_graphtrace_config_start_stop_parameters(struct dp_graphtrace_mp_r graphtrace_request->action_params.op_type = DP_GRAPHTRACE_OP_TYPE_SOFTWARE; } - static int dp_graphtrace_send_request(enum dp_graphtrace_action action, struct dp_graphtrace_mp_reply *reply) { struct rte_mp_msg mp_request; @@ -119,7 +118,6 @@ static int dp_graphtrace_send_request(enum dp_graphtrace_action action, struct d dp_graphtrace_config_start_stop_parameters(graphtrace_request); break; case DP_GRAPHTRACE_ACTION_STOP: - dp_graphtrace_config_start_stop_parameters(graphtrace_request); break; }