build: create pkginfo dir earlier to avoid build breakage
[openwrt.git] / package / madwifi / patches / 341-minrate.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -1308,6 +1308,7 @@ ath_vap_create(struct ieee80211com *ic,
4         vap->iv_key_update_begin = ath_key_update_begin;
5         vap->iv_key_update_end = ath_key_update_end;
6         vap->iv_maxrateindex = 0;
7 +       vap->iv_minrateindex = 0;
8         if (sc->sc_default_ieee80211_debug) {
9                 /* User specified defaults for new VAPs were provided, so
10                  * use those (only). */
11 --- a/ath_rate/minstrel/minstrel.c
12 +++ b/ath_rate/minstrel/minstrel.c
13 @@ -638,9 +638,15 @@ ath_rate_ctl_reset(struct ath_softc *sc,
14                         sn->rs_succ_hist        [x] = 0;
15                         sn->rs_att_hist         [x] = 0;
16                         sn->rs_this_tp          [x] = 0;
17 -
18 +                       if (vap->iv_minrateindex && vap->iv_minrateindex<ni->ni_rates.rs_nrates)
19 +                       {
20 +                       int idx = vap->iv_minrateindex; 
21 +                       sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
22 +                       sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
23 +                       }else{
24                         sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
25                         sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
26 +                       }
27                         if (sn->rates[x].rix == 0xff) {
28                                 DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
29                                         dev_info, __func__, x);
30 @@ -649,7 +655,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
31                         sn->rates[x].rateCode = rt->info[sn->rates[x].rix].rateCode;
32                         sn->rates[x].shortPreambleRateCode =
33                                 rt->info[sn->rates[x].rix].rateCode |
34 -                               rt->info[sn->rates[x].rix].shortPreamble;
35 +                               rt->info[sn->rates[x].rix].shortPreamble;                       
36                 }
37  
38                 ath_fill_sample_table(sn);
39 --- a/ath_rate/sample/sample.c
40 +++ b/ath_rate/sample/sample.c
41 @@ -842,8 +842,15 @@ ath_rate_ctl_reset(struct ath_softc *sc,
42                 sn->num_rates = vap->iv_maxrateindex;
43  
44         for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
45 -               sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
46 -               sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
47 +               if (vap->iv_minrateindex && vap->iv_minrateindex<ni->ni_rates.rs_nrates)
48 +                       {
49 +                       int idx = vap->iv_minrateindex; 
50 +                       sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
51 +                       sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
52 +                       }else{
53 +                       sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
54 +                       sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
55 +                       }
56                 if (sn->rates[x].rix == 0xff) {
57                         DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %u\n",
58                                 dev_info, __func__, x);
59 --- a/net80211/ieee80211_ioctl.h
60 +++ b/net80211/ieee80211_ioctl.h
61 @@ -642,6 +642,7 @@ enum {
62         IEEE80211_PARAM_BEACON_MISS_THRESH      = 73,   /* Beacon miss threshold (in beacons) */
63         IEEE80211_PARAM_BEACON_MISS_THRESH_MS   = 74,   /* Beacon miss threshold (in ms) */
64         IEEE80211_PARAM_MAXRATE                 = 75,   /* Maximum rate (by table index) */
65 +       IEEE80211_PARAM_MINRATE                 = 76,   /* Minimum rate (by table index) */
66  };
67  
68  #define        SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
69 --- a/net80211/ieee80211_var.h
70 +++ b/net80211/ieee80211_var.h
71 @@ -282,6 +282,7 @@ struct ieee80211vap {
72         struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
73         u_int32_t app_filter;                           /* filters which management frames are forwarded to app */
74         u_int iv_maxrateindex;
75 +       u_int iv_minrateindex;
76  };
77  
78  /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
79 --- a/net80211/ieee80211_wireless.c
80 +++ b/net80211/ieee80211_wireless.c
81 @@ -2845,6 +2845,12 @@ ieee80211_ioctl_setparam(struct net_devi
82                 else
83                         vap->iv_maxrateindex = 0;
84                 break;
85 +       case IEEE80211_PARAM_MINRATE:
86 +               if (value > 0)
87 +                       vap->iv_minrateindex = value;
88 +               else
89 +                       vap->iv_minrateindex = 0;
90 +               break;
91  #ifdef ATH_REVERSE_ENGINEERING
92         case IEEE80211_PARAM_DUMPREGS:
93                 ieee80211_dump_registers(dev, info, w, extra);
94 @@ -3183,6 +3189,9 @@ ieee80211_ioctl_getparam(struct net_devi
95         case IEEE80211_PARAM_MAXRATE:
96                 param[0] = vap->iv_maxrateindex;
97                 break;
98 +       case IEEE80211_PARAM_MINRATE:
99 +               param[0] = vap->iv_minrateindex;
100 +               break;
101         default:
102                 return -EOPNOTSUPP;
103         }
104 @@ -5623,6 +5632,10 @@ static const struct iw_priv_args ieee802
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 +       {IEEE80211_PARAM_MINRATE,
109 +        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "minrate"},
110 +       {IEEE80211_PARAM_MINRATE,
111 +        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
112  
113  #ifdef ATH_REVERSE_ENGINEERING
114         /*