diff options
author | Joe Perches <joe@perches.com> | 2011-07-01 05:43:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-01 19:11:16 -0400 |
commit | fcb261f35714fdf3d5c37d714e55b507b8cd55bc (patch) | |
tree | b54a2157be5f4a19cecf603283db80107dd50201 /net/lapb | |
parent | 207ec0abbed50b43a44cb7c69a07aeee08da5e45 (diff) |
lapb: Reduce switch/case indent
Make the case labels the same indent as the switch.
git diff -w shows 80 column reflowing.
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 | 30 | ||||
-rw-r--r-- | net/lapb/lapb_in.c | 881 |
2 files changed, 444 insertions, 467 deletions
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index d5d8d555c410..956b7e47dc52 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c | |||
@@ -300,26 +300,26 @@ int lapb_disconnect_request(struct net_device *dev) | |||
300 | goto out; | 300 | goto out; |
301 | 301 | ||
302 | switch (lapb->state) { | 302 | switch (lapb->state) { |
303 | case LAPB_STATE_0: | 303 | case LAPB_STATE_0: |
304 | rc = LAPB_NOTCONNECTED; | 304 | rc = LAPB_NOTCONNECTED; |
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 | #if LAPB_DEBUG > 1 |
309 | printk(KERN_DEBUG "lapb: (%p) S1 TX DISC(1)\n", lapb->dev); | 309 | printk(KERN_DEBUG "lapb: (%p) S1 TX DISC(1)\n", lapb->dev); |
310 | #endif | 310 | #endif |
311 | #if LAPB_DEBUG > 0 | 311 | #if LAPB_DEBUG > 0 |
312 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); | 312 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); |
313 | #endif | 313 | #endif |
314 | lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); | 314 | lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); |
315 | lapb->state = LAPB_STATE_0; | 315 | lapb->state = LAPB_STATE_0; |
316 | lapb_start_t1timer(lapb); | 316 | lapb_start_t1timer(lapb); |
317 | rc = LAPB_NOTCONNECTED; | 317 | rc = LAPB_NOTCONNECTED; |
318 | goto out_put; | 318 | goto out_put; |
319 | 319 | ||
320 | case LAPB_STATE_2: | 320 | case LAPB_STATE_2: |
321 | rc = LAPB_OK; | 321 | rc = LAPB_OK; |
322 | goto out_put; | 322 | goto out_put; |
323 | } | 323 | } |
324 | 324 | ||
325 | lapb_clear_queues(lapb); | 325 | lapb_clear_queues(lapb); |
diff --git a/net/lapb/lapb_in.c b/net/lapb/lapb_in.c index 21904a002449..2ec1af5c36cc 100644 --- a/net/lapb/lapb_in.c +++ b/net/lapb/lapb_in.c | |||
@@ -44,89 +44,86 @@ static void lapb_state0_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
44 | struct lapb_frame *frame) | 44 | struct lapb_frame *frame) |
45 | { | 45 | { |
46 | switch (frame->type) { | 46 | switch (frame->type) { |
47 | case LAPB_SABM: | 47 | case LAPB_SABM: |
48 | #if LAPB_DEBUG > 1 | 48 | #if LAPB_DEBUG > 1 |
49 | printk(KERN_DEBUG "lapb: (%p) S0 RX SABM(%d)\n", | 49 | printk(KERN_DEBUG "lapb: (%p) S0 RX SABM(%d)\n", |
50 | lapb->dev, frame->pf); | 50 | lapb->dev, frame->pf); |
51 | #endif | 51 | #endif |
52 | if (lapb->mode & LAPB_EXTENDED) { | 52 | if (lapb->mode & LAPB_EXTENDED) { |
53 | #if LAPB_DEBUG > 1 | 53 | #if LAPB_DEBUG > 1 |
54 | printk(KERN_DEBUG "lapb: (%p) S0 TX DM(%d)\n", | 54 | printk(KERN_DEBUG "lapb: (%p) S0 TX DM(%d)\n", |
55 | lapb->dev, frame->pf); | 55 | lapb->dev, frame->pf); |
56 | #endif | 56 | #endif |
57 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 57 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
58 | LAPB_RESPONSE); | 58 | LAPB_RESPONSE); |
59 | } else { | 59 | } else { |
60 | #if LAPB_DEBUG > 1 | 60 | #if LAPB_DEBUG > 1 |
61 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", | 61 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", |
62 | lapb->dev, frame->pf); | 62 | lapb->dev, frame->pf); |
63 | #endif | 63 | #endif |
64 | #if LAPB_DEBUG > 0 | 64 | #if LAPB_DEBUG > 0 |
65 | printk(KERN_DEBUG "lapb: (%p) S0 -> S3\n", | 65 | printk(KERN_DEBUG "lapb: (%p) S0 -> S3\n", lapb->dev); |
66 | lapb->dev); | ||
67 | #endif | 66 | #endif |
68 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 67 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
69 | LAPB_RESPONSE); | 68 | LAPB_RESPONSE); |
70 | lapb_stop_t1timer(lapb); | 69 | lapb_stop_t1timer(lapb); |
71 | lapb_stop_t2timer(lapb); | 70 | lapb_stop_t2timer(lapb); |
72 | lapb->state = LAPB_STATE_3; | 71 | lapb->state = LAPB_STATE_3; |
73 | lapb->condition = 0x00; | 72 | lapb->condition = 0x00; |
74 | lapb->n2count = 0; | 73 | lapb->n2count = 0; |
75 | lapb->vs = 0; | 74 | lapb->vs = 0; |
76 | lapb->vr = 0; | 75 | lapb->vr = 0; |
77 | lapb->va = 0; | 76 | lapb->va = 0; |
78 | lapb_connect_indication(lapb, LAPB_OK); | 77 | lapb_connect_indication(lapb, LAPB_OK); |
79 | } | 78 | } |
80 | break; | 79 | break; |
81 | 80 | ||
82 | case LAPB_SABME: | 81 | case LAPB_SABME: |
83 | #if LAPB_DEBUG > 1 | 82 | #if LAPB_DEBUG > 1 |
84 | printk(KERN_DEBUG "lapb: (%p) S0 RX SABME(%d)\n", | 83 | printk(KERN_DEBUG "lapb: (%p) S0 RX SABME(%d)\n", |
85 | lapb->dev, frame->pf); | 84 | lapb->dev, frame->pf); |
86 | #endif | 85 | #endif |
87 | if (lapb->mode & LAPB_EXTENDED) { | 86 | if (lapb->mode & LAPB_EXTENDED) { |
88 | #if LAPB_DEBUG > 1 | 87 | #if LAPB_DEBUG > 1 |
89 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", | 88 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", |
90 | lapb->dev, frame->pf); | 89 | lapb->dev, frame->pf); |
91 | #endif | 90 | #endif |
92 | #if LAPB_DEBUG > 0 | 91 | #if LAPB_DEBUG > 0 |
93 | printk(KERN_DEBUG "lapb: (%p) S0 -> S3\n", | 92 | printk(KERN_DEBUG "lapb: (%p) S0 -> S3\n", lapb->dev); |
94 | lapb->dev); | ||
95 | #endif | 93 | #endif |
96 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 94 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
97 | LAPB_RESPONSE); | 95 | LAPB_RESPONSE); |
98 | lapb_stop_t1timer(lapb); | 96 | lapb_stop_t1timer(lapb); |
99 | lapb_stop_t2timer(lapb); | 97 | lapb_stop_t2timer(lapb); |
100 | lapb->state = LAPB_STATE_3; | 98 | lapb->state = LAPB_STATE_3; |
101 | lapb->condition = 0x00; | 99 | lapb->condition = 0x00; |
102 | lapb->n2count = 0; | 100 | lapb->n2count = 0; |
103 | lapb->vs = 0; | 101 | lapb->vs = 0; |
104 | lapb->vr = 0; | 102 | lapb->vr = 0; |
105 | lapb->va = 0; | 103 | lapb->va = 0; |
106 | lapb_connect_indication(lapb, LAPB_OK); | 104 | lapb_connect_indication(lapb, LAPB_OK); |
107 | } else { | 105 | } else { |
108 | #if LAPB_DEBUG > 1 | 106 | #if LAPB_DEBUG > 1 |
109 | printk(KERN_DEBUG "lapb: (%p) S0 TX DM(%d)\n", | 107 | printk(KERN_DEBUG "lapb: (%p) S0 TX DM(%d)\n", |
110 | lapb->dev, frame->pf); | 108 | lapb->dev, frame->pf); |
111 | #endif | 109 | #endif |
112 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 110 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
113 | LAPB_RESPONSE); | 111 | LAPB_RESPONSE); |
114 | } | 112 | } |
115 | break; | 113 | break; |
116 | 114 | ||
117 | case LAPB_DISC: | 115 | case LAPB_DISC: |
118 | #if LAPB_DEBUG > 1 | 116 | #if LAPB_DEBUG > 1 |
119 | printk(KERN_DEBUG "lapb: (%p) S0 RX DISC(%d)\n", | 117 | printk(KERN_DEBUG "lapb: (%p) S0 RX DISC(%d)\n", |
120 | lapb->dev, frame->pf); | 118 | lapb->dev, frame->pf); |
121 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", | 119 | printk(KERN_DEBUG "lapb: (%p) S0 TX UA(%d)\n", |
122 | lapb->dev, frame->pf); | 120 | lapb->dev, frame->pf); |
123 | #endif | 121 | #endif |
124 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 122 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); |
125 | LAPB_RESPONSE); | 123 | break; |
126 | break; | ||
127 | 124 | ||
128 | default: | 125 | default: |
129 | break; | 126 | break; |
130 | } | 127 | } |
131 | 128 | ||
132 | kfree_skb(skb); | 129 | kfree_skb(skb); |
@@ -140,100 +137,97 @@ static void lapb_state1_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
140 | struct lapb_frame *frame) | 137 | struct lapb_frame *frame) |
141 | { | 138 | { |
142 | switch (frame->type) { | 139 | switch (frame->type) { |
143 | case LAPB_SABM: | 140 | case LAPB_SABM: |
144 | #if LAPB_DEBUG > 1 | 141 | #if LAPB_DEBUG > 1 |
145 | printk(KERN_DEBUG "lapb: (%p) S1 RX SABM(%d)\n", | 142 | printk(KERN_DEBUG "lapb: (%p) S1 RX SABM(%d)\n", |
146 | lapb->dev, frame->pf); | 143 | lapb->dev, frame->pf); |
147 | #endif | 144 | #endif |
148 | if (lapb->mode & LAPB_EXTENDED) { | 145 | if (lapb->mode & LAPB_EXTENDED) { |
149 | #if LAPB_DEBUG > 1 | 146 | #if LAPB_DEBUG > 1 |
150 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | 147 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", |
151 | lapb->dev, frame->pf); | 148 | lapb->dev, frame->pf); |
152 | #endif | ||
153 | lapb_send_control(lapb, LAPB_DM, frame->pf, | ||
154 | LAPB_RESPONSE); | ||
155 | } else { | ||
156 | #if LAPB_DEBUG > 1 | ||
157 | printk(KERN_DEBUG "lapb: (%p) S1 TX UA(%d)\n", | ||
158 | lapb->dev, frame->pf); | ||
159 | #endif | 149 | #endif |
160 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 150 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
161 | LAPB_RESPONSE); | 151 | LAPB_RESPONSE); |
162 | } | 152 | } else { |
163 | break; | ||
164 | |||
165 | case LAPB_SABME: | ||
166 | #if LAPB_DEBUG > 1 | 153 | #if LAPB_DEBUG > 1 |
167 | printk(KERN_DEBUG "lapb: (%p) S1 RX SABME(%d)\n", | 154 | printk(KERN_DEBUG "lapb: (%p) S1 TX UA(%d)\n", |
168 | lapb->dev, frame->pf); | 155 | lapb->dev, frame->pf); |
169 | #endif | 156 | #endif |
170 | if (lapb->mode & LAPB_EXTENDED) { | 157 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
158 | LAPB_RESPONSE); | ||
159 | } | ||
160 | break; | ||
161 | |||
162 | case LAPB_SABME: | ||
171 | #if LAPB_DEBUG > 1 | 163 | #if LAPB_DEBUG > 1 |
172 | printk(KERN_DEBUG "lapb: (%p) S1 TX UA(%d)\n", | 164 | printk(KERN_DEBUG "lapb: (%p) S1 RX SABME(%d)\n", |
173 | lapb->dev, frame->pf); | 165 | lapb->dev, frame->pf); |
174 | #endif | 166 | #endif |
175 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 167 | if (lapb->mode & LAPB_EXTENDED) { |
176 | LAPB_RESPONSE); | ||
177 | } else { | ||
178 | #if LAPB_DEBUG > 1 | 168 | #if LAPB_DEBUG > 1 |
179 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | 169 | printk(KERN_DEBUG "lapb: (%p) S1 TX UA(%d)\n", |
180 | lapb->dev, frame->pf); | 170 | lapb->dev, frame->pf); |
181 | #endif | 171 | #endif |
182 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 172 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
183 | LAPB_RESPONSE); | 173 | LAPB_RESPONSE); |
184 | } | 174 | } else { |
185 | break; | ||
186 | |||
187 | case LAPB_DISC: | ||
188 | #if LAPB_DEBUG > 1 | 175 | #if LAPB_DEBUG > 1 |
189 | printk(KERN_DEBUG "lapb: (%p) S1 RX DISC(%d)\n", | ||
190 | lapb->dev, frame->pf); | ||
191 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | 176 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", |
192 | lapb->dev, frame->pf); | 177 | lapb->dev, frame->pf); |
193 | #endif | 178 | #endif |
194 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 179 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
195 | LAPB_RESPONSE); | 180 | LAPB_RESPONSE); |
196 | break; | 181 | } |
182 | break; | ||
197 | 183 | ||
198 | case LAPB_UA: | 184 | case LAPB_DISC: |
199 | #if LAPB_DEBUG > 1 | 185 | #if LAPB_DEBUG > 1 |
200 | printk(KERN_DEBUG "lapb: (%p) S1 RX UA(%d)\n", | 186 | printk(KERN_DEBUG "lapb: (%p) S1 RX DISC(%d)\n", |
201 | lapb->dev, frame->pf); | 187 | lapb->dev, frame->pf); |
188 | printk(KERN_DEBUG "lapb: (%p) S1 TX DM(%d)\n", | ||
189 | lapb->dev, frame->pf); | ||
202 | #endif | 190 | #endif |
203 | if (frame->pf) { | 191 | lapb_send_control(lapb, LAPB_DM, frame->pf, LAPB_RESPONSE); |
204 | #if LAPB_DEBUG > 0 | 192 | break; |
205 | printk(KERN_DEBUG "lapb: (%p) S1 -> S3\n", | ||
206 | lapb->dev); | ||
207 | #endif | ||
208 | lapb_stop_t1timer(lapb); | ||
209 | lapb_stop_t2timer(lapb); | ||
210 | lapb->state = LAPB_STATE_3; | ||
211 | lapb->condition = 0x00; | ||
212 | lapb->n2count = 0; | ||
213 | lapb->vs = 0; | ||
214 | lapb->vr = 0; | ||
215 | lapb->va = 0; | ||
216 | lapb_connect_confirmation(lapb, LAPB_OK); | ||
217 | } | ||
218 | break; | ||
219 | 193 | ||
220 | case LAPB_DM: | 194 | case LAPB_UA: |
221 | #if LAPB_DEBUG > 1 | 195 | #if LAPB_DEBUG > 1 |
222 | printk(KERN_DEBUG "lapb: (%p) S1 RX DM(%d)\n", | 196 | printk(KERN_DEBUG "lapb: (%p) S1 RX UA(%d)\n", |
223 | lapb->dev, frame->pf); | 197 | lapb->dev, frame->pf); |
224 | #endif | 198 | #endif |
225 | if (frame->pf) { | 199 | if (frame->pf) { |
226 | #if LAPB_DEBUG > 0 | 200 | #if LAPB_DEBUG > 0 |
227 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", | 201 | printk(KERN_DEBUG "lapb: (%p) S1 -> S3\n", lapb->dev); |
228 | lapb->dev); | 202 | #endif |
229 | #endif | 203 | lapb_stop_t1timer(lapb); |
230 | lapb_clear_queues(lapb); | 204 | lapb_stop_t2timer(lapb); |
231 | lapb->state = LAPB_STATE_0; | 205 | lapb->state = LAPB_STATE_3; |
232 | lapb_start_t1timer(lapb); | 206 | lapb->condition = 0x00; |
233 | lapb_stop_t2timer(lapb); | 207 | lapb->n2count = 0; |
234 | lapb_disconnect_indication(lapb, LAPB_REFUSED); | 208 | lapb->vs = 0; |
235 | } | 209 | lapb->vr = 0; |
236 | break; | 210 | lapb->va = 0; |
211 | lapb_connect_confirmation(lapb, LAPB_OK); | ||
212 | } | ||
213 | break; | ||
214 | |||
215 | case LAPB_DM: | ||
216 | #if LAPB_DEBUG > 1 | ||
217 | printk(KERN_DEBUG "lapb: (%p) S1 RX DM(%d)\n", | ||
218 | lapb->dev, frame->pf); | ||
219 | #endif | ||
220 | if (frame->pf) { | ||
221 | #if LAPB_DEBUG > 0 | ||
222 | printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); | ||
223 | #endif | ||
224 | lapb_clear_queues(lapb); | ||
225 | lapb->state = LAPB_STATE_0; | ||
226 | lapb_start_t1timer(lapb); | ||
227 | lapb_stop_t2timer(lapb); | ||
228 | lapb_disconnect_indication(lapb, LAPB_REFUSED); | ||
229 | } | ||
230 | break; | ||
237 | } | 231 | } |
238 | 232 | ||
239 | kfree_skb(skb); | 233 | kfree_skb(skb); |
@@ -247,78 +241,73 @@ static void lapb_state2_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
247 | struct lapb_frame *frame) | 241 | struct lapb_frame *frame) |
248 | { | 242 | { |
249 | switch (frame->type) { | 243 | switch (frame->type) { |
250 | case LAPB_SABM: | 244 | case LAPB_SABM: |
251 | case LAPB_SABME: | 245 | case LAPB_SABME: |
252 | #if LAPB_DEBUG > 1 | 246 | #if LAPB_DEBUG > 1 |
253 | printk(KERN_DEBUG "lapb: (%p) S2 RX {SABM,SABME}(%d)\n", | 247 | printk(KERN_DEBUG "lapb: (%p) S2 RX {SABM,SABME}(%d)\n", |
254 | lapb->dev, frame->pf); | 248 | lapb->dev, frame->pf); |
255 | printk(KERN_DEBUG "lapb: (%p) S2 TX DM(%d)\n", | 249 | printk(KERN_DEBUG "lapb: (%p) S2 TX DM(%d)\n", |
256 | lapb->dev, frame->pf); | 250 | lapb->dev, frame->pf); |
257 | #endif | 251 | #endif |
258 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 252 | lapb_send_control(lapb, LAPB_DM, frame->pf, LAPB_RESPONSE); |
259 | LAPB_RESPONSE); | 253 | break; |
260 | break; | ||
261 | 254 | ||
262 | case LAPB_DISC: | 255 | case LAPB_DISC: |
263 | #if LAPB_DEBUG > 1 | 256 | #if LAPB_DEBUG > 1 |
264 | printk(KERN_DEBUG "lapb: (%p) S2 RX DISC(%d)\n", | 257 | printk(KERN_DEBUG "lapb: (%p) S2 RX DISC(%d)\n", |
265 | lapb->dev, frame->pf); | 258 | lapb->dev, frame->pf); |
266 | printk(KERN_DEBUG "lapb: (%p) S2 TX UA(%d)\n", | 259 | printk(KERN_DEBUG "lapb: (%p) S2 TX UA(%d)\n", |
267 | lapb->dev, frame->pf); | 260 | lapb->dev, frame->pf); |
268 | #endif | 261 | #endif |
269 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 262 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); |
270 | LAPB_RESPONSE); | 263 | break; |
271 | break; | ||
272 | 264 | ||
273 | case LAPB_UA: | 265 | case LAPB_UA: |
274 | #if LAPB_DEBUG > 1 | 266 | #if LAPB_DEBUG > 1 |
275 | printk(KERN_DEBUG "lapb: (%p) S2 RX UA(%d)\n", | 267 | printk(KERN_DEBUG "lapb: (%p) S2 RX UA(%d)\n", |
276 | lapb->dev, frame->pf); | 268 | lapb->dev, frame->pf); |
277 | #endif | 269 | #endif |
278 | if (frame->pf) { | 270 | if (frame->pf) { |
279 | #if LAPB_DEBUG > 0 | 271 | #if LAPB_DEBUG > 0 |
280 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", | 272 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", lapb->dev); |
281 | lapb->dev); | ||
282 | #endif | 273 | #endif |
283 | lapb->state = LAPB_STATE_0; | 274 | lapb->state = LAPB_STATE_0; |
284 | lapb_start_t1timer(lapb); | 275 | lapb_start_t1timer(lapb); |
285 | lapb_stop_t2timer(lapb); | 276 | lapb_stop_t2timer(lapb); |
286 | lapb_disconnect_confirmation(lapb, LAPB_OK); | 277 | lapb_disconnect_confirmation(lapb, LAPB_OK); |
287 | } | 278 | } |
288 | break; | 279 | break; |
289 | 280 | ||
290 | case LAPB_DM: | 281 | case LAPB_DM: |
291 | #if LAPB_DEBUG > 1 | 282 | #if LAPB_DEBUG > 1 |
292 | printk(KERN_DEBUG "lapb: (%p) S2 RX DM(%d)\n", | 283 | printk(KERN_DEBUG "lapb: (%p) S2 RX DM(%d)\n", |
293 | lapb->dev, frame->pf); | 284 | lapb->dev, frame->pf); |
294 | #endif | 285 | #endif |
295 | if (frame->pf) { | 286 | if (frame->pf) { |
296 | #if LAPB_DEBUG > 0 | 287 | #if LAPB_DEBUG > 0 |
297 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", | 288 | printk(KERN_DEBUG "lapb: (%p) S2 -> S0\n", lapb->dev); |
298 | lapb->dev); | 289 | #endif |
299 | #endif | 290 | lapb->state = LAPB_STATE_0; |
300 | lapb->state = LAPB_STATE_0; | 291 | lapb_start_t1timer(lapb); |
301 | lapb_start_t1timer(lapb); | 292 | lapb_stop_t2timer(lapb); |
302 | lapb_stop_t2timer(lapb); | 293 | lapb_disconnect_confirmation(lapb, LAPB_NOTCONNECTED); |
303 | lapb_disconnect_confirmation(lapb, | 294 | } |
304 | LAPB_NOTCONNECTED); | 295 | break; |
305 | } | ||
306 | break; | ||
307 | 296 | ||
308 | case LAPB_I: | 297 | case LAPB_I: |
309 | case LAPB_REJ: | 298 | case LAPB_REJ: |
310 | case LAPB_RNR: | 299 | case LAPB_RNR: |
311 | case LAPB_RR: | 300 | case LAPB_RR: |
312 | #if LAPB_DEBUG > 1 | 301 | #if LAPB_DEBUG > 1 |
313 | printk(KERN_DEBUG "lapb: (%p) S2 RX {I,REJ,RNR,RR}" | 302 | printk(KERN_DEBUG "lapb: (%p) S2 RX {I,REJ,RNR,RR}(%d)\n", |
314 | "(%d)\n", lapb->dev, frame->pf); | 303 | lapb->dev, frame->pf); |
315 | printk(KERN_DEBUG "lapb: (%p) S2 RX DM(%d)\n", | 304 | printk(KERN_DEBUG "lapb: (%p) S2 RX DM(%d)\n", |
316 | lapb->dev, frame->pf); | 305 | lapb->dev, frame->pf); |
317 | #endif | 306 | #endif |
318 | if (frame->pf) | 307 | if (frame->pf) |
319 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 308 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
320 | LAPB_RESPONSE); | 309 | LAPB_RESPONSE); |
321 | break; | 310 | break; |
322 | } | 311 | } |
323 | 312 | ||
324 | kfree_skb(skb); | 313 | kfree_skb(skb); |
@@ -336,277 +325,267 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
336 | LAPB_SMODULUS; | 325 | LAPB_SMODULUS; |
337 | 326 | ||
338 | switch (frame->type) { | 327 | switch (frame->type) { |
339 | case LAPB_SABM: | 328 | case LAPB_SABM: |
340 | #if LAPB_DEBUG > 1 | 329 | #if LAPB_DEBUG > 1 |
341 | printk(KERN_DEBUG "lapb: (%p) S3 RX SABM(%d)\n", | 330 | printk(KERN_DEBUG "lapb: (%p) S3 RX SABM(%d)\n", |
342 | lapb->dev, frame->pf); | 331 | lapb->dev, frame->pf); |
343 | #endif | 332 | #endif |
344 | if (lapb->mode & LAPB_EXTENDED) { | 333 | if (lapb->mode & LAPB_EXTENDED) { |
345 | #if LAPB_DEBUG > 1 | 334 | #if LAPB_DEBUG > 1 |
346 | printk(KERN_DEBUG "lapb: (%p) S3 TX DM(%d)\n", | 335 | printk(KERN_DEBUG "lapb: (%p) S3 TX DM(%d)\n", |
347 | lapb->dev, frame->pf); | 336 | lapb->dev, frame->pf); |
348 | #endif | 337 | #endif |
349 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 338 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
350 | LAPB_RESPONSE); | 339 | LAPB_RESPONSE); |
351 | } else { | 340 | } else { |
352 | #if LAPB_DEBUG > 1 | 341 | #if LAPB_DEBUG > 1 |
353 | printk(KERN_DEBUG "lapb: (%p) S3 TX UA(%d)\n", | 342 | printk(KERN_DEBUG "lapb: (%p) S3 TX UA(%d)\n", |
354 | lapb->dev, frame->pf); | 343 | lapb->dev, frame->pf); |
355 | #endif | 344 | #endif |
356 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 345 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
357 | LAPB_RESPONSE); | 346 | LAPB_RESPONSE); |
358 | lapb_stop_t1timer(lapb); | 347 | lapb_stop_t1timer(lapb); |
359 | lapb_stop_t2timer(lapb); | 348 | lapb_stop_t2timer(lapb); |
360 | lapb->condition = 0x00; | 349 | lapb->condition = 0x00; |
361 | lapb->n2count = 0; | 350 | lapb->n2count = 0; |
362 | lapb->vs = 0; | 351 | lapb->vs = 0; |
363 | lapb->vr = 0; | 352 | lapb->vr = 0; |
364 | lapb->va = 0; | 353 | lapb->va = 0; |
365 | lapb_requeue_frames(lapb); | 354 | lapb_requeue_frames(lapb); |
366 | } | 355 | } |
367 | break; | 356 | break; |
368 | 357 | ||
369 | case LAPB_SABME: | 358 | case LAPB_SABME: |
370 | #if LAPB_DEBUG > 1 | 359 | #if LAPB_DEBUG > 1 |
371 | printk(KERN_DEBUG "lapb: (%p) S3 RX SABME(%d)\n", | 360 | printk(KERN_DEBUG "lapb: (%p) S3 RX SABME(%d)\n", |
372 | lapb->dev, frame->pf); | 361 | lapb->dev, frame->pf); |
373 | #endif | 362 | #endif |
374 | if (lapb->mode & LAPB_EXTENDED) { | 363 | if (lapb->mode & LAPB_EXTENDED) { |
375 | #if LAPB_DEBUG > 1 | 364 | #if LAPB_DEBUG > 1 |
376 | printk(KERN_DEBUG "lapb: (%p) S3 TX UA(%d)\n", | 365 | printk(KERN_DEBUG "lapb: (%p) S3 TX UA(%d)\n", |
377 | lapb->dev, frame->pf); | 366 | lapb->dev, frame->pf); |
378 | #endif | 367 | #endif |
379 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 368 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
380 | LAPB_RESPONSE); | 369 | LAPB_RESPONSE); |
381 | lapb_stop_t1timer(lapb); | 370 | lapb_stop_t1timer(lapb); |
382 | lapb_stop_t2timer(lapb); | 371 | lapb_stop_t2timer(lapb); |
383 | lapb->condition = 0x00; | 372 | lapb->condition = 0x00; |
384 | lapb->n2count = 0; | 373 | lapb->n2count = 0; |
385 | lapb->vs = 0; | 374 | lapb->vs = 0; |
386 | lapb->vr = 0; | 375 | lapb->vr = 0; |
387 | lapb->va = 0; | 376 | lapb->va = 0; |
388 | lapb_requeue_frames(lapb); | 377 | lapb_requeue_frames(lapb); |
389 | } else { | 378 | } else { |
390 | #if LAPB_DEBUG > 1 | 379 | #if LAPB_DEBUG > 1 |
391 | printk(KERN_DEBUG "lapb: (%p) S3 TX DM(%d)\n", | 380 | printk(KERN_DEBUG "lapb: (%p) S3 TX DM(%d)\n", |
392 | lapb->dev, frame->pf); | 381 | lapb->dev, frame->pf); |
393 | #endif | 382 | #endif |
394 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 383 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
395 | LAPB_RESPONSE); | 384 | LAPB_RESPONSE); |
396 | } | 385 | } |
397 | break; | 386 | break; |
398 | 387 | ||
399 | case LAPB_DISC: | 388 | case LAPB_DISC: |
400 | #if LAPB_DEBUG > 1 | 389 | #if LAPB_DEBUG > 1 |
401 | printk(KERN_DEBUG "lapb: (%p) S3 RX DISC(%d)\n", | 390 | printk(KERN_DEBUG "lapb: (%p) S3 RX DISC(%d)\n", |
402 | lapb->dev, frame->pf); | 391 | lapb->dev, frame->pf); |
403 | #endif | 392 | #endif |
404 | #if LAPB_DEBUG > 0 | 393 | #if LAPB_DEBUG > 0 |
405 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", | 394 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", lapb->dev); |
406 | lapb->dev); | ||
407 | #endif | 395 | #endif |
408 | lapb_clear_queues(lapb); | 396 | lapb_clear_queues(lapb); |
409 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 397 | lapb_send_control(lapb, LAPB_UA, frame->pf, LAPB_RESPONSE); |
410 | LAPB_RESPONSE); | 398 | lapb_start_t1timer(lapb); |
411 | lapb_start_t1timer(lapb); | 399 | lapb_stop_t2timer(lapb); |
412 | lapb_stop_t2timer(lapb); | 400 | lapb->state = LAPB_STATE_0; |
413 | lapb->state = LAPB_STATE_0; | 401 | lapb_disconnect_indication(lapb, LAPB_OK); |
414 | lapb_disconnect_indication(lapb, LAPB_OK); | 402 | break; |
415 | break; | ||
416 | 403 | ||
417 | case LAPB_DM: | 404 | case LAPB_DM: |
418 | #if LAPB_DEBUG > 1 | 405 | #if LAPB_DEBUG > 1 |
419 | printk(KERN_DEBUG "lapb: (%p) S3 RX DM(%d)\n", | 406 | printk(KERN_DEBUG "lapb: (%p) S3 RX DM(%d)\n", |
420 | lapb->dev, frame->pf); | 407 | lapb->dev, frame->pf); |
421 | #endif | 408 | #endif |
422 | #if LAPB_DEBUG > 0 | 409 | #if LAPB_DEBUG > 0 |
423 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", | 410 | printk(KERN_DEBUG "lapb: (%p) S3 -> S0\n", lapb->dev); |
424 | lapb->dev); | ||
425 | #endif | 411 | #endif |
426 | lapb_clear_queues(lapb); | 412 | lapb_clear_queues(lapb); |
427 | lapb->state = LAPB_STATE_0; | 413 | lapb->state = LAPB_STATE_0; |
428 | lapb_start_t1timer(lapb); | 414 | lapb_start_t1timer(lapb); |
429 | lapb_stop_t2timer(lapb); | 415 | lapb_stop_t2timer(lapb); |
430 | lapb_disconnect_indication(lapb, LAPB_NOTCONNECTED); | 416 | lapb_disconnect_indication(lapb, LAPB_NOTCONNECTED); |
431 | break; | 417 | break; |
432 | 418 | ||
433 | case LAPB_RNR: | 419 | case LAPB_RNR: |
434 | #if LAPB_DEBUG > 1 | 420 | #if LAPB_DEBUG > 1 |
435 | printk(KERN_DEBUG "lapb: (%p) S3 RX RNR(%d) R%d\n", | 421 | printk(KERN_DEBUG "lapb: (%p) S3 RX RNR(%d) R%d\n", |
436 | lapb->dev, frame->pf, frame->nr); | 422 | lapb->dev, frame->pf, frame->nr); |
437 | #endif | 423 | #endif |
438 | lapb->condition |= LAPB_PEER_RX_BUSY_CONDITION; | 424 | lapb->condition |= LAPB_PEER_RX_BUSY_CONDITION; |
439 | lapb_check_need_response(lapb, frame->cr, frame->pf); | 425 | lapb_check_need_response(lapb, frame->cr, frame->pf); |
440 | if (lapb_validate_nr(lapb, frame->nr)) { | 426 | if (lapb_validate_nr(lapb, frame->nr)) { |
441 | lapb_check_iframes_acked(lapb, frame->nr); | 427 | lapb_check_iframes_acked(lapb, frame->nr); |
442 | } else { | 428 | } else { |
443 | lapb->frmr_data = *frame; | 429 | lapb->frmr_data = *frame; |
444 | lapb->frmr_type = LAPB_FRMR_Z; | 430 | lapb->frmr_type = LAPB_FRMR_Z; |
445 | lapb_transmit_frmr(lapb); | 431 | lapb_transmit_frmr(lapb); |
446 | #if LAPB_DEBUG > 0 | 432 | #if LAPB_DEBUG > 0 |
447 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", | 433 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); |
448 | lapb->dev); | ||
449 | #endif | 434 | #endif |
450 | lapb_start_t1timer(lapb); | 435 | lapb_start_t1timer(lapb); |
451 | lapb_stop_t2timer(lapb); | 436 | lapb_stop_t2timer(lapb); |
452 | lapb->state = LAPB_STATE_4; | 437 | lapb->state = LAPB_STATE_4; |
453 | lapb->n2count = 0; | 438 | lapb->n2count = 0; |
454 | } | 439 | } |
455 | break; | 440 | break; |
456 | 441 | ||
457 | case LAPB_RR: | 442 | case LAPB_RR: |
458 | #if LAPB_DEBUG > 1 | 443 | #if LAPB_DEBUG > 1 |
459 | printk(KERN_DEBUG "lapb: (%p) S3 RX RR(%d) R%d\n", | 444 | printk(KERN_DEBUG "lapb: (%p) S3 RX RR(%d) R%d\n", |
460 | lapb->dev, frame->pf, frame->nr); | 445 | lapb->dev, frame->pf, frame->nr); |
461 | #endif | 446 | #endif |
462 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; | 447 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; |
463 | lapb_check_need_response(lapb, frame->cr, frame->pf); | 448 | lapb_check_need_response(lapb, frame->cr, frame->pf); |
464 | if (lapb_validate_nr(lapb, frame->nr)) { | 449 | if (lapb_validate_nr(lapb, frame->nr)) { |
465 | lapb_check_iframes_acked(lapb, frame->nr); | 450 | lapb_check_iframes_acked(lapb, frame->nr); |
466 | } else { | 451 | } else { |
467 | lapb->frmr_data = *frame; | 452 | lapb->frmr_data = *frame; |
468 | lapb->frmr_type = LAPB_FRMR_Z; | 453 | lapb->frmr_type = LAPB_FRMR_Z; |
469 | lapb_transmit_frmr(lapb); | 454 | lapb_transmit_frmr(lapb); |
470 | #if LAPB_DEBUG > 0 | 455 | #if LAPB_DEBUG > 0 |
471 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", | 456 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); |
472 | lapb->dev); | ||
473 | #endif | 457 | #endif |
474 | lapb_start_t1timer(lapb); | 458 | lapb_start_t1timer(lapb); |
475 | lapb_stop_t2timer(lapb); | 459 | lapb_stop_t2timer(lapb); |
476 | lapb->state = LAPB_STATE_4; | 460 | lapb->state = LAPB_STATE_4; |
477 | lapb->n2count = 0; | 461 | lapb->n2count = 0; |
478 | } | 462 | } |
479 | break; | 463 | break; |
480 | 464 | ||
481 | case LAPB_REJ: | 465 | case LAPB_REJ: |
482 | #if LAPB_DEBUG > 1 | 466 | #if LAPB_DEBUG > 1 |
483 | printk(KERN_DEBUG "lapb: (%p) S3 RX REJ(%d) R%d\n", | 467 | printk(KERN_DEBUG "lapb: (%p) S3 RX REJ(%d) R%d\n", |
484 | lapb->dev, frame->pf, frame->nr); | 468 | lapb->dev, frame->pf, frame->nr); |
485 | #endif | 469 | #endif |
486 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; | 470 | lapb->condition &= ~LAPB_PEER_RX_BUSY_CONDITION; |
487 | lapb_check_need_response(lapb, frame->cr, frame->pf); | 471 | lapb_check_need_response(lapb, frame->cr, frame->pf); |
488 | if (lapb_validate_nr(lapb, frame->nr)) { | 472 | if (lapb_validate_nr(lapb, frame->nr)) { |
489 | lapb_frames_acked(lapb, frame->nr); | 473 | lapb_frames_acked(lapb, frame->nr); |
490 | lapb_stop_t1timer(lapb); | 474 | lapb_stop_t1timer(lapb); |
491 | lapb->n2count = 0; | 475 | lapb->n2count = 0; |
492 | lapb_requeue_frames(lapb); | 476 | lapb_requeue_frames(lapb); |
493 | } else { | 477 | } else { |
494 | lapb->frmr_data = *frame; | 478 | lapb->frmr_data = *frame; |
495 | lapb->frmr_type = LAPB_FRMR_Z; | 479 | lapb->frmr_type = LAPB_FRMR_Z; |
496 | lapb_transmit_frmr(lapb); | 480 | lapb_transmit_frmr(lapb); |
497 | #if LAPB_DEBUG > 0 | 481 | #if LAPB_DEBUG > 0 |
498 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", | 482 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); |
499 | lapb->dev); | ||
500 | #endif | 483 | #endif |
501 | lapb_start_t1timer(lapb); | 484 | lapb_start_t1timer(lapb); |
502 | lapb_stop_t2timer(lapb); | 485 | lapb_stop_t2timer(lapb); |
503 | lapb->state = LAPB_STATE_4; | 486 | lapb->state = LAPB_STATE_4; |
504 | lapb->n2count = 0; | 487 | lapb->n2count = 0; |
505 | } | 488 | } |
506 | break; | 489 | break; |
507 | 490 | ||
508 | case LAPB_I: | 491 | case LAPB_I: |
509 | #if LAPB_DEBUG > 1 | 492 | #if LAPB_DEBUG > 1 |
510 | printk(KERN_DEBUG "lapb: (%p) S3 RX I(%d) S%d R%d\n", | 493 | printk(KERN_DEBUG "lapb: (%p) S3 RX I(%d) S%d R%d\n", |
511 | lapb->dev, frame->pf, frame->ns, frame->nr); | 494 | lapb->dev, frame->pf, frame->ns, frame->nr); |
512 | #endif | 495 | #endif |
513 | if (!lapb_validate_nr(lapb, frame->nr)) { | 496 | if (!lapb_validate_nr(lapb, frame->nr)) { |
514 | lapb->frmr_data = *frame; | 497 | lapb->frmr_data = *frame; |
515 | lapb->frmr_type = LAPB_FRMR_Z; | 498 | lapb->frmr_type = LAPB_FRMR_Z; |
516 | lapb_transmit_frmr(lapb); | 499 | lapb_transmit_frmr(lapb); |
517 | #if LAPB_DEBUG > 0 | 500 | #if LAPB_DEBUG > 0 |
518 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", | 501 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); |
519 | lapb->dev); | ||
520 | #endif | 502 | #endif |
521 | lapb_start_t1timer(lapb); | 503 | lapb_start_t1timer(lapb); |
522 | lapb_stop_t2timer(lapb); | 504 | lapb_stop_t2timer(lapb); |
523 | lapb->state = LAPB_STATE_4; | 505 | lapb->state = LAPB_STATE_4; |
524 | lapb->n2count = 0; | 506 | lapb->n2count = 0; |
507 | break; | ||
508 | } | ||
509 | if (lapb->condition & LAPB_PEER_RX_BUSY_CONDITION) | ||
510 | lapb_frames_acked(lapb, frame->nr); | ||
511 | else | ||
512 | lapb_check_iframes_acked(lapb, frame->nr); | ||
513 | |||
514 | if (frame->ns == lapb->vr) { | ||
515 | int cn; | ||
516 | cn = lapb_data_indication(lapb, skb); | ||
517 | queued = 1; | ||
518 | /* | ||
519 | * If upper layer has dropped the frame, we | ||
520 | * basically ignore any further protocol | ||
521 | * processing. This will cause the peer | ||
522 | * to re-transmit the frame later like | ||
523 | * a frame lost on the wire. | ||
524 | */ | ||
525 | if (cn == NET_RX_DROP) { | ||
526 | printk(KERN_DEBUG "LAPB: rx congestion\n"); | ||
525 | break; | 527 | break; |
526 | } | 528 | } |
527 | if (lapb->condition & LAPB_PEER_RX_BUSY_CONDITION) | 529 | lapb->vr = (lapb->vr + 1) % modulus; |
528 | lapb_frames_acked(lapb, frame->nr); | 530 | lapb->condition &= ~LAPB_REJECT_CONDITION; |
529 | else | 531 | if (frame->pf) |
530 | lapb_check_iframes_acked(lapb, frame->nr); | 532 | lapb_enquiry_response(lapb); |
531 | 533 | else { | |
532 | if (frame->ns == lapb->vr) { | 534 | if (!(lapb->condition & |
533 | int cn; | 535 | LAPB_ACK_PENDING_CONDITION)) { |
534 | cn = lapb_data_indication(lapb, skb); | 536 | lapb->condition |= LAPB_ACK_PENDING_CONDITION; |
535 | queued = 1; | 537 | lapb_start_t2timer(lapb); |
536 | /* | ||
537 | * If upper layer has dropped the frame, we | ||
538 | * basically ignore any further protocol | ||
539 | * processing. This will cause the peer | ||
540 | * to re-transmit the frame later like | ||
541 | * a frame lost on the wire. | ||
542 | */ | ||
543 | if (cn == NET_RX_DROP) { | ||
544 | printk(KERN_DEBUG | ||
545 | "LAPB: rx congestion\n"); | ||
546 | break; | ||
547 | } | 538 | } |
548 | lapb->vr = (lapb->vr + 1) % modulus; | 539 | } |
549 | lapb->condition &= ~LAPB_REJECT_CONDITION; | 540 | } else { |
541 | if (lapb->condition & LAPB_REJECT_CONDITION) { | ||
550 | if (frame->pf) | 542 | if (frame->pf) |
551 | lapb_enquiry_response(lapb); | 543 | lapb_enquiry_response(lapb); |
552 | else { | ||
553 | if (!(lapb->condition & | ||
554 | LAPB_ACK_PENDING_CONDITION)) { | ||
555 | lapb->condition |= LAPB_ACK_PENDING_CONDITION; | ||
556 | lapb_start_t2timer(lapb); | ||
557 | } | ||
558 | } | ||
559 | } else { | 544 | } else { |
560 | if (lapb->condition & LAPB_REJECT_CONDITION) { | 545 | #if LAPB_DEBUG > 1 |
561 | if (frame->pf) | 546 | printk(KERN_DEBUG |
562 | lapb_enquiry_response(lapb); | 547 | "lapb: (%p) S3 TX REJ(%d) R%d\n", |
563 | } else { | 548 | lapb->dev, frame->pf, lapb->vr); |
564 | #if LAPB_DEBUG > 1 | 549 | #endif |
565 | printk(KERN_DEBUG | 550 | lapb->condition |= LAPB_REJECT_CONDITION; |
566 | "lapb: (%p) S3 TX REJ(%d) R%d\n", | 551 | lapb_send_control(lapb, LAPB_REJ, frame->pf, |
567 | lapb->dev, frame->pf, lapb->vr); | 552 | LAPB_RESPONSE); |
568 | #endif | 553 | lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; |
569 | lapb->condition |= LAPB_REJECT_CONDITION; | ||
570 | lapb_send_control(lapb, LAPB_REJ, | ||
571 | frame->pf, | ||
572 | LAPB_RESPONSE); | ||
573 | lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; | ||
574 | } | ||
575 | } | 554 | } |
576 | break; | 555 | } |
556 | break; | ||
577 | 557 | ||
578 | case LAPB_FRMR: | 558 | case LAPB_FRMR: |
579 | #if LAPB_DEBUG > 1 | 559 | #if LAPB_DEBUG > 1 |
580 | printk(KERN_DEBUG "lapb: (%p) S3 RX FRMR(%d) %02X " | 560 | printk(KERN_DEBUG "lapb: (%p) S3 RX FRMR(%d) %02X " |
581 | "%02X %02X %02X %02X\n", lapb->dev, frame->pf, | 561 | "%02X %02X %02X %02X\n", lapb->dev, frame->pf, |
582 | skb->data[0], skb->data[1], skb->data[2], | 562 | skb->data[0], skb->data[1], skb->data[2], |
583 | skb->data[3], skb->data[4]); | 563 | skb->data[3], skb->data[4]); |
584 | #endif | 564 | #endif |
585 | lapb_establish_data_link(lapb); | 565 | lapb_establish_data_link(lapb); |
586 | #if LAPB_DEBUG > 0 | 566 | #if LAPB_DEBUG > 0 |
587 | printk(KERN_DEBUG "lapb: (%p) S3 -> S1\n", | 567 | printk(KERN_DEBUG "lapb: (%p) S3 -> S1\n", lapb->dev); |
588 | lapb->dev); | ||
589 | #endif | 568 | #endif |
590 | lapb_requeue_frames(lapb); | 569 | lapb_requeue_frames(lapb); |
591 | lapb->state = LAPB_STATE_1; | 570 | lapb->state = LAPB_STATE_1; |
592 | break; | 571 | break; |
593 | 572 | ||
594 | case LAPB_ILLEGAL: | 573 | case LAPB_ILLEGAL: |
595 | #if LAPB_DEBUG > 1 | 574 | #if LAPB_DEBUG > 1 |
596 | printk(KERN_DEBUG "lapb: (%p) S3 RX ILLEGAL(%d)\n", | 575 | printk(KERN_DEBUG "lapb: (%p) S3 RX ILLEGAL(%d)\n", |
597 | lapb->dev, frame->pf); | 576 | lapb->dev, frame->pf); |
598 | #endif | 577 | #endif |
599 | lapb->frmr_data = *frame; | 578 | lapb->frmr_data = *frame; |
600 | lapb->frmr_type = LAPB_FRMR_W; | 579 | lapb->frmr_type = LAPB_FRMR_W; |
601 | lapb_transmit_frmr(lapb); | 580 | lapb_transmit_frmr(lapb); |
602 | #if LAPB_DEBUG > 0 | 581 | #if LAPB_DEBUG > 0 |
603 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); | 582 | printk(KERN_DEBUG "lapb: (%p) S3 -> S4\n", lapb->dev); |
604 | #endif | 583 | #endif |
605 | lapb_start_t1timer(lapb); | 584 | lapb_start_t1timer(lapb); |
606 | lapb_stop_t2timer(lapb); | 585 | lapb_stop_t2timer(lapb); |
607 | lapb->state = LAPB_STATE_4; | 586 | lapb->state = LAPB_STATE_4; |
608 | lapb->n2count = 0; | 587 | lapb->n2count = 0; |
609 | break; | 588 | break; |
610 | } | 589 | } |
611 | 590 | ||
612 | if (!queued) | 591 | if (!queued) |
@@ -621,75 +600,73 @@ static void lapb_state4_machine(struct lapb_cb *lapb, struct sk_buff *skb, | |||
621 | struct lapb_frame *frame) | 600 | struct lapb_frame *frame) |
622 | { | 601 | { |
623 | switch (frame->type) { | 602 | switch (frame->type) { |
624 | case LAPB_SABM: | 603 | case LAPB_SABM: |
625 | #if LAPB_DEBUG > 1 | 604 | #if LAPB_DEBUG > 1 |
626 | printk(KERN_DEBUG "lapb: (%p) S4 RX SABM(%d)\n", | 605 | printk(KERN_DEBUG "lapb: (%p) S4 RX SABM(%d)\n", |
627 | lapb->dev, frame->pf); | 606 | lapb->dev, frame->pf); |
628 | #endif | 607 | #endif |
629 | if (lapb->mode & LAPB_EXTENDED) { | 608 | if (lapb->mode & LAPB_EXTENDED) { |
630 | #if LAPB_DEBUG > 1 | 609 | #if LAPB_DEBUG > 1 |
631 | printk(KERN_DEBUG "lapb: (%p) S4 TX DM(%d)\n", | 610 | printk(KERN_DEBUG "lapb: (%p) S4 TX DM(%d)\n", |
632 | lapb->dev, frame->pf); | 611 | lapb->dev, frame->pf); |
633 | #endif | 612 | #endif |
634 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 613 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
635 | LAPB_RESPONSE); | 614 | LAPB_RESPONSE); |
636 | } else { | 615 | } else { |
637 | #if LAPB_DEBUG > 1 | 616 | #if LAPB_DEBUG > 1 |
638 | printk(KERN_DEBUG "lapb: (%p) S4 TX UA(%d)\n", | 617 | printk(KERN_DEBUG "lapb: (%p) S4 TX UA(%d)\n", |
639 | lapb->dev, frame->pf); | 618 | lapb->dev, frame->pf); |
640 | #endif | 619 | #endif |
641 | #if LAPB_DEBUG > 0 | 620 | #if LAPB_DEBUG > 0 |
642 | printk(KERN_DEBUG "lapb: (%p) S4 -> S3\n", | 621 | printk(KERN_DEBUG "lapb: (%p) S4 -> S3\n", lapb->dev); |
643 | lapb->dev); | ||
644 | #endif | 622 | #endif |
645 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 623 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
646 | LAPB_RESPONSE); | 624 | LAPB_RESPONSE); |
647 | lapb_stop_t1timer(lapb); | 625 | lapb_stop_t1timer(lapb); |
648 | lapb_stop_t2timer(lapb); | 626 | lapb_stop_t2timer(lapb); |
649 | lapb->state = LAPB_STATE_3; | 627 | lapb->state = LAPB_STATE_3; |
650 | lapb->condition = 0x00; | 628 | lapb->condition = 0x00; |
651 | lapb->n2count = 0; | 629 | lapb->n2count = 0; |
652 | lapb->vs = 0; | 630 | lapb->vs = 0; |
653 | lapb->vr = 0; | 631 | lapb->vr = 0; |
654 | lapb->va = 0; | 632 | lapb->va = 0; |
655 | lapb_connect_indication(lapb, LAPB_OK); | 633 | lapb_connect_indication(lapb, LAPB_OK); |
656 | } | 634 | } |
657 | break; | 635 | break; |
658 | 636 | ||
659 | case LAPB_SABME: | 637 | case LAPB_SABME: |
660 | #if LAPB_DEBUG > 1 | 638 | #if LAPB_DEBUG > 1 |
661 | printk(KERN_DEBUG "lapb: (%p) S4 RX SABME(%d)\n", | 639 | printk(KERN_DEBUG "lapb: (%p) S4 RX SABME(%d)\n", |
662 | lapb->dev, frame->pf); | 640 | lapb->dev, frame->pf); |
663 | #endif | 641 | #endif |
664 | if (lapb->mode & LAPB_EXTENDED) { | 642 | if (lapb->mode & LAPB_EXTENDED) { |
665 | #if LAPB_DEBUG > 1 | 643 | #if LAPB_DEBUG > 1 |
666 | printk(KERN_DEBUG "lapb: (%p) S4 TX UA(%d)\n", | 644 | printk(KERN_DEBUG "lapb: (%p) S4 TX UA(%d)\n", |
667 | lapb->dev, frame->pf); | 645 | lapb->dev, frame->pf); |
668 | #endif | 646 | #endif |
669 | #if LAPB_DEBUG > 0 | 647 | #if LAPB_DEBUG > 0 |
670 | printk(KERN_DEBUG "lapb: (%p) S4 -> S3\n", | 648 | printk(KERN_DEBUG "lapb: (%p) S4 -> S3\n", lapb->dev); |
671 | lapb->dev); | ||
672 | #endif | 649 | #endif |
673 | lapb_send_control(lapb, LAPB_UA, frame->pf, | 650 | lapb_send_control(lapb, LAPB_UA, frame->pf, |
674 | LAPB_RESPONSE); | 651 | LAPB_RESPONSE); |
675 | lapb_stop_t1timer(lapb); | 652 | lapb_stop_t1timer(lapb); |
676 | lapb_stop_t2timer(lapb); | 653 | lapb_stop_t2timer(lapb); |
677 | lapb->state = LAPB_STATE_3; | 654 | lapb->state = LAPB_STATE_3; |
678 | lapb->condition = 0x00; | 655 | lapb->condition = 0x00; |
679 | lapb->n2count = 0; | 656 | lapb->n2count = 0; |
680 | lapb->vs = 0; | 657 | lapb->vs = 0; |
681 | lapb->vr = 0; | 658 | lapb->vr = 0; |
682 | lapb->va = 0; | 659 | lapb->va = 0; |
683 | lapb_connect_indication(lapb, LAPB_OK); | 660 | lapb_connect_indication(lapb, LAPB_OK); |
684 | } else { | 661 | } else { |
685 | #if LAPB_DEBUG > 1 | 662 | #if LAPB_DEBUG > 1 |
686 | printk(KERN_DEBUG "lapb: (%p) S4 TX DM(%d)\n", | 663 | printk(KERN_DEBUG "lapb: (%p) S4 TX DM(%d)\n", |
687 | lapb->dev, frame->pf); | 664 | lapb->dev, frame->pf); |
688 | #endif | 665 | #endif |
689 | lapb_send_control(lapb, LAPB_DM, frame->pf, | 666 | lapb_send_control(lapb, LAPB_DM, frame->pf, |
690 | LAPB_RESPONSE); | 667 | LAPB_RESPONSE); |
691 | } | 668 | } |
692 | break; | 669 | break; |
693 | } | 670 | } |
694 | 671 | ||
695 | kfree_skb(skb); | 672 | kfree_skb(skb); |