madwifi: refresh patches
[openwrt.git] / package / madwifi / patches / 340-maxrate.patch
1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c
4 +++ madwifi-trunk-r3314/ath/if_ath.c
5 @@ -1307,6 +1307,7 @@
6         vap->iv_key_set = ath_key_set;
7         vap->iv_key_update_begin = ath_key_update_begin;
8         vap->iv_key_update_end = ath_key_update_end;
9 +       vap->iv_maxrateindex = 0;
10         if (sc->sc_default_ieee80211_debug) {
11                 /* User specified defaults for new VAPs were provided, so
12                  * use those (only). */
13 Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
14 ===================================================================
15 --- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
16 +++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
17 @@ -622,8 +622,12 @@
18                         return;
19                 }
20                 sn->static_rate_ndx = -1;
21 +               if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
22 +                   || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
23 +                       sn->num_rates = ni->ni_rates.rs_nrates;
24 +               else
25 +                       sn->num_rates = vap->iv_maxrateindex;
26  
27 -               sn->num_rates = ni->ni_rates.rs_nrates;
28                 for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
29                         sn->rs_rateattempts     [x] = 0;
30                         sn->rs_thisprob         [x] = 0;
31 Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
32 ===================================================================
33 --- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c
34 +++ madwifi-trunk-r3314/ath_rate/sample/sample.c
35 @@ -835,7 +835,12 @@
36         }
37         sn->static_rate_ndx = -1;
38  
39 -       sn->num_rates = ni->ni_rates.rs_nrates;
40 +       if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
41 +           || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
42 +               sn->num_rates = ni->ni_rates.rs_nrates;
43 +       else
44 +               sn->num_rates = vap->iv_maxrateindex;
45 +
46         for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
47                 sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
48                 sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
49 Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
50 ===================================================================
51 --- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h
52 +++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
53 @@ -641,6 +641,7 @@
54                                                            FCC requires 30m, so that is the default. */
55         IEEE80211_PARAM_BEACON_MISS_THRESH      = 73,   /* Beacon miss threshold (in beacons) */
56         IEEE80211_PARAM_BEACON_MISS_THRESH_MS   = 74,   /* Beacon miss threshold (in ms) */
57 +       IEEE80211_PARAM_MAXRATE                 = 75,   /* Maximum rate (by table index) */
58  };
59  
60  #define        SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
61 Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
62 ===================================================================
63 --- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h
64 +++ madwifi-trunk-r3314/net80211/ieee80211_var.h
65 @@ -281,6 +281,7 @@
66         struct ieee80211_spy iv_spy;                    /* IWSPY support */
67         struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
68         u_int32_t app_filter;                           /* filters which management frames are forwarded to app */
69 +       int iv_maxrateindex;
70  };
71  
72  /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
73 Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
74 ===================================================================
75 --- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c
76 +++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c
77 @@ -2839,6 +2839,12 @@
78                 else
79                         ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
80                 break;
81 +       case IEEE80211_PARAM_MAXRATE:
82 +               if (value > 0)
83 +                       vap->iv_maxrateindex = value;
84 +               else
85 +                       vap->iv_maxrateindex = 0;
86 +               break;
87  #ifdef ATH_REVERSE_ENGINEERING
88         case IEEE80211_PARAM_DUMPREGS:
89                 ieee80211_dump_registers(dev, info, w, extra);
90 @@ -3174,6 +3180,9 @@
91                 else
92                         param[0] = 0;
93                 break;
94 +       case IEEE80211_PARAM_MAXRATE:
95 +               param[0] = vap->iv_maxrateindex;
96 +               break;
97         default:
98                 return -EOPNOTSUPP;
99         }
100 @@ -5610,6 +5619,10 @@
101           0, IW_PRIV_TYPE_APPIEBUF, "getiebuf" },
102         { IEEE80211_IOCTL_FILTERFRAME,
103           IW_PRIV_TYPE_FILTER , 0, "setfilter" },
104 +       {IEEE80211_PARAM_MAXRATE,
105 +        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxrate"},
106 +       {IEEE80211_PARAM_MAXRATE,
107 +        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxrate"},
108  
109  #ifdef ATH_REVERSE_ENGINEERING
110         /*