aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/Kconfig12
-rw-r--r--net/tipc/core.h22
-rw-r--r--net/tipc/link.c36
-rw-r--r--net/tipc/msg.c242
4 files changed, 0 insertions, 312 deletions
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index 2c5954b85933..e24519a54938 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -54,16 +54,4 @@ config TIPC_LOG
54 There is no need to enable the log buffer unless the node will be 54 There is no need to enable the log buffer unless the node will be
55 managed remotely via TIPC. 55 managed remotely via TIPC.
56 56
57config TIPC_DEBUG
58 bool "Enable debugging support"
59 default n
60 help
61 Saying Y here enables TIPC debugging capabilities used by developers.
62 Most users do not need to bother; if unsure, just say N.
63
64 Enabling debugging support causes TIPC to display data about its
65 internal state when certain abnormal conditions occur. It also
66 makes it easy for developers to capture additional information of
67 interest using the dbg() or msg_dbg() macros.
68
69endif # TIPC 57endif # TIPC
diff --git a/net/tipc/core.h b/net/tipc/core.h
index c376ec06e69a..600c433e1467 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -91,28 +91,6 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
91#define TIPC_OUTPUT TIPC_LOG 91#define TIPC_OUTPUT TIPC_LOG
92#endif 92#endif
93 93
94#ifdef CONFIG_TIPC_DEBUG
95
96/*
97 * DBG_OUTPUT is the destination print buffer for debug messages.
98 */
99#ifndef DBG_OUTPUT
100#define DBG_OUTPUT TIPC_LOG
101#endif
102
103#define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt);
104
105void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
106
107#else
108
109#define msg_dbg(msg, txt) do {} while (0)
110
111#define tipc_msg_dbg(buf, msg, txt) do {} while (0)
112
113#endif
114
115
116/* 94/*
117 * TIPC-specific error codes 95 * TIPC-specific error codes
118 */ 96 */
diff --git a/net/tipc/link.c b/net/tipc/link.c
index e543b9f91ee0..9ba70c971142 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -3019,42 +3019,6 @@ static void link_print(struct tipc_link *l_ptr, const char *str)
3019 tipc_printf(buf, "Link %x<%s>:", 3019 tipc_printf(buf, "Link %x<%s>:",
3020 l_ptr->addr, l_ptr->b_ptr->name); 3020 l_ptr->addr, l_ptr->b_ptr->name);
3021 3021
3022#ifdef CONFIG_TIPC_DEBUG
3023 if (link_reset_reset(l_ptr) || link_reset_unknown(l_ptr))
3024 goto print_state;
3025
3026 tipc_printf(buf, ": NXO(%u):", mod(l_ptr->next_out_no));
3027 tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no));
3028 tipc_printf(buf, "SQUE");
3029 if (l_ptr->first_out) {
3030 tipc_printf(buf, "[%u..", buf_seqno(l_ptr->first_out));
3031 if (l_ptr->next_out)
3032 tipc_printf(buf, "%u..", buf_seqno(l_ptr->next_out));
3033 tipc_printf(buf, "%u]", buf_seqno(l_ptr->last_out));
3034 if ((mod(buf_seqno(l_ptr->last_out) -
3035 buf_seqno(l_ptr->first_out))
3036 != (l_ptr->out_queue_size - 1)) ||
3037 (l_ptr->last_out->next != NULL)) {
3038 tipc_printf(buf, "\nSend queue inconsistency\n");
3039 tipc_printf(buf, "first_out= %p ", l_ptr->first_out);
3040 tipc_printf(buf, "next_out= %p ", l_ptr->next_out);
3041 tipc_printf(buf, "last_out= %p ", l_ptr->last_out);
3042 }
3043 } else
3044 tipc_printf(buf, "[]");
3045 tipc_printf(buf, "SQSIZ(%u)", l_ptr->out_queue_size);
3046 if (l_ptr->oldest_deferred_in) {
3047 u32 o = buf_seqno(l_ptr->oldest_deferred_in);
3048 u32 n = buf_seqno(l_ptr->newest_deferred_in);
3049 tipc_printf(buf, ":RQUE[%u..%u]", o, n);
3050 if (l_ptr->deferred_inqueue_sz != mod((n + 1) - o)) {
3051 tipc_printf(buf, ":RQSIZ(%u)",
3052 l_ptr->deferred_inqueue_sz);
3053 }
3054 }
3055print_state:
3056#endif
3057
3058 if (link_working_unknown(l_ptr)) 3022 if (link_working_unknown(l_ptr))
3059 tipc_printf(buf, ":WU"); 3023 tipc_printf(buf, ":WU");
3060 else if (link_reset_reset(l_ptr)) 3024 else if (link_reset_reset(l_ptr))
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index deea0d232dca..f2db8a87d9c5 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -109,245 +109,3 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
109 *buf = NULL; 109 *buf = NULL;
110 return -EFAULT; 110 return -EFAULT;
111} 111}
112
113#ifdef CONFIG_TIPC_DEBUG
114void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str)
115{
116 u32 usr = msg_user(msg);
117 tipc_printf(buf, KERN_DEBUG);
118 tipc_printf(buf, str);
119
120 switch (usr) {
121 case MSG_BUNDLER:
122 tipc_printf(buf, "BNDL::");
123 tipc_printf(buf, "MSGS(%u):", msg_msgcnt(msg));
124 break;
125 case BCAST_PROTOCOL:
126 tipc_printf(buf, "BCASTP::");
127 break;
128 case MSG_FRAGMENTER:
129 tipc_printf(buf, "FRAGM::");
130 switch (msg_type(msg)) {
131 case FIRST_FRAGMENT:
132 tipc_printf(buf, "FIRST:");
133 break;
134 case FRAGMENT:
135 tipc_printf(buf, "BODY:");
136 break;
137 case LAST_FRAGMENT:
138 tipc_printf(buf, "LAST:");
139 break;
140 default:
141 tipc_printf(buf, "UNKNOWN:%x", msg_type(msg));
142
143 }
144 tipc_printf(buf, "NO(%u/%u):", msg_long_msgno(msg),
145 msg_fragm_no(msg));
146 break;
147 case TIPC_LOW_IMPORTANCE:
148 case TIPC_MEDIUM_IMPORTANCE:
149 case TIPC_HIGH_IMPORTANCE:
150 case TIPC_CRITICAL_IMPORTANCE:
151 tipc_printf(buf, "DAT%u:", msg_user(msg));
152 if (msg_short(msg)) {
153 tipc_printf(buf, "CON:");
154 break;
155 }
156 switch (msg_type(msg)) {
157 case TIPC_CONN_MSG:
158 tipc_printf(buf, "CON:");
159 break;
160 case TIPC_MCAST_MSG:
161 tipc_printf(buf, "MCST:");
162 break;
163 case TIPC_NAMED_MSG:
164 tipc_printf(buf, "NAM:");
165 break;
166 case TIPC_DIRECT_MSG:
167 tipc_printf(buf, "DIR:");
168 break;
169 default:
170 tipc_printf(buf, "UNKNOWN TYPE %u", msg_type(msg));
171 }
172 if (msg_reroute_cnt(msg))
173 tipc_printf(buf, "REROUTED(%u):",
174 msg_reroute_cnt(msg));
175 break;
176 case NAME_DISTRIBUTOR:
177 tipc_printf(buf, "NMD::");
178 switch (msg_type(msg)) {
179 case PUBLICATION:
180 tipc_printf(buf, "PUBL(%u):", (msg_size(msg) - msg_hdr_sz(msg)) / 20); /* Items */
181 break;
182 case WITHDRAWAL:
183 tipc_printf(buf, "WDRW:");
184 break;
185 default:
186 tipc_printf(buf, "UNKNOWN:%x", msg_type(msg));
187 }
188 if (msg_reroute_cnt(msg))
189 tipc_printf(buf, "REROUTED(%u):",
190 msg_reroute_cnt(msg));
191 break;
192 case CONN_MANAGER:
193 tipc_printf(buf, "CONN_MNG:");
194 switch (msg_type(msg)) {
195 case CONN_PROBE:
196 tipc_printf(buf, "PROBE:");
197 break;
198 case CONN_PROBE_REPLY:
199 tipc_printf(buf, "PROBE_REPLY:");
200 break;
201 case CONN_ACK:
202 tipc_printf(buf, "CONN_ACK:");
203 tipc_printf(buf, "ACK(%u):", msg_msgcnt(msg));
204 break;
205 default:
206 tipc_printf(buf, "UNKNOWN TYPE:%x", msg_type(msg));
207 }
208 if (msg_reroute_cnt(msg))
209 tipc_printf(buf, "REROUTED(%u):", msg_reroute_cnt(msg));
210 break;
211 case LINK_PROTOCOL:
212 switch (msg_type(msg)) {
213 case STATE_MSG:
214 tipc_printf(buf, "STATE:");
215 tipc_printf(buf, "%s:", msg_probe(msg) ? "PRB" : "");
216 tipc_printf(buf, "NXS(%u):", msg_next_sent(msg));
217 tipc_printf(buf, "GAP(%u):", msg_seq_gap(msg));
218 tipc_printf(buf, "LSTBC(%u):", msg_last_bcast(msg));
219 break;
220 case RESET_MSG:
221 tipc_printf(buf, "RESET:");
222 if (msg_size(msg) != msg_hdr_sz(msg))
223 tipc_printf(buf, "BEAR:%s:", msg_data(msg));
224 break;
225 case ACTIVATE_MSG:
226 tipc_printf(buf, "ACTIVATE:");
227 break;
228 default:
229 tipc_printf(buf, "UNKNOWN TYPE:%x", msg_type(msg));
230 }
231 tipc_printf(buf, "PLANE(%c):", msg_net_plane(msg));
232 tipc_printf(buf, "SESS(%u):", msg_session(msg));
233 break;
234 case CHANGEOVER_PROTOCOL:
235 tipc_printf(buf, "TUNL:");
236 switch (msg_type(msg)) {
237 case DUPLICATE_MSG:
238 tipc_printf(buf, "DUPL:");
239 break;
240 case ORIGINAL_MSG:
241 tipc_printf(buf, "ORIG:");
242 tipc_printf(buf, "EXP(%u)", msg_msgcnt(msg));
243 break;
244 default:
245 tipc_printf(buf, "UNKNOWN TYPE:%x", msg_type(msg));
246 }
247 break;
248 case LINK_CONFIG:
249 tipc_printf(buf, "CFG:");
250 switch (msg_type(msg)) {
251 case DSC_REQ_MSG:
252 tipc_printf(buf, "DSC_REQ:");
253 break;
254 case DSC_RESP_MSG:
255 tipc_printf(buf, "DSC_RESP:");
256 break;
257 default:
258 tipc_printf(buf, "UNKNOWN TYPE:%x:", msg_type(msg));
259 break;
260 }
261 break;
262 default:
263 tipc_printf(buf, "UNKNOWN USER:");
264 }
265
266 switch (usr) {
267 case CONN_MANAGER:
268 case TIPC_LOW_IMPORTANCE:
269 case TIPC_MEDIUM_IMPORTANCE:
270 case TIPC_HIGH_IMPORTANCE:
271 case TIPC_CRITICAL_IMPORTANCE:
272 switch (msg_errcode(msg)) {
273 case TIPC_OK:
274 break;
275 case TIPC_ERR_NO_NAME:
276 tipc_printf(buf, "NO_NAME:");
277 break;
278 case TIPC_ERR_NO_PORT:
279 tipc_printf(buf, "NO_PORT:");
280 break;
281 case TIPC_ERR_NO_NODE:
282 tipc_printf(buf, "NO_PROC:");
283 break;
284 case TIPC_ERR_OVERLOAD:
285 tipc_printf(buf, "OVERLOAD:");
286 break;
287 case TIPC_CONN_SHUTDOWN:
288 tipc_printf(buf, "SHUTDOWN:");
289 break;
290 default:
291 tipc_printf(buf, "UNKNOWN ERROR(%x):",
292 msg_errcode(msg));
293 }
294 default:
295 break;
296 }
297
298 tipc_printf(buf, "HZ(%u):", msg_hdr_sz(msg));
299 tipc_printf(buf, "SZ(%u):", msg_size(msg));
300 tipc_printf(buf, "SQNO(%u):", msg_seqno(msg));
301
302 if (msg_non_seq(msg))
303 tipc_printf(buf, "NOSEQ:");
304 else
305 tipc_printf(buf, "ACK(%u):", msg_ack(msg));
306 tipc_printf(buf, "BACK(%u):", msg_bcast_ack(msg));
307 tipc_printf(buf, "PRND(%x)", msg_prevnode(msg));
308
309 if (msg_isdata(msg)) {
310 if (msg_named(msg)) {
311 tipc_printf(buf, "NTYP(%u):", msg_nametype(msg));
312 tipc_printf(buf, "NINST(%u)", msg_nameinst(msg));
313 }
314 }
315
316 if ((usr != LINK_PROTOCOL) && (usr != LINK_CONFIG) &&
317 (usr != MSG_BUNDLER)) {
318 if (!msg_short(msg)) {
319 tipc_printf(buf, ":ORIG(%x:%u):",
320 msg_orignode(msg), msg_origport(msg));
321 tipc_printf(buf, ":DEST(%x:%u):",
322 msg_destnode(msg), msg_destport(msg));
323 } else {
324 tipc_printf(buf, ":OPRT(%u):", msg_origport(msg));
325 tipc_printf(buf, ":DPRT(%u):", msg_destport(msg));
326 }
327 }
328 if (msg_user(msg) == NAME_DISTRIBUTOR) {
329 tipc_printf(buf, ":ONOD(%x):", msg_orignode(msg));
330 tipc_printf(buf, ":DNOD(%x):", msg_destnode(msg));
331 }
332
333 if (msg_user(msg) == LINK_CONFIG) {
334 struct tipc_media_addr orig;
335
336 tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg));
337 tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg));
338 memcpy(orig.value, msg_media_addr(msg), sizeof(orig.value));
339 orig.media_id = 0;
340 orig.broadcast = 0;
341 tipc_media_addr_printf(buf, &orig);
342 }
343 if (msg_user(msg) == BCAST_PROTOCOL) {
344 tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg));
345 tipc_printf(buf, "TO(%u):", msg_bcgap_to(msg));
346 }
347 tipc_printf(buf, "\n");
348 if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg)))
349 tipc_msg_dbg(buf, msg_get_wrapped(msg), " /");
350 if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT))
351 tipc_msg_dbg(buf, msg_get_wrapped(msg), " /");
352}
353#endif