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 | |
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')
-rw-r--r-- | net/lapb/lapb_iface.c | 22 | ||||
-rw-r--r-- | net/lapb/lapb_in.c | 320 | ||||
-rw-r--r-- | net/lapb/lapb_out.c | 38 | ||||
-rw-r--r-- | net/lapb/lapb_subr.c | 28 | ||||
-rw-r--r-- | net/lapb/lapb_timer.c | 32 |
5 files changed, 134 insertions, 306 deletions
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index ab3d35f23257..3cdaa046c1bc 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.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/module.h> | 20 | #include <linux/module.h> |
19 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
20 | #include <linux/types.h> | 22 | #include <linux/types.h> |
@@ -279,9 +281,7 @@ int lapb_connect_request(struct net_device *dev) | |||
279 | 281 | ||
280 | lapb_establish_data_link(lapb); | 282 | lapb_establish_data_link(lapb); |
281 | 283 | ||
282 | #if LAPB_DEBUG > 0 | 284 | lapb_dbg(0, "(%p) S0 -> S1\n", lapb->dev); |
283 | printk(KERN_DEBUG "lapb: (%p) S0 -> S1\n", lapb->dev); | ||
284 | #endif | ||
285 | lapb->state = LAPB_STATE_1; | 285 | lapb->state = LAPB_STATE_1; |
286 | 286 | ||
287 | rc = LAPB_OK; | 287 | rc = LAPB_OK; |
@@ -305,12 +305,8 @@ int lapb_disconnect_request(struct net_device *dev) | |||
305 | goto out_put; | 305 | goto out_put; |
306 | 306 | ||
307 | case LAPB_STATE_1: | 307 | case LAPB_STATE_1: |
308 | #if LAPB_DEBUG > 1 | 308 | lapb_dbg(1, "(%p) S1 TX DISC(1)\n", lapb->dev); |
309 | printk(KERN_DEBUG "lapb: (%p) S1 TX DISC(1)\n", lapb->dev); | 309 | lapb_dbg(0, "(%p) S1 -> S0\n", lapb->dev); |
310 | #endif | ||
311 | #if LAPB_DEBUG > 0 | ||
312 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); | ||
313 | #endif | ||
314 | lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); | 310 | lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); |
315 | lapb->state = LAPB_STATE_0; | 311 | lapb->state = LAPB_STATE_0; |
316 | lapb_start_t1timer(lapb); | 312 | lapb_start_t1timer(lapb); |
@@ -329,12 +325,8 @@ int lapb_disconnect_request(struct net_device *dev) | |||
329 | lapb_stop_t2timer(lapb); | 325 | lapb_stop_t2timer(lapb); |
330 | lapb->state = LAPB_STATE_2; | 326 | lapb->state = LAPB_STATE_2; |
331 | 327 | ||
332 | #if LAPB_DEBUG > 1 | 328 | lapb_dbg(1, "(%p) S3 DISC(1)\n", lapb->dev); |
333 | printk(KERN_DEBUG "lapb: (%p) S3 DISC(1)\n", lapb->dev); | 329 | lapb_dbg(0, "(%p) S3 -> S2\n", lapb->dev); |
334 | #endif | ||
335 | #if LAPB_DEBUG > 0 | ||
336 | printk(KERN_DEBUG "lapb: (%p) S3 -> S2\n", lapb->dev); | ||
337 | #endif | ||
338 | 330 | ||
339 | rc = LAPB_OK; | 331 | rc = LAPB_OK; |
340 | out_put: | 332 | out_put: |
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 | } |
diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c index baab2760f651..ba4d015bd1a6 100644 --- a/net/lapb/lapb_out.c +++ b/net/lapb/lapb_out.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * LAPB 002 Jonathan Naylor New timer architecture. | 14 | * LAPB 002 Jonathan Naylor New timer architecture. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
18 | |||
17 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
19 | #include <linux/socket.h> | 21 | #include <linux/socket.h> |
@@ -60,10 +62,8 @@ static void lapb_send_iframe(struct lapb_cb *lapb, struct sk_buff *skb, int poll | |||
60 | *frame |= lapb->vs << 1; | 62 | *frame |= lapb->vs << 1; |
61 | } | 63 | } |
62 | 64 | ||
63 | #if LAPB_DEBUG > 1 | 65 | lapb_dbg(1, "(%p) S%d TX I(%d) S%d R%d\n", |
64 | printk(KERN_DEBUG "lapb: (%p) S%d TX I(%d) S%d R%d\n", | 66 | lapb->dev, lapb->state, poll_bit, lapb->vs, lapb->vr); |
65 | lapb->dev, lapb->state, poll_bit, lapb->vs, lapb->vr); | ||
66 | #endif | ||
67 | 67 | ||
68 | lapb_transmit_buffer(lapb, skb, LAPB_COMMAND); | 68 | lapb_transmit_buffer(lapb, skb, LAPB_COMMAND); |
69 | } | 69 | } |
@@ -148,11 +148,9 @@ void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *skb, int type) | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | #if LAPB_DEBUG > 2 | 151 | lapb_dbg(2, "(%p) S%d TX %02X %02X %02X\n", |
152 | printk(KERN_DEBUG "lapb: (%p) S%d TX %02X %02X %02X\n", | 152 | lapb->dev, lapb->state, |
153 | lapb->dev, lapb->state, | 153 | skb->data[0], skb->data[1], skb->data[2]); |
154 | skb->data[0], skb->data[1], skb->data[2]); | ||
155 | #endif | ||
156 | 154 | ||
157 | if (!lapb_data_transmit(lapb, skb)) | 155 | if (!lapb_data_transmit(lapb, skb)) |
158 | kfree_skb(skb); | 156 | kfree_skb(skb); |
@@ -164,16 +162,10 @@ void lapb_establish_data_link(struct lapb_cb *lapb) | |||
164 | lapb->n2count = 0; | 162 | lapb->n2count = 0; |
165 | 163 | ||
166 | if (lapb->mode & LAPB_EXTENDED) { | 164 | if (lapb->mode & LAPB_EXTENDED) { |
167 | #if LAPB_DEBUG > 1 | 165 | lapb_dbg(1, "(%p) S%d TX SABME(1)\n", lapb->dev, lapb->state); |
168 | printk(KERN_DEBUG "lapb: (%p) S%d TX SABME(1)\n", | ||
169 | lapb->dev, lapb->state); | ||
170 | #endif | ||
171 | lapb_send_control(lapb, LAPB_SABME, LAPB_POLLON, LAPB_COMMAND); | 166 | lapb_send_control(lapb, LAPB_SABME, LAPB_POLLON, LAPB_COMMAND); |
172 | } else { | 167 | } else { |
173 | #if LAPB_DEBUG > 1 | 168 | lapb_dbg(1, "(%p) S%d TX SABM(1)\n", lapb->dev, lapb->state); |
174 | printk(KERN_DEBUG "lapb: (%p) S%d TX SABM(1)\n", | ||
175 | lapb->dev, lapb->state); | ||
176 | #endif | ||
177 | lapb_send_control(lapb, LAPB_SABM, LAPB_POLLON, LAPB_COMMAND); | 169 | lapb_send_control(lapb, LAPB_SABM, LAPB_POLLON, LAPB_COMMAND); |
178 | } | 170 | } |
179 | 171 | ||
@@ -183,10 +175,8 @@ void lapb_establish_data_link(struct lapb_cb *lapb) | |||
183 | 175 | ||
184 | void lapb_enquiry_response(struct lapb_cb *lapb) | 176 | void lapb_enquiry_response(struct lapb_cb *lapb) |
185 | { | 177 | { |
186 | #if LAPB_DEBUG > 1 | 178 | lapb_dbg(1, "(%p) S%d TX RR(1) R%d\n", |
187 | printk(KERN_DEBUG "lapb: (%p) S%d TX RR(1) R%d\n", | 179 | lapb->dev, lapb->state, lapb->vr); |
188 | lapb->dev, lapb->state, lapb->vr); | ||
189 | #endif | ||
190 | 180 | ||
191 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLON, LAPB_RESPONSE); | 181 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLON, LAPB_RESPONSE); |
192 | 182 | ||
@@ -195,10 +185,8 @@ void lapb_enquiry_response(struct lapb_cb *lapb) | |||
195 | 185 | ||
196 | void lapb_timeout_response(struct lapb_cb *lapb) | 186 | void lapb_timeout_response(struct lapb_cb *lapb) |
197 | { | 187 | { |
198 | #if LAPB_DEBUG > 1 | 188 | lapb_dbg(1, "(%p) S%d TX RR(0) R%d\n", |
199 | printk(KERN_DEBUG "lapb: (%p) S%d TX RR(0) R%d\n", | 189 | lapb->dev, lapb->state, lapb->vr); |
200 | lapb->dev, lapb->state, lapb->vr); | ||
201 | #endif | ||
202 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLOFF, LAPB_RESPONSE); | 190 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLOFF, LAPB_RESPONSE); |
203 | 191 | ||
204 | lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; | 192 | lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; |
diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c index 066225b4e824..9d0a426eccbb 100644 --- a/net/lapb/lapb_subr.c +++ b/net/lapb/lapb_subr.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * LAPB 001 Jonathan Naylor Started Coding | 13 | * LAPB 001 Jonathan Naylor Started Coding |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
17 | |||
16 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
17 | #include <linux/types.h> | 19 | #include <linux/types.h> |
18 | #include <linux/socket.h> | 20 | #include <linux/socket.h> |
@@ -111,11 +113,9 @@ int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb, | |||
111 | { | 113 | { |
112 | frame->type = LAPB_ILLEGAL; | 114 | frame->type = LAPB_ILLEGAL; |
113 | 115 | ||
114 | #if LAPB_DEBUG > 2 | 116 | lapb_dbg(2, "(%p) S%d RX %02X %02X %02X\n", |
115 | printk(KERN_DEBUG "lapb: (%p) S%d RX %02X %02X %02X\n", | 117 | lapb->dev, lapb->state, |
116 | lapb->dev, lapb->state, | 118 | skb->data[0], skb->data[1], skb->data[2]); |
117 | skb->data[0], skb->data[1], skb->data[2]); | ||
118 | #endif | ||
119 | 119 | ||
120 | /* We always need to look at 2 bytes, sometimes we need | 120 | /* We always need to look at 2 bytes, sometimes we need |
121 | * to look at 3 and those cases are handled below. | 121 | * to look at 3 and those cases are handled below. |
@@ -284,12 +284,10 @@ void lapb_transmit_frmr(struct lapb_cb *lapb) | |||
284 | dptr++; | 284 | dptr++; |
285 | *dptr++ = lapb->frmr_type; | 285 | *dptr++ = lapb->frmr_type; |
286 | 286 | ||
287 | #if LAPB_DEBUG > 1 | 287 | lapb_dbg(1, "(%p) S%d TX FRMR %02X %02X %02X %02X %02X\n", |
288 | printk(KERN_DEBUG "lapb: (%p) S%d TX FRMR %02X %02X %02X %02X %02X\n", | 288 | lapb->dev, lapb->state, |
289 | lapb->dev, lapb->state, | 289 | skb->data[1], skb->data[2], skb->data[3], |
290 | skb->data[1], skb->data[2], skb->data[3], | 290 | skb->data[4], skb->data[5]); |
291 | skb->data[4], skb->data[5]); | ||
292 | #endif | ||
293 | } else { | 291 | } else { |
294 | dptr = skb_put(skb, 4); | 292 | dptr = skb_put(skb, 4); |
295 | *dptr++ = LAPB_FRMR; | 293 | *dptr++ = LAPB_FRMR; |
@@ -301,11 +299,9 @@ void lapb_transmit_frmr(struct lapb_cb *lapb) | |||
301 | dptr++; | 299 | dptr++; |
302 | *dptr++ = lapb->frmr_type; | 300 | *dptr++ = lapb->frmr_type; |
303 | 301 | ||
304 | #if LAPB_DEBUG > 1 | 302 | lapb_dbg(1, "(%p) S%d TX FRMR %02X %02X %02X\n", |
305 | printk(KERN_DEBUG "lapb: (%p) S%d TX FRMR %02X %02X %02X\n", | 303 | lapb->dev, lapb->state, skb->data[1], |
306 | lapb->dev, lapb->state, skb->data[1], | 304 | skb->data[2], skb->data[3]); |
307 | skb->data[2], skb->data[3]); | ||
308 | #endif | ||
309 | } | 305 | } |
310 | 306 | ||
311 | lapb_transmit_buffer(lapb, skb, LAPB_RESPONSE); | 307 | lapb_transmit_buffer(lapb, skb, LAPB_RESPONSE); |
diff --git a/net/lapb/lapb_timer.c b/net/lapb/lapb_timer.c index f8cd641dfc82..54563ad8aeb1 100644 --- a/net/lapb/lapb_timer.c +++ b/net/lapb/lapb_timer.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * LAPB 002 Jonathan Naylor New timer architecture. | 14 | * LAPB 002 Jonathan Naylor New timer architecture. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
18 | |||
17 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
19 | #include <linux/socket.h> | 21 | #include <linux/socket.h> |
@@ -105,21 +107,17 @@ static void lapb_t1timer_expiry(unsigned long param) | |||
105 | lapb_clear_queues(lapb); | 107 | lapb_clear_queues(lapb); |
106 | lapb->state = LAPB_STATE_0; | 108 | lapb->state = LAPB_STATE_0; |
107 | lapb_disconnect_indication(lapb, LAPB_TIMEDOUT); | 109 | lapb_disconnect_indication(lapb, LAPB_TIMEDOUT); |
108 | #if LAPB_DEBUG > 0 | 110 | lapb_dbg(0, "(%p) S1 -> S0\n", lapb->dev); |
109 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); | ||
110 | #endif | ||
111 | return; | 111 | return; |
112 | } else { | 112 | } else { |
113 | lapb->n2count++; | 113 | lapb->n2count++; |
114 | if (lapb->mode & LAPB_EXTENDED) { | 114 | if (lapb->mode & LAPB_EXTENDED) { |
115 | #if LAPB_DEBUG > 1 | 115 | lapb_dbg(1, "(%p) S1 TX SABME(1)\n", |
116 | printk(KERN_DEBUG "lapb: (%p) S1 TX SABME(1)\n", lapb->dev); | 116 | lapb->dev); |
117 | #endif | ||
118 | lapb_send_control(lapb, LAPB_SABME, LAPB_POLLON, LAPB_COMMAND); | 117 | lapb_send_control(lapb, LAPB_SABME, LAPB_POLLON, LAPB_COMMAND); |
119 | } else { | 118 | } else { |
120 | #if LAPB_DEBUG > 1 | 119 | lapb_dbg(1, "(%p) S1 TX SABM(1)\n", |
121 | printk(KERN_DEBUG "lapb: (%p) S1 TX SABM(1)\n", lapb->dev); | 120 | lapb->dev); |
122 | #endif | ||
123 | lapb_send_control(lapb, LAPB_SABM, LAPB_POLLON, LAPB_COMMAND); | 121 | lapb_send_control(lapb, LAPB_SABM, LAPB_POLLON, LAPB_COMMAND); |
124 | } | 122 | } |
125 | } | 123 | } |
@@ -133,15 +131,11 @@ static void lapb_t1timer_expiry(unsigned long param) | |||
133 | lapb_clear_queues(lapb); | 131 | lapb_clear_queues(lapb); |
134 | lapb->state = LAPB_STATE_0; | 132 | lapb->state = LAPB_STATE_0; |
135 | lapb_disconnect_confirmation(lapb, LAPB_TIMEDOUT); | 133 | lapb_disconnect_confirmation(lapb, LAPB_TIMEDOUT); |
136 | #if LAPB_DEBUG > 0 | 134 | lapb_dbg(0, "(%p) S2 -> S0\n", lapb->dev); |
137 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", lapb->dev); | ||
138 | #endif | ||
139 | return; | 135 | return; |
140 | } else { | 136 | } else { |
141 | lapb->n2count++; | 137 | lapb->n2count++; |
142 | #if LAPB_DEBUG > 1 | 138 | lapb_dbg(1, "(%p) S2 TX DISC(1)\n", lapb->dev); |
143 | printk(KERN_DEBUG "lapb: (%p) S2 TX DISC(1)\n", lapb->dev); | ||
144 | #endif | ||
145 | lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); | 139 | lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); |
146 | } | 140 | } |
147 | break; | 141 | break; |
@@ -155,9 +149,7 @@ static void lapb_t1timer_expiry(unsigned long param) | |||
155 | lapb->state = LAPB_STATE_0; | 149 | lapb->state = LAPB_STATE_0; |
156 | lapb_stop_t2timer(lapb); | 150 | lapb_stop_t2timer(lapb); |
157 | lapb_disconnect_indication(lapb, LAPB_TIMEDOUT); | 151 | lapb_disconnect_indication(lapb, LAPB_TIMEDOUT); |
158 | #if LAPB_DEBUG > 0 | 152 | lapb_dbg(0, "(%p) S3 -> S0\n", lapb->dev); |
159 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", lapb->dev); | ||
160 | #endif | ||
161 | return; | 153 | return; |
162 | } else { | 154 | } else { |
163 | lapb->n2count++; | 155 | lapb->n2count++; |
@@ -173,9 +165,7 @@ static void lapb_t1timer_expiry(unsigned long param) | |||
173 | lapb_clear_queues(lapb); | 165 | lapb_clear_queues(lapb); |
174 | lapb->state = LAPB_STATE_0; | 166 | lapb->state = LAPB_STATE_0; |
175 | lapb_disconnect_indication(lapb, LAPB_TIMEDOUT); | 167 | lapb_disconnect_indication(lapb, LAPB_TIMEDOUT); |
176 | #if LAPB_DEBUG > 0 | 168 | lapb_dbg(0, "(%p) S4 -> S0\n", lapb->dev); |
177 | printk(KERN_DEBUG "lapb: (%p) S4 -> S0\n", lapb->dev); | ||
178 | #endif | ||
179 | return; | 169 | return; |
180 | } else { | 170 | } else { |
181 | lapb->n2count++; | 171 | lapb->n2count++; |