[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
[deliverable/linux.git] / net / irda / irlap_frame.c
1 /*********************************************************************
2 *
3 * Filename: irlap_frame.c
4 * Version: 1.0
5 * Description: Build and transmit IrLAP frames
6 * Status: Stable
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Tue Aug 19 10:27:26 1997
9 * Modified at: Wed Jan 5 08:59:04 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 *
12 * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>,
13 * All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge.
24 *
25 ********************************************************************/
26
27 #include <linux/skbuff.h>
28 #include <linux/if.h>
29 #include <linux/if_ether.h>
30 #include <linux/netdevice.h>
31 #include <linux/irda.h>
32
33 #include <net/pkt_sched.h>
34 #include <net/sock.h>
35
36 #include <asm/byteorder.h>
37
38 #include <net/irda/irda.h>
39 #include <net/irda/irda_device.h>
40 #include <net/irda/irlap.h>
41 #include <net/irda/wrapper.h>
42 #include <net/irda/timer.h>
43 #include <net/irda/irlap_frame.h>
44 #include <net/irda/qos.h>
45
46 static void irlap_send_i_frame(struct irlap_cb *self, struct sk_buff *skb,
47 int command);
48
49 /*
50 * Function irlap_insert_info (self, skb)
51 *
52 * Insert minimum turnaround time and speed information into the skb. We
53 * need to do this since it's per packet relevant information. Safe to
54 * have this function inlined since it's only called from one place
55 */
56 static inline void irlap_insert_info(struct irlap_cb *self,
57 struct sk_buff *skb)
58 {
59 struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
60
61 /*
62 * Insert MTT (min. turn time) and speed into skb, so that the
63 * device driver knows which settings to use
64 */
65 cb->magic = LAP_MAGIC;
66 cb->mtt = self->mtt_required;
67 cb->next_speed = self->speed;
68
69 /* Reset */
70 self->mtt_required = 0;
71
72 /*
73 * Delay equals negotiated BOFs count, plus the number of BOFs to
74 * force the negotiated minimum turnaround time
75 */
76 cb->xbofs = self->bofs_count;
77 cb->next_xbofs = self->next_bofs;
78 cb->xbofs_delay = self->xbofs_delay;
79
80 /* Reset XBOF's delay (used only for getting min turn time) */
81 self->xbofs_delay = 0;
82 /* Put the correct xbofs value for the next packet */
83 self->bofs_count = self->next_bofs;
84 }
85
86 /*
87 * Function irlap_queue_xmit (self, skb)
88 *
89 * A little wrapper for dev_queue_xmit, so we can insert some common
90 * code into it.
91 */
92 void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb)
93 {
94 /* Some common init stuff */
95 skb->dev = self->netdev;
96 skb->h.raw = skb->nh.raw = skb->mac.raw = skb->data;
97 skb->protocol = htons(ETH_P_IRDA);
98 skb->priority = TC_PRIO_BESTEFFORT;
99
100 irlap_insert_info(self, skb);
101
102 dev_queue_xmit(skb);
103 }
104
105 /*
106 * Function irlap_send_snrm_cmd (void)
107 *
108 * Transmits a connect SNRM command frame
109 */
110 void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
111 {
112 struct sk_buff *tx_skb;
113 struct snrm_frame *frame;
114 int ret;
115
116 IRDA_ASSERT(self != NULL, return;);
117 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
118
119 /* Allocate frame */
120 tx_skb = alloc_skb(64, GFP_ATOMIC);
121 if (!tx_skb)
122 return;
123
124 frame = (struct snrm_frame *) skb_put(tx_skb, 2);
125
126 /* Insert connection address field */
127 if (qos)
128 frame->caddr = CMD_FRAME | CBROADCAST;
129 else
130 frame->caddr = CMD_FRAME | self->caddr;
131
132 /* Insert control field */
133 frame->control = SNRM_CMD | PF_BIT;
134
135 /*
136 * If we are establishing a connection then insert QoS paramerters
137 */
138 if (qos) {
139 skb_put(tx_skb, 9); /* 21 left */
140 frame->saddr = cpu_to_le32(self->saddr);
141 frame->daddr = cpu_to_le32(self->daddr);
142
143 frame->ncaddr = self->caddr;
144
145 ret = irlap_insert_qos_negotiation_params(self, tx_skb);
146 if (ret < 0) {
147 dev_kfree_skb(tx_skb);
148 return;
149 }
150 }
151 irlap_queue_xmit(self, tx_skb);
152 }
153
154 /*
155 * Function irlap_recv_snrm_cmd (skb, info)
156 *
157 * Received SNRM (Set Normal Response Mode) command frame
158 *
159 */
160 static void irlap_recv_snrm_cmd(struct irlap_cb *self, struct sk_buff *skb,
161 struct irlap_info *info)
162 {
163 struct snrm_frame *frame;
164
165 if (pskb_may_pull(skb,sizeof(struct snrm_frame))) {
166 frame = (struct snrm_frame *) skb->data;
167
168 /* Copy the new connection address ignoring the C/R bit */
169 info->caddr = frame->ncaddr & 0xFE;
170
171 /* Check if the new connection address is valid */
172 if ((info->caddr == 0x00) || (info->caddr == 0xfe)) {
173 IRDA_DEBUG(3, "%s(), invalid connection address!\n",
174 __FUNCTION__);
175 return;
176 }
177
178 /* Copy peer device address */
179 info->daddr = le32_to_cpu(frame->saddr);
180 info->saddr = le32_to_cpu(frame->daddr);
181
182 /* Only accept if addressed directly to us */
183 if (info->saddr != self->saddr) {
184 IRDA_DEBUG(2, "%s(), not addressed to us!\n",
185 __FUNCTION__);
186 return;
187 }
188 irlap_do_event(self, RECV_SNRM_CMD, skb, info);
189 } else {
190 /* Signal that this SNRM frame does not contain and I-field */
191 irlap_do_event(self, RECV_SNRM_CMD, skb, NULL);
192 }
193 }
194
195 /*
196 * Function irlap_send_ua_response_frame (qos)
197 *
198 * Send UA (Unnumbered Acknowledgement) frame
199 *
200 */
201 void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
202 {
203 struct sk_buff *tx_skb;
204 struct ua_frame *frame;
205 int ret;
206
207 IRDA_DEBUG(2, "%s() <%ld>\n", __FUNCTION__, jiffies);
208
209 IRDA_ASSERT(self != NULL, return;);
210 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
211
212 /* Allocate frame */
213 tx_skb = alloc_skb(64, GFP_ATOMIC);
214 if (!tx_skb)
215 return;
216
217 frame = (struct ua_frame *) skb_put(tx_skb, 10);
218
219 /* Build UA response */
220 frame->caddr = self->caddr;
221 frame->control = UA_RSP | PF_BIT;
222
223 frame->saddr = cpu_to_le32(self->saddr);
224 frame->daddr = cpu_to_le32(self->daddr);
225
226 /* Should we send QoS negotiation parameters? */
227 if (qos) {
228 ret = irlap_insert_qos_negotiation_params(self, tx_skb);
229 if (ret < 0) {
230 dev_kfree_skb(tx_skb);
231 return;
232 }
233 }
234
235 irlap_queue_xmit(self, tx_skb);
236 }
237
238
239 /*
240 * Function irlap_send_dm_frame (void)
241 *
242 * Send disconnected mode (DM) frame
243 *
244 */
245 void irlap_send_dm_frame( struct irlap_cb *self)
246 {
247 struct sk_buff *tx_skb = NULL;
248 __u8 *frame;
249
250 IRDA_ASSERT(self != NULL, return;);
251 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
252
253 tx_skb = alloc_skb(32, GFP_ATOMIC);
254 if (!tx_skb)
255 return;
256
257 frame = skb_put(tx_skb, 2);
258
259 if (self->state == LAP_NDM)
260 frame[0] = CBROADCAST;
261 else
262 frame[0] = self->caddr;
263
264 frame[1] = DM_RSP | PF_BIT;
265
266 irlap_queue_xmit(self, tx_skb);
267 }
268
269 /*
270 * Function irlap_send_disc_frame (void)
271 *
272 * Send disconnect (DISC) frame
273 *
274 */
275 void irlap_send_disc_frame(struct irlap_cb *self)
276 {
277 struct sk_buff *tx_skb = NULL;
278 __u8 *frame;
279
280 IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
281
282 IRDA_ASSERT(self != NULL, return;);
283 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
284
285 tx_skb = alloc_skb(16, GFP_ATOMIC);
286 if (!tx_skb)
287 return;
288
289 frame = skb_put(tx_skb, 2);
290
291 frame[0] = self->caddr | CMD_FRAME;
292 frame[1] = DISC_CMD | PF_BIT;
293
294 irlap_queue_xmit(self, tx_skb);
295 }
296
297 /*
298 * Function irlap_send_discovery_xid_frame (S, s, command)
299 *
300 * Build and transmit a XID (eXchange station IDentifier) discovery
301 * frame.
302 */
303 void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
304 __u8 command, discovery_t *discovery)
305 {
306 struct sk_buff *tx_skb = NULL;
307 struct xid_frame *frame;
308 __u32 bcast = BROADCAST;
309 __u8 *info;
310
311 IRDA_DEBUG(4, "%s(), s=%d, S=%d, command=%d\n", __FUNCTION__,
312 s, S, command);
313
314 IRDA_ASSERT(self != NULL, return;);
315 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
316 IRDA_ASSERT(discovery != NULL, return;);
317
318 tx_skb = alloc_skb(64, GFP_ATOMIC);
319 if (!tx_skb)
320 return;
321
322 skb_put(tx_skb, 14);
323 frame = (struct xid_frame *) tx_skb->data;
324
325 if (command) {
326 frame->caddr = CBROADCAST | CMD_FRAME;
327 frame->control = XID_CMD | PF_BIT;
328 } else {
329 frame->caddr = CBROADCAST;
330 frame->control = XID_RSP | PF_BIT;
331 }
332 frame->ident = XID_FORMAT;
333
334 frame->saddr = cpu_to_le32(self->saddr);
335
336 if (command)
337 frame->daddr = cpu_to_le32(bcast);
338 else
339 frame->daddr = cpu_to_le32(discovery->data.daddr);
340
341 switch (S) {
342 case 1:
343 frame->flags = 0x00;
344 break;
345 case 6:
346 frame->flags = 0x01;
347 break;
348 case 8:
349 frame->flags = 0x02;
350 break;
351 case 16:
352 frame->flags = 0x03;
353 break;
354 default:
355 frame->flags = 0x02;
356 break;
357 }
358
359 frame->slotnr = s;
360 frame->version = 0x00;
361
362 /*
363 * Provide info for final slot only in commands, and for all
364 * responses. Send the second byte of the hint only if the
365 * EXTENSION bit is set in the first byte.
366 */
367 if (!command || (frame->slotnr == 0xff)) {
368 int len;
369
370 if (discovery->data.hints[0] & HINT_EXTENSION) {
371 info = skb_put(tx_skb, 2);
372 info[0] = discovery->data.hints[0];
373 info[1] = discovery->data.hints[1];
374 } else {
375 info = skb_put(tx_skb, 1);
376 info[0] = discovery->data.hints[0];
377 }
378 info = skb_put(tx_skb, 1);
379 info[0] = discovery->data.charset;
380
381 len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb));
382 info = skb_put(tx_skb, len);
383 memcpy(info, discovery->data.info, len);
384 }
385 irlap_queue_xmit(self, tx_skb);
386 }
387
388 /*
389 * Function irlap_recv_discovery_xid_rsp (skb, info)
390 *
391 * Received a XID discovery response
392 *
393 */
394 static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
395 struct sk_buff *skb,
396 struct irlap_info *info)
397 {
398 struct xid_frame *xid;
399 discovery_t *discovery = NULL;
400 __u8 *discovery_info;
401 char *text;
402
403 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
404
405 IRDA_ASSERT(self != NULL, return;);
406 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
407
408 if (!pskb_may_pull(skb, sizeof(struct xid_frame))) {
409 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
410 return;
411 }
412
413 xid = (struct xid_frame *) skb->data;
414
415 info->daddr = le32_to_cpu(xid->saddr);
416 info->saddr = le32_to_cpu(xid->daddr);
417
418 /* Make sure frame is addressed to us */
419 if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
420 IRDA_DEBUG(0, "%s(), frame is not addressed to us!\n",
421 __FUNCTION__);
422 return;
423 }
424
425 if ((discovery = kzalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) {
426 IRDA_WARNING("%s: kmalloc failed!\n", __FUNCTION__);
427 return;
428 }
429
430 discovery->data.daddr = info->daddr;
431 discovery->data.saddr = self->saddr;
432 discovery->timestamp = jiffies;
433
434 IRDA_DEBUG(4, "%s(), daddr=%08x\n", __FUNCTION__,
435 discovery->data.daddr);
436
437 discovery_info = skb_pull(skb, sizeof(struct xid_frame));
438
439 /* Get info returned from peer */
440 discovery->data.hints[0] = discovery_info[0];
441 if (discovery_info[0] & HINT_EXTENSION) {
442 IRDA_DEBUG(4, "EXTENSION\n");
443 discovery->data.hints[1] = discovery_info[1];
444 discovery->data.charset = discovery_info[2];
445 text = (char *) &discovery_info[3];
446 } else {
447 discovery->data.hints[1] = 0;
448 discovery->data.charset = discovery_info[1];
449 text = (char *) &discovery_info[2];
450 }
451 /*
452 * Terminate info string, should be safe since this is where the
453 * FCS bytes resides.
454 */
455 skb->data[skb->len] = '\0';
456 strncpy(discovery->data.info, text, NICKNAME_MAX_LEN);
457 discovery->name_len = strlen(discovery->data.info);
458
459 info->discovery = discovery;
460
461 irlap_do_event(self, RECV_DISCOVERY_XID_RSP, skb, info);
462 }
463
464 /*
465 * Function irlap_recv_discovery_xid_cmd (skb, info)
466 *
467 * Received a XID discovery command
468 *
469 */
470 static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
471 struct sk_buff *skb,
472 struct irlap_info *info)
473 {
474 struct xid_frame *xid;
475 discovery_t *discovery = NULL;
476 __u8 *discovery_info;
477 char *text;
478
479 if (!pskb_may_pull(skb, sizeof(struct xid_frame))) {
480 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
481 return;
482 }
483
484 xid = (struct xid_frame *) skb->data;
485
486 info->daddr = le32_to_cpu(xid->saddr);
487 info->saddr = le32_to_cpu(xid->daddr);
488
489 /* Make sure frame is addressed to us */
490 if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
491 IRDA_DEBUG(0, "%s(), frame is not addressed to us!\n",
492 __FUNCTION__);
493 return;
494 }
495
496 switch (xid->flags & 0x03) {
497 case 0x00:
498 info->S = 1;
499 break;
500 case 0x01:
501 info->S = 6;
502 break;
503 case 0x02:
504 info->S = 8;
505 break;
506 case 0x03:
507 info->S = 16;
508 break;
509 default:
510 /* Error!! */
511 return;
512 }
513 info->s = xid->slotnr;
514
515 discovery_info = skb_pull(skb, sizeof(struct xid_frame));
516
517 /*
518 * Check if last frame
519 */
520 if (info->s == 0xff) {
521 /* Check if things are sane at this point... */
522 if((discovery_info == NULL) ||
523 !pskb_may_pull(skb, 3)) {
524 IRDA_ERROR("%s: discovery frame to short!\n",
525 __FUNCTION__);
526 return;
527 }
528
529 /*
530 * We now have some discovery info to deliver!
531 */
532 discovery = kmalloc(sizeof(discovery_t), GFP_ATOMIC);
533 if (!discovery) {
534 IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__);
535 return;
536 }
537
538 discovery->data.daddr = info->daddr;
539 discovery->data.saddr = self->saddr;
540 discovery->timestamp = jiffies;
541
542 discovery->data.hints[0] = discovery_info[0];
543 if (discovery_info[0] & HINT_EXTENSION) {
544 discovery->data.hints[1] = discovery_info[1];
545 discovery->data.charset = discovery_info[2];
546 text = (char *) &discovery_info[3];
547 } else {
548 discovery->data.hints[1] = 0;
549 discovery->data.charset = discovery_info[1];
550 text = (char *) &discovery_info[2];
551 }
552 /*
553 * Terminate string, should be safe since this is where the
554 * FCS bytes resides.
555 */
556 skb->data[skb->len] = '\0';
557 strncpy(discovery->data.info, text, NICKNAME_MAX_LEN);
558 discovery->name_len = strlen(discovery->data.info);
559
560 info->discovery = discovery;
561 } else
562 info->discovery = NULL;
563
564 irlap_do_event(self, RECV_DISCOVERY_XID_CMD, skb, info);
565 }
566
567 /*
568 * Function irlap_send_rr_frame (self, command)
569 *
570 * Build and transmit RR (Receive Ready) frame. Notice that it is currently
571 * only possible to send RR frames with the poll bit set.
572 */
573 void irlap_send_rr_frame(struct irlap_cb *self, int command)
574 {
575 struct sk_buff *tx_skb;
576 __u8 *frame;
577
578 tx_skb = alloc_skb(16, GFP_ATOMIC);
579 if (!tx_skb)
580 return;
581
582 frame = skb_put(tx_skb, 2);
583
584 frame[0] = self->caddr;
585 frame[0] |= (command) ? CMD_FRAME : 0;
586
587 frame[1] = RR | PF_BIT | (self->vr << 5);
588
589 irlap_queue_xmit(self, tx_skb);
590 }
591
592 /*
593 * Function irlap_send_rd_frame (self)
594 *
595 * Request disconnect. Used by a secondary station to request the
596 * disconnection of the link.
597 */
598 void irlap_send_rd_frame(struct irlap_cb *self)
599 {
600 struct sk_buff *tx_skb;
601 __u8 *frame;
602
603 tx_skb = alloc_skb(16, GFP_ATOMIC);
604 if (!tx_skb)
605 return;
606
607 frame = skb_put(tx_skb, 2);
608
609 frame[0] = self->caddr;
610 frame[1] = RD_RSP | PF_BIT;
611
612 irlap_queue_xmit(self, tx_skb);
613 }
614
615 /*
616 * Function irlap_recv_rr_frame (skb, info)
617 *
618 * Received RR (Receive Ready) frame from peer station, no harm in
619 * making it inline since its called only from one single place
620 * (irlap_driver_rcv).
621 */
622 static inline void irlap_recv_rr_frame(struct irlap_cb *self,
623 struct sk_buff *skb,
624 struct irlap_info *info, int command)
625 {
626 info->nr = skb->data[1] >> 5;
627
628 /* Check if this is a command or a response frame */
629 if (command)
630 irlap_do_event(self, RECV_RR_CMD, skb, info);
631 else
632 irlap_do_event(self, RECV_RR_RSP, skb, info);
633 }
634
635 /*
636 * Function irlap_recv_rnr_frame (self, skb, info)
637 *
638 * Received RNR (Receive Not Ready) frame from peer station
639 *
640 */
641 static void irlap_recv_rnr_frame(struct irlap_cb *self, struct sk_buff *skb,
642 struct irlap_info *info, int command)
643 {
644 info->nr = skb->data[1] >> 5;
645
646 IRDA_DEBUG(4, "%s(), nr=%d, %ld\n", __FUNCTION__, info->nr, jiffies);
647
648 if (command)
649 irlap_do_event(self, RECV_RNR_CMD, skb, info);
650 else
651 irlap_do_event(self, RECV_RNR_RSP, skb, info);
652 }
653
654 static void irlap_recv_rej_frame(struct irlap_cb *self, struct sk_buff *skb,
655 struct irlap_info *info, int command)
656 {
657 IRDA_DEBUG(0, "%s()\n", __FUNCTION__);
658
659 info->nr = skb->data[1] >> 5;
660
661 /* Check if this is a command or a response frame */
662 if (command)
663 irlap_do_event(self, RECV_REJ_CMD, skb, info);
664 else
665 irlap_do_event(self, RECV_REJ_RSP, skb, info);
666 }
667
668 static void irlap_recv_srej_frame(struct irlap_cb *self, struct sk_buff *skb,
669 struct irlap_info *info, int command)
670 {
671 IRDA_DEBUG(0, "%s()\n", __FUNCTION__);
672
673 info->nr = skb->data[1] >> 5;
674
675 /* Check if this is a command or a response frame */
676 if (command)
677 irlap_do_event(self, RECV_SREJ_CMD, skb, info);
678 else
679 irlap_do_event(self, RECV_SREJ_RSP, skb, info);
680 }
681
682 static void irlap_recv_disc_frame(struct irlap_cb *self, struct sk_buff *skb,
683 struct irlap_info *info, int command)
684 {
685 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
686
687 /* Check if this is a command or a response frame */
688 if (command)
689 irlap_do_event(self, RECV_DISC_CMD, skb, info);
690 else
691 irlap_do_event(self, RECV_RD_RSP, skb, info);
692 }
693
694 /*
695 * Function irlap_recv_ua_frame (skb, frame)
696 *
697 * Received UA (Unnumbered Acknowledgement) frame
698 *
699 */
700 static inline void irlap_recv_ua_frame(struct irlap_cb *self,
701 struct sk_buff *skb,
702 struct irlap_info *info)
703 {
704 irlap_do_event(self, RECV_UA_RSP, skb, info);
705 }
706
707 /*
708 * Function irlap_send_data_primary(self, skb)
709 *
710 * Send I-frames as the primary station but without the poll bit set
711 *
712 */
713 void irlap_send_data_primary(struct irlap_cb *self, struct sk_buff *skb)
714 {
715 struct sk_buff *tx_skb;
716
717 if (skb->data[1] == I_FRAME) {
718
719 /*
720 * Insert frame sequence number (Vs) in control field before
721 * inserting into transmit window queue.
722 */
723 skb->data[1] = I_FRAME | (self->vs << 1);
724
725 /*
726 * Insert frame in store, in case of retransmissions
727 * Increase skb reference count, see irlap_do_event()
728 */
729 skb_get(skb);
730 skb_queue_tail(&self->wx_list, skb);
731
732 /* Copy buffer */
733 tx_skb = skb_clone(skb, GFP_ATOMIC);
734 if (tx_skb == NULL) {
735 return;
736 }
737
738 self->vs = (self->vs + 1) % 8;
739 self->ack_required = FALSE;
740 self->window -= 1;
741
742 irlap_send_i_frame( self, tx_skb, CMD_FRAME);
743 } else {
744 IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__);
745 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
746 self->window -= 1;
747 }
748 }
749 /*
750 * Function irlap_send_data_primary_poll (self, skb)
751 *
752 * Send I(nformation) frame as primary with poll bit set
753 */
754 void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb)
755 {
756 struct sk_buff *tx_skb;
757 int transmission_time;
758
759 /* Stop P timer */
760 del_timer(&self->poll_timer);
761
762 /* Is this reliable or unreliable data? */
763 if (skb->data[1] == I_FRAME) {
764
765 /*
766 * Insert frame sequence number (Vs) in control field before
767 * inserting into transmit window queue.
768 */
769 skb->data[1] = I_FRAME | (self->vs << 1);
770
771 /*
772 * Insert frame in store, in case of retransmissions
773 * Increase skb reference count, see irlap_do_event()
774 */
775 skb_get(skb);
776 skb_queue_tail(&self->wx_list, skb);
777
778 /* Copy buffer */
779 tx_skb = skb_clone(skb, GFP_ATOMIC);
780 if (tx_skb == NULL) {
781 return;
782 }
783
784 /*
785 * Set poll bit if necessary. We do this to the copied
786 * skb, since retransmitted need to set or clear the poll
787 * bit depending on when they are sent.
788 */
789 tx_skb->data[1] |= PF_BIT;
790
791 self->vs = (self->vs + 1) % 8;
792 self->ack_required = FALSE;
793
794 irlap_send_i_frame(self, tx_skb, CMD_FRAME);
795 } else {
796 IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__);
797
798 if (self->ack_required) {
799 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
800 irlap_send_rr_frame(self, CMD_FRAME);
801 self->ack_required = FALSE;
802 } else {
803 skb->data[1] |= PF_BIT;
804 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
805 }
806 }
807
808 /* How much time we took for transmission of all frames.
809 * We don't know, so let assume we used the full window. Jean II */
810 transmission_time = self->final_timeout;
811
812 /* Reset parameter so that we can fill next window */
813 self->window = self->window_size;
814
815 #ifdef CONFIG_IRDA_DYNAMIC_WINDOW
816 /* Remove what we have not used. Just do a prorata of the
817 * bytes left in window to window capacity.
818 * See max_line_capacities[][] in qos.c for details. Jean II */
819 transmission_time -= (self->final_timeout * self->bytes_left
820 / self->line_capacity);
821 IRDA_DEBUG(4, "%s() adjusting transmission_time : ft=%d, bl=%d, lc=%d -> tt=%d\n", __FUNCTION__, self->final_timeout, self->bytes_left, self->line_capacity, transmission_time);
822
823 /* We are allowed to transmit a maximum number of bytes again. */
824 self->bytes_left = self->line_capacity;
825 #endif /* CONFIG_IRDA_DYNAMIC_WINDOW */
826
827 /*
828 * The network layer has a intermediate buffer between IrLAP
829 * and the IrDA driver which can contain 8 frames. So, even
830 * though IrLAP is currently sending the *last* frame of the
831 * tx-window, the driver most likely has only just started
832 * sending the *first* frame of the same tx-window.
833 * I.e. we are always at the very begining of or Tx window.
834 * Now, we are supposed to set the final timer from the end
835 * of our tx-window to let the other peer reply. So, we need
836 * to add extra time to compensate for the fact that we
837 * are really at the start of tx-window, otherwise the final timer
838 * might expire before he can answer...
839 * Jean II
840 */
841 irlap_start_final_timer(self, self->final_timeout + transmission_time);
842
843 /*
844 * The clever amongst you might ask why we do this adjustement
845 * only here, and not in all the other cases in irlap_event.c.
846 * In all those other case, we only send a very short management
847 * frame (few bytes), so the adjustement would be lost in the
848 * noise...
849 * The exception of course is irlap_resend_rejected_frame().
850 * Jean II */
851 }
852
853 /*
854 * Function irlap_send_data_secondary_final (self, skb)
855 *
856 * Send I(nformation) frame as secondary with final bit set
857 *
858 */
859 void irlap_send_data_secondary_final(struct irlap_cb *self,
860 struct sk_buff *skb)
861 {
862 struct sk_buff *tx_skb = NULL;
863
864 IRDA_ASSERT(self != NULL, return;);
865 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
866 IRDA_ASSERT(skb != NULL, return;);
867
868 /* Is this reliable or unreliable data? */
869 if (skb->data[1] == I_FRAME) {
870
871 /*
872 * Insert frame sequence number (Vs) in control field before
873 * inserting into transmit window queue.
874 */
875 skb->data[1] = I_FRAME | (self->vs << 1);
876
877 /*
878 * Insert frame in store, in case of retransmissions
879 * Increase skb reference count, see irlap_do_event()
880 */
881 skb_get(skb);
882 skb_queue_tail(&self->wx_list, skb);
883
884 tx_skb = skb_clone(skb, GFP_ATOMIC);
885 if (tx_skb == NULL) {
886 return;
887 }
888
889 tx_skb->data[1] |= PF_BIT;
890
891 self->vs = (self->vs + 1) % 8;
892 self->ack_required = FALSE;
893
894 irlap_send_i_frame(self, tx_skb, RSP_FRAME);
895 } else {
896 if (self->ack_required) {
897 irlap_send_ui_frame(self, skb_get(skb), self->caddr, RSP_FRAME);
898 irlap_send_rr_frame(self, RSP_FRAME);
899 self->ack_required = FALSE;
900 } else {
901 skb->data[1] |= PF_BIT;
902 irlap_send_ui_frame(self, skb_get(skb), self->caddr, RSP_FRAME);
903 }
904 }
905
906 self->window = self->window_size;
907 #ifdef CONFIG_IRDA_DYNAMIC_WINDOW
908 /* We are allowed to transmit a maximum number of bytes again. */
909 self->bytes_left = self->line_capacity;
910 #endif /* CONFIG_IRDA_DYNAMIC_WINDOW */
911
912 irlap_start_wd_timer(self, self->wd_timeout);
913 }
914
915 /*
916 * Function irlap_send_data_secondary (self, skb)
917 *
918 * Send I(nformation) frame as secondary without final bit set
919 *
920 */
921 void irlap_send_data_secondary(struct irlap_cb *self, struct sk_buff *skb)
922 {
923 struct sk_buff *tx_skb = NULL;
924
925 /* Is this reliable or unreliable data? */
926 if (skb->data[1] == I_FRAME) {
927
928 /*
929 * Insert frame sequence number (Vs) in control field before
930 * inserting into transmit window queue.
931 */
932 skb->data[1] = I_FRAME | (self->vs << 1);
933
934 /*
935 * Insert frame in store, in case of retransmissions
936 * Increase skb reference count, see irlap_do_event()
937 */
938 skb_get(skb);
939 skb_queue_tail(&self->wx_list, skb);
940
941 tx_skb = skb_clone(skb, GFP_ATOMIC);
942 if (tx_skb == NULL) {
943 return;
944 }
945
946 self->vs = (self->vs + 1) % 8;
947 self->ack_required = FALSE;
948 self->window -= 1;
949
950 irlap_send_i_frame(self, tx_skb, RSP_FRAME);
951 } else {
952 irlap_send_ui_frame(self, skb_get(skb), self->caddr, RSP_FRAME);
953 self->window -= 1;
954 }
955 }
956
957 /*
958 * Function irlap_resend_rejected_frames (nr)
959 *
960 * Resend frames which has not been acknowledged. Should be safe to
961 * traverse the list without locking it since this function will only be
962 * called from interrupt context (BH)
963 */
964 void irlap_resend_rejected_frames(struct irlap_cb *self, int command)
965 {
966 struct sk_buff *tx_skb;
967 struct sk_buff *skb;
968 int count;
969
970 IRDA_ASSERT(self != NULL, return;);
971 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
972
973 /* Initialize variables */
974 count = skb_queue_len(&self->wx_list);
975
976 /* Resend unacknowledged frame(s) */
977 skb = skb_peek(&self->wx_list);
978 while (skb != NULL) {
979 irlap_wait_min_turn_around(self, &self->qos_tx);
980
981 /* We copy the skb to be retransmitted since we will have to
982 * modify it. Cloning will confuse packet sniffers
983 */
984 /* tx_skb = skb_clone( skb, GFP_ATOMIC); */
985 tx_skb = skb_copy(skb, GFP_ATOMIC);
986 if (!tx_skb) {
987 IRDA_DEBUG(0, "%s(), unable to copy\n", __FUNCTION__);
988 return;
989 }
990
991 /* Clear old Nr field + poll bit */
992 tx_skb->data[1] &= 0x0f;
993
994 /*
995 * Set poll bit on the last frame retransmitted
996 */
997 if (count-- == 1)
998 tx_skb->data[1] |= PF_BIT; /* Set p/f bit */
999 else
1000 tx_skb->data[1] &= ~PF_BIT; /* Clear p/f bit */
1001
1002 irlap_send_i_frame(self, tx_skb, command);
1003
1004 /*
1005 * If our skb is the last buffer in the list, then
1006 * we are finished, if not, move to the next sk-buffer
1007 */
1008 if (skb == skb_peek_tail(&self->wx_list))
1009 skb = NULL;
1010 else
1011 skb = skb->next;
1012 }
1013 #if 0 /* Not yet */
1014 /*
1015 * We can now fill the window with additional data frames
1016 */
1017 while (!skb_queue_empty(&self->txq)) {
1018
1019 IRDA_DEBUG(0, "%s(), sending additional frames!\n", __FUNCTION__);
1020 if (self->window > 0) {
1021 skb = skb_dequeue( &self->txq);
1022 IRDA_ASSERT(skb != NULL, return;);
1023
1024 /*
1025 * If send window > 1 then send frame with pf
1026 * bit cleared
1027 */
1028 if ((self->window > 1) &&
1029 !skb_queue_empty(&self->txq)) {
1030 irlap_send_data_primary(self, skb);
1031 } else {
1032 irlap_send_data_primary_poll(self, skb);
1033 }
1034 kfree_skb(skb);
1035 }
1036 }
1037 #endif
1038 }
1039
1040 void irlap_resend_rejected_frame(struct irlap_cb *self, int command)
1041 {
1042 struct sk_buff *tx_skb;
1043 struct sk_buff *skb;
1044
1045 IRDA_ASSERT(self != NULL, return;);
1046 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
1047
1048 /* Resend unacknowledged frame(s) */
1049 skb = skb_peek(&self->wx_list);
1050 if (skb != NULL) {
1051 irlap_wait_min_turn_around(self, &self->qos_tx);
1052
1053 /* We copy the skb to be retransmitted since we will have to
1054 * modify it. Cloning will confuse packet sniffers
1055 */
1056 /* tx_skb = skb_clone( skb, GFP_ATOMIC); */
1057 tx_skb = skb_copy(skb, GFP_ATOMIC);
1058 if (!tx_skb) {
1059 IRDA_DEBUG(0, "%s(), unable to copy\n", __FUNCTION__);
1060 return;
1061 }
1062
1063 /* Clear old Nr field + poll bit */
1064 tx_skb->data[1] &= 0x0f;
1065
1066 /* Set poll/final bit */
1067 tx_skb->data[1] |= PF_BIT; /* Set p/f bit */
1068
1069 irlap_send_i_frame(self, tx_skb, command);
1070 }
1071 }
1072
1073 /*
1074 * Function irlap_send_ui_frame (self, skb, command)
1075 *
1076 * Contruct and transmit an Unnumbered Information (UI) frame
1077 *
1078 */
1079 void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
1080 __u8 caddr, int command)
1081 {
1082 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
1083
1084 IRDA_ASSERT(self != NULL, return;);
1085 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
1086 IRDA_ASSERT(skb != NULL, return;);
1087
1088 /* Insert connection address */
1089 skb->data[0] = caddr | ((command) ? CMD_FRAME : 0);
1090
1091 irlap_queue_xmit(self, skb);
1092 }
1093
1094 /*
1095 * Function irlap_send_i_frame (skb)
1096 *
1097 * Contruct and transmit Information (I) frame
1098 */
1099 static void irlap_send_i_frame(struct irlap_cb *self, struct sk_buff *skb,
1100 int command)
1101 {
1102 /* Insert connection address */
1103 skb->data[0] = self->caddr;
1104 skb->data[0] |= (command) ? CMD_FRAME : 0;
1105
1106 /* Insert next to receive (Vr) */
1107 skb->data[1] |= (self->vr << 5); /* insert nr */
1108
1109 irlap_queue_xmit(self, skb);
1110 }
1111
1112 /*
1113 * Function irlap_recv_i_frame (skb, frame)
1114 *
1115 * Receive and parse an I (Information) frame, no harm in making it inline
1116 * since it's called only from one single place (irlap_driver_rcv).
1117 */
1118 static inline void irlap_recv_i_frame(struct irlap_cb *self,
1119 struct sk_buff *skb,
1120 struct irlap_info *info, int command)
1121 {
1122 info->nr = skb->data[1] >> 5; /* Next to receive */
1123 info->pf = skb->data[1] & PF_BIT; /* Final bit */
1124 info->ns = (skb->data[1] >> 1) & 0x07; /* Next to send */
1125
1126 /* Check if this is a command or a response frame */
1127 if (command)
1128 irlap_do_event(self, RECV_I_CMD, skb, info);
1129 else
1130 irlap_do_event(self, RECV_I_RSP, skb, info);
1131 }
1132
1133 /*
1134 * Function irlap_recv_ui_frame (self, skb, info)
1135 *
1136 * Receive and parse an Unnumbered Information (UI) frame
1137 *
1138 */
1139 static void irlap_recv_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
1140 struct irlap_info *info)
1141 {
1142 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
1143
1144 info->pf = skb->data[1] & PF_BIT; /* Final bit */
1145
1146 irlap_do_event(self, RECV_UI_FRAME, skb, info);
1147 }
1148
1149 /*
1150 * Function irlap_recv_frmr_frame (skb, frame)
1151 *
1152 * Received Frame Reject response.
1153 *
1154 */
1155 static void irlap_recv_frmr_frame(struct irlap_cb *self, struct sk_buff *skb,
1156 struct irlap_info *info)
1157 {
1158 __u8 *frame;
1159 int w, x, y, z;
1160
1161 IRDA_DEBUG(0, "%s()\n", __FUNCTION__);
1162
1163 IRDA_ASSERT(self != NULL, return;);
1164 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
1165 IRDA_ASSERT(skb != NULL, return;);
1166 IRDA_ASSERT(info != NULL, return;);
1167
1168 if (!pskb_may_pull(skb, 4)) {
1169 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
1170 return;
1171 }
1172
1173 frame = skb->data;
1174
1175 info->nr = frame[2] >> 5; /* Next to receive */
1176 info->pf = frame[2] & PF_BIT; /* Final bit */
1177 info->ns = (frame[2] >> 1) & 0x07; /* Next to send */
1178
1179 w = frame[3] & 0x01;
1180 x = frame[3] & 0x02;
1181 y = frame[3] & 0x04;
1182 z = frame[3] & 0x08;
1183
1184 if (w) {
1185 IRDA_DEBUG(0, "Rejected control field is undefined or not "
1186 "implemented.\n");
1187 }
1188 if (x) {
1189 IRDA_DEBUG(0, "Rejected control field was invalid because it "
1190 "contained a non permitted I field.\n");
1191 }
1192 if (y) {
1193 IRDA_DEBUG(0, "Received I field exceeded the maximum negotiated "
1194 "for the existing connection or exceeded the maximum "
1195 "this station supports if no connection exists.\n");
1196 }
1197 if (z) {
1198 IRDA_DEBUG(0, "Rejected control field control field contained an "
1199 "invalid Nr count.\n");
1200 }
1201 irlap_do_event(self, RECV_FRMR_RSP, skb, info);
1202 }
1203
1204 /*
1205 * Function irlap_send_test_frame (self, daddr)
1206 *
1207 * Send a test frame response
1208 *
1209 */
1210 void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
1211 struct sk_buff *cmd)
1212 {
1213 struct sk_buff *tx_skb;
1214 struct test_frame *frame;
1215 __u8 *info;
1216
1217 tx_skb = alloc_skb(cmd->len+sizeof(struct test_frame), GFP_ATOMIC);
1218 if (!tx_skb)
1219 return;
1220
1221 /* Broadcast frames must include saddr and daddr fields */
1222 if (caddr == CBROADCAST) {
1223 frame = (struct test_frame *)
1224 skb_put(tx_skb, sizeof(struct test_frame));
1225
1226 /* Insert the swapped addresses */
1227 frame->saddr = cpu_to_le32(self->saddr);
1228 frame->daddr = cpu_to_le32(daddr);
1229 } else
1230 frame = (struct test_frame *) skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER);
1231
1232 frame->caddr = caddr;
1233 frame->control = TEST_RSP | PF_BIT;
1234
1235 /* Copy info */
1236 info = skb_put(tx_skb, cmd->len);
1237 memcpy(info, cmd->data, cmd->len);
1238
1239 /* Return to sender */
1240 irlap_wait_min_turn_around(self, &self->qos_tx);
1241 irlap_queue_xmit(self, tx_skb);
1242 }
1243
1244 /*
1245 * Function irlap_recv_test_frame (self, skb)
1246 *
1247 * Receive a test frame
1248 *
1249 */
1250 static void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb,
1251 struct irlap_info *info, int command)
1252 {
1253 struct test_frame *frame;
1254
1255 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
1256
1257 if (!pskb_may_pull(skb, sizeof(*frame))) {
1258 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
1259 return;
1260 }
1261 frame = (struct test_frame *) skb->data;
1262
1263 /* Broadcast frames must carry saddr and daddr fields */
1264 if (info->caddr == CBROADCAST) {
1265 if (skb->len < sizeof(struct test_frame)) {
1266 IRDA_DEBUG(0, "%s() test frame to short!\n",
1267 __FUNCTION__);
1268 return;
1269 }
1270
1271 /* Read and swap addresses */
1272 info->daddr = le32_to_cpu(frame->saddr);
1273 info->saddr = le32_to_cpu(frame->daddr);
1274
1275 /* Make sure frame is addressed to us */
1276 if ((info->saddr != self->saddr) &&
1277 (info->saddr != BROADCAST)) {
1278 return;
1279 }
1280 }
1281
1282 if (command)
1283 irlap_do_event(self, RECV_TEST_CMD, skb, info);
1284 else
1285 irlap_do_event(self, RECV_TEST_RSP, skb, info);
1286 }
1287
1288 /*
1289 * Function irlap_driver_rcv (skb, netdev, ptype)
1290 *
1291 * Called when a frame is received. Dispatches the right receive function
1292 * for processing of the frame.
1293 *
1294 * Note on skb management :
1295 * After calling the higher layers of the IrDA stack, we always
1296 * kfree() the skb, which drop the reference count (and potentially
1297 * destroy it).
1298 * If a higher layer of the stack want to keep the skb around (to put
1299 * in a queue or pass it to the higher layer), it will need to use
1300 * skb_get() to keep a reference on it. This is usually done at the
1301 * LMP level in irlmp.c.
1302 * Jean II
1303 */
1304 int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
1305 struct packet_type *ptype, struct net_device *orig_dev)
1306 {
1307 struct irlap_info info;
1308 struct irlap_cb *self;
1309 int command;
1310 __u8 control;
1311
1312 /* FIXME: should we get our own field? */
1313 self = (struct irlap_cb *) dev->atalk_ptr;
1314
1315 /* If the net device is down, then IrLAP is gone! */
1316 if (!self || self->magic != LAP_MAGIC) {
1317 dev_kfree_skb(skb);
1318 return -1;
1319 }
1320
1321 /* We are no longer an "old" protocol, so we need to handle
1322 * share and non linear skbs. This should never happen, so
1323 * we don't need to be clever about it. Jean II */
1324 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
1325 IRDA_ERROR("%s: can't clone shared skb!\n", __FUNCTION__);
1326 dev_kfree_skb(skb);
1327 return -1;
1328 }
1329
1330 /* Check if frame is large enough for parsing */
1331 if (!pskb_may_pull(skb, 2)) {
1332 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
1333 dev_kfree_skb(skb);
1334 return -1;
1335 }
1336
1337 command = skb->data[0] & CMD_FRAME;
1338 info.caddr = skb->data[0] & CBROADCAST;
1339
1340 info.pf = skb->data[1] & PF_BIT;
1341 info.control = skb->data[1] & ~PF_BIT; /* Mask away poll/final bit */
1342
1343 control = info.control;
1344
1345 /* First we check if this frame has a valid connection address */
1346 if ((info.caddr != self->caddr) && (info.caddr != CBROADCAST)) {
1347 IRDA_DEBUG(0, "%s(), wrong connection address!\n",
1348 __FUNCTION__);
1349 goto out;
1350 }
1351 /*
1352 * Optimize for the common case and check if the frame is an
1353 * I(nformation) frame. Only I-frames have bit 0 set to 0
1354 */
1355 if (~control & 0x01) {
1356 irlap_recv_i_frame(self, skb, &info, command);
1357 goto out;
1358 }
1359 /*
1360 * We now check is the frame is an S(upervisory) frame. Only
1361 * S-frames have bit 0 set to 1 and bit 1 set to 0
1362 */
1363 if (~control & 0x02) {
1364 /*
1365 * Received S(upervisory) frame, check which frame type it is
1366 * only the first nibble is of interest
1367 */
1368 switch (control & 0x0f) {
1369 case RR:
1370 irlap_recv_rr_frame(self, skb, &info, command);
1371 break;
1372 case RNR:
1373 irlap_recv_rnr_frame(self, skb, &info, command);
1374 break;
1375 case REJ:
1376 irlap_recv_rej_frame(self, skb, &info, command);
1377 break;
1378 case SREJ:
1379 irlap_recv_srej_frame(self, skb, &info, command);
1380 break;
1381 default:
1382 IRDA_WARNING("%s: Unknown S-frame %02x received!\n",
1383 __FUNCTION__, info.control);
1384 break;
1385 }
1386 goto out;
1387 }
1388 /*
1389 * This must be a C(ontrol) frame
1390 */
1391 switch (control) {
1392 case XID_RSP:
1393 irlap_recv_discovery_xid_rsp(self, skb, &info);
1394 break;
1395 case XID_CMD:
1396 irlap_recv_discovery_xid_cmd(self, skb, &info);
1397 break;
1398 case SNRM_CMD:
1399 irlap_recv_snrm_cmd(self, skb, &info);
1400 break;
1401 case DM_RSP:
1402 irlap_do_event(self, RECV_DM_RSP, skb, &info);
1403 break;
1404 case DISC_CMD: /* And RD_RSP since they have the same value */
1405 irlap_recv_disc_frame(self, skb, &info, command);
1406 break;
1407 case TEST_CMD:
1408 irlap_recv_test_frame(self, skb, &info, command);
1409 break;
1410 case UA_RSP:
1411 irlap_recv_ua_frame(self, skb, &info);
1412 break;
1413 case FRMR_RSP:
1414 irlap_recv_frmr_frame(self, skb, &info);
1415 break;
1416 case UI_FRAME:
1417 irlap_recv_ui_frame(self, skb, &info);
1418 break;
1419 default:
1420 IRDA_WARNING("%s: Unknown frame %02x received!\n",
1421 __FUNCTION__, info.control);
1422 break;
1423 }
1424 out:
1425 /* Always drop our reference on the skb */
1426 dev_kfree_skb(skb);
1427 return 0;
1428 }
This page took 0.060335 seconds and 5 git commands to generate.