]> git.pld-linux.org Git - packages/kernel.git/blob - atm-04-min-frame-size.patch
- atm backport from 2.5 and fixes for kernel 2.4
[packages/kernel.git] / atm-04-min-frame-size.patch
1 the minimum frame size for token ring (802.5) pdus is 16 octets.  also,
2 count the pdus that failed to copy as dropped.  also, skb_copy_expand()
3 now seems to be the right way to do this.
4
5 Index: linux/net/atm/lec.c
6 ===================================================================
7 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
8 retrieving revision 1.5
9 retrieving revision 1.6
10 diff -u -d -b -w -r1.5 -r1.6
11 --- linux/net/atm/lec.c 22 Feb 2003 19:23:22 -0000      1.5
12 +++ linux/net/atm/lec.c 24 Feb 2003 13:24:45 -0000      1.6
13 @@ -223,7 +223,8 @@
14          struct lecdatahdr_8023 *lec_h;
15          struct atm_vcc *send_vcc;
16         struct lec_arp_table *entry;
17 -        unsigned char *nb, *dst;
18 +        unsigned char *dst;
19 +       int min_frame_size;
20  #ifdef CONFIG_TR
21          unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */
22  #endif
23 @@ -294,26 +295,24 @@
24  #endif /* DUMP_PACKETS > 0 */
25  
26          /* Minimum ethernet-frame size */
27 -        if (skb->len <62) {
28 -                if (skb->truesize < 62) {
29 -                        printk("%s:data packet %d / %d\n",
30 -                               dev->name,
31 -                               skb->len,skb->truesize);
32 -                        nb=(unsigned char*)kmalloc(64, GFP_ATOMIC);
33 -                        if (nb == NULL) {
34 +#ifdef CONFIG_TR
35 +        if (priv->is_trdev)
36 +                min_frame_size = LEC_MINIMUM_8025_SIZE;
37 +       else
38 +#endif
39 +        min_frame_size = LEC_MINIMUM_8023_SIZE;
40 +        if (skb->len < min_frame_size) {
41 +                if (skb->truesize < min_frame_size) {
42 +                        skb2 = skb_copy_expand(skb, 0,
43 +                            min_frame_size - skb->truesize, GFP_ATOMIC);
44                                  dev_kfree_skb(skb);
45 +                        if (skb2 == NULL) {
46 +                                priv->stats.tx_dropped++;
47                                  return 0;
48                          }
49 -                        memcpy(nb,skb->data,skb->len);
50 -                        kfree(skb->head);
51 -                        skb->head = skb->data = nb;
52 -                        skb->tail = nb+62;
53 -                        skb->end = nb+64;
54 -                        skb->len=62;
55 -                        skb->truesize = 64;
56 -                } else {
57 -                        skb->len = 62;
58 +                        skb = skb2;
59                  }
60 +               skb_put(skb, min_frame_size - skb->len);
61          }
62          
63          /* Send to right vcc */
64 Index: linux/net/atm/lec.h
65 ===================================================================
66 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.h,v
67 retrieving revision 1.2
68 retrieving revision 1.3
69 diff -u -d -b -w -r1.2 -r1.3
70 --- linux/net/atm/lec.h 22 Feb 2003 19:29:27 -0000      1.2
71 +++ linux/net/atm/lec.h 24 Feb 2003 13:24:46 -0000      1.3
72 @@ -38,6 +38,9 @@
73    unsigned char h_source[ETH_ALEN];
74  };
75  
76 +#define LEC_MINIMUM_8023_SIZE   62
77 +#define LEC_MINIMUM_8025_SIZE   16
78 +
79  /*
80   * Operations that LANE2 capable device can do. Two first functions
81   * are used to make the device do things. See spec 3.1.3 and 3.1.4.
82 -
83 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
84 the body of a message to majordomo@vger.kernel.org
85 More majordomo info at  http://vger.kernel.org/majordomo-info.html
86 Please read the FAQ at  http://www.tux.org/lkml/
This page took 0.036617 seconds and 4 git commands to generate.