aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-08-28 17:01:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:51 -0400
commit8f20fc24986a083228823d9b68adca20714b254e (patch)
treeb5d7638b913649c7a181d6703ccd72e35ca06de9 /include
parent13262ffd4902805acad2618c12b41fcaa6c50791 (diff)
[MAC80211]: embed key conf in key, fix driver interface
This patch embeds the struct ieee80211_key_conf into struct ieee80211_key and thus avoids allocations and having data present twice. This required some more changes: 1) The removal of the IEEE80211_KEY_DEFAULT_TX_KEY key flag. This flag isn't used by drivers nor should it be since we have a set_key_idx() callback. Maybe that callback needs to be extended to include the key conf, but only a driver that requires it will tell. 2) The removal of the IEEE80211_KEY_DEFAULT_WEP_ONLY key flag. This flag is global, so it shouldn't be passed in the key conf structure. Pass it to the function instead. Also, this patch removes the AID parameter to the set_key() callback because it is currently unused and the hardware currently cannot know about the AID anyway. I suspect this was used with some hardware that actually selected the AID itself, but that functionality was removed. Additionally, I've removed the ALG_NULL key algorithm since we have ALG_NONE. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Michael Wu <flamingice@sourmilk.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/mac80211.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 029e8cb7bf4e..056c225173d8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -205,8 +205,8 @@ struct ieee80211_tx_control {
205 * is not implemented by the driver */ 205 * is not implemented by the driver */
206 u8 power_level; /* per-packet transmit power level, in dBm */ 206 u8 power_level; /* per-packet transmit power level, in dBm */
207 u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ 207 u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
208 s8 key_idx; /* -1 = do not encrypt, >= 0 keyidx from 208 s8 key_idx; /* HW_KEY_IDX_INVALID = do not encrypt,
209 * hw->set_key() */ 209 * other values: keyidx from hw->set_key() */
210 u8 icv_len; /* length of the ICV/MIC field in octets */ 210 u8 icv_len; /* length of the ICV/MIC field in octets */
211 u8 iv_len; /* length of the IV field in octets */ 211 u8 iv_len; /* length of the IV field in octets */
212 u8 tkip_key[16]; /* generated phase2/phase1 key for hw TKIP */ 212 u8 tkip_key[16]; /* generated phase2/phase1 key for hw TKIP */
@@ -392,26 +392,23 @@ struct ieee80211_if_conf {
392 struct ieee80211_tx_control *beacon_control; 392 struct ieee80211_tx_control *beacon_control;
393}; 393};
394 394
395typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL } 395typedef enum {
396ieee80211_key_alg; 396 ALG_NONE,
397 397 ALG_WEP,
398 ALG_TKIP,
399 ALG_CCMP,
400} ieee80211_key_alg;
398 401
399struct ieee80211_key_conf { 402struct ieee80211_key_conf {
403 /* shall be changed by the driver to anything but HW_KEY_IDX_INVALID */
404 int hw_key_idx;
400 405
401 int hw_key_idx; /* filled + used by low-level driver */
402 ieee80211_key_alg alg; 406 ieee80211_key_alg alg;
407
403 int keylen; 408 int keylen;
404 409
405#define IEEE80211_KEY_FORCE_SW_ENCRYPT (1<<0) /* to be cleared by low-level 410#define IEEE80211_KEY_FORCE_SW_ENCRYPT (1<<0) /* to be cleared by low-level
406 driver */ 411 driver */
407#define IEEE80211_KEY_DEFAULT_TX_KEY (1<<1) /* This key is the new default TX
408 key (used only for broadcast
409 keys). */
410#define IEEE80211_KEY_DEFAULT_WEP_ONLY (1<<2) /* static WEP is the only
411 configured security policy;
412 this allows some low-level
413 drivers to determine when
414 hwaccel can be used */
415 u32 flags; /* key configuration flags defined above */ 412 u32 flags; /* key configuration flags defined above */
416 413
417 s8 keyidx; /* WEP key index */ 414 s8 keyidx; /* WEP key index */
@@ -625,20 +622,26 @@ struct ieee80211_ops {
625 * Must be atomic. */ 622 * Must be atomic. */
626 int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); 623 int (*set_tim)(struct ieee80211_hw *hw, int aid, int set);
627 624
628 /* Set encryption key. IEEE 802.11 module calls this function to set 625 /*
629 * encryption keys. addr is ff:ff:ff:ff:ff:ff for default keys and 626 * Set encryption key.
630 * station hwaddr for individual keys. aid of the station is given 627 *
631 * to help low-level driver in selecting which key->hw_key_idx to use 628 * This is called to enable hardware acceleration of encryption and
632 * for this key. TX control data will use the hw_key_idx selected by 629 * decryption. The address will be the broadcast address for default
633 * the low-level driver. */ 630 * keys and the other station's hardware address for individual keys.
631 * When transmitting, the TX control data will use the hw_key_idx
632 * selected by the low-level driver.
633 */
634 int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, 634 int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd,
635 u8 *addr, struct ieee80211_key_conf *key, int aid); 635 u8 *address, struct ieee80211_key_conf *key,
636 int static_wep_only);
636 637
637 /* Set TX key index for default/broadcast keys. This is needed in cases 638 /*
639 * Set TX key index for default/broadcast keys. This is needed in cases
638 * where wlan card is doing full WEP/TKIP encapsulation (wep_include_iv 640 * where wlan card is doing full WEP/TKIP encapsulation (wep_include_iv
639 * is not set), in other cases, this function pointer can be set to 641 * is not set), in other cases, this function pointer can be set to
640 * NULL since the IEEE 802. 11 module takes care of selecting the key 642 * NULL since the IEEE 802.11 module takes care of selecting the key
641 * index for each TX frame. */ 643 * index for each TX frame.
644 */
642 int (*set_key_idx)(struct ieee80211_hw *hw, int idx); 645 int (*set_key_idx)(struct ieee80211_hw *hw, int idx);
643 646
644 /* Enable/disable IEEE 802.1X. This item requests wlan card to pass 647 /* Enable/disable IEEE 802.1X. This item requests wlan card to pass