Skip to content

Commit

Permalink
compress stop msg handling to stop graphtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
byteocean committed Sep 18, 2023
1 parent 756d725 commit 8758ab4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/dp_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
32 changes: 12 additions & 20 deletions src/monitoring/dp_graphtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions tools/dp_graphtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 8758ab4

Please sign in to comment.