iwmc3200wifi updates
cover iwmc3200wifi updates
Hi,
Here are some patches for iwmc3200wifi driver to adapt to recent cfg80211 changes.
[PATCH 01/09] iwmc3200wifi: fix UMAC INIT_COMPLETE notification handling [PATCH 02/09] iwmc3200wifi: hardware does not support IP checksum [PATCH 03/09] iwmc3200wifi: set cipher_suites before registering wiphy [PATCH 04/09] iwmc3200wifi: use correct debug level
[PATCH 05/09] iwmc3200wifi: cfg80211 managed mode port
[PATCH 06/09] iwmc3200wifi: remove setting WEP keys before setting essid support [PATCH 07/09] iwmc3200wifi: make iwm_send_wifi_if_cmd return 0 on success [PATCH 08/09] iwmc3200wifi: remove key caches in driver
[PATCH 09/09] cfg80211: remove WARN_ON in __cfg80211_sme_scan_done
Thanks,
-yi
PATCH 1/10 iwmc3200wifi: fix UMAC INIT_COMPLETE notification handling
The patch fixes the missing UMAC iwm_umac_wifi_in_hdr header in the UMAC INIT_COMPLETE (iwm_umac_notif_init_complete) notification.
--- drivers/net/wireless/iwmc3200wifi/rx.c | 1 - drivers/net/wireless/iwmc3200wifi/umac.h | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/wireless/iwmc3200wifi/rx.c +0 -1
@@ -102,7 +102,6 @@ static int iwm_ntf_error(struct iwm_priv *iwm, u8 *buf, error = (struct iwm_umac_notif_error *)buf; fw_err = &error->err; -IWM_ERR (iwm,"%cMAC FW ERROR:\n" , (le32_to_cpu (fw_err->category) ==UMAC_SYS_ERR_CAT_LMAC ) ?'L' :'U' );IWM_ERR (iwm,"\tCategory: %d\n" ,le32_to_cpu (fw_err->category));
drivers/net/wireless/iwmc3200wifi/umac.h +6 -0
@@ -615,6 +615,7 @@ struct iwm_umac_notif_alive { } __attribute__ ((packed));struct iwm_umac_notif_init_complete { +struct iwm_umac_wifi_in_hdr hdr;__le16 status;__le16 reserved; } __attribute__ ((packed));
@@ -643,6 +644,11 @@ struct iwm_fw_error_hdr {__le32 umac_status;__le32 lmac_status;__le32 sdio_status; +__le32 dbm_sample_ctrl; +__le32 dbm_buf_base; +__le32 dbm_buf_end; +__le32 dbm_buf_write_ptr; +__le32 dbm_buf_cycle_cnt; } __attribute__ ((packed));struct iwm_umac_notif_error {
Signature · 1 line
1.6.0.4
PATCH 2/10 iwmc3200wifi: hardware does not support IP checksum
The iwmc3200wifi hardware doesn't support IP checksum. So mark the skb->ip_summed to CHECKSUM_NONE instead of CHECKSUM_UNNECESSARY.
--- drivers/net/wireless/iwmc3200wifi/rx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwmc3200wifi/rx.c +1 -1
@@ -1359,7 +1359,7 @@ static void iwm_rx_process_packet(struct iwm_priv *iwm, skb->dev =iwm_to_ndev (iwm); skb->protocol =eth_type_trans (skb, ndev); - skb->ip_summed =CHECKSUM_UNNECESSARY ; + skb->ip_summed =CHECKSUM_NONE ;memset (skb->cb,0 ,sizeof (skb->cb)); ndev->stats.rx_packets++;
Signature · 1 line
1.6.0.4
PATCH 3/10 iwmc3200wifi: set cipher_suites before registering wiphy
We need to specify all the cipher suites we supported. Otherwise cfg80211_validate_key_settings() will fail when we are setting keys.
--- drivers/net/wireless/iwmc3200wifi/cfg80211.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/wireless/iwmc3200wifi/cfg80211.c +10 -0
@@ -558,6 +558,13 @@ static struct cfg80211_ops iwm_cfg80211_ops = { .set_power_mgmt = iwm_cfg80211_set_power_mgmt, }; +static const u32 cipher_suites[] = { +WLAN_CIPHER_SUITE_WEP40 , +WLAN_CIPHER_SUITE_WEP104 , +WLAN_CIPHER_SUITE_TKIP , +WLAN_CIPHER_SUITE_CCMP , +}; +struct wireless_dev *iwm_wdev_alloc (int sizeof_bus,struct device *dev) {int ret =0 ;
@@ -600,6 +607,9 @@ struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev) wdev->wiphy->bands[IEEE80211_BAND_5GHZ ] = &iwm_band_5ghz; wdev->wiphy->signal_type =CFG80211_SIGNAL_TYPE_MBM ; + wdev->wiphy->cipher_suites = cipher_suites; + wdev->wiphy->n_cipher_suites =ARRAY_SIZE (cipher_suites); + ret =wiphy_register (wdev->wiphy);if (ret <0 ) {dev_err (dev,"Couldn't register wiphy device\n" );
Signature · 1 line
1.6.0.4
PATCH 4/10 iwmc3200wifi: use correct debug level
This patch uses TX and RX instead of NTF debug levels in some hot paths.
--- drivers/net/wireless/iwmc3200wifi/rx.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/wireless/iwmc3200wifi/rx.c +16 -16
@@ -218,17 +218,17 @@ static int iwm_ntf_tx(struct iwm_priv *iwm, u8 *buf, (buf +sizeof (struct iwm_umac_wifi_in_hdr )); hdr = (struct iwm_umac_wifi_in_hdr *)buf; -IWM_DBG_NTF (iwm,DBG ,"REPLY_TX, buf size: %lu\n" , buf_size); - -IWM_DBG_NTF (iwm,DBG ,"Seqnum: %d\n" , -le16_to_cpu (hdr->sw_hdr.cmd.seq_num)); -IWM_DBG_NTF (iwm,DBG ,"\tFrame cnt: %d\n" , tx_resp->frame_cnt); -IWM_DBG_NTF (iwm,DBG ,"\tRetry cnt: %d\n" , -le16_to_cpu (tx_resp->retry_cnt)); -IWM_DBG_NTF (iwm,DBG ,"\tSeq ctl: %d\n" ,le16_to_cpu (tx_resp->seq_ctl)); -IWM_DBG_NTF (iwm,DBG ,"\tByte cnt: %d\n" , -le16_to_cpu (tx_resp->byte_cnt)); -IWM_DBG_NTF (iwm,DBG ,"\tStatus: 0x%x\n" ,le32_to_cpu (tx_resp->status)); +IWM_DBG_TX (iwm,DBG ,"REPLY_TX, buf size: %lu\n" , buf_size); + +IWM_DBG_TX (iwm,DBG ,"Seqnum: %d\n" , +le16_to_cpu (hdr->sw_hdr.cmd.seq_num)); +IWM_DBG_TX (iwm,DBG ,"\tFrame cnt: %d\n" , tx_resp->frame_cnt); +IWM_DBG_TX (iwm,DBG ,"\tRetry cnt: %d\n" , +le16_to_cpu (tx_resp->retry_cnt)); +IWM_DBG_TX (iwm,DBG ,"\tSeq ctl: %d\n" ,le16_to_cpu (tx_resp->seq_ctl)); +IWM_DBG_TX (iwm,DBG ,"\tByte cnt: %d\n" , +le16_to_cpu (tx_resp->byte_cnt)); +IWM_DBG_TX (iwm,DBG ,"\tStatus: 0x%x\n" ,le32_to_cpu (tx_resp->status));return 0 ; }
@@ -418,8 +418,8 @@ static int iwm_ntf_rx_ticket(struct iwm_priv *iwm, u8 *buf,if (IS_ERR (ticket_node))return PTR_ERR (ticket_node); -IWM_DBG_NTF (iwm,DBG ,"TICKET RELEASE(%d)\n" , - ticket->id); +IWM_DBG_RX (iwm,DBG ,"TICKET RELEASE(%d)\n" , + ticket->id);list_add_tail (&ticket_node->node, &iwm->rx_tickets);/*
@@ -454,15 +454,15 @@ static int iwm_ntf_rx_packet(struct iwm_priv *iwm, u8 *buf,u16 id, buf_offset;u32 packet_size; -IWM_DBG_NTF (iwm,DBG ,"\n" ); +IWM_DBG_RX (iwm,DBG ,"\n" ); wifi_hdr = (struct iwm_umac_wifi_in_hdr *)buf; id =le16_to_cpu (wifi_hdr->sw_hdr.cmd.seq_num); buf_offset =sizeof (struct iwm_umac_wifi_in_hdr ); packet_size = buf_size -sizeof (struct iwm_umac_wifi_in_hdr ); -IWM_DBG_NTF (iwm,DBG ,"CMD:0x%x, seqnum: %d, packet size: %d\n" , - wifi_hdr->sw_hdr.cmd.cmd, id, packet_size); +IWM_DBG_RX (iwm,DBG ,"CMD:0x%x, seqnum: %d, packet size: %d\n" , + wifi_hdr->sw_hdr.cmd.cmd, id, packet_size);IWM_DBG_RX (iwm,DBG ,"Packet id: %d\n" , id);IWM_HEXDUMP (iwm,DBG ,RX ,"PACKET: " , buf + buf_offset, packet_size);
Signature · 1 line
1.6.0.4
PATCH 5/10 iwmc3200wifi: cfg80211 managed mode port
From: Samuel Ortiz <[email protected]>
This patch ports iwmc3200wifi to the cfg80211 managed mode API.
--- drivers/net/wireless/iwmc3200wifi/cfg80211.c | 195 ++++++++++++++++ drivers/net/wireless/iwmc3200wifi/rx.c | 16 +- drivers/net/wireless/iwmc3200wifi/wext.c | 320 +++----------------------- 3 files changed, 239 insertions(+), 292 deletions(-)
drivers/net/wireless/iwmc3200wifi/cfg80211.c +195 -0
@@ -305,6 +305,25 @@ static int iwm_cfg80211_set_default_key(struct wiphy *wiphy,return iwm_reset_profile (iwm); } +int iwm_cfg80211_get_station (struct wiphy *wiphy,struct net_device *ndev, +u8 *mac,struct station_info *sinfo) +{ +struct iwm_priv *iwm =ndev_to_iwm (ndev); + +if (memcmp (mac, iwm->bssid,ETH_ALEN )) +return -ENOENT ; + + sinfo->filled |=STATION_INFO_TX_BITRATE ; + sinfo->txrate.legacy = iwm->rate *10 ; + +if (test_bit (IWM_STATUS_ASSOCIATED , &iwm->status)) { + sinfo->filled |=STATION_INFO_SIGNAL ; + sinfo->signal = iwm->wstats.qual.level; + } + +return 0 ; +} +int iwm_cfg80211_inform_bss (struct iwm_priv *iwm) {
@@ -500,6 +519,179 @@ static int iwm_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)return 0 ; } +static int iwm_set_auth_type (struct iwm_priv *iwm, +enum nl80211_auth_type sme_auth_type) +{ +u8 *auth_type = &iwm->umac_profile->sec.auth_type; + +switch (sme_auth_type) { +case NL80211_AUTHTYPE_AUTOMATIC : +case NL80211_AUTHTYPE_OPEN_SYSTEM : +IWM_DBG_WEXT (iwm,DBG ,"OPEN auth\n" ); + *auth_type =UMAC_AUTH_TYPE_OPEN ; +break ; +case NL80211_AUTHTYPE_SHARED_KEY : +if (iwm->umac_profile->sec.flags & + (UMAC_SEC_FLG_WPA_ON_MSK |UMAC_SEC_FLG_RSNA_ON_MSK )) { +IWM_DBG_WEXT (iwm,DBG ,"WPA auth alg\n" ); + *auth_type =UMAC_AUTH_TYPE_RSNA_PSK ; + }else { +IWM_DBG_WEXT (iwm,DBG ,"WEP shared key auth alg\n" ); + *auth_type =UMAC_AUTH_TYPE_LEGACY_PSK ; + } + +break ; +default : +IWM_ERR (iwm,"Unsupported auth alg: 0x%x\n" , sme_auth_type); +return -ENOTSUPP ; + } + +return 0 ; +} + +static int iwm_set_wpa_version (struct iwm_priv *iwm,u32 wpa_version) +{ +if (!wpa_version) { + iwm->umac_profile->sec.flags =UMAC_SEC_FLG_LEGACY_PROFILE ; +return 0 ; + } + +if (wpa_version &NL80211_WPA_VERSION_2 ) + iwm->umac_profile->sec.flags =UMAC_SEC_FLG_RSNA_ON_MSK ; + +if (wpa_version &NL80211_WPA_VERSION_1 ) + iwm->umac_profile->sec.flags |=UMAC_SEC_FLG_WPA_ON_MSK ; + +return 0 ; +} + +static int iwm_set_cipher (struct iwm_priv *iwm,u32 cipher,bool ucast) +{ +u8 *profile_cipher = ucast ? &iwm->umac_profile->sec.ucast_cipher : + &iwm->umac_profile->sec.mcast_cipher; + +if (!cipher) { + *profile_cipher =UMAC_CIPHER_TYPE_NONE ; +return 0 ; + } + +switch (cipher) { +case IW_AUTH_CIPHER_NONE : + *profile_cipher =UMAC_CIPHER_TYPE_NONE ; +break ; +case WLAN_CIPHER_SUITE_WEP40 : + *profile_cipher =UMAC_CIPHER_TYPE_WEP_40 ; +break ; +case WLAN_CIPHER_SUITE_WEP104 : + *profile_cipher =UMAC_CIPHER_TYPE_WEP_104 ; +break ; +case WLAN_CIPHER_SUITE_TKIP : + *profile_cipher =UMAC_CIPHER_TYPE_TKIP ; +break ; +case WLAN_CIPHER_SUITE_CCMP : + *profile_cipher =UMAC_CIPHER_TYPE_CCMP ; +break ; +default : +IWM_ERR (iwm,"Unsupported cipher: 0x%x\n" , cipher); +return -ENOTSUPP ; + } + +return 0 ; +} + +static int iwm_set_key_mgt (struct iwm_priv *iwm,u32 key_mgt) +{ +u8 *auth_type = &iwm->umac_profile->sec.auth_type; + +IWM_DBG_WEXT (iwm,DBG ,"key_mgt: 0x%x\n" , key_mgt); + +if (key_mgt ==WLAN_AKM_SUITE_8021X ) + *auth_type =UMAC_AUTH_TYPE_8021X ; +else if (key_mgt ==WLAN_AKM_SUITE_PSK ) { +if (iwm->umac_profile->sec.flags & + (UMAC_SEC_FLG_WPA_ON_MSK |UMAC_SEC_FLG_RSNA_ON_MSK )) + *auth_type =UMAC_AUTH_TYPE_RSNA_PSK ; +else + *auth_type =UMAC_AUTH_TYPE_LEGACY_PSK ; + }else { +IWM_ERR (iwm,"Invalid key mgt: 0x%x\n" , key_mgt); +return -EINVAL ; + } + +return 0 ; +} + + +static int iwm_cfg80211_connect (struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_connect_params *sme) +{ +struct iwm_priv *iwm =wiphy_to_iwm (wiphy); +struct ieee80211_channel *chan = sme->channel; +int ret; + +if (!test_bit (IWM_STATUS_READY , &iwm->status)) +return -EIO ; + +if (!sme->ssid) +return -EINVAL ; + +if (chan) + iwm->channel = +ieee80211_frequency_to_channel (chan->center_freq); + + iwm->umac_profile->ssid.ssid_len = sme->ssid_len; +memcpy (iwm->umac_profile->ssid.ssid, sme->ssid, sme->ssid_len); + +if (sme->bssid) { +IWM_DBG_WEXT (iwm,DBG ,"BSSID: %pM\n" , sme->bssid); +memcpy (&iwm->umac_profile->bssid[0 ], sme->bssid,ETH_ALEN ); + iwm->umac_profile->bss_num =1 ; + }else { +memset (&iwm->umac_profile->bssid[0 ],0 ,ETH_ALEN ); + iwm->umac_profile->bss_num =0 ; + } + + ret =iwm_set_auth_type (iwm, sme->auth_type); +if (ret <0 ) +return ret; + + ret =iwm_set_wpa_version (iwm, sme->crypto.wpa_versions); +if (ret <0 ) +return ret; + +if (sme->crypto.n_ciphers_pairwise) { + ret =iwm_set_cipher (iwm, sme->crypto.ciphers_pairwise[0 ], + true); +if (ret <0 ) +return ret; + } + + ret =iwm_set_cipher (iwm, sme->crypto.cipher_group, false); +if (ret <0 ) +return ret; + +if (sme->crypto.n_akm_suites) { + ret =iwm_set_key_mgt (iwm, sme->crypto.akm_suites[0 ]); +if (ret <0 ) +return ret; + } + +return iwm_send_mlme_profile (iwm); +} + +static int iwm_cfg80211_disconnect (struct wiphy *wiphy,struct net_device *dev, +u16 reason_code) +{ +struct iwm_priv *iwm =wiphy_to_iwm (wiphy); + +IWM_DBG_WEXT (iwm,DBG ,"Active: %d\n" , iwm->umac_profile_active); + +if (iwm->umac_profile_active) +return iwm_invalidate_mlme_profile (iwm); + +return 0 ; +} +static int iwm_cfg80211_set_txpower (struct wiphy *wiphy,enum tx_power_setting type,int dbm) {
@@ -549,8 +741,11 @@ static struct cfg80211_ops iwm_cfg80211_ops = { .get_key = iwm_cfg80211_get_key, .del_key = iwm_cfg80211_del_key, .set_default_key = iwm_cfg80211_set_default_key, + .get_station = iwm_cfg80211_get_station, .scan = iwm_cfg80211_scan, .set_wiphy_params = iwm_cfg80211_set_wiphy_params, + .connect = iwm_cfg80211_connect, + .disconnect = iwm_cfg80211_disconnect, .join_ibss = iwm_cfg80211_join_ibss, .leave_ibss = iwm_cfg80211_leave_ibss, .set_tx_power = iwm_cfg80211_set_txpower,
drivers/net/wireless/iwmc3200wifi/rx.c +9 -7
@@ -503,13 +503,10 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf, {struct iwm_umac_notif_assoc_complete *complete = (struct iwm_umac_notif_assoc_complete *)buf; -union iwreq_data wrqu;IWM_DBG_MLME (iwm,INFO ,"Association with %pM completed, status: %d\n" , complete->bssid, complete->status); -memset (&wrqu,0 ,sizeof (wrqu)); -clear_bit (IWM_STATUS_ASSOCIATING , &iwm->status);switch (le32_to_cpu (complete->status)) {
@@ -520,7 +517,10 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,iwm_link_on (iwm); -memcpy (wrqu.ap_addr.sa_data, complete->bssid,ETH_ALEN ); +cfg80211_connect_result (iwm_to_ndev (iwm), + complete->bssid, +NULL ,0 ,NULL ,0 , +WLAN_STATUS_SUCCESS ,GFP_KERNEL );break ;case UMAC_ASSOC_COMPLETE_FAILURE :clear_bit (IWM_STATUS_ASSOCIATED , &iwm->status);
@@ -528,6 +528,11 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf, iwm->channel =0 ;iwm_link_off (iwm); + +cfg80211_connect_result (iwm_to_ndev (iwm), complete->bssid, +NULL ,0 ,NULL ,0 , +WLAN_STATUS_UNSPECIFIED_FAILURE , +GFP_KERNEL );default :break ; }
@@ -537,9 +542,6 @@ static int iwm_mlme_assoc_complete(struct iwm_priv *iwm, u8 *buf,return 0 ; } - wrqu.ap_addr.sa_family =ARPHRD_ETHER ; -wireless_send_event (iwm_to_ndev (iwm),SIOCGIWAP , &wrqu,NULL ); -return 0 ; }
drivers/net/wireless/iwmc3200wifi/wext.c +35 -285
399 lines not on this page · raw message
Signature · 1 line
1.6.0.4
PATCH 6/10 iwmc3200wifi: remove setting WEP keys before setting essid support
The recent cfg80211 "rework key operation" patch from Johannes Berg makes sure keys are set only after the connection has been established. So we can remove the setting WEP keys before essid support from the driver.
--- drivers/net/wireless/iwmc3200wifi/cfg80211.c | 26 -------------------------- 1 files changed, 0 insertions(+), 26 deletions(-)
drivers/net/wireless/iwmc3200wifi/cfg80211.c +0 -26
@@ -203,32 +203,6 @@ static int iwm_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,return ret; } -/* -* The WEP keys can be set before or after setting the essid. -* We need to handle both cases by simply pushing the keys after -* we send the profile. -* If the profile is not set yet (i.e. we're pushing keys before -* the essid), we set the cipher appropriately. -* If the profile is set, we havent associated yet because our -* cipher was incorrectly set. So we invalidate and send the -* profile again. -*/ -if (key->cipher ==WLAN_CIPHER_SUITE_WEP40 || - key->cipher ==WLAN_CIPHER_SUITE_WEP104 ) { -u8 *ucast_cipher = &iwm->umac_profile->sec.ucast_cipher; -u8 *mcast_cipher = &iwm->umac_profile->sec.mcast_cipher; - -IWM_DBG_WEXT (iwm,DBG ,"WEP key\n" ); - -if (key->cipher ==WLAN_CIPHER_SUITE_WEP40 ) - *ucast_cipher = *mcast_cipher =UMAC_CIPHER_TYPE_WEP_40 ; -if (key->cipher ==WLAN_CIPHER_SUITE_WEP104 ) - *ucast_cipher = *mcast_cipher = -UMAC_CIPHER_TYPE_WEP_104 ; - -return iwm_reset_profile (iwm); - } -return iwm_set_key (iwm,0 , key); }
Signature · 1 line
1.6.0.4
PATCH 7/10 iwmc3200wifi: make iwm_send_wifi_if_cmd return 0 on success
We used to return the result of wait_event_interruptible_timeout() which is the remaining timeout on success. But this information is not used by any of its callers. So we just return 0 on success. This fixed a erroneous return value bug for iwm_set_key().
--- drivers/net/wireless/iwmc3200wifi/commands.c | 27 ++++++++++++------------- 1 files changed, 13 insertions(+), 14 deletions(-)
drivers/net/wireless/iwmc3200wifi/commands.c +13 -14
@@ -87,8 +87,7 @@ int iwm_send_wifi_if_cmd(struct iwm_priv *iwm, void *payload, u16 payload_size,test_and_clear_bit (oid, &iwm->wifi_ntfy[0 ]), 3 * HZ); -if (!ret) - ret = -EBUSY ; +return ret ?0 : -EBUSY ; }return ret;
@@ -480,8 +479,10 @@ static int iwm_target_read(struct iwm_priv *iwm, __le32 address, target_cmd.eop =1 ; ret =iwm_hal_send_target_cmd (iwm, &target_cmd,NULL ); -if (ret <0 ) +if (ret <0 ) {IWM_ERR (iwm,"Couldn't send READ command\n" ); +return ret; + }/* When succeding, the send_target routine returns the seq number */ seq_num = ret;
@@ -501,7 +502,7 @@ static int iwm_target_read(struct iwm_priv *iwm, __le32 address,kfree (cmd); -return ret; +return 0 ; }int iwm_read_mac (struct iwm_priv *iwm,u8 *mac)
@@ -511,7 +512,7 @@ int iwm_read_mac(struct iwm_priv *iwm, u8 *mac) ret =iwm_target_read (iwm,cpu_to_le32 (WICO_MAC_ADDRESS_ADDR ), mac_align,sizeof (mac_align)); -if (ret <0 ) +if (ret)return ret;if (is_valid_ether_addr (mac_align))
@@ -714,7 +715,7 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key) ret =iwm_send_wifi_if_cmd (iwm, &key_remove,sizeof (struct iwm_umac_key_remove ),1 ); -if (ret <0 ) +if (ret)return ret; iwm->keys[key_idx].key_len =0 ;
@@ -736,7 +737,7 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm) sizeof(struct iwm_umac_wifi_if)); ret =iwm_send_wifi_if_cmd (iwm, &profile,sizeof (profile),1 ); -if (ret <0 ) { +if (ret) {IWM_ERR (iwm,"Send profile command failed\n" );return ret; }
@@ -752,12 +753,12 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm) 3 * HZ); ret =iwm_set_key (iwm,0 , key); -if (ret <0 ) +if (ret)return ret;if (iwm->default_key == i) { ret =iwm_set_tx_key (iwm, i); -if (ret <0 ) +if (ret)return ret; } }
@@ -778,15 +779,13 @@ int iwm_invalidate_mlme_profile(struct iwm_priv *iwm) invalid.reason =WLAN_REASON_UNSPECIFIED ; ret =iwm_send_wifi_if_cmd (iwm, &invalid,sizeof (invalid),1 ); -if (ret <0 ) +if (ret)return ret; ret =wait_event_interruptible_timeout (iwm->mlme_queue, (iwm->umac_profile_active ==0 ),2 *HZ ); -if (!ret) -return -EBUSY ; -return 0 ; +return ret ?0 : -EBUSY ; }int iwm_send_umac_stats_req (struct iwm_priv *iwm,u32 flags)
@@ -869,7 +868,7 @@ int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids, } ret =iwm_send_wifi_if_cmd (iwm, &req,sizeof (req),0 ); -if (ret <0 ) { +if (ret) {IWM_ERR (iwm,"Couldn't send scan request\n" );return ret; }
Signature · 1 line
1.6.0.4
PATCH 8/10 iwmc3200wifi: remove key caches in driver
cfg80211 now guarantees keys are set after connecting. We can remove the key cache code from the driver now.
--- drivers/net/wireless/iwmc3200wifi/cfg80211.c | 43 +------------------------- drivers/net/wireless/iwmc3200wifi/commands.c | 29 +----------------- 2 files changed, 2 insertions(+), 70 deletions(-)
drivers/net/wireless/iwmc3200wifi/cfg80211.c +1 -42
@@ -158,34 +158,6 @@ static int iwm_key_init(struct iwm_key *key, u8 key_index,return 0 ; } -static int iwm_reset_profile (struct iwm_priv *iwm) -{ -int ret; - -if (!iwm->umac_profile_active) -return 0 ; - -/* -* If there is a current active profile, but no -* default key, it's not worth trying to associate again. -*/ -if (iwm->default_key <0 ) -return 0 ; - -/* -* Here we have an active profile, but a key setting changed. -* We thus have to invalidate the current profile, and push the -* new one. Keys will be pushed when association takes place. -*/ - ret =iwm_invalidate_mlme_profile (iwm); -if (ret <0 ) { -IWM_ERR (iwm,"Couldn't invalidate profile\n" ); -return ret; - } - -return iwm_send_mlme_profile (iwm); -} -static int iwm_cfg80211_add_key (struct wiphy *wiphy,struct net_device *ndev,u8 key_index,const u8 *mac_addr,struct key_params *params)
@@ -245,10 +217,6 @@ static int iwm_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,if (key_index == iwm->default_key) iwm->default_key =-1 ; -/* If the interface is down, we just cache this */ -if (!test_bit (IWM_STATUS_READY , &iwm->status)) -return 0 ; -return iwm_set_key (iwm,1 , key); }
@@ -257,7 +225,6 @@ static int iwm_cfg80211_set_default_key(struct wiphy *wiphy, u8 key_index) {struct iwm_priv *iwm =ndev_to_iwm (ndev); -int ret;IWM_DBG_WEXT (iwm,DBG ,"Default key index is: %d\n" , key_index);
@@ -268,15 +235,7 @@ static int iwm_cfg80211_set_default_key(struct wiphy *wiphy, iwm->default_key = key_index; -/* If the interface is down, we just cache this */ -if (!test_bit (IWM_STATUS_READY , &iwm->status)) -return 0 ; - - ret =iwm_set_tx_key (iwm, key_index); -if (ret <0 ) -return ret; - -return iwm_reset_profile (iwm); +return iwm_set_tx_key (iwm, key_index); } int iwm_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
drivers/net/wireless/iwmc3200wifi/commands.c +1 -28
@@ -584,12 +584,6 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key)struct iwm_umac_key_tkip *tkip = (struct iwm_umac_key_tkip *)cmd;struct iwm_umac_key_ccmp *ccmp = (struct iwm_umac_key_ccmp *)cmd; -/* -* We check if our current profile is valid. -* If not, we dont push the key, we just cache them, -* so that with the next siwsessid call, the keys -* will be actually pushed. -*/ if (!remove) { ret =iwm_check_profile (iwm);if (ret <0 )
@@ -727,7 +721,7 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key)int iwm_send_mlme_profile (struct iwm_priv *iwm) { -int ret, i; +int ret;struct iwm_umac_profile profile;memcpy (&profile, iwm->umac_profile,sizeof (profile));
@@ -742,27 +736,6 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm)return ret; } -for (i =0 ; i <IWM_NUM_KEYS ; i++) -if (iwm->keys[i].key_len) { -struct iwm_key *key = &iwm->keys[i]; - -/* Wait for the profile before sending the keys */ -wait_event_interruptible_timeout (iwm->mlme_queue, - (test_bit (IWM_STATUS_ASSOCIATING , &iwm->status) || -test_bit (IWM_STATUS_ASSOCIATED , &iwm->status)), -3 *HZ ); - - ret =iwm_set_key (iwm,0 , key); -if (ret) -return ret; - -if (iwm->default_key == i) { - ret =iwm_set_tx_key (iwm, i); -if (ret) -return ret; - } - } -return 0 ; }
Signature · 1 line
1.6.0.4
PATCH 9/10 cfg80211: remove WARN_ON in __cfg80211_sme_scan_done
cfg80211_sme_scan_done() can be called (by fullmac cards) with wdev->conn == NULL when CFG80211_SME_CONNECTING. We quit silently instead of WARN_ON in this case.
--- net/wireless/sme.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/wireless/sme.c +1 -1
@@ -227,7 +227,7 @@ static void __cfg80211_sme_scan_done(struct net_device *dev)if (wdev->sme_state !=CFG80211_SME_CONNECTING )return ; -if (WARN_ON (!wdev->conn)) +if (!wdev->conn)return ; if (wdev->conn->state != CFG80211_CONN_SCANNING &&
Signature · 1 line
1.6.0.4
Re: [PATCH 09/10] cfg80211: remove WARN_ON in __cfg80211_sme_scan_done
Quoted 3 lines · Zhu Yi
cfg80211_sme_scan_done()can be called (by fullmac cards) withwdev->conn== NULL whenCFG80211_SME_CONNECTING. We quit silently instead ofWARN_ONin this case.
Indeed, sorry.
Quoted 18 lines
Signed-off-by Zhu Yi <[email protected]>--- net/wireless/sme.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/wireless/sme.c +1
-1@@ -227,7 +227,7 @@ static void __cfg80211_sme_scan_done(struct net_device *dev)if (wdev->sme_state !=CFG80211_SME_CONNECTING )return ; -if (WARN_ON (!wdev->conn)) +if (!wdev->conn)return ; if (wdev->conn->state != CFG80211_CONN_SCANNING &&