]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/files/ir241_qos_param-2.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / files / ir241_qos_param-2.diff
1 --- linux/net/irda/qos.c.orig   2005-01-22 19:19:56.013787192 +0100
2 +++ linux/net/irda/qos.c        2005-01-22 19:21:13.493008560 +0100
3 @@ -73,13 +73,18 @@
4   * 1.2, chapt 5.3.2.1, p41). But, this number includes the LAP header
5   * (2 bytes), and CRC (32 bits at 4 Mb/s). So, for the I field (LAP
6   * payload), that's only 2042 bytes. Oups !
7 - * I've had trouble trouble transmitting 2048 bytes frames with USB
8 - * dongles and nsc-ircc at 4 Mb/s, so adjust to 2042... I don't know
9 - * if this bug applies only for 2048 bytes frames or all negociated
10 - * frame sizes, but all hardware seem to support "2048 bytes" frames.
11 - * You can use the sysctl to play with this value anyway.
12 + * My nsc-ircc hardware has troubles receiving 2048 bytes frames at 4 Mb/s,
13 + * so adjust to 2042... I don't know if this bug applies only for 2048
14 + * bytes frames or all negociated frame sizes, but you can use the sysctl
15 + * to play with this value anyway.
16   * Jean II */
17  unsigned sysctl_max_tx_data_size = 2042;
18 +/*
19 + * Maximum transmit window, i.e. number of LAP frames between turn-around.
20 + * This allow to override what the peer told us. Some peers are buggy and
21 + * don't always support what they tell us.
22 + * Jean II */
23 +unsigned sysctl_max_tx_window = 7;
24  
25  /*
26   * Specific device list limits some negotiation parameters at the connection
27 @@ -227,7 +232,19 @@
28  {
29         __u16 msb = 0x8000;
30         int index = 15;   /* Current MSB */
31 -       
32 +
33 +       /* Check for buggy peers.
34 +        * Note : there is a small probability that it could be us, but I
35 +        * would expect driver authors to catch that pretty early and be
36 +        * able to check precisely what's going on. If a end user sees this,
37 +        * it's very likely the peer. - Jean II */
38 +       if (word == 0) {
39 +               WARNING("%s(), Detected buggy peer, adjust null PV to 0x1!\n",
40 +                        __FUNCTION__);
41 +               /* The only safe choice (we don't know the array size) */
42 +               word = 0x1;
43 +       }
44 +
45         while (msb) {
46                 if (word & msb)
47                         break;   /* Found it! */
48 @@ -378,10 +395,14 @@
49  
50         /*
51          * Make sure the mintt is sensible.
52 +        * Main culprit : Ericsson T39. - Jean II
53          */
54         if (sysctl_min_tx_turn_time > qos->min_turn_time.value) {
55                 int i;
56  
57 +               WARNING("%s(), Detected buggy peer, adjust mtt to %dus!\n",
58 +                        __FUNCTION__, sysctl_min_tx_turn_time);
59 +
60                 /* We don't really need bits, but easier this way */
61                 i = value_highest_bit(sysctl_min_tx_turn_time, min_turn_times,
62                                       8, &qos->min_turn_time.bits);
63 @@ -443,6 +464,11 @@
64         if (qos->data_size.value > sysctl_max_tx_data_size)
65                 /* Allow non discrete adjustement to avoid loosing capacity */
66                 qos->data_size.value = sysctl_max_tx_data_size;
67 +       /*
68 +        * Override Tx window if user request it. - Jean II
69 +        */
70 +       if (qos->window_size.value > sysctl_max_tx_window)
71 +               qos->window_size.value = sysctl_max_tx_window;
72  }
73  
74  /*
75 --- linux/net/irda/irsysctl.c.orig      2005-01-22 19:19:56.006788256 +0100
76 +++ linux/net/irda/irsysctl.c   2005-01-22 19:24:31.273941288 +0100
77 @@ -40,8 +40,8 @@
78  
79  enum { DISCOVERY=1, DEVNAME, DEBUG, FAST_POLL, DISCOVERY_SLOTS,
80         DISCOVERY_TIMEOUT, SLOT_TIMEOUT, MAX_BAUD_RATE, MIN_TX_TURN_TIME,
81 -       MAX_TX_DATA_SIZE, MAX_NOREPLY_TIME, WARN_NOREPLY_TIME, LAP_KEEPALIVE_TIME,
82 -       SPECIFIC_DEV };
83 +       MAX_TX_DATA_SIZE, MAX_TX_WINDOW, MAX_NOREPLY_TIME, WARN_NOREPLY_TIME, 
84 +       LAP_KEEPALIVE_TIME, SPECIFIC_DEV };
85  
86  extern int  sysctl_discovery;
87  extern int  sysctl_discovery_slots;
88 @@ -53,6 +53,7 @@
89  extern int  sysctl_max_baud_rate;
90  extern int  sysctl_min_tx_turn_time;
91  extern int  sysctl_max_tx_data_size;
92 +extern int  sysctl_max_tx_window;
93  extern int  sysctl_max_noreply_time;
94  extern int  sysctl_warn_noreply_time;
95  extern int  sysctl_lap_keepalive_time;
96 @@ -75,6 +76,8 @@
97  static int min_min_tx_turn_time = 0;
98  static int max_max_tx_data_size = 2048;                /* See qos.c - IrLAP spec */
99  static int min_max_tx_data_size = 64;
100 +static int max_max_tx_window = 7;              /* See qos.c - IrLAP spec */
101 +static int min_max_tx_window = 1;
102  static int max_max_noreply_time = 40;          /* See qos.c - IrLAP spec */
103  static int min_max_noreply_time = 3;
104  static int max_warn_noreply_time = 3;          /* 3s == standard */
105 @@ -135,6 +138,9 @@
106         { MAX_TX_DATA_SIZE, "max_tx_data_size", &sysctl_max_tx_data_size,
107           sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
108           NULL, &min_max_tx_data_size, &max_max_tx_data_size },
109 +       { MAX_TX_WINDOW, "max_tx_window", &sysctl_max_tx_window,
110 +         sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
111 +         NULL, &min_max_tx_window, &max_max_tx_window },
112         { MAX_NOREPLY_TIME, "max_noreply_time", &sysctl_max_noreply_time,
113           sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
114           NULL, &min_max_noreply_time, &max_max_noreply_time },
115 --- linux/net/irda/parameters.c.orig    2003-05-13 11:20:16.000000000 +0200
116 +++ linux/net/irda/parameters.c 2005-01-22 19:21:13.527003392 +0100
117 @@ -204,11 +204,13 @@
118  {
119         irda_param_t p;
120         int n = 0;
121 +       int extract_len;        /* Real lenght we extract */
122         int err;
123  
124         p.pi = pi;     /* In case handler needs to know */
125         p.pl = buf[1]; /* Extract lenght of value */
126         p.pv.i = 0;    /* Clear value */
127 +       extract_len = p.pl;     /* Default : extract all */
128  
129         /* Check if buffer is long enough for parsing */
130         if (len < (2+p.pl)) {
131 @@ -220,18 +222,30 @@
132         /* 
133          * Check that the integer length is what we expect it to be. If the
134          * handler want a 16 bits integer then a 32 bits is not good enough
135 +        * PV_INTEGER means that the handler is flexible.
136          */
137         if (((type & PV_MASK) != PV_INTEGER) && ((type & PV_MASK) != p.pl)) {
138                 ERROR(__FUNCTION__ "(), invalid parameter length! "
139                       "Expected %d bytes, but value had %d bytes!\n",
140                       type & PV_MASK, p.pl);
141                 
142 -               /* Skip parameter */
143 -               return p.pl+2;
144 +               /* Most parameters are bit/byte fields or little endian,
145 +                * so it's ok to only extract a subset of it (the subset
146 +                * that the handler expect). This is necessary, as some
147 +                * broken implementations seems to add extra undefined bits.
148 +                * If the parameter is shorter than we expect or is big
149 +                * endian, we can't play those tricks. Jean II */
150 +               if((p.pl < (type & PV_MASK)) || (type & PV_BIG_ENDIAN)) {
151 +                       /* Skip parameter */
152 +                       return p.pl+2;
153 +               } else {
154 +                       /* Extract subset of it, fallthrough */
155 +                       extract_len = type & PV_MASK;
156 +               }
157         }
158  
159  
160 -       switch (p.pl) {
161 +       switch (extract_len) {
162         case 1:
163                 n += irda_param_unpack(buf+2, "b", &p.pv.i);
164                 break;