summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/irdma/trace.c
blob: fc2f566977419430ed9ab4101cef5a9e6d49cd35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2019 Intel Corporation */
#define CREATE_TRACE_POINTS
#include "trace.h"

const char *print_ip_addr(struct trace_seq *p, u32 *addr, u16 port, bool ipv4)
{
	const char *ret = trace_seq_buffer_ptr(p);

	if (ipv4) {
		__be32 myaddr = htonl(*addr);

		trace_seq_printf(p, "%pI4:%d", &myaddr, htons(port));
	} else {
		trace_seq_printf(p, "%pI6:%d", addr, htons(port));
	}
	trace_seq_putc(p, 0);

	return ret;
}

const char *parse_iw_event_type(enum iw_cm_event_type iw_type)
{
	switch (iw_type) {
	case IW_CM_EVENT_CONNECT_REQUEST:
		return "IwRequest";
	case IW_CM_EVENT_CONNECT_REPLY:
		return "IwReply";
	case IW_CM_EVENT_ESTABLISHED:
		return "IwEstablished";
	case IW_CM_EVENT_DISCONNECT:
		return "IwDisconnect";
	case IW_CM_EVENT_CLOSE:
		return "IwClose";
	}

	return "Unknown";
}

const char *parse_cm_event_type(enum irdma_cm_event_type cm_type)
{
	switch (cm_type) {
	case IRDMA_CM_EVENT_ESTABLISHED:
		return "CmEstablished";
	case IRDMA_CM_EVENT_MPA_REQ:
		return "CmMPA_REQ";
	case IRDMA_CM_EVENT_MPA_CONNECT:
		return "CmMPA_CONNECT";
	case IRDMA_CM_EVENT_MPA_ACCEPT:
		return "CmMPA_ACCEPT";
	case IRDMA_CM_EVENT_MPA_REJECT:
		return "CmMPA_REJECT";
	case IRDMA_CM_EVENT_MPA_ESTABLISHED:
		return "CmMPA_ESTABLISHED";
	case IRDMA_CM_EVENT_CONNECTED:
		return "CmConnected";
	case IRDMA_CM_EVENT_RESET:
		return "CmReset";
	case IRDMA_CM_EVENT_ABORTED:
		return "CmAborted";
	case IRDMA_CM_EVENT_UNKNOWN:
		return "none";
	}
	return "Unknown";
}

const char *parse_cm_state(enum irdma_cm_node_state state)
{
	switch (state) {
	case IRDMA_CM_STATE_UNKNOWN:
		return "UNKNOWN";
	case IRDMA_CM_STATE_INITED:
		return "INITED";
	case IRDMA_CM_STATE_LISTENING:
		return "LISTENING";
	case IRDMA_CM_STATE_SYN_RCVD:
		return "SYN_RCVD";
	case IRDMA_CM_STATE_SYN_SENT:
		return "SYN_SENT";
	case IRDMA_CM_STATE_ONE_SIDE_ESTABLISHED:
		return "ONE_SIDE_ESTABLISHED";
	case IRDMA_CM_STATE_ESTABLISHED:
		return "ESTABLISHED";
	case IRDMA_CM_STATE_ACCEPTING:
		return "ACCEPTING";
	case IRDMA_CM_STATE_MPAREQ_SENT:
		return "MPAREQ_SENT";
	case IRDMA_CM_STATE_MPAREQ_RCVD:
		return "MPAREQ_RCVD";
	case IRDMA_CM_STATE_MPAREJ_RCVD:
		return "MPAREJ_RECVD";
	case IRDMA_CM_STATE_OFFLOADED:
		return "OFFLOADED";
	case IRDMA_CM_STATE_FIN_WAIT1:
		return "FIN_WAIT1";
	case IRDMA_CM_STATE_FIN_WAIT2:
		return "FIN_WAIT2";
	case IRDMA_CM_STATE_CLOSE_WAIT:
		return "CLOSE_WAIT";
	case IRDMA_CM_STATE_TIME_WAIT:
		return "TIME_WAIT";
	case IRDMA_CM_STATE_LAST_ACK:
		return "LAST_ACK";
	case IRDMA_CM_STATE_CLOSING:
		return "CLOSING";
	case IRDMA_CM_STATE_LISTENER_DESTROYED:
		return "LISTENER_DESTROYED";
	case IRDMA_CM_STATE_CLOSED:
		return "CLOSED";
	}
	return ("Bad state");
}