diff options
Diffstat (limited to 'drivers/net/wireless')
22 files changed, 208 insertions, 167 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index bff04cba3fe..ba737c6cebe 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -5868,7 +5868,7 @@ static int airo_set_essid(struct net_device *dev, int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; /* Check the size of the string */ - if(dwrq->length > IW_ESSID_MAX_SIZE+1) { + if(dwrq->length > IW_ESSID_MAX_SIZE) { return -E2BIG ; } /* Check if index is valid */ @@ -5880,7 +5880,7 @@ static int airo_set_essid(struct net_device *dev, memset(SSID_rid.ssids[index].ssid, 0, sizeof(SSID_rid.ssids[index].ssid)); memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length); - SSID_rid.ssids[index].len = dwrq->length - 1; + SSID_rid.ssids[index].len = dwrq->length; } SSID_rid.len = sizeof(SSID_rid); /* Write it to the card */ @@ -5990,7 +5990,7 @@ static int airo_set_nick(struct net_device *dev, struct airo_info *local = dev->priv; /* Check the size of the string */ - if(dwrq->length > 16 + 1) { + if(dwrq->length > 16) { return -E2BIG; } readConfigRid(local, 1); @@ -6015,7 +6015,7 @@ static int airo_get_nick(struct net_device *dev, readConfigRid(local, 1); strncpy(extra, local->config.nodeName, 16); extra[16] = '\0'; - dwrq->length = strlen(extra) + 1; + dwrq->length = strlen(extra); return 0; } @@ -6767,9 +6767,9 @@ static int airo_set_retry(struct net_device *dev, } readConfigRid(local, 1); if(vwrq->flags & IW_RETRY_LIMIT) { - if(vwrq->flags & IW_RETRY_MAX) + if(vwrq->flags & IW_RETRY_LONG) local->config.longRetryLimit = vwrq->value; - else if (vwrq->flags & IW_RETRY_MIN) + else if (vwrq->flags & IW_RETRY_SHORT) local->config.shortRetryLimit = vwrq->value; else { /* No modifier : set both */ @@ -6805,14 +6805,14 @@ static int airo_get_retry(struct net_device *dev, if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { vwrq->flags = IW_RETRY_LIFETIME; vwrq->value = (int)local->config.txLifetime * 1024; - } else if((vwrq->flags & IW_RETRY_MAX)) { - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + } else if((vwrq->flags & IW_RETRY_LONG)) { + vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; vwrq->value = (int)local->config.longRetryLimit; } else { vwrq->flags = IW_RETRY_LIMIT; vwrq->value = (int)local->config.shortRetryLimit; if((int)local->config.shortRetryLimit != (int)local->config.longRetryLimit) - vwrq->flags |= IW_RETRY_MIN; + vwrq->flags |= IW_RETRY_SHORT; } return 0; @@ -6990,6 +6990,7 @@ static int airo_set_power(struct net_device *dev, local->config.rmode |= RXMODE_BC_MC_ADDR; set_bit (FLAG_COMMIT, &local->flags); case IW_POWER_ON: + /* This is broken, fixme ;-) */ break; default: return -EINVAL; diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 995c7bea589..0fc267d626d 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -1656,13 +1656,13 @@ static int atmel_set_essid(struct net_device *dev, priv->connect_to_any_BSS = 0; /* Check the size of the string */ - if (dwrq->length > MAX_SSID_LENGTH + 1) + if (dwrq->length > MAX_SSID_LENGTH) return -E2BIG; if (index != 0) return -EINVAL; - memcpy(priv->new_SSID, extra, dwrq->length - 1); - priv->new_SSID_size = dwrq->length - 1; + memcpy(priv->new_SSID, extra, dwrq->length); + priv->new_SSID_size = dwrq->length; } return -EINPROGRESS; @@ -2120,9 +2120,9 @@ static int atmel_set_retry(struct net_device *dev, struct atmel_private *priv = netdev_priv(dev); if (!vwrq->disabled && (vwrq->flags & IW_RETRY_LIMIT)) { - if (vwrq->flags & IW_RETRY_MAX) + if (vwrq->flags & IW_RETRY_LONG) priv->long_retry = vwrq->value; - else if (vwrq->flags & IW_RETRY_MIN) + else if (vwrq->flags & IW_RETRY_SHORT) priv->short_retry = vwrq->value; else { /* No modifier : set both */ @@ -2144,15 +2144,15 @@ static int atmel_get_retry(struct net_device *dev, vwrq->disabled = 0; /* Can't be disabled */ - /* Note : by default, display the min retry number */ - if (vwrq->flags & IW_RETRY_MAX) { - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + /* Note : by default, display the short retry number */ + if (vwrq->flags & IW_RETRY_LONG) { + vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; vwrq->value = priv->long_retry; } else { vwrq->flags = IW_RETRY_LIMIT; vwrq->value = priv->short_retry; if (priv->long_retry != priv->short_retry) - vwrq->flags |= IW_RETRY_MIN; + vwrq->flags |= IW_RETRY_SHORT; } return 0; diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index 6d4ea36bc56..d6a8bf09878 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h @@ -666,7 +666,6 @@ struct bcm43xx_noise_calculation { }; struct bcm43xx_stats { - u8 link_quality; u8 noise; struct iw_statistics wstats; /* Store the last TX/RX times here for updating the leds. */ diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index cb9a3ae8463..eb65db7393b 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c @@ -2405,9 +2405,10 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm) BCM43xx_UCODE_TIME) & 0x1f); if ( value16 > 0x128 ) { - dprintk(KERN_ERR PFX - "Firmware: no support for microcode rev > 0x128\n"); - err = -1; + printk(KERN_ERR PFX + "Firmware: no support for microcode extracted " + "from version 4.x binary drivers.\n"); + err = -EOPNOTSUPP; goto err_release_fw; } @@ -3169,8 +3170,7 @@ static void bcm43xx_periodic_work_handler(void *d) * be preemtible. */ mutex_lock(&bcm->mutex); - netif_stop_queue(bcm->net_dev); - synchronize_net(); + netif_tx_disable(bcm->net_dev); spin_lock_irqsave(&bcm->irq_lock, flags); bcm43xx_mac_suspend(bcm); if (bcm43xx_using_pio(bcm)) diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index eafd0f66268..52ce2a9334f 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c @@ -361,7 +361,7 @@ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm) if (phy->rev <= 2) for (i = 0; i < BCM43xx_ILT_NOISESCALEG_SIZE; i++) bcm43xx_ilt_write(bcm, 0x1400 + i, bcm43xx_ilt_noisescaleg1[i]); - else if ((phy->rev == 7) && (bcm43xx_phy_read(bcm, 0x0449) & 0x0200)) + else if ((phy->rev >= 7) && (bcm43xx_phy_read(bcm, 0x0449) & 0x0200)) for (i = 0; i < BCM43xx_ILT_NOISESCALEG_SIZE; i++) bcm43xx_ilt_write(bcm, 0x1400 + i, bcm43xx_ilt_noisescaleg3[i]); else @@ -371,7 +371,7 @@ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm) if (phy->rev == 2) for (i = 0; i < BCM43xx_ILT_SIGMASQR_SIZE; i++) bcm43xx_ilt_write(bcm, 0x5000 + i, bcm43xx_ilt_sigmasqr1[i]); - else if ((phy->rev > 2) && (phy->rev <= 7)) + else if ((phy->rev > 2) && (phy->rev <= 8)) for (i = 0; i < BCM43xx_ILT_SIGMASQR_SIZE; i++) bcm43xx_ilt_write(bcm, 0x5000 + i, bcm43xx_ilt_sigmasqr2[i]); @@ -1197,7 +1197,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) if (phy->rev == 1) bcm43xx_phy_initb5(bcm); - else if (phy->rev >= 2 && phy->rev <= 7) + else bcm43xx_phy_initb6(bcm); if (phy->rev >= 2 || phy->connected) bcm43xx_phy_inita(bcm); @@ -1241,23 +1241,22 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) bcm43xx_phy_lo_g_measure(bcm); } else { if (radio->version == 0x2050 && radio->revision == 8) { - //FIXME + bcm43xx_radio_write16(bcm, 0x0052, + (radio->txctl1 << 4) | radio->txctl2); } else { bcm43xx_radio_write16(bcm, 0x0052, (bcm43xx_radio_read16(bcm, 0x0052) & 0xFFF0) | radio->txctl1); } if (phy->rev >= 6) { - /* bcm43xx_phy_write(bcm, 0x0036, (bcm43xx_phy_read(bcm, 0x0036) - & 0xF000) | (FIXME << 12)); - */ + & 0xF000) | (radio->txctl2 << 12)); } if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) bcm43xx_phy_write(bcm, 0x002E, 0x8075); else - bcm43xx_phy_write(bcm, 0x003E, 0x807F); + bcm43xx_phy_write(bcm, 0x002E, 0x807F); if (phy->rev < 2) bcm43xx_phy_write(bcm, 0x002F, 0x0101); else diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 888077fc14c..9b7b15cf656 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c @@ -334,7 +334,7 @@ static int bcm43xx_wx_get_nick(struct net_device *net_dev, size_t len; mutex_lock(&bcm->mutex); - len = strlen(bcm->nick) + 1; + len = strlen(bcm->nick); memcpy(extra, bcm->nick, len); data->data.length = (__u16)len; data->data.flags = 1; diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c index c0efbfe605a..0159e4e9320 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c @@ -496,15 +496,14 @@ int bcm43xx_rx(struct bcm43xx_private *bcm, stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm, !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ), !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ)); -//TODO stats.noise = + stats.noise = bcm->stats.noise; if (is_ofdm) stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp); else stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); stats.received_channel = radio->channel; -//TODO stats.control = stats.mask = IEEE80211_STATMASK_SIGNAL | -//TODO IEEE80211_STATMASK_NOISE | + IEEE80211_STATMASK_NOISE | IEEE80211_STATMASK_RATE | IEEE80211_STATMASK_RSSI; if (phy->type == BCM43xx_PHYTYPE_A) diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 7a4978516ea..d061fb3443f 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c @@ -1412,9 +1412,9 @@ static int prism2_ioctl_siwretry(struct net_device *dev, /* what could be done, if firmware would support this.. */ if (rrq->flags & IW_RETRY_LIMIT) { - if (rrq->flags & IW_RETRY_MAX) + if (rrq->flags & IW_RETRY_LONG) HFA384X_RID_LONGRETRYLIMIT = rrq->value; - else if (rrq->flags & IW_RETRY_MIN) + else if (rrq->flags & IW_RETRY_SHORT) HFA384X_RID_SHORTRETRYLIMIT = rrq->value; else { HFA384X_RID_LONGRETRYLIMIT = rrq->value; @@ -1468,14 +1468,14 @@ static int prism2_ioctl_giwretry(struct net_device *dev, rrq->value = le16_to_cpu(altretry); else rrq->value = local->manual_retry_count; - } else if ((rrq->flags & IW_RETRY_MAX)) { - rrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + } else if ((rrq->flags & IW_RETRY_LONG)) { + rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; rrq->value = longretry; } else { rrq->flags = IW_RETRY_LIMIT; rrq->value = shortretry; if (shortretry != longretry) - rrq->flags |= IW_RETRY_MIN; + rrq->flags |= IW_RETRY_SHORT; } } return 0; diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index b4d81a04c89..6c5add701a6 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -6958,7 +6958,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, } if (wrqu->essid.flags && wrqu->essid.length) { - length = wrqu->essid.length - 1; + length = wrqu->essid.length; essid = extra; } @@ -7051,7 +7051,7 @@ static int ipw2100_wx_get_nick(struct net_device *dev, struct ipw2100_priv *priv = ieee80211_priv(dev); - wrqu->data.length = strlen(priv->nick) + 1; + wrqu->data.length = strlen(priv->nick); memcpy(extra, priv->nick, wrqu->data.length); wrqu->data.flags = 1; /* active */ @@ -7343,14 +7343,14 @@ static int ipw2100_wx_set_retry(struct net_device *dev, goto done; } - if (wrqu->retry.flags & IW_RETRY_MIN) { + if (wrqu->retry.flags & IW_RETRY_SHORT) { err = ipw2100_set_short_retry(priv, wrqu->retry.value); IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", wrqu->retry.value); goto done; } - if (wrqu->retry.flags & IW_RETRY_MAX) { + if (wrqu->retry.flags & IW_RETRY_LONG) { err = ipw2100_set_long_retry(priv, wrqu->retry.value); IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", wrqu->retry.value); @@ -7383,14 +7383,14 @@ static int ipw2100_wx_get_retry(struct net_device *dev, if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) return -EINVAL; - if (wrqu->retry.flags & IW_RETRY_MAX) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + if (wrqu->retry.flags & IW_RETRY_LONG) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; wrqu->retry.value = priv->long_retry_limit; } else { wrqu->retry.flags = (priv->short_retry_limit != priv->long_retry_limit) ? - IW_RETRY_LIMIT | IW_RETRY_MIN : IW_RETRY_LIMIT; + IW_RETRY_LIMIT | IW_RETRY_SHORT : IW_RETRY_LIMIT; wrqu->retry.value = priv->short_retry_limit; } diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 7358664e090..5685d7ba55b 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8875,8 +8875,6 @@ static int ipw_wx_set_essid(struct net_device *dev, } length = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE); - if (!extra[length - 1]) - length--; priv->config |= CFG_STATIC_ESSID; @@ -8953,7 +8951,7 @@ static int ipw_wx_get_nick(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); IPW_DEBUG_WX("Getting nick\n"); mutex_lock(&priv->mutex); - wrqu->data.length = strlen(priv->nick) + 1; + wrqu->data.length = strlen(priv->nick); memcpy(extra, priv->nick, wrqu->data.length); wrqu->data.flags = 1; /* active */ mutex_unlock(&priv->mutex); @@ -9276,9 +9274,9 @@ static int ipw_wx_set_retry(struct net_device *dev, return -EINVAL; mutex_lock(&priv->mutex); - if (wrqu->retry.flags & IW_RETRY_MIN) + if (wrqu->retry.flags & IW_RETRY_SHORT) priv->short_retry_limit = (u8) wrqu->retry.value; - else if (wrqu->retry.flags & IW_RETRY_MAX) + else if (wrqu->retry.flags & IW_RETRY_LONG) priv->long_retry_limit = (u8) wrqu->retry.value; else { priv->short_retry_limit = (u8) wrqu->retry.value; @@ -9307,11 +9305,11 @@ static int ipw_wx_get_retry(struct net_device *dev, return -EINVAL; } - if (wrqu->retry.flags & IW_RETRY_MAX) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + if (wrqu->retry.flags & IW_RETRY_LONG) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; wrqu->retry.value = priv->long_retry_limit; - } else if (wrqu->retry.flags & IW_RETRY_MIN) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; + } else if (wrqu->retry.flags & IW_RETRY_SHORT) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; wrqu->retry.value = priv->short_retry_limit; } else { wrqu->retry.flags = IW_RETRY_LIMIT; diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 1840b69e3cb..9e19a963feb 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -3037,7 +3037,7 @@ static int orinoco_ioctl_getessid(struct net_device *dev, } erq->flags = 1; - erq->length = strlen(essidbuf) + 1; + erq->length = strlen(essidbuf); return 0; } @@ -3078,7 +3078,7 @@ static int orinoco_ioctl_getnick(struct net_device *dev, memcpy(nickbuf, priv->nick, IW_ESSID_MAX_SIZE+1); orinoco_unlock(priv, &flags); - nrq->length = strlen(nickbuf)+1; + nrq->length = strlen(nickbuf); return 0; } @@ -3575,14 +3575,14 @@ static int orinoco_ioctl_getretry(struct net_device *dev, rrq->value = lifetime * 1000; /* ??? */ } else { /* By default, display the min number */ - if ((rrq->flags & IW_RETRY_MAX)) { - rrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + if ((rrq->flags & IW_RETRY_LONG)) { + rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; rrq->value = long_limit; } else { rrq->flags = IW_RETRY_LIMIT; rrq->value = short_limit; if(short_limit != long_limit) - rrq->flags |= IW_RETRY_MIN; + rrq->flags |= IW_RETRY_SHORT; } } diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index c09fbf733b3..286325ca329 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c @@ -742,9 +742,9 @@ prism54_set_essid(struct net_device *ndev, struct iw_request_info *info, /* Check if we were asked for `any' */ if (dwrq->flags && dwrq->length) { - if (dwrq->length > min(33, IW_ESSID_MAX_SIZE + 1)) + if (dwrq->length > 32) return -E2BIG; - essid.length = dwrq->length - 1; + essid.length = dwrq->length; memcpy(essid.octets, extra, dwrq->length); } else essid.length = 0; @@ -814,7 +814,7 @@ prism54_get_nick(struct net_device *ndev, struct iw_request_info *info, dwrq->length = 0; down_read(&priv->mib_sem); - dwrq->length = strlen(priv->nickname) + 1; + dwrq->length = strlen(priv->nickname); memcpy(extra, priv->nickname, dwrq->length); up_read(&priv->mib_sem); @@ -992,9 +992,9 @@ prism54_set_retry(struct net_device *ndev, struct iw_request_info *info, return -EINVAL; if (vwrq->flags & IW_RETRY_LIMIT) { - if (vwrq->flags & IW_RETRY_MIN) + if (vwrq->flags & IW_RETRY_SHORT) slimit = vwrq->value; - else if (vwrq->flags & IW_RETRY_MAX) + else if (vwrq->flags & IW_RETRY_LONG) llimit = vwrq->value; else { /* we are asked to set both */ @@ -1035,18 +1035,18 @@ prism54_get_retry(struct net_device *ndev, struct iw_request_info *info, mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r); vwrq->value = r.u * 1024; vwrq->flags = IW_RETRY_LIFETIME; - } else if ((vwrq->flags & IW_RETRY_MAX)) { + } else if ((vwrq->flags & IW_RETRY_LONG)) { /* we are asked for the long retry limit */ rvalue |= mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r); vwrq->value = r.u; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; } else { /* default. get the short retry limit */ rvalue |= mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r); vwrq->value = r.u; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MIN; + vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; } return rvalue; diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 4574290f971..e82548ea609 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -1173,7 +1173,7 @@ static int ray_set_essid(struct net_device *dev, return -EOPNOTSUPP; } else { /* Check the size of the string */ - if(dwrq->length > IW_ESSID_MAX_SIZE + 1) { + if(dwrq->length > IW_ESSID_MAX_SIZE) { return -E2BIG; } diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index e0d294c1297..e3ae5f60d5b 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1802,15 +1802,15 @@ static int wl3501_get_retry(struct net_device *dev, &retry, sizeof(retry)); if (rc) goto out; - if (wrqu->retry.flags & IW_RETRY_MAX) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + if (wrqu->retry.flags & IW_RETRY_LONG) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; goto set_value; } rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_SHORT_RETRY_LIMIT, &retry, sizeof(retry)); if (rc) goto out; - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; set_value: wrqu->retry.value = retry; wrqu->retry.disabled = 0; diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index c52e9bcf8d0..a44dda952c6 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c @@ -1218,7 +1218,7 @@ static int zd1201_set_essid(struct net_device *dev, return -EINVAL; if (data->length < 1) data->length = 1; - zd->essidlen = data->length-1; + zd->essidlen = data->length; memset(zd->essid, 0, IW_ESSID_MAX_SIZE+1); memcpy(zd->essid, essid, data->length); return zd1201_join(zd, zd->essid, zd->essidlen); diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index 7c4e32cf0d4..aa661b2b76c 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c @@ -249,7 +249,6 @@ int zd_ioread16(struct zd_chip *chip, zd_addr_t addr, u16 *value) { int r; - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); mutex_lock(&chip->mutex); r = zd_ioread16_locked(chip, value, addr); mutex_unlock(&chip->mutex); @@ -260,7 +259,6 @@ int zd_ioread32(struct zd_chip *chip, zd_addr_t addr, u32 *value) { int r; - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); mutex_lock(&chip->mutex); r = zd_ioread32_locked(chip, value, addr); mutex_unlock(&chip->mutex); @@ -271,7 +269,6 @@ int zd_iowrite16(struct zd_chip *chip, zd_addr_t addr, u16 value) { int r; - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); mutex_lock(&chip->mutex); r = zd_iowrite16_locked(chip, value, addr); mutex_unlock(&chip->mutex); @@ -282,7 +279,6 @@ int zd_iowrite32(struct zd_chip *chip, zd_addr_t addr, u32 value) { int r; - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); mutex_lock(&chip->mutex); r = zd_iowrite32_locked(chip, value, addr); mutex_unlock(&chip->mutex); @@ -294,7 +290,6 @@ int zd_ioread32v(struct zd_chip *chip, const zd_addr_t *addresses, { int r; - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); mutex_lock(&chip->mutex); r = zd_ioread32v_locked(chip, values, addresses, count); mutex_unlock(&chip->mutex); @@ -306,7 +301,6 @@ int zd_iowrite32a(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs, { int r; - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); mutex_lock(&chip->mutex); r = zd_iowrite32a_locked(chip, ioreqs, count); mutex_unlock(&chip->mutex); @@ -331,13 +325,22 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type) chip->patch_cr157 = (value >> 13) & 0x1; chip->patch_6m_band_edge = (value >> 21) & 0x1; chip->new_phy_layout = (value >> 31) & 0x1; + chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; + chip->supports_tx_led = 1; + if (value & (1 << 24)) { /* LED scenario */ + if (value & (1 << 29)) + chip->supports_tx_led = 0; + } dev_dbg_f(zd_chip_dev(chip), "RF %s %#01x PA type %#01x patch CCK %d patch CR157 %d " - "patch 6M %d new PHY %d\n", + "patch 6M %d new PHY %d link LED%d tx led %d\n", zd_rf_name(*rf_type), *rf_type, chip->pa_type, chip->patch_cck_gain, - chip->patch_cr157, chip->patch_6m_band_edge, chip->new_phy_layout); + chip->patch_cr157, chip->patch_6m_band_edge, + chip->new_phy_layout, + chip->link_led == LED1 ? 1 : 2, + chip->supports_tx_led); return 0; error: *rf_type = 0; @@ -1181,7 +1184,7 @@ static int update_pwr_int(struct zd_chip *chip, u8 channel) u8 value = chip->pwr_int_values[channel - 1]; dev_dbg_f(zd_chip_dev(chip), "channel %d pwr_int %#04x\n", channel, value); - return zd_iowrite32_locked(chip, value, CR31); + return zd_iowrite16_locked(chip, value, CR31); } static int update_pwr_cal(struct zd_chip *chip, u8 channel) @@ -1189,12 +1192,12 @@ static int update_pwr_cal(struct zd_chip *chip, u8 channel) u8 value = chip->pwr_cal_values[channel-1]; dev_dbg_f(zd_chip_dev(chip), "channel %d pwr_cal %#04x\n", channel, value); - return zd_iowrite32_locked(chip, value, CR68); + return zd_iowrite16_locked(chip, value, CR68); } static int update_ofdm_cal(struct zd_chip *chip, u8 channel) { - struct zd_ioreq32 ioreqs[3]; + struct zd_ioreq16 ioreqs[3]; ioreqs[0].addr = CR67; ioreqs[0].value = chip->ofdm_cal_values[OFDM_36M_INDEX][channel-1]; @@ -1206,7 +1209,7 @@ static int update_ofdm_cal(struct zd_chip *chip, u8 channel) dev_dbg_f(zd_chip_dev(chip), "channel %d ofdm_cal 36M %#04x 48M %#04x 54M %#04x\n", channel, ioreqs[0].value, ioreqs[1].value, ioreqs[2].value); - return zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); + return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); } static int update_channel_integration_and_calibration(struct zd_chip *chip, @@ -1218,7 +1221,7 @@ static int update_channel_integration_and_calibration(struct zd_chip *chip, if (r) return r; if (chip->is_zd1211b) { - static const struct zd_ioreq32 ioreqs[] = { + static const struct zd_ioreq16 ioreqs[] = { { CR69, 0x28 }, {}, { CR69, 0x2a }, @@ -1230,7 +1233,7 @@ static int update_channel_integration_and_calibration(struct zd_chip *chip, r = update_pwr_cal(chip, channel); if (r) return r; - r = zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); + r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); if (r) return r; } @@ -1252,7 +1255,7 @@ static int patch_cck_gain(struct zd_chip *chip) if (r) return r; dev_dbg_f(zd_chip_dev(chip), "patching value %x\n", value & 0xff); - return zd_iowrite32_locked(chip, value & 0xff, CR47); + return zd_iowrite16_locked(chip, value & 0xff, CR47); } int zd_chip_set_channel(struct zd_chip *chip, u8 channel) @@ -1295,89 +1298,60 @@ u8 zd_chip_get_channel(struct zd_chip *chip) return channel; } -static u16 led_mask(int led) +int zd_chip_control_leds(struct zd_chip *chip, enum led_status status) { - switch (led) { - case 1: - return LED1; - case 2: - return LED2; - default: - return 0; - } -} - -static int read_led_reg(struct zd_chip *chip, u16 *status) -{ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_ioread16_locked(chip, status, CR_LED); -} - -static int write_led_reg(struct zd_chip *chip, u16 status) -{ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_iowrite16_locked(chip, status, CR_LED); -} + static const zd_addr_t a[] = { + FW_LINK_STATUS, + CR_LED, + }; -int zd_chip_led_status(struct zd_chip *chip, int led, enum led_status status) -{ - int r, ret; - u16 mask = led_mask(led); - u16 reg; + int r; + u16 v[ARRAY_SIZE(a)]; + struct zd_ioreq16 ioreqs[ARRAY_SIZE(a)] = { + [0] = { FW_LINK_STATUS }, + [1] = { CR_LED }, + }; + u16 other_led; - if (!mask) - return -EINVAL; mutex_lock(&chip->mutex); - r = read_led_reg(chip, ®); + r = zd_ioread16v_locked(chip, v, (const zd_addr_t *)a, ARRAY_SIZE(a)); if (r) - return r; + goto out; + + other_led = chip->link_led == LED1 ? LED2 : LED1; + switch (status) { - case LED_STATUS: - return (reg & mask) ? LED_ON : LED_OFF; case LED_OFF: - reg &= ~mask; - ret = LED_OFF; + ioreqs[0].value = FW_LINK_OFF; + ioreqs[1].value = v[1] & ~(LED1|LED2); break; - case LED_FLIP: - reg ^= mask; - ret = (reg&mask) ? LED_ON : LED_OFF; + case LED_SCANNING: + ioreqs[0].value = FW_LINK_OFF; + ioreqs[1].value = v[1] & ~other_led; + if (get_seconds() % 3 == 0) { + ioreqs[1].value &= ~chip->link_led; + } else { + ioreqs[1].value |= chip->link_led; + } break; - case LED_ON: - reg |= mask; - ret = LED_ON; + case LED_ASSOCIATED: + ioreqs[0].value = FW_LINK_TX; + ioreqs[1].value = v[1] & ~other_led; + ioreqs[1].value |= chip->link_led; break; default: - return -EINVAL; - } - r = write_led_reg(chip, reg); - if (r) { - ret = r; + r = -EINVAL; goto out; } -out: - mutex_unlock(&chip->mutex); - return r; -} - -int zd_chip_led_flip(struct zd_chip *chip, int led, - const unsigned int *phases_msecs, unsigned int count) -{ - int i, r; - enum led_status status; - r = zd_chip_led_status(chip, led, LED_STATUS); - if (r) - return r; - status = r; - for (i = 0; i < count; i++) { - r = zd_chip_led_status(chip, led, LED_FLIP); - if (r < 0) + if (v[0] != ioreqs[0].value || v[1] != ioreqs[1].value) { + r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); + if (r) goto out; - msleep(phases_msecs[i]); } - + r = 0; out: - zd_chip_led_status(chip, led, status); + mutex_unlock(&chip->mutex); return r; } @@ -1679,4 +1653,3 @@ int zd_rfwritev_cr_locked(struct zd_chip *chip, return 0; } - diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index 4b125085989..ae59597ce4e 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h @@ -428,6 +428,7 @@ /* masks for controlling LEDs */ #define LED1 0x0100 #define LED2 0x0200 +#define LED_SW 0x0400 /* Seems to indicate that the configuration is over. */ @@ -629,6 +630,10 @@ #define FW_SOFT_RESET FW_REG(4) #define FW_FLASH_CHK FW_REG(5) +#define FW_LINK_OFF 0x0 +#define FW_LINK_TX 0x1 +/* 0x2 - link led on? */ + enum { CR_BASE_OFFSET = 0x9000, FW_START_OFFSET = 0xee00, @@ -663,8 +668,11 @@ struct zd_chip { u8 pwr_int_values[E2P_CHANNEL_COUNT]; /* SetPointOFDM in the vendor driver */ u8 ofdm_cal_values[3][E2P_CHANNEL_COUNT]; - u8 pa_type:4, patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, - new_phy_layout:1, is_zd1211b:1; + u16 link_led; + unsigned int pa_type:4, + patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, + new_phy_layout:1, + is_zd1211b:1, supports_tx_led:1; }; static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb) @@ -812,15 +820,12 @@ int zd_chip_lock_phy_regs(struct zd_chip *chip); int zd_chip_unlock_phy_regs(struct zd_chip *chip); enum led_status { - LED_OFF = 0, - LED_ON = 1, - LED_FLIP = 2, - LED_STATUS = 3, + LED_OFF = 0, + LED_SCANNING = 1, + LED_ASSOCIATED = 2, }; -int zd_chip_led_status(struct zd_chip *chip, int led, enum led_status status); -int zd_chip_led_flip(struct zd_chip *chip, int led, - const unsigned int *phases_msecs, unsigned int count); +int zd_chip_control_leds(struct zd_chip *chip, enum led_status status); int zd_set_beacon_interval(struct zd_chip *chip, u32 interval); diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 1989f1c05fb..2d12837052b 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -33,6 +33,10 @@ static void ieee_init(struct ieee80211_device *ieee); static void softmac_init(struct ieee80211softmac_device *sm); +static void housekeeping_init(struct zd_mac *mac); +static void housekeeping_enable(struct zd_mac *mac); +static void housekeeping_disable(struct zd_mac *mac); + int zd_mac_init(struct zd_mac *mac, struct net_device *netdev, struct usb_interface *intf) @@ -46,6 +50,7 @@ int zd_mac_init(struct zd_mac *mac, ieee_init(ieee); softmac_init(ieee80211_priv(netdev)); zd_chip_init(&mac->chip, netdev, intf); + housekeeping_init(mac); return 0; } @@ -178,6 +183,7 @@ int zd_mac_open(struct net_device *netdev) if (r < 0) goto disable_rx; + housekeeping_enable(mac); ieee80211softmac_start(netdev); return 0; disable_rx: @@ -204,6 +210,7 @@ int zd_mac_stop(struct net_device *netdev) */ zd_chip_disable_rx(chip); + housekeeping_disable(mac); ieee80211softmac_stop(netdev); zd_chip_disable_hwint(chip); @@ -1080,3 +1087,46 @@ void zd_dump_rx_status(const struct rx_status *status) } } #endif /* DEBUG */ + +#define LINK_LED_WORK_DELAY HZ + +static void link_led_handler(void *p) +{ + struct zd_mac *mac = p; + struct zd_chip *chip = &mac->chip; + struct ieee80211softmac_device *sm = ieee80211_priv(mac->netdev); + int is_associated; + int r; + + spin_lock_irq(&mac->lock); + is_associated = sm->associated != 0; + spin_unlock_irq(&mac->lock); + + r = zd_chip_control_leds(chip, + is_associated ? LED_ASSOCIATED : LED_SCANNING); + if (r) + dev_err(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r); + + queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work, + LINK_LED_WORK_DELAY); +} + +static void housekeeping_init(struct zd_mac *mac) +{ + INIT_WORK(&mac->housekeeping.link_led_work, link_led_handler, mac); +} + +static void housekeeping_enable(struct zd_mac *mac) +{ + dev_dbg_f(zd_mac_dev(mac), "\n"); + queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work, + 0); +} + +static void housekeeping_disable(struct zd_mac *mac) +{ + dev_dbg_f(zd_mac_dev(mac), "\n"); + cancel_rearming_delayed_workqueue(zd_workqueue, + &mac->housekeeping.link_led_work); + zd_chip_control_leds(&mac->chip, LED_OFF); +} diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h index 29b51fd7d4e..b8ea3de7924 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.h +++ b/drivers/net/wireless/zd1211rw/zd_mac.h @@ -120,6 +120,10 @@ enum mac_flags { MAC_FIXED_CHANNEL = 0x01, }; +struct housekeeping { + struct work_struct link_led_work; +}; + #define ZD_MAC_STATS_BUFFER_SIZE 16 struct zd_mac { @@ -128,6 +132,7 @@ struct zd_mac { struct net_device *netdev; /* Unlocked reading possible */ struct iw_statistics iw_stats; + struct housekeeping housekeeping; unsigned int stats_count; u8 qual_buffer[ZD_MAC_STATS_BUFFER_SIZE]; u8 rssi_buffer[ZD_MAC_STATS_BUFFER_SIZE]; diff --git a/drivers/net/wireless/zd1211rw/zd_netdev.c b/drivers/net/wireless/zd1211rw/zd_netdev.c index 440ef24b5fd..af3a7b36d07 100644 --- a/drivers/net/wireless/zd1211rw/zd_netdev.c +++ b/drivers/net/wireless/zd1211rw/zd_netdev.c @@ -82,7 +82,7 @@ static int iw_get_nick(struct net_device *netdev, union iwreq_data *req, char *extra) { strcpy(extra, "zd1211"); - req->data.length = strlen(extra) + 1; + req->data.length = strlen(extra); req->data.flags = 1; return 0; } diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 31027e52b04..5c265ad0485 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c @@ -24,6 +24,7 @@ #include <linux/errno.h> #include <linux/skbuff.h> #include <linux/usb.h> +#include <linux/workqueue.h> #include <net/ieee80211.h> #include "zd_def.h" @@ -1112,12 +1113,20 @@ static struct usb_driver driver = { .disconnect = disconnect, }; +struct workqueue_struct *zd_workqueue; + static int __init usb_init(void) { int r; pr_debug("usb_init()\n"); + zd_workqueue = create_singlethread_workqueue(driver.name); + if (zd_workqueue == NULL) { + printk(KERN_ERR "%s: couldn't create workqueue\n", driver.name); + return -ENOMEM; + } + r = usb_register(&driver); if (r) { printk(KERN_ERR "usb_register() failed. Error number %d\n", r); @@ -1132,6 +1141,7 @@ static void __exit usb_exit(void) { pr_debug("usb_exit()\n"); usb_deregister(&driver); + destroy_workqueue(zd_workqueue); } module_init(usb_init); diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h index ded39de5f72..e81a2d3cfff 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.h +++ b/drivers/net/wireless/zd1211rw/zd_usb.h @@ -238,4 +238,6 @@ int zd_usb_iowrite16v(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits); +extern struct workqueue_struct *zd_workqueue; + #endif /* _ZD_USB_H */ |