diff options
author | Joe Perches <joe@perches.com> | 2012-05-17 06:25:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-17 18:45:20 -0400 |
commit | a508da6cc0093171833efb8376b00473f24221b9 (patch) | |
tree | d2578008abfaf33a59da65a64b916c62ee79eedd /net/lapb/lapb_in.c | |
parent | a5e371f61ad33c07b28e7c9b60c78d71fdd34e2a (diff) |
lapb: Neaten debugging
Enable dynamic debugging and remove a bunch of #ifdef/#endifs.
Add a lapb_dbg(level, fmt, ...) macro and replace the
printk(KERN_DEBUG uses.
Add pr_fmt and remove embedded prefixes.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/lapb/lapb_in.c')
-rw-r--r-- | net/lapb/lapb_in.c | 320 |
1 files changed, 91 insertions, 229 deletions
diff --git a/net/lapb/lapb_in.c b/net/lapb/lapb_in.c index f4e3c1accab7..5dba899131b3 100644 --- a/net/lapb/lapb_in.c +++ b/net/lapb/lapb_in.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * 2000-10-29 Henner Eisen lapb_data_indication() return status. | 15 | * 2000-10-29 Henner Eisen lapb_data_indication() return status. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
19 | #include <linux/types.h> | 21 | #include <linux/types.h> |
20 | #include <linux/socket.h> | 22 | #include <linux/socket.h> |
@@ -44,25 +46,16 @@ static void lapb_state0_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
44 | { | 46 | { |
45 | switch (frame->type) { | 47 | switch (frame->type) { |
46 | case LAPB_SABM: | 48 | case LAPB_SABM: |
47 | #if LAPB_DEBUG > 1 | 49 | lapb_dbg(1, "(%p) S0 RX SABM(%d)\n", lapb->dev, frame->pf); |
48 | printk(KERN_DEBUG "lapb: (%p) S0 RX SABM(%d)\n", | ||
49 | lapb->dev, frame->pf); | ||
50 | #endif | ||
51 | if (lapb->mode & LAPB_EXTENDED) { | 50 | if (lapb->mode & LAPB_EXTENDED) { |
52 | #if LAPB_DEBUG > 1 | 51 | lapb_dbg(1, "(%p) S0 TX DM(%d)\n", |
53 | printk(KERN_DEBUG "lapb: (%p) S0 TX DM(%d)\n", | 52 | lapb->dev, frame->pf); |
54 | lapb->dev, frame->pf); | ||
55 | #endif | ||
56 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 53 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
57 | LAPB_RESPONSE); | 54 | LAPB_RESPONSE); |
58 | } else { | 55 | } else { |
59 | #if LAPB_DEBUG > 1 | 56 | lapb_dbg(1, "(%p) S0 TX UA(%d)\n", |
60 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", | 57 | lapb->dev, frame->pf); |
61 | lapb->dev, frame->pf); | 58 | lapb_dbg(0, "(%p) S0 -> S3\n", lapb->dev); |
62 | #endif | ||
63 | #if LAPB_DEBUG > 0 | ||
64 | printk(KERN_DEBUG "lapb: (%p) S0 -> S3\n", lapb->dev); | ||
65 | #endif | ||
66 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 59 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
67 | LAPB_RESPONSE); | 60 | LAPB_RESPONSE); |
68 | lapb_stop_t1timer(lapb); | 61 | lapb_stop_t1timer(lapb); |
@@ -78,18 +71,11 @@ static void lapb_state0_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
78 | break; | 71 | break; |
79 | 72 | ||
80 | case LAPB_SABME: | 73 | case LAPB_SABME: |
81 | #if LAPB_DEBUG > 1 | 74 | lapb_dbg(1, "(%p) S0 RX SABME(%d)\n", lapb->dev, frame->pf); |
82 | printk(KERN_DEBUG "lapb: (%p) S0 RX SABME(%d)\n", | ||
83 | lapb->dev, frame->pf); | ||
84 | #endif | ||
85 | if (lapb->mode & LAPB_EXTENDED) { | 75 | if (lapb->mode & LAPB_EXTENDED) { |
86 | #if LAPB_DEBUG > 1 | 76 | lapb_dbg(1, "(%p) S0 TX UA(%d)\n", |
87 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", | 77 | lapb->dev, frame->pf); |
88 | lapb->dev, frame->pf); | 78 | lapb_dbg(0, "(%p) S0 -> S3\n", lapb->dev); |
89 | #endif | ||
90 | #if LAPB_DEBUG > 0 | ||
91 | printk(KERN_DEBUG "lapb: (%p) S0 -> S3\n", lapb->dev); | ||
92 | #endif | ||
93 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 79 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
94 | LAPB_RESPONSE); | 80 | LAPB_RESPONSE); |
95 | lapb_stop_t1timer(lapb); | 81 | lapb_stop_t1timer(lapb); |
@@ -102,22 +88,16 @@ static void lapb_state0_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
102 | lapb->va = 0; | 88 | lapb->va = 0; |
103 | lapb_connect_indication(lapb, LAPB_OK); | 89 | lapb_connect_indication(lapb, LAPB_OK); |
104 | } else { | 90 | } else { |
105 | #if LAPB_DEBUG > 1 | 91 | lapb_dbg(1, "(%p) S0 TX DM(%d)\n", |
106 | printk(KERN_DEBUG "lapb: (%p) S0 TX DM(%d)\n", | 92 | lapb->dev, frame->pf); |
107 | lapb->dev, frame->pf); | ||
108 | #endif | ||
109 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 93 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
110 | LAPB_RESPONSE); | 94 | LAPB_RESPONSE); |
111 | } | 95 | } |
112 | break; | 96 | break; |
113 | 97 | ||
114 | case LAPB_DISC: | 98 | case LAPB_DISC: |
115 | #if LAPB_DEBUG > 1 | 99 | lapb_dbg(1, "(%p) S0 RX DISC(%d)\n", lapb->dev, frame->pf); |
116 | printk(KERN_DEBUG "lapb: (%p) S0 RX DISC(%d)\n", | 100 | lapb_dbg(1, "(%p) S0 TX UA(%d)\n", lapb->dev, frame->pf); |
117 | lapb->dev, frame->pf); | ||
118 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", | ||
119 | lapb->dev, frame->pf); | ||
120 | #endif | ||
121 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); | 101 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); |
122 | break; | 102 | break; |
123 | 103 | ||
@@ -137,68 +117,45 @@ static void lapb_state1_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
137 | { | 117 | { |
138 | switch (frame->type) { | 118 | switch (frame->type) { |
139 | case LAPB_SABM: | 119 | case LAPB_SABM: |
140 | #if LAPB_DEBUG > 1 | 120 | lapb_dbg(1, "(%p) S1 RX SABM(%d)\n", lapb->dev, frame->pf); |
141 | printk(KERN_DEBUG "lapb: (%p) S1 RX SABM(%d)\n", | ||
142 | lapb->dev, frame->pf); | ||
143 | #endif | ||
144 | if (lapb->mode & LAPB_EXTENDED) { | 121 | if (lapb->mode & LAPB_EXTENDED) { |
145 | #if LAPB_DEBUG > 1 | 122 | lapb_dbg(1, "(%p) S1 TX DM(%d)\n", |
146 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | 123 | lapb->dev, frame->pf); |
147 | lapb->dev, frame->pf); | ||
148 | #endif | ||
149 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 124 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
150 | LAPB_RESPONSE); | 125 | LAPB_RESPONSE); |
151 | } else { | 126 | } else { |
152 | #if LAPB_DEBUG > 1 | 127 | lapb_dbg(1, "(%p) S1 TX UA(%d)\n", |
153 | printk(KERN_DEBUG "lapb: (%p) S1 TX UA(%d)\n", | 128 | lapb->dev, frame->pf); |
154 | lapb->dev, frame->pf); | ||
155 | #endif | ||
156 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 129 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
157 | LAPB_RESPONSE); | 130 | LAPB_RESPONSE); |
158 | } | 131 | } |
159 | break; | 132 | break; |
160 | 133 | ||
161 | case LAPB_SABME: | 134 | case LAPB_SABME: |
162 | #if LAPB_DEBUG > 1 | 135 | lapb_dbg(1, "(%p) S1 RX SABME(%d)\n", lapb->dev, frame->pf); |
163 | printk(KERN_DEBUG "lapb: (%p) S1 RX SABME(%d)\n", | ||
164 | lapb->dev, frame->pf); | ||
165 | #endif | ||
166 | if (lapb->mode & LAPB_EXTENDED) { | 136 | if (lapb->mode & LAPB_EXTENDED) { |
167 | #if LAPB_DEBUG > 1 | 137 | lapb_dbg(1, "(%p) S1 TX UA(%d)\n", |
168 | printk(KERN_DEBUG "lapb: (%p) S1 TX UA(%d)\n", | 138 | lapb->dev, frame->pf); |
169 | lapb->dev, frame->pf); | ||
170 | #endif | ||
171 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 139 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
172 | LAPB_RESPONSE); | 140 | LAPB_RESPONSE); |
173 | } else { | 141 | } else { |
174 | #if LAPB_DEBUG > 1 | 142 | lapb_dbg(1, "(%p) S1 TX DM(%d)\n", |
175 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | 143 | lapb->dev, frame->pf); |
176 | lapb->dev, frame->pf); | ||
177 | #endif | ||
178 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 144 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
179 | LAPB_RESPONSE); | 145 | LAPB_RESPONSE); |
180 | } | 146 | } |
181 | break; | 147 | break; |
182 | 148 | ||
183 | case LAPB_DISC: | 149 | case LAPB_DISC: |
184 | #if LAPB_DEBUG > 1 | 150 | lapb_dbg(1, "(%p) S1 RX DISC(%d)\n", lapb->dev, frame->pf); |
185 | printk(KERN_DEBUG "lapb: (%p) S1 RX DISC(%d)\n", | 151 | lapb_dbg(1, "(%p) S1 TX DM(%d)\n", lapb->dev, frame->pf); |
186 | lapb->dev, frame->pf); | ||
187 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | ||
188 | lapb->dev, frame->pf); | ||
189 | #endif | ||
190 | lapb_send_control(lapb, LAPB_DM, frame->pf, LAPB_RESPONSE); | 152 | lapb_send_control(lapb, LAPB_DM, frame->pf, LAPB_RESPONSE); |
191 | break; | 153 | break; |
192 | 154 | ||
193 | case LAPB_UA: | 155 | case LAPB_UA: |
194 | #if LAPB_DEBUG > 1 | 156 | lapb_dbg(1, "(%p) S1 RX UA(%d)\n", lapb->dev, frame->pf); |
195 | printk(KERN_DEBUG "lapb: (%p) S1 RX UA(%d)\n", | ||
196 | lapb->dev, frame->pf); | ||
197 | #endif | ||
198 | if (frame->pf) { | 157 | if (frame->pf) { |
199 | #if LAPB_DEBUG > 0 | 158 | lapb_dbg(0, "(%p) S1 -> S3\n", lapb->dev); |
200 | printk(KERN_DEBUG "lapb: (%p) S1 -> S3\n", lapb->dev); | ||
201 | #endif | ||
202 | lapb_stop_t1timer(lapb); | 159 | lapb_stop_t1timer(lapb); |
203 | lapb_stop_t2timer(lapb); | 160 | lapb_stop_t2timer(lapb); |
204 | lapb->state = LAPB_STATE_3; | 161 | lapb->state = LAPB_STATE_3; |
@@ -212,14 +169,9 @@ static void lapb_state1_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
212 | break; | 169 | break; |
213 | 170 | ||
214 | case LAPB_DM: | 171 | case LAPB_DM: |
215 | #if LAPB_DEBUG > 1 | 172 | lapb_dbg(1, "(%p) S1 RX DM(%d)\n", lapb->dev, frame->pf); |
216 | printk(KERN_DEBUG "lapb: (%p) S1 RX DM(%d)\n", | ||
217 | lapb->dev, frame->pf); | ||
218 | #endif | ||
219 | if (frame->pf) { | 173 | if (frame->pf) { |
220 | #if LAPB_DEBUG > 0 | 174 | lapb_dbg(0, "(%p) S1 -> S0\n", lapb->dev); |
221 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); | ||
222 | #endif | ||
223 | lapb_clear_queues(lapb); | 175 | lapb_clear_queues(lapb); |
224 | lapb->state = LAPB_STATE_0; | 176 | lapb->state = LAPB_STATE_0; |
225 | lapb_start_t1timer(lapb); | 177 | lapb_start_t1timer(lapb); |
@@ -242,34 +194,22 @@ static void lapb_state2_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
242 | switch (frame->type) { | 194 | switch (frame->type) { |
243 | case LAPB_SABM: | 195 | case LAPB_SABM: |
244 | case LAPB_SABME: | 196 | case LAPB_SABME: |
245 | #if LAPB_DEBUG > 1 | 197 | lapb_dbg(1, "(%p) S2 RX {SABM,SABME}(%d)\n", |
246 | printk(KERN_DEBUG "lapb: (%p) S2 RX {SABM,SABME}(%d)\n", | 198 | lapb->dev, frame->pf); |
247 | lapb->dev, frame->pf); | 199 | lapb_dbg(1, "(%p) S2 TX DM(%d)\n", lapb->dev, frame->pf); |
248 | printk(KERN_DEBUG "lapb: (%p) S2 TX DM(%d)\n", | ||
249 | lapb->dev, frame->pf); | ||
250 | #endif | ||
251 | lapb_send_control(lapb, LAPB_DM, frame->pf, LAPB_RESPONSE); | 200 | lapb_send_control(lapb, LAPB_DM, frame->pf, LAPB_RESPONSE); |
252 | break; | 201 | break; |
253 | 202 | ||
254 | case LAPB_DISC: | 203 | case LAPB_DISC: |
255 | #if LAPB_DEBUG > 1 | 204 | lapb_dbg(1, "(%p) S2 RX DISC(%d)\n", lapb->dev, frame->pf); |
256 | printk(KERN_DEBUG "lapb: (%p) S2 RX DISC(%d)\n", | 205 | lapb_dbg(1, "(%p) S2 TX UA(%d)\n", lapb->dev, frame->pf); |
257 | lapb->dev, frame->pf); | ||
258 | printk(KERN_DEBUG "lapb: (%p) S2 TX UA(%d)\n", | ||
259 | lapb->dev, frame->pf); | ||
260 | #endif | ||
261 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); | 206 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); |
262 | break; | 207 | break; |
263 | 208 | ||
264 | case LAPB_UA: | 209 | case LAPB_UA: |
265 | #if LAPB_DEBUG > 1 | 210 | lapb_dbg(1, "(%p) S2 RX UA(%d)\n", lapb->dev, frame->pf); |
266 | printk(KERN_DEBUG "lapb: (%p) S2 RX UA(%d)\n", | ||
267 | lapb->dev, frame->pf); | ||
268 | #endif | ||
269 | if (frame->pf) { | 211 | if (frame->pf) { |
270 | #if LAPB_DEBUG > 0 | 212 | lapb_dbg(0, "(%p) S2 -> S0\n", lapb->dev); |
271 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", lapb->dev); | ||
272 | #endif | ||
273 | lapb->state = LAPB_STATE_0; | 213 | lapb->state = LAPB_STATE_0; |
274 | lapb_start_t1timer(lapb); | 214 | lapb_start_t1timer(lapb); |
275 | lapb_stop_t2timer(lapb); | 215 | lapb_stop_t2timer(lapb); |
@@ -278,14 +218,9 @@ static void lapb_state2_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
278 | break; | 218 | break; |
279 | 219 | ||
280 | case LAPB_DM: | 220 | case LAPB_DM: |
281 | #if LAPB_DEBUG > 1 | 221 | lapb_dbg(1, "(%p) S2 RX DM(%d)\n", lapb->dev, frame->pf); |
282 | printk(KERN_DEBUG "lapb: (%p) S2 RX DM(%d)\n", | ||
283 | lapb->dev, frame->pf); | ||
284 | #endif | ||
285 | if (frame->pf) { | 222 | if (frame->pf) { |
286 | #if LAPB_DEBUG > 0 | 223 | lapb_dbg(0, "(%p) S2 -> S0\n", lapb->dev); |
287 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", lapb->dev); | ||
288 | #endif | ||
289 | lapb->state = LAPB_STATE_0; | 224 | lapb->state = LAPB_STATE_0; |
290 | lapb_start_t1timer(lapb); | 225 | lapb_start_t1timer(lapb); |
291 | lapb_stop_t2timer(lapb); | 226 | lapb_stop_t2timer(lapb); |
@@ -297,12 +232,9 @@ static void lapb_state2_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
297 | case LAPB_REJ: | 232 | case LAPB_REJ: |
298 | case LAPB_RNR: | 233 | case LAPB_RNR: |
299 | case LAPB_RR: | 234 | case LAPB_RR: |
300 | #if LAPB_DEBUG > 1 | 235 | lapb_dbg(1, "(%p) S2 RX {I,REJ,RNR,RR}(%d)\n", |
301 | printk(KERN_DEBUG "lapb: (%p) S2 RX {I,REJ,RNR,RR}(%d)\n", | ||
302 | lapb->dev, frame->pf); | ||
303 | printk(KERN_DEBUG "lapb: (%p) S2 RX DM(%d)\n", | ||
304 | lapb->dev, frame->pf); | 236 | lapb->dev, frame->pf); |
305 | #endif | 237 | lapb_dbg(1, "(%p) S2 RX DM(%d)\n", lapb->dev, frame->pf); |
306 | if (frame->pf) | 238 | if (frame->pf) |
307 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 239 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
308 | LAPB_RESPONSE); | 240 | LAPB_RESPONSE); |
@@ -325,22 +257,15 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
325 | 257 | ||
326 | switch (frame->type) { | 258 | switch (frame->type) { |
327 | case LAPB_SABM: | 259 | case LAPB_SABM: |
328 | #if LAPB_DEBUG > 1 | 260 | lapb_dbg(1, "(%p) S3 RX SABM(%d)\n", lapb->dev, frame->pf); |
329 | printk(KERN_DEBUG "lapb: (%p) S3 RX SABM(%d)\n", | ||
330 | lapb->dev, frame->pf); | ||
331 | #endif | ||
332 | if (lapb->mode & LAPB_EXTENDED) { | 261 | if (lapb->mode & LAPB_EXTENDED) { |
333 | #if LAPB_DEBUG > 1 | 262 | lapb_dbg(1, "(%p) S3 TX DM(%d)\n", |
334 | printk(KERN_DEBUG "lapb: (%p) S3 TX DM(%d)\n", | 263 | lapb->dev, frame->pf); |
335 | lapb->dev, frame->pf); | ||
336 | #endif | ||
337 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 264 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
338 | LAPB_RESPONSE); | 265 | LAPB_RESPONSE); |
339 | } else { | 266 | } else { |
340 | #if LAPB_DEBUG > 1 | 267 | lapb_dbg(1, "(%p) S3 TX UA(%d)\n", |
341 | printk(KERN_DEBUG "lapb: (%p) S3 TX UA(%d)\n", | 268 | lapb->dev, frame->pf); |
342 | lapb->dev, frame->pf); | ||
343 | #endif | ||
344 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 269 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
345 | LAPB_RESPONSE); | 270 | LAPB_RESPONSE); |
346 | lapb_stop_t1timer(lapb); | 271 | lapb_stop_t1timer(lapb); |
@@ -355,15 +280,10 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
355 | break; | 280 | break; |
356 | 281 | ||
357 | case LAPB_SABME: | 282 | case LAPB_SABME: |
358 | #if LAPB_DEBUG > 1 | 283 | lapb_dbg(1, "(%p) S3 RX SABME(%d)\n", lapb->dev, frame->pf); |
359 | printk(KERN_DEBUG "lapb: (%p) S3 RX SABME(%d)\n", | ||
360 | lapb->dev, frame->pf); | ||
361 | #endif | ||
362 | if (lapb->mode & LAPB_EXTENDED) { | 284 | if (lapb->mode & LAPB_EXTENDED) { |
363 | #if LAPB_DEBUG > 1 | 285 | lapb_dbg(1, "(%p) S3 TX UA(%d)\n", |
364 | printk(KERN_DEBUG "lapb: (%p) S3 TX UA(%d)\n", | 286 | lapb->dev, frame->pf); |
365 | lapb->dev, frame->pf); | ||
366 | #endif | ||
367 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 287 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
368 | LAPB_RESPONSE); | 288 | LAPB_RESPONSE); |
369 | lapb_stop_t1timer(lapb); | 289 | lapb_stop_t1timer(lapb); |
@@ -375,23 +295,16 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
375 | lapb->va = 0; | 295 | lapb->va = 0; |
376 | lapb_requeue_frames(lapb); | 296 | lapb_requeue_frames(lapb); |
377 | } else { | 297 | } else { |
378 | #if LAPB_DEBUG > 1 | 298 | lapb_dbg(1, "(%p) S3 TX DM(%d)\n", |
379 | printk(KERN_DEBUG "lapb: (%p) S3 TX DM(%d)\n", | 299 | lapb->dev, frame->pf); |
380 | lapb->dev, frame->pf); | ||
381 | #endif | ||
382 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 300 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
383 | LAPB_RESPONSE); | 301 | LAPB_RESPONSE); |
384 | } | 302 | } |
385 | break; | 303 | break; |
386 | 304 | ||
387 | case LAPB_DISC: | 305 | case LAPB_DISC: |
388 | #if LAPB_DEBUG > 1 | 306 | lapb_dbg(1, "(%p) S3 RX DISC(%d)\n", lapb->dev, frame->pf); |
389 | printk(KERN_DEBUG "lapb: (%p) S3 RX DISC(%d)\n", | 307 | lapb_dbg(0, "(%p) S3 -> S0\n", lapb->dev); |
390 | lapb->dev, frame->pf); | ||
391 | #endif | ||
392 | #if LAPB_DEBUG > 0 | ||
393 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", lapb->dev); | ||
394 | #endif | ||
395 | lapb_clear_queues(lapb); | 308 | lapb_clear_queues(lapb); |
396 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); | 309 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); |
397 | lapb_start_t1timer(lapb); | 310 | lapb_start_t1timer(lapb); |
@@ -401,13 +314,8 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
401 | break; | 314 | break; |
402 | 315 | ||
403 | case LAPB_DM: | 316 | case LAPB_DM: |
404 | #if LAPB_DEBUG > 1 | 317 | lapb_dbg(1, "(%p) S3 RX DM(%d)\n", lapb->dev, frame->pf); |
405 | printk(KERN_DEBUG "lapb: (%p) S3 RX DM(%d)\n", | 318 | lapb_dbg(0, "(%p) S3 -> S0\n", lapb->dev); |
406 | lapb->dev, frame->pf); | ||
407 | #endif | ||
408 | #if LAPB_DEBUG > 0 | ||
409 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", lapb->dev); | ||
410 | #endif | ||
411 | lapb_clear_queues(lapb); | 319 | lapb_clear_queues(lapb); |
412 | lapb->state = LAPB_STATE_0; | 320 | lapb->state = LAPB_STATE_0; |
413 | lapb_start_t1timer(lapb); | 321 | lapb_start_t1timer(lapb); |
@@ -416,10 +324,8 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
416 | break; | 324 | break; |
417 | 325 | ||
418 | case LAPB_RNR: | 326 | case LAPB_RNR: |
419 | #if LAPB_DEBUG > 1 | 327 | lapb_dbg(1, "(%p) S3 RX RNR(%d) R%d\n", |
420 | printk(KERN_DEBUG "lapb: (%p) S3 RX RNR(%d) R%d\n", | 328 | lapb->dev, frame->pf, frame->nr); |
421 | lapb->dev, frame->pf, frame->nr); | ||
422 | #endif | ||
423 | lapb->condition |= LAPB_PEER_RX_BUSY_CONDITION; | 329 | lapb->condition |= LAPB_PEER_RX_BUSY_CONDITION; |
424 | lapb_check_need_response(lapb, frame->cr, frame->pf); | 330 | lapb_check_need_response(lapb, frame->cr, frame->pf); |
425 | if (lapb_validate_nr(lapb, frame->nr)) { | 331 | if (lapb_validate_nr(lapb, frame->nr)) { |
@@ -428,9 +334,7 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
428 | lapb->frmr_data = *frame; | 334 | lapb->frmr_data = *frame; |
429 | lapb->frmr_type = LAPB_FRMR_Z; | 335 | lapb->frmr_type = LAPB_FRMR_Z; |
430 | lapb_transmit_frmr(lapb); | 336 | lapb_transmit_frmr(lapb); |
431 | #if LAPB_DEBUG > 0 | 337 | lapb_dbg(0, "(%p) S3 -> S4\n", lapb->dev); |
432 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); | ||
433 | #endif | ||
434 | lapb_start_t1timer(lapb); | 338 | lapb_start_t1timer(lapb); |
435 | lapb_stop_t2timer(lapb); | 339 | lapb_stop_t2timer(lapb); |
436 | lapb->state = LAPB_STATE_4; | 340 | lapb->state = LAPB_STATE_4; |
@@ -439,10 +343,8 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
439 | break; | 343 | break; |
440 | 344 | ||
441 | case LAPB_RR: | 345 | case LAPB_RR: |
442 | #if LAPB_DEBUG > 1 | 346 | lapb_dbg(1, "(%p) S3 RX RR(%d) R%d\n", |
443 | printk(KERN_DEBUG "lapb: (%p) S3 RX RR(%d) R%d\n", | 347 | lapb->dev, frame->pf, frame->nr); |
444 | lapb->dev, frame->pf, frame->nr); | ||
445 | #endif | ||
446 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; | 348 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; |
447 | lapb_check_need_response(lapb, frame->cr, frame->pf); | 349 | lapb_check_need_response(lapb, frame->cr, frame->pf); |
448 | if (lapb_validate_nr(lapb, frame->nr)) { | 350 | if (lapb_validate_nr(lapb, frame->nr)) { |
@@ -451,9 +353,7 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
451 | lapb->frmr_data = *frame; | 353 | lapb->frmr_data = *frame; |
452 | lapb->frmr_type = LAPB_FRMR_Z; | 354 | lapb->frmr_type = LAPB_FRMR_Z; |
453 | lapb_transmit_frmr(lapb); | 355 | lapb_transmit_frmr(lapb); |
454 | #if LAPB_DEBUG > 0 | 356 | lapb_dbg(0, "(%p) S3 -> S4\n", lapb->dev); |
455 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); | ||
456 | #endif | ||
457 | lapb_start_t1timer(lapb); | 357 | lapb_start_t1timer(lapb); |
458 | lapb_stop_t2timer(lapb); | 358 | lapb_stop_t2timer(lapb); |
459 | lapb->state = LAPB_STATE_4; | 359 | lapb->state = LAPB_STATE_4; |
@@ -462,10 +362,8 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
462 | break; | 362 | break; |
463 | 363 | ||
464 | case LAPB_REJ: | 364 | case LAPB_REJ: |
465 | #if LAPB_DEBUG > 1 | 365 | lapb_dbg(1, "(%p) S3 RX REJ(%d) R%d\n", |
466 | printk(KERN_DEBUG "lapb: (%p) S3 RX REJ(%d) R%d\n", | 366 | lapb->dev, frame->pf, frame->nr); |
467 | lapb->dev, frame->pf, frame->nr); | ||
468 | #endif | ||
469 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; | 367 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; |
470 | lapb_check_need_response(lapb, frame->cr, frame->pf); | 368 | lapb_check_need_response(lapb, frame->cr, frame->pf); |
471 | if (lapb_validate_nr(lapb, frame->nr)) { | 369 | if (lapb_validate_nr(lapb, frame->nr)) { |
@@ -477,9 +375,7 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
477 | lapb->frmr_data = *frame; | 375 | lapb->frmr_data = *frame; |
478 | lapb->frmr_type = LAPB_FRMR_Z; | 376 | lapb->frmr_type = LAPB_FRMR_Z; |
479 | lapb_transmit_frmr(lapb); | 377 | lapb_transmit_frmr(lapb); |
480 | #if LAPB_DEBUG > 0 | 378 | lapb_dbg(0, "(%p) S3 -> S4\n", lapb->dev); |
481 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); | ||
482 | #endif | ||
483 | lapb_start_t1timer(lapb); | 379 | lapb_start_t1timer(lapb); |
484 | lapb_stop_t2timer(lapb); | 380 | lapb_stop_t2timer(lapb); |
485 | lapb->state = LAPB_STATE_4; | 381 | lapb->state = LAPB_STATE_4; |
@@ -488,17 +384,13 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
488 | break; | 384 | break; |
489 | 385 | ||
490 | case LAPB_I: | 386 | case LAPB_I: |
491 | #if LAPB_DEBUG > 1 | 387 | lapb_dbg(1, "(%p) S3 RX I(%d) S%d R%d\n", |
492 | printk(KERN_DEBUG "lapb: (%p) S3 RX I(%d) S%d R%d\n", | 388 | lapb->dev, frame->pf, frame->ns, frame->nr); |
493 | lapb->dev, frame->pf, frame->ns, frame->nr); | ||
494 | #endif | ||
495 | if (!lapb_validate_nr(lapb, frame->nr)) { | 389 | if (!lapb_validate_nr(lapb, frame->nr)) { |
496 | lapb->frmr_data = *frame; | 390 | lapb->frmr_data = *frame; |
497 | lapb->frmr_type = LAPB_FRMR_Z; | 391 | lapb->frmr_type = LAPB_FRMR_Z; |
498 | lapb_transmit_frmr(lapb); | 392 | lapb_transmit_frmr(lapb); |
499 | #if LAPB_DEBUG > 0 | 393 | lapb_dbg(0, "(%p) S3 -> S4\n", lapb->dev); |
500 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); | ||
501 | #endif | ||
502 | lapb_start_t1timer(lapb); | 394 | lapb_start_t1timer(lapb); |
503 | lapb_stop_t2timer(lapb); | 395 | lapb_stop_t2timer(lapb); |
504 | lapb->state = LAPB_STATE_4; | 396 | lapb->state = LAPB_STATE_4; |
@@ -522,7 +414,7 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
522 | * a frame lost on the wire. | 414 | * a frame lost on the wire. |
523 | */ | 415 | */ |
524 | if (cn == NET_RX_DROP) { | 416 | if (cn == NET_RX_DROP) { |
525 | printk(KERN_DEBUG "LAPB: rx congestion\n"); | 417 | pr_debug("rx congestion\n"); |
526 | break; | 418 | break; |
527 | } | 419 | } |
528 | lapb->vr = (lapb->vr + 1) % modulus; | 420 | lapb->vr = (lapb->vr + 1) % modulus; |
@@ -541,11 +433,8 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
541 | if (frame->pf) | 433 | if (frame->pf) |
542 | lapb_enquiry_response(lapb); | 434 | lapb_enquiry_response(lapb); |
543 | } else { | 435 | } else { |
544 | #if LAPB_DEBUG > 1 | 436 | lapb_dbg(1, "(%p) S3 TX REJ(%d) R%d\n", |
545 | printk(KERN_DEBUG | 437 | lapb->dev, frame->pf, lapb->vr); |
546 | "lapb: (%p) S3 TX REJ(%d) R%d\n", | ||
547 | lapb->dev, frame->pf, lapb->vr); | ||
548 | #endif | ||
549 | lapb->condition |= LAPB_REJECT_CONDITION; | 438 | lapb->condition |= LAPB_REJECT_CONDITION; |
550 | lapb_send_control(lapb, LAPB_REJ, frame->pf, | 439 | lapb_send_control(lapb, LAPB_REJ, frame->pf, |
551 | LAPB_RESPONSE); | 440 | LAPB_RESPONSE); |
@@ -555,31 +444,22 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
555 | break; | 444 | break; |
556 | 445 | ||
557 | case LAPB_FRMR: | 446 | case LAPB_FRMR: |
558 | #if LAPB_DEBUG > 1 | 447 | lapb_dbg(1, "(%p) S3 RX FRMR(%d) %02X %02X %02X %02X %02X\n", |
559 | printk(KERN_DEBUG "lapb: (%p) S3 RX FRMR(%d) %02X " | 448 | lapb->dev, frame->pf, |
560 | "%02X %02X %02X %02X\n", lapb->dev, frame->pf, | 449 | skb->data[0], skb->data[1], skb->data[2], |
561 | skb->data[0], skb->data[1], skb->data[2], | 450 | skb->data[3], skb->data[4]); |
562 | skb->data[3], skb->data[4]); | ||
563 | #endif | ||
564 | lapb_establish_data_link(lapb); | 451 | lapb_establish_data_link(lapb); |
565 | #if LAPB_DEBUG > 0 | 452 | lapb_dbg(0, "(%p) S3 -> S1\n", lapb->dev); |
566 | printk(KERN_DEBUG "lapb: (%p) S3 -> S1\n", lapb->dev); | ||
567 | #endif | ||
568 | lapb_requeue_frames(lapb); | 453 | lapb_requeue_frames(lapb); |
569 | lapb->state = LAPB_STATE_1; | 454 | lapb->state = LAPB_STATE_1; |
570 | break; | 455 | break; |
571 | 456 | ||
572 | case LAPB_ILLEGAL: | 457 | case LAPB_ILLEGAL: |
573 | #if LAPB_DEBUG > 1 | 458 | lapb_dbg(1, "(%p) S3 RX ILLEGAL(%d)\n", lapb->dev, frame->pf); |
574 | printk(KERN_DEBUG "lapb: (%p) S3 RX ILLEGAL(%d)\n", | ||
575 | lapb->dev, frame->pf); | ||
576 | #endif | ||
577 | lapb->frmr_data = *frame; | 459 | lapb->frmr_data = *frame; |
578 | lapb->frmr_type = LAPB_FRMR_W; | 460 | lapb->frmr_type = LAPB_FRMR_W; |
579 | lapb_transmit_frmr(lapb); | 461 | lapb_transmit_frmr(lapb); |
580 | #if LAPB_DEBUG > 0 | 462 | lapb_dbg(0, "(%p) S3 -> S4\n", lapb->dev); |
581 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); | ||
582 | #endif | ||
583 | lapb_start_t1timer(lapb); | 463 | lapb_start_t1timer(lapb); |
584 | lapb_stop_t2timer(lapb); | 464 | lapb_stop_t2timer(lapb); |
585 | lapb->state = LAPB_STATE_4; | 465 | lapb->state = LAPB_STATE_4; |
@@ -600,25 +480,16 @@ static void lapb_state4_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
600 | { | 480 | { |
601 | switch (frame->type) { | 481 | switch (frame->type) { |
602 | case LAPB_SABM: | 482 | case LAPB_SABM: |
603 | #if LAPB_DEBUG > 1 | 483 | lapb_dbg(1, "(%p) S4 RX SABM(%d)\n", lapb->dev, frame->pf); |
604 | printk(KERN_DEBUG "lapb: (%p) S4 RX SABM(%d)\n", | ||
605 | lapb->dev, frame->pf); | ||
606 | #endif | ||
607 | if (lapb->mode & LAPB_EXTENDED) { | 484 | if (lapb->mode & LAPB_EXTENDED) { |
608 | #if LAPB_DEBUG > 1 | 485 | lapb_dbg(1, "(%p) S4 TX DM(%d)\n", |
609 | printk(KERN_DEBUG "lapb: (%p) S4 TX DM(%d)\n", | 486 | lapb->dev, frame->pf); |
610 | lapb->dev, frame->pf); | ||
611 | #endif | ||
612 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 487 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
613 | LAPB_RESPONSE); | 488 | LAPB_RESPONSE); |
614 | } else { | 489 | } else { |
615 | #if LAPB_DEBUG > 1 | 490 | lapb_dbg(1, "(%p) S4 TX UA(%d)\n", |
616 | printk(KERN_DEBUG "lapb: (%p) S4 TX UA(%d)\n", | 491 | lapb->dev, frame->pf); |
617 | lapb->dev, frame->pf); | 492 | lapb_dbg(0, "(%p) S4 -> S3\n", lapb->dev); |
618 | #endif | ||
619 | #if LAPB_DEBUG > 0 | ||
620 | printk(KERN_DEBUG "lapb: (%p) S4 -> S3\n", lapb->dev); | ||
621 | #endif | ||
622 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 493 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
623 | LAPB_RESPONSE); | 494 | LAPB_RESPONSE); |
624 | lapb_stop_t1timer(lapb); | 495 | lapb_stop_t1timer(lapb); |
@@ -634,18 +505,11 @@ static void lapb_state4_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
634 | break; | 505 | break; |
635 | 506 | ||
636 | case LAPB_SABME: | 507 | case LAPB_SABME: |
637 | #if LAPB_DEBUG > 1 | 508 | lapb_dbg(1, "(%p) S4 RX SABME(%d)\n", lapb->dev, frame->pf); |
638 | printk(KERN_DEBUG "lapb: (%p) S4 RX SABME(%d)\n", | ||
639 | lapb->dev, frame->pf); | ||
640 | #endif | ||
641 | if (lapb->mode & LAPB_EXTENDED) { | 509 | if (lapb->mode & LAPB_EXTENDED) { |
642 | #if LAPB_DEBUG > 1 | 510 | lapb_dbg(1, "(%p) S4 TX UA(%d)\n", |
643 | printk(KERN_DEBUG "lapb: (%p) S4 TX UA(%d)\n", | 511 | lapb->dev, frame->pf); |
644 | lapb->dev, frame->pf); | 512 | lapb_dbg(0, "(%p) S4 -> S3\n", lapb->dev); |
645 | #endif | ||
646 | #if LAPB_DEBUG > 0 | ||
647 | printk(KERN_DEBUG "lapb: (%p) S4 -> S3\n", lapb->dev); | ||
648 | #endif | ||
649 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 513 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
650 | LAPB_RESPONSE); | 514 | LAPB_RESPONSE); |
651 | lapb_stop_t1timer(lapb); | 515 | lapb_stop_t1timer(lapb); |
@@ -658,10 +522,8 @@ static void lapb_state4_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
658 | lapb->va = 0; | 522 | lapb->va = 0; |
659 | lapb_connect_indication(lapb, LAPB_OK); | 523 | lapb_connect_indication(lapb, LAPB_OK); |
660 | } else { | 524 | } else { |
661 | #if LAPB_DEBUG > 1 | 525 | lapb_dbg(1, "(%p) S4 TX DM(%d)\n", |
662 | printk(KERN_DEBUG "lapb: (%p) S4 TX DM(%d)\n", | 526 | lapb->dev, frame->pf); |
663 | lapb->dev, frame->pf); | ||
664 | #endif | ||
665 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 527 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
666 | LAPB_RESPONSE); | 528 | LAPB_RESPONSE); |
667 | } | 529 | } |