1 // SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
2 /* Copyright (c) 2019 Intel Corporation */
3 #define CREATE_TRACE_POINTS
4 #include "trace.h"
5
print_ip_addr(struct trace_seq * p,u32 * addr,u16 port,bool ipv4)6 const char *print_ip_addr(struct trace_seq *p, u32 *addr, u16 port, bool ipv4)
7 {
8 const char *ret = trace_seq_buffer_ptr(p);
9
10 if (ipv4) {
11 __be32 myaddr = htonl(*addr);
12
13 trace_seq_printf(p, "%pI4:%d", &myaddr, htons(port));
14 } else {
15 trace_seq_printf(p, "%pI6:%d", addr, htons(port));
16 }
17 trace_seq_putc(p, 0);
18
19 return ret;
20 }
21
parse_iw_event_type(enum iw_cm_event_type iw_type)22 const char *parse_iw_event_type(enum iw_cm_event_type iw_type)
23 {
24 switch (iw_type) {
25 case IW_CM_EVENT_CONNECT_REQUEST:
26 return "IwRequest";
27 case IW_CM_EVENT_CONNECT_REPLY:
28 return "IwReply";
29 case IW_CM_EVENT_ESTABLISHED:
30 return "IwEstablished";
31 case IW_CM_EVENT_DISCONNECT:
32 return "IwDisconnect";
33 case IW_CM_EVENT_CLOSE:
34 return "IwClose";
35 }
36
37 return "Unknown";
38 }
39
parse_cm_event_type(enum irdma_cm_event_type cm_type)40 const char *parse_cm_event_type(enum irdma_cm_event_type cm_type)
41 {
42 switch (cm_type) {
43 case IRDMA_CM_EVENT_ESTABLISHED:
44 return "CmEstablished";
45 case IRDMA_CM_EVENT_MPA_REQ:
46 return "CmMPA_REQ";
47 case IRDMA_CM_EVENT_MPA_CONNECT:
48 return "CmMPA_CONNECT";
49 case IRDMA_CM_EVENT_MPA_ACCEPT:
50 return "CmMPA_ACCEPT";
51 case IRDMA_CM_EVENT_MPA_REJECT:
52 return "CmMPA_REJECT";
53 case IRDMA_CM_EVENT_MPA_ESTABLISHED:
54 return "CmMPA_ESTABLISHED";
55 case IRDMA_CM_EVENT_CONNECTED:
56 return "CmConnected";
57 case IRDMA_CM_EVENT_RESET:
58 return "CmReset";
59 case IRDMA_CM_EVENT_ABORTED:
60 return "CmAborted";
61 case IRDMA_CM_EVENT_UNKNOWN:
62 return "none";
63 }
64 return "Unknown";
65 }
66
parse_cm_state(enum irdma_cm_node_state state)67 const char *parse_cm_state(enum irdma_cm_node_state state)
68 {
69 switch (state) {
70 case IRDMA_CM_STATE_UNKNOWN:
71 return "UNKNOWN";
72 case IRDMA_CM_STATE_INITED:
73 return "INITED";
74 case IRDMA_CM_STATE_LISTENING:
75 return "LISTENING";
76 case IRDMA_CM_STATE_SYN_RCVD:
77 return "SYN_RCVD";
78 case IRDMA_CM_STATE_SYN_SENT:
79 return "SYN_SENT";
80 case IRDMA_CM_STATE_ONE_SIDE_ESTABLISHED:
81 return "ONE_SIDE_ESTABLISHED";
82 case IRDMA_CM_STATE_ESTABLISHED:
83 return "ESTABLISHED";
84 case IRDMA_CM_STATE_ACCEPTING:
85 return "ACCEPTING";
86 case IRDMA_CM_STATE_MPAREQ_SENT:
87 return "MPAREQ_SENT";
88 case IRDMA_CM_STATE_MPAREQ_RCVD:
89 return "MPAREQ_RCVD";
90 case IRDMA_CM_STATE_MPAREJ_RCVD:
91 return "MPAREJ_RECVD";
92 case IRDMA_CM_STATE_OFFLOADED:
93 return "OFFLOADED";
94 case IRDMA_CM_STATE_FIN_WAIT1:
95 return "FIN_WAIT1";
96 case IRDMA_CM_STATE_FIN_WAIT2:
97 return "FIN_WAIT2";
98 case IRDMA_CM_STATE_CLOSE_WAIT:
99 return "CLOSE_WAIT";
100 case IRDMA_CM_STATE_TIME_WAIT:
101 return "TIME_WAIT";
102 case IRDMA_CM_STATE_LAST_ACK:
103 return "LAST_ACK";
104 case IRDMA_CM_STATE_CLOSING:
105 return "CLOSING";
106 case IRDMA_CM_STATE_LISTENER_DESTROYED:
107 return "LISTENER_DESTROYED";
108 case IRDMA_CM_STATE_CLOSED:
109 return "CLOSED";
110 }
111 return ("Bad state");
112 }
113