Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] wireless/airo: clean up WEXT association and scan events

Airo firmware versions >= 5.30.17 send re-association events to the
driver that are currently unrecognized, causing spurious disassociation
events to be sent to user space. Loss of sync due to scan requests also
results in disassociation events sent to user space. This patch traps
those two events; suppressing sync-loss on scan, and sending the correct
association event on re-association notifications.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Dan Williams and committed by
John W. Linville
6fcdf565 e4b5fae8

+17 -29
+17 -29
drivers/net/wireless/airo.c
··· 3139 3139 } 3140 3140 if ( status & EV_LINK ) { 3141 3141 union iwreq_data wrqu; 3142 + int scan_forceloss = 0; 3142 3143 /* The link status has changed, if you want to put a 3143 3144 monitor hook in, do it here. (Remember that 3144 3145 interrupts are still disabled!) ··· 3158 3157 code) */ 3159 3158 #define AUTHFAIL 0x0300 /* Authentication failure (low byte is reason 3160 3159 code) */ 3161 - #define ASSOCIATED 0x0400 /* Assocatied */ 3160 + #define ASSOCIATED 0x0400 /* Associated */ 3161 + #define REASSOCIATED 0x0600 /* Reassociated? Only on firmware >= 5.30.17 */ 3162 3162 #define RC_RESERVED 0 /* Reserved return code */ 3163 3163 #define RC_NOREASON 1 /* Unspecified reason */ 3164 3164 #define RC_AUTHINV 2 /* Previous authentication invalid */ ··· 3176 3174 leaving BSS */ 3177 3175 #define RC_NOAUTH 9 /* Station requesting (Re)Association is not 3178 3176 Authenticated with the responding station */ 3179 - if (newStatus != ASSOCIATED) { 3180 - if (auto_wep && !apriv->expires) { 3181 - apriv->expires = RUN_AT(3*HZ); 3182 - wake_up_interruptible(&apriv->thr_wait); 3183 - } 3184 - } else { 3185 - struct task_struct *task = apriv->task; 3177 + if (newStatus == FORCELOSS && apriv->scan_timeout > 0) 3178 + scan_forceloss = 1; 3179 + if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) { 3186 3180 if (auto_wep) 3187 3181 apriv->expires = 0; 3188 - if (task) 3189 - wake_up_process (task); 3182 + if (apriv->task) 3183 + wake_up_process (apriv->task); 3190 3184 set_bit(FLAG_UPDATE_UNI, &apriv->flags); 3191 3185 set_bit(FLAG_UPDATE_MULTI, &apriv->flags); 3192 - } 3193 - /* Question : is ASSOCIATED the only status 3194 - * that is valid ? We want to catch handover 3195 - * and reassociations as valid status 3196 - * Jean II */ 3197 - if(newStatus == ASSOCIATED) { 3198 - #if 0 3199 - /* FIXME: Grabbing scan results here 3200 - * seems to be too early??? Just wait for 3201 - * timeout instead. */ 3202 - if (apriv->scan_timeout > 0) { 3203 - set_bit(JOB_SCAN_RESULTS, &apriv->flags); 3204 - wake_up_interruptible(&apriv->thr_wait); 3205 - } 3206 - #endif 3186 + 3207 3187 if (down_trylock(&apriv->sem) != 0) { 3208 3188 set_bit(JOB_EVENT, &apriv->flags); 3209 3189 wake_up_interruptible(&apriv->thr_wait); 3210 3190 } else 3211 3191 airo_send_event(dev); 3212 - } else { 3213 - memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); 3214 - wrqu.ap_addr.sa_family = ARPHRD_ETHER; 3192 + } else if (!scan_forceloss) { 3193 + if (auto_wep && !apriv->expires) { 3194 + apriv->expires = RUN_AT(3*HZ); 3195 + wake_up_interruptible(&apriv->thr_wait); 3196 + } 3215 3197 3216 3198 /* Send event to user space */ 3199 + memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); 3200 + wrqu.ap_addr.sa_family = ARPHRD_ETHER; 3217 3201 wireless_send_event(dev, SIOCGIWAP, &wrqu,NULL); 3218 3202 } 3219 3203 } ··· 7124 7136 goto out; 7125 7137 7126 7138 /* Initiate a scan command */ 7139 + ai->scan_timeout = RUN_AT(3*HZ); 7127 7140 memset(&cmd, 0, sizeof(cmd)); 7128 7141 cmd.cmd=CMD_LISTBSS; 7129 7142 issuecommand(ai, &cmd, &rsp); 7130 - ai->scan_timeout = RUN_AT(3*HZ); 7131 7143 wake = 1; 7132 7144 7133 7145 out: