Documentation/Libmac: madwifi-0.9.1-libmac.diff

File madwifi-0.9.1-libmac.diff, 24.4 kB (added by kishore, 2 years ago)
  • ath/if_ath.c

    diff -Naur madwifi-0.9.1/ath/if_ath.c madwifi-0.9.1-libmac/ath/if_ath.c
    old new  
    9191#include "ath_tx99.h" 
    9292#endif 
    9393 
     94#include <net80211/libmac.h> 
     95 
    9496/* unaligned little endian access */ 
    9597#define LE_READ_2(p)                                                    \ 
    9698        ((u_int16_t)                                                    \ 
     
    903905                                dev->name, error); 
    904906        } 
    905907 
     908#ifdef CONFIG_MADWIFI_LIBMAC /* Should this go here of before ieee80211_create_vap() ? */ 
     909        ic->mac_append_in_mode = APPEND_OFF; 
     910        ic->mac_append_out_mode = APPEND_OFF; 
     911        ic->mac_supported_params[0] = mac_rssi; 
     912        ic->mac_supported_params_flags[0] = WLGETONLY;  
     913        /* we should eventually print supported params list .. */ 
     914        printk("%s: libmac-%s supported\n", dev->name, LIBMAC_VERSION); 
     915#endif 
     916 
    906917        return 0; 
    907918bad3: 
    908919        ieee80211_ifdetach(ic); 
     
    51005111        struct sk_buff *skb; 
    51015112        struct ath_desc *ds; 
    51025113 
     5114        #ifdef CONFIG_MADWIFI_LIBMAC 
     5115        struct ieee80211com *ic = &sc->sc_ic; 
     5116        int tail_need = 0; 
     5117        #endif 
     5118         
    51035119        skb = bf->bf_skb; 
    51045120        if (skb == NULL) { 
    51055121                if (sc->sc_nmonvaps > 0) { 
     
    51315147                        if (off != 0) 
    51325148                                skb_reserve(skb, sc->sc_cachelsz - off); 
    51335149                } else { 
     5150#ifdef CONFIG_MADWIFI_LIBMAC 
     5151                        /* Make sure this has not been done before. */ 
     5152                        if (ic->mac_rxbufsize_flag) { 
     5153                                if ( (ic->mac_append_in_mode==APPEND_ON) ) 
     5154                                        /* For each parameter, space needed is 3 bytes. In addition,  
     5155                                         * 1 byte is needed for the no_of_params indicator and 2 bytes 
     5156                                         * more are needed for the length. Total number of bytes appended  
     5157                                         * is 1 (for no. of params) + 3 (1(for key) + 2(for value)) * num_params +  
     5158                                         * 2 (for length field). 
     5159                                         * */ 
     5160                                        tail_need = (3 * (ic->mac_in_params.len)) + 1 + 2; 
     5161                                /* For each parameter, space needed is 2 bytes  
     5162                                 * for the length. 
     5163                                 */ 
     5164                                else if ( (ic->mac_append_in_mode==APPEND_OFF) ) 
     5165                                        tail_need = 2; 
     5166                                sc->sc_rxbufsize += tail_need; 
     5167                                ic->mac_rxbufsize_flag = 1; 
     5168                        } 
     5169#endif /* CONFIG_MADWIFI_LIBMAC */ 
     5170 
    51345171                        /* 
    51355172                         * Cache-line-align.  This is important (for the 
    51365173                         * 5210 at least) as not doing so causes bogus data 
     
    55815618                                keyix = ni->ni_ucastkey.wk_keyix; 
    55825619                                if (keyix != IEEE80211_KEYIX_NONE && 
    55835620                                    sc->sc_keyixmap[keyix] == NULL) 
    5584                                         sc->sc_keyixmap[keyix] = ieee80211_ref_node(ni); 
     5621                                  sc->sc_keyixmap[keyix] = ieee80211_ref_node(ni); 
    55855622                                ieee80211_free_node(ni);  
    55865623                        } else 
    55875624                                type = ieee80211_input_all(ic, skb, 
     
    89969033{ 
    89979034        struct ath_softc *sc = dev->priv; 
    89989035        struct ieee80211com *ic = &sc->sc_ic; 
    8999         int error; 
     9036        int error = 0; 
    90009037 
    90019038        ATH_LOCK(sc); 
    90029039        switch (cmd) { 
  • madwifi-0.9.

    diff -Naur madwifi-0.9.1/Makefile madwifi-0.9.1-libmac/Makefile
    old new  
    5151# NB: the order is important here 
    5252DIRS_MODULES=   ${WLAN} ${ATH_RATE} ${ATH} 
    5353 
    54 obj-y := ath/ $(ATH_RATE)/ net80211/ 
     54obj-y := ath/ $(ATH_RATE)/ net80211/  
    5555 
    56 all: modules tools 
     56#all: modules tools 
     57all: modules 
    5758 
    5859modules: configcheck svnversion.h 
    5960ifdef LINUX24 
     
    8182tools: 
    8283        $(MAKE) -C ${TOOLS} all || exit 1 
    8384 
    84 install: install-modules install-tools 
    85  
     85#install: install-modules install-tools 
     86install: install-modules 
    8687install-modules: 
    8788        @# check if there are modules left from an old installation 
    8889        @# might cause make to abort the build 
  • net80211/ieee80211_input.c

    diff -Naur madwifi-0.9.1/net80211/ieee80211_input.c madwifi-0.9.1-libmac/net80211/ieee80211_input.c
    old new  
    5454 
    5555#include <net80211/ieee80211_var.h> 
    5656 
     57/* Begin WINLAB */ 
     58#include <net80211/libmac.h> 
     59/* End WINLAB */ 
     60 
    5761#ifdef IEEE80211_DEBUG 
    5862/* 
    5963 * Decide if a received management frame should be 
     
    968972        struct net_device *dev = vap->iv_dev; 
    969973        struct ether_header *eh = (struct ether_header *) skb->data; 
    970974 
     975        /* Begin WINLAB */ 
     976#ifdef CONFIG_MADWIFI_LIBMAC 
     977        struct ieee80211com *ic = vap->iv_ic; 
     978        u8  *mac_skb_rx_8;      // 8-bit pointer to append values to end of packet 
     979        u32 *mac_skb_rx_32;     // 32-bit pointer to append values to end of packet 
     980        u8  *mac_skb_num_params;// 8-bit pointer to append number of parameters to end of packet 
     981        u16 *mac_skb_len_16;    // 16-bit pointer to append length of data to end of packet 
     982        int mac_i;              // counter 
     983        u_int16_t payload_len; 
     984#endif 
     985        /* End WINLAB */ 
     986         
    971987#ifdef ATH_SUPERG_XR  
    972988        /* 
    973989         * if it is a XR vap, send the data to associated normal net 
     
    10281044                if (ni->ni_vlan != 0 && vap->iv_vlgrp != NULL) { 
    10291045                        /* attach vlan tag */ 
    10301046                        vlan_hwaccel_receive_skb(skb, vap->iv_vlgrp, ni->ni_vlan); 
    1031                 } else 
    1032                         netif_rx(skb); 
     1047                } else { 
     1048                  /* Begin WINLAB */ 
     1049#ifdef CONFIG_MADWIFI_LIBMAC 
     1050                  payload_len = skb->len; 
     1051                  if (ic->mac_append_in_mode==APPEND_ON) 
     1052                    { 
     1053                            printk("APPEND_ON detected, number params:\t%d\n", ic->mac_in_params.len); 
     1054                      // First create space at the end of the buffer for number of params 
     1055                      mac_skb_num_params = (u8*)skb_put(skb, 1); 
     1056                      // Next fill in the number of parameters being appended 
     1057                      mac_skb_num_params[0] = ic->mac_in_params.len; 
     1058 
     1059                      for(mac_i=0;mac_i<ic->mac_in_params.len; mac_i++) 
     1060                        { 
     1061                          switch(ic->mac_in_params.key_array[mac_i]) 
     1062                            { 
     1063                            case mac_rssi : 
     1064                              mac_skb_rx_8 = (u8*)skb_put(skb,1); 
     1065                              mac_skb_rx_32 = (u32*)skb_put(skb, 4); 
     1066                              mac_skb_rx_8[0] = ic->mac_in_params.key_array[mac_i]; 
     1067                              //mac_skb_rx_32[0] = ni->ni_rssi; 
     1068                              /* XXX: check to see differing values between 
     1069                               * ni->ni_rssi and what ieee80211_getrssi(ic) gets */ 
     1070                              mac_skb_rx_32[0] = ieee80211_getrssi(ic); 
     1071                              printk("RSSI reported:\t%d\n", mac_skb_rx_32[0]); 
     1072                              break; 
     1073                            default: 
     1074                              printk("Unsupported param:\t%d\n", ic->mac_in_params.key_array[mac_i]); 
     1075                              break; 
     1076                            } 
     1077                        } 
     1078                    } 
     1079                   
     1080                  /* Do not append length to frame type 0x0900. */ 
     1081                  if (eh->ether_type != __constant_htons(0x0900)) 
     1082                    { 
     1083                      // Create space at the end of the packet for length of data 
     1084                      mac_skb_len_16 = (u16*)skb_put(skb,2); 
     1085                      mac_skb_len_16[0] = payload_len; 
     1086                    } 
     1087#endif 
     1088                  /* End WINLAB */ 
     1089                   
     1090                  netif_rx(skb); 
     1091                } 
    10331092                dev->last_rx = jiffies; 
    10341093        } 
    10351094} 
  • net80211/ieee80211_ioctl.h

    diff -Naur madwifi-0.9.1/net80211/ieee80211_ioctl.h madwifi-0.9.1-libmac/net80211/ieee80211_ioctl.h
    old new  
    4141#include <net80211/ieee80211.h> 
    4242#include <net80211/ieee80211_crypto.h> 
    4343 
     44/* Begin WINLAB */ 
     45#include <net80211/libmac.h> 
     46/* End Winlab */ 
     47 
    4448/* 
    4549 * Per/node (station) statistics available when operating as an AP. 
    4650 */ 
     
    532536        IEEE80211_WMMPARAMS_TXOPLIMIT   = 4, 
    533537        IEEE80211_WMMPARAMS_ACM         = 5, 
    534538        IEEE80211_WMMPARAMS_NOACKPOLICY = 6,     
     539#ifdef CONFIG_MADWIFI_LIBMAC 
     540/* We're out of ioctls, and private ioctls, lets abuse this 
     541 * for now. Later on we can use configfs */ 
     542        LIBMAC_INAPP                    = 7,    /* */ 
     543        LIBMAC_OUTAPP                   = 8,    /* */ 
     544        LIBMAC_ALLAPPOFF                = 9,    /* */ 
     545        LIBMAC_PARAMS                   = 10,   /* Get supported params with flags / Set flags for supported params */ 
     546        LIBMAC_RSSI                     = 11,   /* */ 
     547        LIBMAC_TXPOWER                  = 12,   /* */ 
     548        LIBMAC_TXRATE                   = 13,   /* */ 
     549        LIBMAC_NOISE                    = 14,   /* */ 
     550#endif /* CONFIG_MADWIFI_LIBMAC */ 
    535551}; 
    536552enum { 
    537553        IEEE80211_PARAM_TURBO           = 1,    /* turbo mode */ 
  • net80211/ieee80211_var.h

    diff -Naur madwifi-0.9.1/net80211/ieee80211_var.h madwifi-0.9.1-libmac/net80211/ieee80211_var.h
    old new  
    5252#include <net80211/ieee80211_power.h> 
    5353#include <net80211/ieee80211_proto.h> 
    5454#include <net80211/ieee80211_scan.h> 
     55/* Begin WINLAB */ 
     56#include <net80211/libmac.h> 
     57/* End WINLAB */ 
    5558 
    5659#define IEEE80211_TXPOWER_MAX   100     /* .5 dBm units */ 
    5760#define IEEE80211_TXPOWER_MIN   0       /* kill radio */ 
     
    209212        u_int8_t ic_chanchange_tbtt; 
    210213        u_int8_t ic_chanchange_chan; 
    211214 
     215#ifdef CONFIG_MADWIFI_LIBMAC 
     216        mac_params_list mac_in_params; 
     217        mac_params_list mac_out_params; 
     218        u_int8_t mac_append_in_mode; 
     219        u_int8_t mac_append_out_mode; 
     220        u_int8_t mac_rxbufsize_flag; 
     221        /* list of suppported mac params */ 
     222        unsigned char mac_supported_params[1]; 
     223        /* parameter attributes */  
     224        unsigned char mac_supported_params_flags[1]; 
     225#endif /* CONFIG_MADWIFI_LIBMAC */ 
     226 
    212227        /* virtual ap create/delete */ 
    213228        struct ieee80211vap *(*ic_vap_create)(struct ieee80211com *, 
    214229                const char *, int, int, int, struct net_device *); 
  • net80211/ieee80211_wireless.c

    diff -Naur madwifi-0.9.1/net80211/ieee80211_wireless.c madwifi-0.9.1-libmac/net80211/ieee80211_wireless.c
    old new  
    6060#include <net80211/ieee80211_var.h> 
    6161#include <net80211/ieee80211_linux.h> 
    6262 
     63/* Begin WINLAB */ 
     64#include <net80211/libmac.h> 
     65#include <ath/if_athvar.h> /* for struct ath_softc */ 
     66/* End WINLAB */ 
     67 
    6368#define IS_UP(_dev) \ 
    6469        (((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP)) 
    6570#define IS_UP_AUTO(_vap) \ 
     
    31613166        int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE; 
    31623167        int bss = param[2];  
    31633168        struct ieee80211_wme_state *wme = &vap->iv_ic->ic_wme; 
     3169#ifdef CONFIG_MADWIFI_LIBMAC 
     3170        struct ath_softc *sc = dev->priv; 
     3171        struct ieee80211com *ic = vap->iv_ic;  
     3172        int *compat = (int *) w; 
     3173        struct iw_point *iwp = (struct iw_point *) w; 
     3174        struct mac_params_list *p_in = (struct mac_params_list *) iwp->pointer; 
     3175        struct mac_params_list *p = (struct mac_params_list *) extra; 
     3176        //struct iw_param *iwparam = (struct iw_param *) extra; 
     3177        union iwreq_data *wrqu = (union iwreq_data *) w; 
     3178 
     3179        /* Note: iwp->length is 0 when iwpriv is used */ 
     3180 
     3181        /* If we have a Libmac sub-ioctl */ 
     3182        if((iwp->length == sizeof(struct mac_params_list)) &&  
     3183                        (p_in->si_num >= LIBMAC_INAPP) && (p_in->si_num <= LIBMAC_NOISE)) { 
     3184                /* Libmac note: we only allow libmac sub-ioclts if magic flag was set to LIBMAC_MAGIC_FLAG */ 
     3185                if (p_in->si_flag != LIBMAC_MAGIC_FLAG) { 
     3186                        printk("%s: special get sub-ioctl (%d) for libmac called without magic flag (%d), do " 
     3187                                "not call directly using iwpriv or if you are unsure how to use this\n",  
     3188                                        dev->name, p_in->si_num, p_in->si_flag); 
     3189                        return -EINVAL; 
     3190                } 
     3191                switch (p_in->si_num) { 
     3192                        /* ioctl to turn on the append mode on all incoming packets */ 
     3193                        case LIBMAC_INAPP: 
     3194                                memcpy(ic->mac_in_params.key_array, p->key_array, p->len); 
     3195                                memcpy(ic->mac_in_params.flags, p->flags, p->len); 
     3196                                ic->mac_in_params.len = p->len; 
     3197                                ic->mac_append_in_mode = APPEND_ON; 
     3198                                /* update ath_soft sc->sc_rxbufsize over here....other  
     3199                                 * one only takes care of HW reset */ 
     3200                                sc->sc_rxbufsize += (3 * (ic->mac_in_params.len)) + 1 + 2; 
     3201                                break; 
     3202                        /* Turn append off for both incomming and outgoing packets */ 
     3203                        case LIBMAC_ALLAPPOFF: 
     3204                                ic->mac_append_in_mode = APPEND_OFF; 
     3205                                ic->mac_append_out_mode = APPEND_OFF; 
     3206                                break; 
     3207#if 0 
     3208                        case LIBMAC_TXRATE: 
     3209                                if (ath_ioctl_siwrate(dev, (struct iw_request_info *)NULL, iwparam, (char *)NULL )) 
     3210                                        printk("%s: libmac - Could not set txrate\n", dev->name); 
     3211                                break; 
     3212                        case LIBMAC_TXPOWER: 
     3213                                if (ath_ioctl_siwtxpow(dev,(struct iw_request_info *)NULL, iwparam, (char *)NULL)) 
     3214                                        printk("%s: libmac - Could not set txpower\n"); 
     3215                                break; 
     3216#endif 
     3217                        /* ioctl to turn on the append mode on all outgoing packets */ 
     3218                        case LIBMAC_OUTAPP: /* Not supported yet */ 
     3219                        case LIBMAC_PARAMS: 
     3220                        case LIBMAC_RSSI: 
     3221                        case LIBMAC_NOISE: 
     3222                        default: 
     3223                                printk("%s: Libmac set sub-ioctl (%d) detected but not supported\n", dev->name, p_in->si_num); 
     3224                                return -EFAULT; 
     3225                } 
     3226                return 0; 
     3227        } 
    31643228 
    3165         switch (param[0]) { 
     3229        printk("Sorry, but set WMM private (%X) ioctls are not supported\n", compat[0]); 
     3230        return 0; 
     3231 
     3232        /* To support Libmac through sub-iotls we needed to bastardize this handler,  
     3233         * here is some backward compatiblity work */ 
     3234 
     3235        /* Note: sizeof(extra) == 4 */ 
     3236 
     3237        param[0] = compat[0]; 
     3238        param[1] = compat[1]; 
     3239        param[2] = compat[2]; 
     3240 
     3241        wrqu->data.length = 525; 
     3242 
     3243        printk("%s: Libmac Compatibility at work - (param[0]: %d) (param[1]: %d) " 
     3244                        "(param[2]: %d) (data.length: %d)\n", 
     3245                        dev->name, param[0], param[1], param[2], wrqu->data.length); 
     3246 
     3247        ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;  
     3248        bss = param[2]; 
     3249 
     3250#endif /* CONFIG_MADWIFI_LIBMAC */ 
     3251        switch (param[0]) {  
    31663252        case IEEE80211_WMMPARAMS_CWMIN: 
    31673253                if (param[3] < 0 || param[3] > 15)  
    31683254                        return -EINVAL; 
     
    32403326        return 0; 
    32413327} 
    32423328 
     3329 
    32433330static int 
    32443331ieee80211_ioctl_getwmmparams(struct net_device *dev, 
    32453332        struct iw_request_info *info, void *w, char *extra) 
    32463333{ 
    32473334        struct ieee80211vap *vap = dev->priv; 
    32483335        int *param = (int *) extra; 
    3249         int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE; 
     3336        int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;  
    32503337        struct ieee80211_wme_state *wme = &vap->iv_ic->ic_wme; 
    32513338        struct chanAccParams *chanParams = (param[2] == 0) ?  
    32523339                &(wme->wme_chanParams) : &(wme->wme_bssChanParams); 
     3340#ifdef CONFIG_MADWIFI_LIBMAC 
     3341        struct ieee80211com *ic = vap->iv_ic;  
     3342        int *compat = (int *) w; 
     3343        struct iw_point *iwp = (struct iw_point *) w; 
     3344        struct mac_params_list *p_in = (struct mac_params_list *) iwp->pointer; 
     3345        struct mac_params_list *p = (struct mac_params_list *) extra; 
     3346        struct iw_param *iwparam = (struct iw_param *) extra; 
     3347        union iwreq_data *wrqu = (union iwreq_data *) w; 
     3348 
     3349        /* Note: iwp->length is 0 when iwpriv is used */ 
     3350 
     3351        /* If we have a Libmac sub-ioctl */ 
     3352        if((iwp->length == sizeof(struct mac_params_list)) &&  
     3353                        (p_in->si_num >= LIBMAC_INAPP) && (p_in->si_num <= LIBMAC_NOISE)) { 
     3354                /* Libmac note: we only allow libmac sub-ioclts if magic flag was set to LIBMAC_MAGIC_FLAG */ 
     3355                if (p_in->si_flag != LIBMAC_MAGIC_FLAG) { 
     3356                        printk("%s: special get sub-ioctl (%d) for libmac called without magic flag (%d), " 
     3357                                "do not call directly using iwpriv or if you are unsure how to use this\n",  
     3358                                        dev->name, p_in->si_num, p_in->si_flag); 
     3359                        return -EINVAL; 
     3360                } 
     3361                switch (p_in->si_num) { 
     3362                        /* Retrieves all supported Libmac MAC parameters */ 
     3363                        case LIBMAC_PARAMS:      
     3364                                //memset(p, 0, sizeof(struct mac_params_list)); 
     3365                                p->len = sizeof(ic->mac_supported_params); 
     3366                                memcpy(p->key_array, ic->mac_supported_params,  
     3367                                                sizeof(ic->mac_supported_params)); 
     3368                                memcpy(p->flags, ic->mac_supported_params_flags,  
     3369                                                sizeof(ic->mac_supported_params_flags)); 
     3370                                break; 
     3371                        case LIBMAC_RSSI: 
     3372                                /* XXX: Missing setting of length of sent data to user, required? */ 
     3373                                iwparam->value = ieee80211_getrssi(ic); 
     3374                                printk("%s: RSSI returned is %d\n", dev->name, iwparam->value); 
     3375                                iwparam->fixed = 0; /* This has no meaning in this context */ 
     3376                                iwparam->disabled = 0; /* This has no meaning in this context */ 
     3377                                iwparam->flags = 0; /* This is not used currently */ 
     3378                                break; 
     3379                        case LIBMAC_NOISE: 
     3380                                /* 161 (-95dB hard coded) */ 
     3381                                iwparam->value = 161; 
     3382                                iwparam->fixed = 0; 
     3383                                iwparam->disabled = 0; 
     3384                                iwparam->flags = 0; 
     3385                                break; 
     3386#if 0 
     3387                        case LIBMAC_TXRATE: 
     3388                                if (ath_ioctl_giwrate(dev, (struct iw_request_info *)NULL, iwparam, (char *)NULL )) 
     3389                                        printk("%s: libmac - Could not retrieve txrate\n", dev->name) 
     3390                                break; 
     3391                        case LIBMAC_TXPOWER: 
     3392                                if (ath_ioctl_giwtxpow(dev,(struct iw_request_info *)NULL, iwparam, (char *)NULL)) 
     3393                                        printk("%s: libmac - Could not retrive txpower\n", dev->name); 
     3394                                break; 
     3395#endif 
     3396                        case LIBMAC_INAPP: 
     3397                        case LIBMAC_OUTAPP: 
     3398                        case LIBMAC_ALLAPPOFF: 
     3399                        default: 
     3400                                printk("%s: Libmac get sub-ioctl (%d) detected but not supported\n", dev->name, p_in->si_num); 
     3401                                break; 
     3402                } 
     3403                return 0; 
     3404        } 
     3405 
     3406        printk("Sorry, but get WMM private (%X) ioctls are not supported\n", compat[0]); 
     3407        return 0; 
     3408 
     3409        /* To support Libmac through sub-iotls we needed to bastardize this handler,  
     3410         * here is some backward compatiblity work */ 
     3411 
     3412        /* Note: sizeof(extra) == 4 */ 
     3413 
     3414        param[0] = compat[0]; 
     3415        param[1] = compat[1]; 
     3416        param[2] = compat[2]; 
     3417 
     3418        wrqu->data.length = 525; 
     3419 
     3420        printk("%s: Libmac Compatibility at work - (param[0]: %d) (param[1]: %d) (param[2]: %d) (data.length: %d)\n", 
     3421                        dev->name, param[0], param[1], param[2], wrqu->data.length); 
     3422 
     3423        ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;  
     3424        chanParams = (param[2] == 0) ? &(wme->wme_chanParams) : &(wme->wme_bssChanParams); 
     3425 
     3426        /* Note: we are failing for iwpriv with BAD ADDRESS because wireless core tries this: 
     3427         * 
     3428         * err = copy_to_user(iwr->u.data.pointer, extra, 
     3429         *      extra_size); 
     3430         * 
     3431         * At the end if (!ret && IW_IS_GET(cmd)) { }  
     3432         * 
     3433         * The buffer it allocates from iwpriv is buffer[4096] so its not the size,  
     3434         * as seen bellow eve if we try to copy 1 byte it doesn't work. The data which we 
     3435         * are trying to copy IS USERSPACE -- this has been verified with access_ok(), see bellow. 
     3436         */ 
     3437 
     3438        /* From iwpriv:  
     3439         * 
     3440         * iwpriv will not print data unless a value >= 0 is detected from ioctl. As mentioned above 
     3441         * we are going to get -EFAULT returnd (bad address) as the core cannot copy_to_user even 1 byte 
     3442         * 
     3443         *   if(ioctl(skfd, priv[k].cmd, &wrq) < 0) 
     3444         *       { 
     3445         *              fprintf(stderr, "Interface doesn't accept private ioctl...\n"); 
     3446         *              fprintf(stderr, "%s (%X): %s\n", cmdname, priv[k].cmd, strerror(errno)); 
     3447         *              return(-1); 
     3448         *      } 
     3449         * 
     3450         */ 
     3451 
     3452#endif /* CONFIG_MADWIFI_LIBMAC */ 
    32533453 
    32543454        switch (param[0]) { 
    32553455        case IEEE80211_WMMPARAMS_CWMIN:  
    32563456                param[0] = chanParams->cap_wmeParams[ac].wmep_logcwmin; 
     3457                param[0] = 123; 
    32573458                break; 
    32583459        case IEEE80211_WMMPARAMS_CWMAX:  
    32593460                param[0] = chanParams->cap_wmeParams[ac].wmep_logcwmax; 
     
    32733474        default: 
    32743475                break; 
    32753476        } 
     3477         
    32763478        return 0; 
    32773479} 
    32783480 
     
    43634565#define IW_PRIV_TYPE_CHANINFO \ 
    43644566        IW_PRIV_TYPE_BYTE | sizeof(struct ieee80211req_chaninfo) 
    43654567 
     4568#ifdef CONFIG_MADWIFI_LIBMAC 
     4569#define IW_PRIV_TYPE_LIBMAC_PARAMS\ 
     4570        IW_PRIV_TYPE_BYTE | sizeof(struct mac_params_list)  
     4571#endif /* CONFIG_MADWIFI_LIBMAC */ 
     4572 
     4573#define WWM_GET_SIOCTL(ioctl, name) { ioctl, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, IW_PRIV_TYPE_LIBMAC_PARAMS | IW_PRIV_SIZE_FIXED, name } 
     4574#define WMM_SET_SIOCTL(ioctl, name) { ioctl, IW_PRIV_TYPE_LIBMAC_PARAMS | IW_PRIV_SIZE_FIXED, 0, name } 
     4575#define WMM_GSET_SIOCTL(ioctl, name) WWM_GET_SIOCTL(ioctl, "g_"name), WMM_SET_SIOCTL(ioctl, "s_"name) 
     4576  
    43664577static const struct iw_priv_args ieee80211_priv_args[] = { 
    43674578        /* NB: setoptie & getoptie are !IW_PRIV_SIZE_FIXED */ 
    43684579        { IEEE80211_IOCTL_SETOPTIE, 
     
    43964607        { IEEE80211_IOCTL_GETMODE, 
    43974608          0, IW_PRIV_TYPE_CHAR | 6, "get_mode" }, 
    43984609#if WIRELESS_EXT >= 12     
    4399         { IEEE80211_IOCTL_SETWMMPARAMS, 
    4400           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 4, 0,"setwmmparams" }, 
    4401         { IEEE80211_IOCTL_GETWMMPARAMS, 
    4402           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,  
    4403           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "getwmmparams" }, 
    4404         /* 
    4405          * These depends on sub-ioctl support which added in version 12. 
    4406          */ 
    4407         { IEEE80211_IOCTL_SETWMMPARAMS, 
    4408           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"" }, 
    4409         { IEEE80211_IOCTL_GETWMMPARAMS, 
    4410           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,  
    4411           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "" }, 
    44124610        /* sub-ioctl handlers */ 
    4413         { IEEE80211_WMMPARAMS_CWMIN, 
    4414           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"cwmin" }, 
    4415         { IEEE80211_WMMPARAMS_CWMIN, 
    4416           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,  
    4417           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "get_cwmin" }, 
    4418         { IEEE80211_WMMPARAMS_CWMAX, 
    4419           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"cwmax" }, 
    4420         { IEEE80211_WMMPARAMS_CWMAX, 
    4421           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,  
    4422           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "get_cwmax" }, 
    4423         { IEEE80211_WMMPARAMS_AIFS, 
    4424           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"aifs" }, 
    4425         { IEEE80211_WMMPARAMS_AIFS, 
    4426           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,  
    4427           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "get_aifs" }, 
    4428         { IEEE80211_WMMPARAMS_TXOPLIMIT, 
    4429           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"txoplimit" }, 
    4430         { IEEE80211_WMMPARAMS_TXOPLIMIT, 
    4431           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,  
    4432           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "get_txoplimit" }, 
    4433         { IEEE80211_WMMPARAMS_ACM, 
    4434           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"acm" }, 
    4435         { IEEE80211_WMMPARAMS_ACM, 
    4436           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,  
    4437           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "get_acm" }, 
    4438         { IEEE80211_WMMPARAMS_NOACKPOLICY, 
    4439           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0,"noackpolicy" }, 
    4440         { IEEE80211_WMMPARAMS_NOACKPOLICY, 
    4441           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,     
    4442           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "get_noackpolicy" }, 
     4611        WMM_SET_SIOCTL(IEEE80211_IOCTL_SETWMMPARAMS,    ""), 
     4612        WWM_GET_SIOCTL(IEEE80211_IOCTL_GETWMMPARAMS,    ""), 
     4613        /* sub-ioctl definitions */ 
     4614        WMM_GSET_SIOCTL(IEEE80211_WMMPARAMS_CWMIN,      "cwmin"),  
     4615        WMM_GSET_SIOCTL(IEEE80211_WMMPARAMS_CWMAX,      "cwmax"),  
     4616        WMM_GSET_SIOCTL(IEEE80211_WMMPARAMS_AIFS,       "aifs"),  
     4617        WMM_GSET_SIOCTL(IEEE80211_WMMPARAMS_TXOPLIMIT,  "txoplimit"),  
     4618        WMM_GSET_SIOCTL(IEEE80211_WMMPARAMS_ACM,        "acm"),  
     4619        WMM_GSET_SIOCTL(IEEE80211_WMMPARAMS_NOACKPOLICY,"noackpolicy"),  
     4620#ifdef CONFIG_MADWIFI_LIBMAC 
     4621        WMM_GSET_SIOCTL(LIBMAC_PARAMS,                  "lbparams"),  
     4622#endif /* CONFIG_MADWIFI_LIBMAC */ 
     4623        /* raw access to sub-ioctl hanlders */ 
     4624        {IEEE80211_IOCTL_SETWMMPARAMS, IW_PRIV_TYPE_LIBMAC_PARAMS | IW_PRIV_SIZE_FIXED, 0, "setwmmparams"}, 
     4625        {IEEE80211_IOCTL_GETWMMPARAMS, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 
     4626                IW_PRIV_TYPE_LIBMAC_PARAMS | IW_PRIV_SIZE_FIXED, "getwmmparams"}, 
    44434627         
    4444         { IEEE80211_IOCTL_SETPARAM, 
    4445           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setparam" }, 
    44464628        /* 
    44474629         * These depends on sub-ioctl support which added in version 12. 
    44484630         */ 
     4631        { IEEE80211_IOCTL_SETPARAM, 
     4632          IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setparam" }, 
    44494633        { IEEE80211_IOCTL_GETPARAM, 
    44504634          IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
    44514635          IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,    "getparam" }, 
     
    44554639          IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "" }, 
    44564640        { IEEE80211_IOCTL_GETPARAM, 
    44574641          0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "" }, 
    4458  
     4642         
    44594643        /* sub-ioctl definitions */ 
    44604644        { IEEE80211_PARAM_AUTHMODE, 
    44614645          IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "authmode" }, 
     
    44674651          0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_protmode" }, 
    44684652        { IEEE80211_PARAM_MCASTCIPHER, 
    44694653          IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "mcastcipher" }, 
    44