Merge bk://oe-devel@oe-devel.bkbits.net/packages
[vuplus_openembedded] / linux / openzaurus-pxa-2.4.18-rmk7-pxa3-embedix20031107 / irda-qos.patch
1 diff -urN linux.orig/net/irda/irsysctl.c linux/net/irda/irsysctl.c
2 --- linux.orig/net/irda/irsysctl.c      Fri Feb 27 18:28:04 2004
3 +++ linux/net/irda/irsysctl.c   Wed Jan 14 19:36:40 2004
4 @@ -40,7 +40,8 @@
5  
6  enum { DISCOVERY=1, DEVNAME, DEBUG, FAST_POLL, DISCOVERY_SLOTS,
7         DISCOVERY_TIMEOUT, SLOT_TIMEOUT, MAX_BAUD_RATE, MIN_TX_TURN_TIME,
8 -       MAX_NOREPLY_TIME, WARN_NOREPLY_TIME, LAP_KEEPALIVE_TIME, SPECIFIC_DEV };
9 +       MAX_TX_WINDOW, MAX_NOREPLY_TIME, WARN_NOREPLY_TIME,
10 +       LAP_KEEPALIVE_TIME, SPECIFIC_DEV };
11  
12  extern int  sysctl_discovery;
13  extern int  sysctl_discovery_slots;
14 @@ -51,6 +52,7 @@
15  extern char sysctl_devname[];
16  extern int  sysctl_max_baud_rate;
17  extern int  sysctl_min_tx_turn_time;
18 +extern int  sysctl_max_tx_window;
19  extern int  sysctl_max_noreply_time;
20  extern int  sysctl_warn_noreply_time;
21  extern int  sysctl_lap_keepalive_time;
22 @@ -71,6 +73,8 @@
23  static int min_max_baud_rate = 2400;
24  static int max_min_tx_turn_time = 10000;       /* See qos.c - IrLAP spec */
25  static int min_min_tx_turn_time = 0;
26 +static int max_max_tx_window=7;
27 +static int min_max_tx_window=1;
28  static int max_max_noreply_time = 40;          /* See qos.c - IrLAP spec */
29  static int min_max_noreply_time = 3;
30  static int max_warn_noreply_time = 3;          /* 3s == standard */
31 @@ -128,6 +132,9 @@
32         { MIN_TX_TURN_TIME, "min_tx_turn_time", &sysctl_min_tx_turn_time,
33           sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
34           NULL, &min_min_tx_turn_time, &max_min_tx_turn_time },
35 +       { MAX_TX_WINDOW, "max_tx_window", &sysctl_max_tx_window,
36 +         sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
37 +         NULL, &min_max_tx_window, &max_max_tx_window },
38         { MAX_NOREPLY_TIME, "max_noreply_time", &sysctl_max_noreply_time,
39           sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
40           NULL, &min_max_noreply_time, &max_max_noreply_time },
41 diff -urN linux.orig/net/irda/parameters.c linux/net/irda/parameters.c
42 --- linux.orig/net/irda/parameters.c    Sat Nov 10 01:22:17 2001
43 +++ linux/net/irda/parameters.c Wed Jan 14 19:34:23 2004
44 @@ -204,12 +204,14 @@
45  {
46         irda_param_t p;
47         int n = 0;
48 +       int extract_len;
49         int err;
50  
51         p.pi = pi;     /* In case handler needs to know */
52         p.pl = buf[1]; /* Extract lenght of value */
53         p.pv.i = 0;    /* Clear value */
54 -
55 +       extract_len = p.pl;
56 +       
57         /* Check if buffer is long enough for parsing */
58         if (len < (2+p.pl)) {
59                 WARNING(__FUNCTION__ "(), buffer to short for parsing! "
60 @@ -226,12 +228,15 @@
61                       "Expected %d bytes, but value had %d bytes!\n",
62                       type & PV_MASK, p.pl);
63                 
64 -               /* Skip parameter */
65 +           if((p.pl < (type & PV_MASK)) || (type & PV_BIG_ENDIAN)) {
66                 return p.pl+2;
67 +           } else {
68 +               extract_len = type & PV_MASK;
69 +           }
70         }
71  
72  
73 -       switch (p.pl) {
74 +       switch (extract_len) {
75         case 1:
76                 n += irda_param_unpack(buf+2, "b", &p.pv.i);
77                 break;
78 diff -urN linux.orig/net/irda/qos.c linux/net/irda/qos.c
79 --- linux.orig/net/irda/qos.c   Fri Feb 27 18:28:04 2004
80 +++ linux/net/irda/qos.c        Wed Jan 14 18:18:20 2004
81 @@ -65,6 +65,7 @@
82   */
83  unsigned sysctl_min_tx_turn_time = 10;
84  
85 +unsigned sysctl_max_tx_window = 7;
86  /*
87   * Specific device list limits some negotiation parameters at the connection
88   * with listed peer devices.
89 @@ -212,6 +213,9 @@
90         __u16 msb = 0x8000;
91         int index = 15;   /* Current MSB */
92         
93 +       if(!word)
94 +           word=0x1;
95 +
96         while (msb) {
97                 if (word & msb)
98                         break;   /* Found it! */
99 @@ -386,6 +390,9 @@
100                 qos->max_turn_time.value = 500;
101         }
102         
103 +       if(qos->window_size.value > sysctl_max_tx_window)
104 +           qos->window_size.value = sysctl_max_tx_window;
105 +           
106         /*
107          * The data size must be adjusted according to the baud rate and max 
108          * turn time