Changeset 2279

Show
Ignore:
Timestamp:
04/17/07 02:04:35 (2 years ago)
Author:
mentor
Message:

The net80211 layer should be independent from the ath driver; unfortunately, it isn't. There are lots of implicit assumptions of the ath driver in the net80211 layer.
Add a macro to convert from net80211 valuse to ath values; this should optimise away as long as the values are consistent, hopefully.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ath/if_ath.c

    r2277 r2279  
    29232923                        memcpy(hk->kv_mic, k->wk_txmic, sizeof(hk->kv_mic)); 
    29242924                        KEYPRINTF(sc, k->wk_keyix, hk, zerobssid); 
    2925                         if (!ath_hal_keyset(ah, k->wk_keyix, hk, zerobssid)) 
     2925                        if (!ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, zerobssid)) 
    29262926                                return 0; 
    29272927 
    29282928                        memcpy(hk->kv_mic, k->wk_rxmic, sizeof(hk->kv_mic)); 
    2929                         KEYPRINTF(sc, k->wk_keyix+32, hk, mac); 
     2929                        KEYPRINTF(sc, k->wk_keyix + 32, hk, mac); 
    29302930                        /* XXX delete tx key on failure? */ 
    2931                         return ath_hal_keyset(ah, k->wk_keyix+32, hk, mac); 
     2931                        return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix + 32), hk, mac); 
    29322932                } else { 
    29332933                        /* 
     
    29412941#endif 
    29422942                        KEYPRINTF(sc, k->wk_keyix, hk, mac); 
    2943                         return ath_hal_keyset(ah, k->wk_keyix, hk, mac); 
     2943                        return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac); 
    29442944                } 
    29452945        } else if (k->wk_flags & IEEE80211_KEY_XR) { 
     
    29512951                        k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); 
    29522952                KEYPRINTF(sc, k->wk_keyix, hk, mac); 
    2953                 return ath_hal_keyset(ah, k->wk_keyix, hk, mac); 
     2953                return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac); 
    29542954        } 
    29552955        return 0; 
     
    30153015        } else { 
    30163016                KEYPRINTF(sc, k->wk_keyix, &hk, mac); 
    3017                 return ath_hal_keyset(ah, k->wk_keyix, &hk, mac); 
     3017                return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), &hk, mac); 
    30183018        } 
    30193019#undef N 
     
    60506050                                        k = ieee80211_crypto_encap(vap->iv_bss, skb); 
    60516051                                        if (k) 
    6052                                                 keyix = k->wk_keyix
     6052                                                keyix = ATH_KEY(k->wk_keyix)
    60536053                                } 
    60546054                        } 
     
    66526652                                        pktlen += cip->ic_miclen; 
    66536653                } 
    6654                 keyix = k->wk_keyix
     6654                keyix = ATH_KEY(k->wk_keyix)
    66556655 
    66566656#ifdef ATH_SUPERG_COMP 
     
    66646664                 * Use station key cache slot, if assigned. 
    66656665                 */ 
    6666                 keyix = ni->ni_ucastkey.wk_keyix; 
    6667                 if (keyix == IEEE80211_KEYIX_NONE) 
    6668                         keyix = HAL_TXKEYIX_INVALID; 
     6666                keyix = ATH_KEY(ni->ni_ucastkey.wk_keyix); 
    66696667        } else 
    66706668                keyix = HAL_TXKEYIX_INVALID; 
  • trunk/ath/if_athvar.h

    r2217 r2279  
    314314#define ATH_KEYMAX      128             /* max key cache size we handle */ 
    315315#define ATH_KEYBYTES    (ATH_KEYMAX / NBBY)     /* storage space in bytes */ 
     316 
     317/* 
     318 * Convert from net80211 layer values to Ath layer values. Hopefully this will 
     319 * be optimised away when the two constants are the same. 
     320 */ 
     321#define ATH_KEY(_keyix) ((_keyix == IEEE80211_KEYIX_NONE) ? HAL_TXKEYIX_INVALID : _keyix) 
     322 
    316323#define ATH_MIN_FF_RATE 12000           /* min rate for ff aggregation in kbps */ 
    317324#define ATH_MIN_FF_RATE 12000           /* min rate for ff aggregation in kbps */ 
     
    596603        u_int sc_fftxqmin;                      /* aggregation threshold */ 
    597604        HAL_INT sc_imask;                       /* interrupt mask copy */ 
    598         u_int sc_keymax;                               /* size of key cache */ 
     605        u_int sc_keymax;                        /* size of key cache */ 
    599606        u_int8_t sc_keymap[ATH_KEYBYTES];       /* key use bit map */ 
    600607        struct ieee80211_node *sc_keyixmap[ATH_KEYMAX];/* key ix->node map */ 
    601608        u_int8_t sc_bssidmask[IEEE80211_ADDR_LEN]; 
    602609 
    603         u_int sc_ledpin;                               /* GPIO pin for driving LED */ 
     610        u_int sc_ledpin;                        /* GPIO pin for driving LED */ 
    604611        u_int sc_ledon;                         /* pin setting for LED on */ 
    605612        u_int sc_ledidle;                       /* idle polling interval */ 
    606         int sc_ledevent;                               /* time of last LED event */ 
     613        int sc_ledevent;                        /* time of last LED event */ 
    607614        u_int8_t sc_rxrate;                     /* current rx rate for LED */ 
    608615        u_int8_t sc_txrate;                     /* current tx rate for LED */ 
     
    640647        u_int sc_bmisscount;                    /* missed beacon transmits */ 
    641648        u_int32_t sc_ant_tx[8];                 /* recent tx frames/antenna */ 
    642         struct ath_txq *sc_cabq;                       /* tx q for cab frames */ 
     649        struct ath_txq *sc_cabq;                /* tx q for cab frames */ 
    643650        struct ath_txq sc_grpplq;               /* tx q for XR group polls */ 
    644651        struct ath_txq *sc_xrtxq;               /* tx q for XR data */