diff options
author | Sean MacLennan <seanm@seanm.ca> | 2011-12-19 23:21:41 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-22 13:48:59 -0800 |
commit | 0ddcf5fdfac6bd80e153ee5c405bdfc9cb868b95 (patch) | |
tree | 521df3600ec21e1ffe93b40f8d64c72d8419d48e /drivers/staging/rtl8192e | |
parent | 32c44cb5b9fdc6eaa445bd622008dd672a3dd1a7 (diff) |
staging/rtl8192e: Convert to lib80211_crypt_info
Convert rtllib to use lib80211_crypt_info.
Signed-off-by: Sean MacLennan <seanm@seanm.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rtl8192e')
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 2 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib.h | 8 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt.c | 38 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt.h | 6 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_module.c | 16 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_rx.c | 2 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_softmac.c | 18 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_tx.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_wx.c | 40 |
9 files changed, 66 insertions, 68 deletions
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 44fffe2f3d07..4e93669210af 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -802,7 +802,7 @@ static int r8192_wx_set_enc(struct net_device *dev, switch (wrqu->encoding.flags & IW_ENCODE_INDEX) { case 0: - key_idx = ieee->tx_keyidx; + key_idx = ieee->crypt_info.tx_keyidx; break; case 1: key_idx = 0; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 17097e7ed9f6..a8133d4a1541 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2188,14 +2188,10 @@ struct rtllib_device { u8 ap_mac_addr[6]; u16 pairwise_key_type; u16 group_key_type; - struct list_head crypt_deinit_list; - struct rtllib_crypt_data *crypt[NUM_WEP_KEYS]; - int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ - struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; - struct timer_list crypt_deinit_timer; - int crypt_quiesced; + struct lib80211_crypt_info crypt_info; + struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; int bcrx_sta_key; /* use individual keys to override default keys even * with RX of broad/multicast frames */ diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c index 313d089c24fa..606a2f5158fd 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.c +++ b/drivers/staging/rtl8192e/rtllib_crypt.c @@ -32,14 +32,14 @@ struct rtllib_crypto { static struct rtllib_crypto *hcrypt; -void rtllib_crypt_deinit_entries(struct rtllib_device *ieee, +void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info, int force) { struct list_head *ptr, *n; struct lib80211_crypt_data *entry; - for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; - ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { + for (ptr = info->crypt_deinit_list.next, n = ptr->next; + ptr != &info->crypt_deinit_list; ptr = n, n = ptr->next) { entry = list_entry(ptr, struct lib80211_crypt_data, list); if (atomic_read(&entry->refcnt) != 0 && !force) @@ -56,24 +56,24 @@ EXPORT_SYMBOL(rtllib_crypt_deinit_entries); void rtllib_crypt_deinit_handler(unsigned long data) { - struct rtllib_device *ieee = (struct rtllib_device *)data; + struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data; unsigned long flags; - spin_lock_irqsave(&ieee->lock, flags); - rtllib_crypt_deinit_entries(ieee, 0); - if (!list_empty(&ieee->crypt_deinit_list)) { + spin_lock_irqsave(info->lock, flags); + rtllib_crypt_deinit_entries(info, 0); + if (!list_empty(&info->crypt_deinit_list)) { printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", ieee->dev->name); - ieee->crypt_deinit_timer.expires = jiffies + HZ; - add_timer(&ieee->crypt_deinit_timer); + "deletion list\n", info->name); + info->crypt_deinit_timer.expires = jiffies + HZ; + add_timer(&info->crypt_deinit_timer); } - spin_unlock_irqrestore(&ieee->lock, flags); + spin_unlock_irqrestore(info->lock, flags); } EXPORT_SYMBOL(rtllib_crypt_deinit_handler); -void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, - struct lib80211_crypt_data **crypt) +void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, + struct lib80211_crypt_data **crypt) { struct lib80211_crypt_data *tmp; unsigned long flags; @@ -88,13 +88,13 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, * decrypt operations. Use a list of delayed deinits to avoid needing * locking. */ - spin_lock_irqsave(&ieee->lock, flags); - list_add(&tmp->list, &ieee->crypt_deinit_list); - if (!timer_pending(&ieee->crypt_deinit_timer)) { - ieee->crypt_deinit_timer.expires = jiffies + HZ; - add_timer(&ieee->crypt_deinit_timer); + spin_lock_irqsave(info->lock, flags); + list_add(&tmp->list, &info->crypt_deinit_list); + if (!timer_pending(&info->crypt_deinit_timer)) { + info->crypt_deinit_timer.expires = jiffies + HZ; + add_timer(&info->crypt_deinit_timer); } - spin_unlock_irqrestore(&ieee->lock, flags); + spin_unlock_irqrestore(info->lock, flags); } EXPORT_SYMBOL(rtllib_crypt_delayed_deinit); diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h index 8c058f2b6690..e177c9287b44 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.h +++ b/drivers/staging/rtl8192e/rtllib_crypt.h @@ -28,8 +28,8 @@ int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops); int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops); struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name); -void rtllib_crypt_deinit_entries(struct rtllib_device *, int); -void rtllib_crypt_deinit_handler(unsigned long); -void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, +void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info, int force); +void rtllib_crypt_deinit_handler(unsigned long data); +void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, struct lib80211_crypt_data **crypt); #endif diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index f08926776d15..35ea93de3682 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -137,10 +137,10 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ /* SAM Init here */ - INIT_LIST_HEAD(&ieee->crypt_deinit_list); - _setup_timer(&ieee->crypt_deinit_timer, + INIT_LIST_HEAD(&ieee->crypt_info.crypt_deinit_list); + _setup_timer(&ieee->crypt_info.crypt_deinit_timer, rtllib_crypt_deinit_handler, - (unsigned long) ieee); + (unsigned long)&ieee->crypt_info); ieee->rtllib_ap_sec_type = rtllib_ap_sec_type; spin_lock_init(&ieee->lock); @@ -197,16 +197,18 @@ void free_rtllib(struct net_device *dev) kfree(ieee->pHTInfo); ieee->pHTInfo = NULL; rtllib_softmac_free(ieee); - del_timer_sync(&ieee->crypt_deinit_timer); - rtllib_crypt_deinit_entries(ieee, 1); + + /* SAM cleanup */ + del_timer_sync(&ieee->crypt_info.crypt_deinit_timer); + rtllib_crypt_deinit_entries(&ieee->crypt_info, 1); for (i = 0; i < NUM_WEP_KEYS; i++) { - struct lib80211_crypt_data *crypt = ieee->crypt[i]; + struct lib80211_crypt_data *crypt = ieee->crypt_info.crypt[i]; if (crypt) { if (crypt->ops) crypt->ops->deinit(crypt->priv); kfree(crypt); - ieee->crypt[i] = NULL; + ieee->crypt_info.crypt[i] = NULL; } } diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index d02a88bb3a46..6c5061f12bad 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1019,7 +1019,7 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, if (skb->len >= hdrlen + 3) idx = skb->data[hdrlen + 3] >> 6; - *crypt = ieee->crypt[idx]; + *crypt = ieee->crypt_info.crypt[idx]; /* allow NULL decrypt to indicate an station specific override * for default encryption */ if (*crypt && ((*crypt)->ops == NULL || diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 47c163b9e35d..80d147693490 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -871,7 +871,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) } else erp_len = 0; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); if (ieee->pHTInfo->bCurrentHTSupport) { @@ -923,7 +923,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME)); - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (encrypt) beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); @@ -1013,7 +1013,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); if (ieee->host_encrypt) - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; else crypt = NULL; @@ -1191,7 +1191,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, unsigned int turbo_info_len = beacon->Turbo_Enable ? 9 : 0; int len = 0; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (crypt != NULL) encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name, "WEP") || @@ -3367,7 +3367,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { if (param->u.crypt.idx >= NUM_WEP_KEYS) return -EINVAL; - crypt = &ieee->crypt[param->u.crypt.idx]; + crypt = &ieee->crypt_info.crypt[param->u.crypt.idx]; } else { return -EINVAL; } @@ -3377,7 +3377,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, sec.enabled = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_ENABLED | SEC_LEVEL; - rtllib_crypt_delayed_deinit(ieee, crypt); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); } goto done; } @@ -3410,7 +3410,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, if (*crypt == NULL || (*crypt)->ops != ops) { struct lib80211_crypt_data *new_crypt; - rtllib_crypt_delayed_deinit(ieee, crypt); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); new_crypt = (struct lib80211_crypt_data *) kmalloc(sizeof(*new_crypt), GFP_KERNEL); @@ -3446,7 +3446,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, skip_host_crypt: if (param->u.crypt.set_tx) { - ieee->tx_keyidx = param->u.crypt.idx; + ieee->crypt_info.tx_keyidx = param->u.crypt.idx; sec.active_key = param->u.crypt.idx; sec.flags |= SEC_ACTIVE_KEY; } else @@ -3565,7 +3565,7 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) struct lib80211_crypt_data *crypt; int encrypt; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name, "WEP"))); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index b038357b6175..f451bfc27a86 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -182,7 +182,7 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, struct lib80211_crypt_data *crypt = NULL; int res; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (!(crypt && crypt->ops)) { printk(KERN_INFO "=========>%s(), crypt is null\n", __func__); @@ -645,7 +645,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } skb->priority = rtllib_classify(skb, IsAmsdu); - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && ieee->host_encrypt && crypt && crypt->ops; if (!encrypt && ieee->ieee802_1x && diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 3978ed2137ef..1328dbc92f10 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -318,28 +318,28 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, key_provided = 1; } else { key_provided = 0; - key = ieee->tx_keyidx; + key = ieee->crypt_info.tx_keyidx; } RTLLIB_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? "provided" : "default"); - crypt = &ieee->crypt[key]; + crypt = &ieee->crypt_info.crypt[key]; if (erq->flags & IW_ENCODE_DISABLED) { if (key_provided && *crypt) { RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n", key); - rtllib_crypt_delayed_deinit(ieee, crypt); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); } else RTLLIB_DEBUG_WX("Disabling encryption.\n"); /* Check all the keys to see if any are still configured, * and if no key index was provided, de-init them all */ for (i = 0; i < NUM_WEP_KEYS; i++) { - if (ieee->crypt[i] != NULL) { + if (ieee->crypt_info.crypt[i] != NULL) { if (key_provided) break; - rtllib_crypt_delayed_deinit(ieee, - &ieee->crypt[i]); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, + &ieee->crypt_info.crypt[i]); } } @@ -361,7 +361,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, strcmp((*crypt)->ops->name, "WEP") != 0) { /* changing to use WEP; deinit previously used algorithm * on this key */ - rtllib_crypt_delayed_deinit(ieee, crypt); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); } if (*crypt == NULL) { @@ -411,7 +411,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, * explicitely set */ if (key == sec.active_key) sec.flags |= SEC_ACTIVE_KEY; - ieee->tx_keyidx = key; + ieee->crypt_info.tx_keyidx = key; } else { len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, @@ -434,7 +434,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (key_provided) { RTLLIB_DEBUG_WX( "Setting key %d to default Tx key.\n", key); - ieee->tx_keyidx = key; + ieee->crypt_info.tx_keyidx = key; sec.active_key = key; sec.flags |= SEC_ACTIVE_KEY; } @@ -490,9 +490,9 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, return -EINVAL; key--; } else { - key = ieee->tx_keyidx; + key = ieee->crypt_info.tx_keyidx; } - crypt = ieee->crypt[key]; + crypt = ieee->crypt_info.crypt[key]; erq->flags = key + 1; @@ -538,17 +538,17 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, return -EINVAL; idx--; } else{ - idx = ieee->tx_keyidx; + idx = ieee->crypt_info.tx_keyidx; } if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - crypt = &ieee->crypt[idx]; + crypt = &ieee->crypt_info.crypt[idx]; group_key = 1; } else { /* some Cisco APs use idx>0 for unicast in dynamic WEP */ if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) return -EINVAL; if (ieee->iw_mode == IW_MODE_INFRA) - crypt = &ieee->crypt[idx]; + crypt = &ieee->crypt_info.crypt[idx]; else return -EINVAL; } @@ -557,10 +557,10 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE) { if (*crypt) - rtllib_crypt_delayed_deinit(ieee, crypt); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); for (i = 0; i < NUM_WEP_KEYS; i++) { - if (ieee->crypt[i] != NULL) + if (ieee->crypt_info.crypt[i] != NULL) break; } if (i == NUM_WEP_KEYS) { @@ -613,7 +613,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if (*crypt == NULL || (*crypt)->ops != ops) { struct lib80211_crypt_data *new_crypt; - rtllib_crypt_delayed_deinit(ieee, crypt); + rtllib_crypt_delayed_deinit(&ieee->crypt_info, crypt); new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { @@ -642,7 +642,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, goto done; } if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - ieee->tx_keyidx = idx; + ieee->crypt_info.tx_keyidx = idx; sec.active_key = idx; sec.flags |= SEC_ACTIVE_KEY; } @@ -696,14 +696,14 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, return -EINVAL; idx--; } else { - idx = ieee->tx_keyidx; + idx = ieee->crypt_info.tx_keyidx; } if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && (ext->alg != IW_ENCODE_ALG_WEP)) if (idx != 0 || (ieee->iw_mode != IW_MODE_INFRA)) return -EINVAL; - crypt = ieee->crypt[idx]; + crypt = ieee->crypt_info.crypt[idx]; encoding->flags = idx + 1; memset(ext, 0, sizeof(*ext)); |