Commit b54a134a authored by David Howells's avatar David Howells

rxrpc: Fix handling of enums-to-string translation in tracing

Fix the way enum values are translated into strings in AF_RXRPC
tracepoints.  The problem with just doing a lookup in a normal flat array
of strings or chars is that external tracing infrastructure can't find it.
Rather, TRACE_DEFINE_ENUM must be used.

Also sort the enums and string tables to make it easier to keep them in
order so that a future patch to __print_symbolic() can be optimised to try
a direct lookup into the table first before iterating over it.

A couple of _proto() macro calls are removed because they refered to tables
that got moved to the tracing infrastructure.  The relevant data can be
found by way of tracing.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 57ea884b
This diff is collapsed.
...@@ -593,200 +593,6 @@ struct rxrpc_ack_summary { ...@@ -593,200 +593,6 @@ struct rxrpc_ack_summary {
u8 cumulative_acks; u8 cumulative_acks;
}; };
enum rxrpc_skb_trace {
rxrpc_skb_rx_cleaned,
rxrpc_skb_rx_freed,
rxrpc_skb_rx_got,
rxrpc_skb_rx_lost,
rxrpc_skb_rx_received,
rxrpc_skb_rx_rotated,
rxrpc_skb_rx_purged,
rxrpc_skb_rx_seen,
rxrpc_skb_tx_cleaned,
rxrpc_skb_tx_freed,
rxrpc_skb_tx_got,
rxrpc_skb_tx_new,
rxrpc_skb_tx_rotated,
rxrpc_skb_tx_seen,
rxrpc_skb__nr_trace
};
extern const char rxrpc_skb_traces[rxrpc_skb__nr_trace][7];
enum rxrpc_conn_trace {
rxrpc_conn_new_client,
rxrpc_conn_new_service,
rxrpc_conn_queued,
rxrpc_conn_seen,
rxrpc_conn_got,
rxrpc_conn_put_client,
rxrpc_conn_put_service,
rxrpc_conn__nr_trace
};
extern const char rxrpc_conn_traces[rxrpc_conn__nr_trace][4];
enum rxrpc_client_trace {
rxrpc_client_activate_chans,
rxrpc_client_alloc,
rxrpc_client_chan_activate,
rxrpc_client_chan_disconnect,
rxrpc_client_chan_pass,
rxrpc_client_chan_unstarted,
rxrpc_client_cleanup,
rxrpc_client_count,
rxrpc_client_discard,
rxrpc_client_duplicate,
rxrpc_client_exposed,
rxrpc_client_replace,
rxrpc_client_to_active,
rxrpc_client_to_culled,
rxrpc_client_to_idle,
rxrpc_client_to_inactive,
rxrpc_client_to_waiting,
rxrpc_client_uncount,
rxrpc_client__nr_trace
};
extern const char rxrpc_client_traces[rxrpc_client__nr_trace][7];
extern const char rxrpc_conn_cache_states[RXRPC_CONN__NR_CACHE_STATES][5];
enum rxrpc_call_trace {
rxrpc_call_new_client,
rxrpc_call_new_service,
rxrpc_call_queued,
rxrpc_call_queued_ref,
rxrpc_call_seen,
rxrpc_call_connected,
rxrpc_call_release,
rxrpc_call_got,
rxrpc_call_got_userid,
rxrpc_call_got_kernel,
rxrpc_call_put,
rxrpc_call_put_userid,
rxrpc_call_put_kernel,
rxrpc_call_put_noqueue,
rxrpc_call_error,
rxrpc_call__nr_trace
};
extern const char rxrpc_call_traces[rxrpc_call__nr_trace][4];
enum rxrpc_transmit_trace {
rxrpc_transmit_wait,
rxrpc_transmit_queue,
rxrpc_transmit_queue_last,
rxrpc_transmit_rotate,
rxrpc_transmit_rotate_last,
rxrpc_transmit_await_reply,
rxrpc_transmit_end,
rxrpc_transmit__nr_trace
};
extern const char rxrpc_transmit_traces[rxrpc_transmit__nr_trace][4];
enum rxrpc_receive_trace {
rxrpc_receive_incoming,
rxrpc_receive_queue,
rxrpc_receive_queue_last,
rxrpc_receive_front,
rxrpc_receive_rotate,
rxrpc_receive_end,
rxrpc_receive__nr_trace
};
extern const char rxrpc_receive_traces[rxrpc_receive__nr_trace][4];
enum rxrpc_recvmsg_trace {
rxrpc_recvmsg_enter,
rxrpc_recvmsg_wait,
rxrpc_recvmsg_dequeue,
rxrpc_recvmsg_hole,
rxrpc_recvmsg_next,
rxrpc_recvmsg_cont,
rxrpc_recvmsg_full,
rxrpc_recvmsg_data_return,
rxrpc_recvmsg_terminal,
rxrpc_recvmsg_to_be_accepted,
rxrpc_recvmsg_return,
rxrpc_recvmsg__nr_trace
};
extern const char rxrpc_recvmsg_traces[rxrpc_recvmsg__nr_trace][5];
enum rxrpc_rtt_tx_trace {
rxrpc_rtt_tx_ping,
rxrpc_rtt_tx_data,
rxrpc_rtt_tx__nr_trace
};
extern const char rxrpc_rtt_tx_traces[rxrpc_rtt_tx__nr_trace][5];
enum rxrpc_rtt_rx_trace {
rxrpc_rtt_rx_ping_response,
rxrpc_rtt_rx_requested_ack,
rxrpc_rtt_rx__nr_trace
};
extern const char rxrpc_rtt_rx_traces[rxrpc_rtt_rx__nr_trace][5];
enum rxrpc_timer_trace {
rxrpc_timer_begin,
rxrpc_timer_init_for_reply,
rxrpc_timer_init_for_send_reply,
rxrpc_timer_expired,
rxrpc_timer_set_for_ack,
rxrpc_timer_set_for_ping,
rxrpc_timer_set_for_resend,
rxrpc_timer_set_for_send,
rxrpc_timer__nr_trace
};
extern const char rxrpc_timer_traces[rxrpc_timer__nr_trace][8];
enum rxrpc_propose_ack_trace {
rxrpc_propose_ack_client_tx_end,
rxrpc_propose_ack_input_data,
rxrpc_propose_ack_ping_for_lost_ack,
rxrpc_propose_ack_ping_for_lost_reply,
rxrpc_propose_ack_ping_for_params,
rxrpc_propose_ack_processing_op,
rxrpc_propose_ack_respond_to_ack,
rxrpc_propose_ack_respond_to_ping,
rxrpc_propose_ack_retry_tx,
rxrpc_propose_ack_rotate_rx,
rxrpc_propose_ack_terminal_ack,
rxrpc_propose_ack__nr_trace
};
enum rxrpc_propose_ack_outcome {
rxrpc_propose_ack_use,
rxrpc_propose_ack_update,
rxrpc_propose_ack_subsume,
rxrpc_propose_ack__nr_outcomes
};
extern const char rxrpc_propose_ack_traces[rxrpc_propose_ack__nr_trace][8];
extern const char *const rxrpc_propose_ack_outcomes[rxrpc_propose_ack__nr_outcomes];
enum rxrpc_congest_change {
rxrpc_cong_begin_retransmission,
rxrpc_cong_cleared_nacks,
rxrpc_cong_new_low_nack,
rxrpc_cong_no_change,
rxrpc_cong_progress,
rxrpc_cong_retransmit_again,
rxrpc_cong_rtt_window_end,
rxrpc_cong_saw_nack,
rxrpc_congest__nr_change
};
extern const char rxrpc_congest_modes[NR__RXRPC_CONGEST_MODES][10];
extern const char rxrpc_congest_changes[rxrpc_congest__nr_change][9];
extern const char *const rxrpc_pkts[];
extern const char rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4];
#include <trace/events/rxrpc.h> #include <trace/events/rxrpc.h>
/* /*
......
...@@ -43,24 +43,6 @@ const char *const rxrpc_call_completions[NR__RXRPC_CALL_COMPLETIONS] = { ...@@ -43,24 +43,6 @@ const char *const rxrpc_call_completions[NR__RXRPC_CALL_COMPLETIONS] = {
[RXRPC_CALL_NETWORK_ERROR] = "NetError", [RXRPC_CALL_NETWORK_ERROR] = "NetError",
}; };
const char rxrpc_call_traces[rxrpc_call__nr_trace][4] = {
[rxrpc_call_new_client] = "NWc",
[rxrpc_call_new_service] = "NWs",
[rxrpc_call_queued] = "QUE",
[rxrpc_call_queued_ref] = "QUR",
[rxrpc_call_connected] = "CON",
[rxrpc_call_release] = "RLS",
[rxrpc_call_seen] = "SEE",
[rxrpc_call_got] = "GOT",
[rxrpc_call_got_userid] = "Gus",
[rxrpc_call_got_kernel] = "Gke",
[rxrpc_call_put] = "PUT",
[rxrpc_call_put_userid] = "Pus",
[rxrpc_call_put_kernel] = "Pke",
[rxrpc_call_put_noqueue] = "PNQ",
[rxrpc_call_error] = "*E*",
};
struct kmem_cache *rxrpc_call_jar; struct kmem_cache *rxrpc_call_jar;
LIST_HEAD(rxrpc_calls); LIST_HEAD(rxrpc_calls);
DEFINE_RWLOCK(rxrpc_call_lock); DEFINE_RWLOCK(rxrpc_call_lock);
......
...@@ -105,14 +105,6 @@ static void rxrpc_discard_expired_client_conns(struct work_struct *); ...@@ -105,14 +105,6 @@ static void rxrpc_discard_expired_client_conns(struct work_struct *);
static DECLARE_DELAYED_WORK(rxrpc_client_conn_reap, static DECLARE_DELAYED_WORK(rxrpc_client_conn_reap,
rxrpc_discard_expired_client_conns); rxrpc_discard_expired_client_conns);
const char rxrpc_conn_cache_states[RXRPC_CONN__NR_CACHE_STATES][5] = {
[RXRPC_CONN_CLIENT_INACTIVE] = "Inac",
[RXRPC_CONN_CLIENT_WAITING] = "Wait",
[RXRPC_CONN_CLIENT_ACTIVE] = "Actv",
[RXRPC_CONN_CLIENT_CULLED] = "Cull",
[RXRPC_CONN_CLIENT_IDLE] = "Idle",
};
/* /*
* Get a connection ID and epoch for a client connection from the global pool. * Get a connection ID and epoch for a client connection from the global pool.
* The connection struct pointer is then recorded in the idr radix tree. The * The connection struct pointer is then recorded in the idr radix tree. The
......
...@@ -767,15 +767,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb, ...@@ -767,15 +767,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
trace_rxrpc_rx_ack(call, first_soft_ack, summary.ack_reason, nr_acks); trace_rxrpc_rx_ack(call, first_soft_ack, summary.ack_reason, nr_acks);
_proto("Rx ACK %%%u { m=%hu f=#%u p=#%u s=%%%u r=%s n=%u }",
sp->hdr.serial,
ntohs(buf.ack.maxSkew),
first_soft_ack,
ntohl(buf.ack.previousPacket),
acked_serial,
rxrpc_ack_names[summary.ack_reason],
buf.ack.nAcks);
if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE) if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE)
rxrpc_input_ping_response(call, skb->tstamp, acked_serial, rxrpc_input_ping_response(call, skb->tstamp, acked_serial,
sp->hdr.serial); sp->hdr.serial);
...@@ -931,7 +922,6 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call, ...@@ -931,7 +922,6 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
break; break;
default: default:
_proto("Rx %s %%%u", rxrpc_pkts[sp->hdr.type], sp->hdr.serial);
break; break;
} }
......
...@@ -77,12 +77,6 @@ unsigned int rxrpc_rx_jumbo_max = 4; ...@@ -77,12 +77,6 @@ unsigned int rxrpc_rx_jumbo_max = 4;
*/ */
unsigned int rxrpc_resend_timeout = 4 * 1000; unsigned int rxrpc_resend_timeout = 4 * 1000;
const char *const rxrpc_pkts[] = {
"?00",
"DATA", "ACK", "BUSY", "ABORT", "ACKALL", "CHALL", "RESP", "DEBUG",
"?09", "?10", "?11", "?12", "VERSION", "?14", "?15"
};
const s8 rxrpc_ack_priority[] = { const s8 rxrpc_ack_priority[] = {
[0] = 0, [0] = 0,
[RXRPC_ACK_DELAY] = 1, [RXRPC_ACK_DELAY] = 1,
...@@ -94,148 +88,3 @@ const s8 rxrpc_ack_priority[] = { ...@@ -94,148 +88,3 @@ const s8 rxrpc_ack_priority[] = {
[RXRPC_ACK_NOSPACE] = 7, [RXRPC_ACK_NOSPACE] = 7,
[RXRPC_ACK_PING_RESPONSE] = 8, [RXRPC_ACK_PING_RESPONSE] = 8,
}; };
const char rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4] = {
"---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY",
"IDL", "-?-"
};
const char rxrpc_skb_traces[rxrpc_skb__nr_trace][7] = {
[rxrpc_skb_rx_cleaned] = "Rx CLN",
[rxrpc_skb_rx_freed] = "Rx FRE",
[rxrpc_skb_rx_got] = "Rx GOT",
[rxrpc_skb_rx_lost] = "Rx *L*",
[rxrpc_skb_rx_received] = "Rx RCV",
[rxrpc_skb_rx_purged] = "Rx PUR",
[rxrpc_skb_rx_rotated] = "Rx ROT",
[rxrpc_skb_rx_seen] = "Rx SEE",
[rxrpc_skb_tx_cleaned] = "Tx CLN",
[rxrpc_skb_tx_freed] = "Tx FRE",
[rxrpc_skb_tx_got] = "Tx GOT",
[rxrpc_skb_tx_new] = "Tx NEW",
[rxrpc_skb_tx_rotated] = "Tx ROT",
[rxrpc_skb_tx_seen] = "Tx SEE",
};
const char rxrpc_conn_traces[rxrpc_conn__nr_trace][4] = {
[rxrpc_conn_new_client] = "NWc",
[rxrpc_conn_new_service] = "NWs",
[rxrpc_conn_queued] = "QUE",
[rxrpc_conn_seen] = "SEE",
[rxrpc_conn_got] = "GOT",
[rxrpc_conn_put_client] = "PTc",
[rxrpc_conn_put_service] = "PTs",
};
const char rxrpc_client_traces[rxrpc_client__nr_trace][7] = {
[rxrpc_client_activate_chans] = "Activa",
[rxrpc_client_alloc] = "Alloc ",
[rxrpc_client_chan_activate] = "ChActv",
[rxrpc_client_chan_disconnect] = "ChDisc",
[rxrpc_client_chan_pass] = "ChPass",
[rxrpc_client_chan_unstarted] = "ChUnst",
[rxrpc_client_cleanup] = "Clean ",
[rxrpc_client_count] = "Count ",
[rxrpc_client_discard] = "Discar",
[rxrpc_client_duplicate] = "Duplic",
[rxrpc_client_exposed] = "Expose",
[rxrpc_client_replace] = "Replac",
[rxrpc_client_to_active] = "->Actv",
[rxrpc_client_to_culled] = "->Cull",
[rxrpc_client_to_idle] = "->Idle",
[rxrpc_client_to_inactive] = "->Inac",
[rxrpc_client_to_waiting] = "->Wait",
[rxrpc_client_uncount] = "Uncoun",
};
const char rxrpc_transmit_traces[rxrpc_transmit__nr_trace][4] = {
[rxrpc_transmit_wait] = "WAI",
[rxrpc_transmit_queue] = "QUE",
[rxrpc_transmit_queue_last] = "QLS",
[rxrpc_transmit_rotate] = "ROT",
[rxrpc_transmit_rotate_last] = "RLS",
[rxrpc_transmit_await_reply] = "AWR",
[rxrpc_transmit_end] = "END",
};
const char rxrpc_receive_traces[rxrpc_receive__nr_trace][4] = {
[rxrpc_receive_incoming] = "INC",
[rxrpc_receive_queue] = "QUE",
[rxrpc_receive_queue_last] = "QLS",
[rxrpc_receive_front] = "FRN",
[rxrpc_receive_rotate] = "ROT",
[rxrpc_receive_end] = "END",
};
const char rxrpc_recvmsg_traces[rxrpc_recvmsg__nr_trace][5] = {
[rxrpc_recvmsg_enter] = "ENTR",
[rxrpc_recvmsg_wait] = "WAIT",
[rxrpc_recvmsg_dequeue] = "DEQU",
[rxrpc_recvmsg_hole] = "HOLE",
[rxrpc_recvmsg_next] = "NEXT",
[rxrpc_recvmsg_cont] = "CONT",
[rxrpc_recvmsg_full] = "FULL",
[rxrpc_recvmsg_data_return] = "DATA",
[rxrpc_recvmsg_terminal] = "TERM",
[rxrpc_recvmsg_to_be_accepted] = "TBAC",
[rxrpc_recvmsg_return] = "RETN",
};
const char rxrpc_rtt_tx_traces[rxrpc_rtt_tx__nr_trace][5] = {
[rxrpc_rtt_tx_ping] = "PING",
[rxrpc_rtt_tx_data] = "DATA",
};
const char rxrpc_rtt_rx_traces[rxrpc_rtt_rx__nr_trace][5] = {
[rxrpc_rtt_rx_ping_response] = "PONG",
[rxrpc_rtt_rx_requested_ack] = "RACK",
};
const char rxrpc_timer_traces[rxrpc_timer__nr_trace][8] = {
[rxrpc_timer_begin] = "Begin ",
[rxrpc_timer_expired] = "*EXPR*",
[rxrpc_timer_init_for_reply] = "IniRpl",
[rxrpc_timer_init_for_send_reply] = "SndRpl",
[rxrpc_timer_set_for_ack] = "SetAck",
[rxrpc_timer_set_for_ping] = "SetPng",
[rxrpc_timer_set_for_send] = "SetTx ",
[rxrpc_timer_set_for_resend] = "SetRTx",
};
const char rxrpc_propose_ack_traces[rxrpc_propose_ack__nr_trace][8] = {
[rxrpc_propose_ack_client_tx_end] = "ClTxEnd",
[rxrpc_propose_ack_input_data] = "DataIn ",
[rxrpc_propose_ack_ping_for_lost_ack] = "LostAck",
[rxrpc_propose_ack_ping_for_lost_reply] = "LostRpl",
[rxrpc_propose_ack_ping_for_params] = "Params ",
[rxrpc_propose_ack_processing_op] = "ProcOp ",
[rxrpc_propose_ack_respond_to_ack] = "Rsp2Ack",
[rxrpc_propose_ack_respond_to_ping] = "Rsp2Png",
[rxrpc_propose_ack_retry_tx] = "RetryTx",
[rxrpc_propose_ack_rotate_rx] = "RxAck ",
[rxrpc_propose_ack_terminal_ack] = "ClTerm ",
};
const char *const rxrpc_propose_ack_outcomes[rxrpc_propose_ack__nr_outcomes] = {
[rxrpc_propose_ack_use] = "",
[rxrpc_propose_ack_update] = " Update",
[rxrpc_propose_ack_subsume] = " Subsume",
};
const char rxrpc_congest_modes[NR__RXRPC_CONGEST_MODES][10] = {
[RXRPC_CALL_SLOW_START] = "SlowStart",
[RXRPC_CALL_CONGEST_AVOIDANCE] = "CongAvoid",
[RXRPC_CALL_PACKET_LOSS] = "PktLoss ",
[RXRPC_CALL_FAST_RETRANSMIT] = "FastReTx ",
};
const char rxrpc_congest_changes[rxrpc_congest__nr_change][9] = {
[rxrpc_cong_begin_retransmission] = " Retrans",
[rxrpc_cong_cleared_nacks] = " Cleared",
[rxrpc_cong_new_low_nack] = " NewLowN",
[rxrpc_cong_no_change] = "",
[rxrpc_cong_progress] = " Progres",
[rxrpc_cong_retransmit_again] = " ReTxAgn",
[rxrpc_cong_rtt_window_end] = " RttWinE",
[rxrpc_cong_saw_nack] = " SawNack",
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment