* [RFC 2/5] orinoco: add cfg80211 join_ibss and leave_ibss
From: David Kilroy @ 2009-08-19 0:04 UTC (permalink / raw)
To: linux-wireless; +Cc: orinoco-devel, David Kilroy
In-Reply-To: <1250640253-18434-1-git-send-email-kilroyd@googlemail.com>
Basic ad-hoc support.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
---
drivers/net/wireless/orinoco/cfg.c | 57 +++++++++++++++++++++++++++++++++++
drivers/net/wireless/orinoco/main.c | 12 +++++++
2 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index 09b38e9..253cb4e 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -438,10 +438,67 @@ static int orinoco_disconnect(struct wiphy *wiphy, struct net_device *dev,
return err;
}
+static int orinoco_join_ibss(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_ibss_params *params)
+{
+ struct orinoco_private *priv = wiphy_priv(wiphy);
+ unsigned long lock;
+ int err;
+
+ if (orinoco_lock(priv, &lock) != 0)
+ return -EBUSY;
+
+ /* Setup the requested parameters in priv. If the card is not
+ * capable, then the driver will just ignore the settings that
+ * it can't do. */
+
+ err = __orinoco_connect(wiphy, params->channel, params->bssid,
+ params->ssid, params->ssid_len);
+ if (err)
+ goto out;
+
+ /* Ignore information elements and beacon interval */
+
+ /* Enable cfg80211 notification */
+ priv->connect_commanded = 1;
+
+ err = orinoco_commit(priv);
+ out:
+ orinoco_unlock(priv, &lock);
+
+ return err;
+}
+
+static int orinoco_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
+{
+ struct orinoco_private *priv = wiphy_priv(wiphy);
+ unsigned long lock;
+ int err;
+
+ if (orinoco_lock(priv, &lock) != 0)
+ return -EBUSY;
+
+ /* Do we need to disassociate as well? */
+
+ memset(priv->desired_bssid, 0, ETH_ALEN);
+ memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
+
+ /* Disable cfg80211 notification */
+ priv->connect_commanded = 0;
+
+ err = orinoco_commit(priv);
+
+ orinoco_unlock(priv, &lock);
+
+ return err;
+}
+
const struct cfg80211_ops orinoco_cfg_ops = {
.change_virtual_intf = orinoco_change_vif,
.set_channel = orinoco_set_channel,
.scan = orinoco_scan,
.connect = orinoco_connect,
.disconnect = orinoco_disconnect,
+ .join_ibss = orinoco_join_ibss,
+ .leave_ibss = orinoco_leave_ibss,
};
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index 5542173..78ef22e 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1283,7 +1283,19 @@ static void orinoco_send_wevents(struct work_struct *work)
break;
}
break;
+
case NL80211_IFTYPE_ADHOC:
+ switch (linkstatus) {
+ case HERMES_LINKSTATUS_CONNECTED:
+ case HERMES_LINKSTATUS_AP_IN_RANGE:
+ cfg80211_ibss_joined(priv->ndev, bssid, GFP_KERNEL);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
case NL80211_IFTYPE_MONITOR:
default:
break;
--
1.6.3.3
^ permalink raw reply related
* [RFC 3/5] orinoco: implement cfg80211 key manipulation functions
From: David Kilroy @ 2009-08-19 0:04 UTC (permalink / raw)
To: linux-wireless; +Cc: orinoco-devel, David Kilroy
In-Reply-To: <1250640253-18434-1-git-send-email-kilroyd@googlemail.com>
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
---
drivers/net/wireless/orinoco/cfg.c | 196 ++++++++++++++++++++++++++++++++++++
1 files changed, 196 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index 253cb4e..07775b6 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -493,6 +493,198 @@ static int orinoco_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
return err;
}
+static int orinoco_add_key(struct wiphy *wiphy, struct net_device *dev,
+ u8 key_index, const u8 *mac_addr,
+ struct key_params *params)
+{
+ struct orinoco_private *priv = wiphy_priv(wiphy);
+ int err = 0;
+ unsigned long lock;
+ enum orinoco_alg alg = ORINOCO_ALG_NONE;
+ int key_len;
+
+ if (key_index >= ORINOCO_MAX_KEYS)
+ return -EINVAL;
+
+ if (orinoco_lock(priv, &lock) != 0)
+ return -EBUSY;
+
+ switch (params->cipher) {
+ case WLAN_CIPHER_SUITE_WEP40:
+ case WLAN_CIPHER_SUITE_WEP104:
+ alg = ORINOCO_ALG_WEP;
+
+ if (!priv->has_wep)
+ err = -EOPNOTSUPP;
+
+ if (params->key_len > ORINOCO_MAX_KEY_SIZE)
+ err = -E2BIG;
+ else if (params->key_len > SMALL_KEY_SIZE)
+ key_len = LARGE_KEY_SIZE;
+ else if (params->key_len > 0)
+ key_len = SMALL_KEY_SIZE;
+ else
+ err = -EINVAL;
+
+ break;
+
+ case WLAN_CIPHER_SUITE_TKIP:
+ alg = ORINOCO_ALG_TKIP;
+
+ if (!priv->has_wpa)
+ err = -EOPNOTSUPP;
+ else if (params->key_len < WLAN_KEY_LEN_TKIP)
+ err = -EINVAL;
+
+ key_len = WLAN_KEY_LEN_TKIP;
+ break;
+
+ case WLAN_CIPHER_SUITE_CCMP:
+ case WLAN_CIPHER_SUITE_AES_CMAC:
+ default:
+ err = -EOPNOTSUPP;
+ }
+
+ if (err)
+ goto out;
+
+ /* Ensure existing keys are of the same cipher suite */
+ orinoco_set_encoding(priv, alg);
+
+ err = orinoco_set_key(priv, key_index, alg,
+ params->key, params->key_len,
+ params->seq, params->seq_len);
+ if (err)
+ goto out;
+
+ if (alg == ORINOCO_ALG_TKIP) {
+ /* If this is a pairwise key, assume it is the transmit key */
+ int set_tx = 0;
+ if (mac_addr) {
+ priv->tx_key = key_index;
+ set_tx = 1;
+ }
+ err = __orinoco_hw_set_tkip_key(priv, key_index, set_tx,
+ priv->keys[key_index].key,
+ priv->keys[key_index].seq,
+ priv->keys[key_index].seq_len,
+ NULL, 0);
+ }
+
+ err = __orinoco_hw_setup_enc(priv);
+
+ out:
+ orinoco_unlock(priv, &lock);
+
+ return err;
+}
+
+static int orinoco_get_key(struct wiphy *wiphy, struct net_device *dev,
+ u8 key_index, const u8 *mac_addr, void *cookie,
+ void (*callback)(void *cookie, struct key_params*))
+{
+ struct orinoco_private *priv = wiphy_priv(wiphy);
+ struct key_params params;
+ u8 key[WLAN_KEY_LEN_TKIP];
+ u8 tsc[ORINOCO_SEQ_LEN];
+ unsigned long lock;
+ int err = 0;
+
+ if (key_index >= ORINOCO_MAX_KEYS)
+ return -EINVAL;
+
+ if (orinoco_lock(priv, &lock) != 0)
+ return -EBUSY;
+
+ /* Take a copy of the key info */
+ memcpy(&key, priv->keys[key_index].key, priv->keys[key_index].key_len);
+
+ params.cipher = priv->keys[key_index].cipher;
+ params.key = &key[0];
+ params.key_len = priv->keys[key_index].key_len;
+
+ if (params.cipher == WLAN_CIPHER_SUITE_TKIP) {
+ /* Populate the current TSC */
+ orinoco_hw_get_tkip_iv(priv, key_index, &tsc[0]);
+ params.seq = &tsc[0];
+ params.seq_len = ORINOCO_SEQ_LEN;
+ } else {
+ params.seq = NULL;
+ params.seq_len = 0;
+ }
+
+ orinoco_unlock(priv, &lock);
+
+ callback(cookie, ¶ms);
+
+ return err;
+}
+
+static int orinoco_del_key(struct wiphy *wiphy, struct net_device *dev,
+ u8 key_index, const u8 *mac_addr)
+{
+ struct orinoco_private *priv = wiphy_priv(wiphy);
+ int err = 0;
+ unsigned long lock;
+
+ if (key_index >= ORINOCO_MAX_KEYS)
+ return -EINVAL;
+
+ if (orinoco_lock(priv, &lock) != 0)
+ return -EBUSY;
+
+ kzfree(priv->keys[key_index].key);
+ kzfree(priv->keys[key_index].seq);
+ priv->keys[key_index].key = NULL;
+ priv->keys[key_index].seq = NULL;
+ priv->keys[key_index].key_len = 0;
+ priv->keys[key_index].seq_len = 0;
+ priv->keys[key_index].cipher = 0;
+
+ if (priv->has_wpa &&
+ priv->keys[key_index].cipher == WLAN_CIPHER_SUITE_TKIP)
+ err = orinoco_clear_tkip_key(priv, key_index);
+
+ err = __orinoco_hw_setup_enc(priv);
+
+ orinoco_unlock(priv, &lock);
+
+ return err;
+}
+
+static int orinoco_set_default_key(struct wiphy *wiphy,
+ struct net_device *netdev,
+ u8 key_index)
+{
+ struct orinoco_private *priv = wiphy_priv(wiphy);
+ int err = 0;
+ unsigned long lock;
+
+ if (key_index >= ORINOCO_MAX_KEYS)
+ return -EINVAL;
+
+ if (orinoco_lock(priv, &lock) != 0)
+ return -EBUSY;
+
+ priv->tx_key = key_index;
+
+ if (priv->has_wpa &&
+ priv->keys[key_index].cipher == WLAN_CIPHER_SUITE_TKIP)
+ err = __orinoco_hw_set_tkip_key(priv, key_index, 1,
+ priv->keys[key_index].key,
+ priv->keys[key_index].seq,
+ priv->keys[key_index].seq_len,
+ NULL, 0);
+ else if (priv->encode_alg == ORINOCO_ALG_WEP)
+ err = __orinoco_hw_setup_wepkeys(priv);
+ else
+ err = -EINVAL;
+
+ orinoco_unlock(priv, &lock);
+
+ return err;
+}
+
const struct cfg80211_ops orinoco_cfg_ops = {
.change_virtual_intf = orinoco_change_vif,
.set_channel = orinoco_set_channel,
@@ -501,4 +693,8 @@ const struct cfg80211_ops orinoco_cfg_ops = {
.disconnect = orinoco_disconnect,
.join_ibss = orinoco_join_ibss,
.leave_ibss = orinoco_leave_ibss,
+ .add_key = orinoco_add_key,
+ .get_key = orinoco_get_key,
+ .del_key = orinoco_del_key,
+ .set_default_key = orinoco_set_default_key,
};
--
1.6.3.3
^ permalink raw reply related
* [RFC 4/5] orinoco: do WE via cfg80211
From: David Kilroy @ 2009-08-19 0:04 UTC (permalink / raw)
To: linux-wireless; +Cc: orinoco-devel, David Kilroy
In-Reply-To: <1250640253-18434-1-git-send-email-kilroyd@googlemail.com>
Now that the driver supports both station and ad-hoc modes in cfg80211,
we can point the WE handlers at the cfg80211 versions.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
---
drivers/net/wireless/orinoco/wext.c | 726 +----------------------------------
1 files changed, 11 insertions(+), 715 deletions(-)
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 7698fdd..264c76f 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -22,67 +22,6 @@
#define MAX_RID_LEN 1024
-/* Helper routine to record keys
- * Do not call from interrupt context */
-static int orinoco_set_key(struct orinoco_private *priv, int index,
- enum orinoco_alg alg, const u8 *key, int key_len,
- const u8 *seq, int seq_len)
-{
- kzfree(priv->keys[index].key);
- kzfree(priv->keys[index].seq);
-
- if (key_len) {
- priv->keys[index].key = kzalloc(key_len, GFP_KERNEL);
- if (!priv->keys[index].key)
- goto nomem;
- } else
- priv->keys[index].key = NULL;
-
- if (seq_len) {
- priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL);
- if (!priv->keys[index].seq)
- goto free_key;
- } else
- priv->keys[index].seq = NULL;
-
- priv->keys[index].key_len = key_len;
- priv->keys[index].seq_len = seq_len;
-
- if (key_len)
- memcpy(priv->keys[index].key, key, key_len);
- if (seq_len)
- memcpy(priv->keys[index].seq, seq, seq_len);
-
- switch (alg) {
- case ORINOCO_ALG_TKIP:
- priv->keys[index].cipher = WLAN_CIPHER_SUITE_TKIP;
- break;
-
- case ORINOCO_ALG_WEP:
- priv->keys[index].cipher = (key_len > SMALL_KEY_SIZE) ?
- WLAN_CIPHER_SUITE_WEP104 : WLAN_CIPHER_SUITE_WEP40;
- break;
-
- case ORINOCO_ALG_NONE:
- default:
- priv->keys[index].cipher = 0;
- break;
- }
-
- return 0;
-
-free_key:
- kfree(priv->keys[index].key);
- priv->keys[index].key = NULL;
-
-nomem:
- priv->keys[index].key_len = 0;
- priv->keys[index].seq_len = 0;
- priv->keys[index].cipher = 0;
-
- return -ENOMEM;
-}
-
static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
{
struct orinoco_private *priv = ndev_priv(dev);
@@ -149,274 +88,6 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
/* Wireless extensions */
/********************************************************************/
-static int orinoco_ioctl_setwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *ap_addr,
- char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- int err = -EINPROGRESS; /* Call commit handler */
- unsigned long flags;
- static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
- static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- /* Enable automatic roaming - no sanity checks are needed */
- if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
- memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
- priv->bssid_fixed = 0;
- memset(priv->desired_bssid, 0, ETH_ALEN);
-
- /* "off" means keep existing connection */
- if (ap_addr->sa_data[0] == 0) {
- __orinoco_hw_set_wap(priv);
- err = 0;
- }
- goto out;
- }
-
- if (priv->firmware_type == FIRMWARE_TYPE_AGERE) {
- printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't "
- "support manual roaming\n",
- dev->name);
- err = -EOPNOTSUPP;
- goto out;
- }
-
- if (priv->iw_mode != NL80211_IFTYPE_STATION) {
- printk(KERN_WARNING "%s: Manual roaming supported only in "
- "managed mode\n", dev->name);
- err = -EOPNOTSUPP;
- goto out;
- }
-
- /* Intersil firmware hangs without Desired ESSID */
- if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL &&
- strlen(priv->desired_essid) == 0) {
- printk(KERN_WARNING "%s: Desired ESSID must be set for "
- "manual roaming\n", dev->name);
- err = -EOPNOTSUPP;
- goto out;
- }
-
- /* Finally, enable manual roaming */
- priv->bssid_fixed = 1;
- memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
-
- out:
- orinoco_unlock(priv, &flags);
- return err;
-}
-
-static int orinoco_ioctl_getwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *ap_addr,
- char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
-
- int err = 0;
- unsigned long flags;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- ap_addr->sa_family = ARPHRD_ETHER;
- err = orinoco_hw_get_current_bssid(priv, ap_addr->sa_data);
-
- orinoco_unlock(priv, &flags);
-
- return err;
-}
-
-static int orinoco_ioctl_setiwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq,
- char *keybuf)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- int index = (erq->flags & IW_ENCODE_INDEX) - 1;
- int setindex = priv->tx_key;
- enum orinoco_alg encode_alg = priv->encode_alg;
- int restricted = priv->wep_restrict;
- int err = -EINPROGRESS; /* Call commit handler */
- unsigned long flags;
-
- if (!priv->has_wep)
- return -EOPNOTSUPP;
-
- if (erq->pointer) {
- /* We actually have a key to set - check its length */
- if (erq->length > LARGE_KEY_SIZE)
- return -E2BIG;
-
- if ((erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep)
- return -E2BIG;
- }
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- /* Clear any TKIP key we have */
- if ((priv->has_wpa) && (priv->encode_alg == ORINOCO_ALG_TKIP))
- (void) orinoco_clear_tkip_key(priv, setindex);
-
- if (erq->length > 0) {
- if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
- index = priv->tx_key;
-
- /* Switch on WEP if off */
- if (encode_alg != ORINOCO_ALG_WEP) {
- setindex = index;
- encode_alg = ORINOCO_ALG_WEP;
- }
- } else {
- /* Important note : if the user do "iwconfig eth0 enc off",
- * we will arrive there with an index of -1. This is valid
- * but need to be taken care off... Jean II */
- if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) {
- if ((index != -1) || (erq->flags == 0)) {
- err = -EINVAL;
- goto out;
- }
- } else {
- /* Set the index : Check that the key is valid */
- if (priv->keys[index].key_len == 0) {
- err = -EINVAL;
- goto out;
- }
- setindex = index;
- }
- }
-
- if (erq->flags & IW_ENCODE_DISABLED)
- encode_alg = ORINOCO_ALG_NONE;
- if (erq->flags & IW_ENCODE_OPEN)
- restricted = 0;
- if (erq->flags & IW_ENCODE_RESTRICTED)
- restricted = 1;
-
- if (erq->pointer && erq->length > 0) {
- err = orinoco_set_key(priv, index, ORINOCO_ALG_WEP, keybuf,
- erq->length, NULL, 0);
- }
- priv->tx_key = setindex;
-
- /* Try fast key change if connected and only keys are changed */
- if ((priv->encode_alg == encode_alg) &&
- (priv->wep_restrict == restricted) &&
- netif_carrier_ok(dev)) {
- err = __orinoco_hw_setup_wepkeys(priv);
- /* No need to commit if successful */
- goto out;
- }
-
- priv->encode_alg = encode_alg;
- priv->wep_restrict = restricted;
-
- out:
- orinoco_unlock(priv, &flags);
-
- return err;
-}
-
-static int orinoco_ioctl_getiwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq,
- char *keybuf)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- int index = (erq->flags & IW_ENCODE_INDEX) - 1;
- unsigned long flags;
-
- if (!priv->has_wep)
- return -EOPNOTSUPP;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
- index = priv->tx_key;
-
- erq->flags = 0;
- if (!priv->encode_alg)
- erq->flags |= IW_ENCODE_DISABLED;
- erq->flags |= index + 1;
-
- if (priv->wep_restrict)
- erq->flags |= IW_ENCODE_RESTRICTED;
- else
- erq->flags |= IW_ENCODE_OPEN;
-
- erq->length = priv->keys[index].key_len;
-
- memcpy(keybuf, priv->keys[index].key, erq->length);
-
- orinoco_unlock(priv, &flags);
- return 0;
-}
-
-static int orinoco_ioctl_setessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq,
- char *essidbuf)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- unsigned long flags;
-
- /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
- * anyway... - Jean II */
-
- /* Hum... Should not use Wireless Extension constant (may change),
- * should use our own... - Jean II */
- if (erq->length > IW_ESSID_MAX_SIZE)
- return -E2BIG;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */
- memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
-
- /* If not ANY, get the new ESSID */
- if (erq->flags)
- memcpy(priv->desired_essid, essidbuf, erq->length);
-
- orinoco_unlock(priv, &flags);
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int orinoco_ioctl_getessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *erq,
- char *essidbuf)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- int active;
- int err = 0;
- unsigned long flags;
-
- if (netif_running(dev)) {
- err = orinoco_hw_get_essid(priv, &active, essidbuf);
- if (err < 0)
- return err;
- erq->length = err;
- } else {
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
- memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE);
- erq->length = strlen(priv->desired_essid);
- orinoco_unlock(priv, &flags);
- }
-
- erq->flags = 1;
-
- return 0;
-}
-
static int orinoco_ioctl_setfreq(struct net_device *dev,
struct iw_request_info *info,
struct iw_freq *frq,
@@ -827,379 +498,6 @@ static int orinoco_ioctl_getpower(struct net_device *dev,
return err;
}
-static int orinoco_ioctl_set_encodeext(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- struct iw_point *encoding = &wrqu->encoding;
- struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
- int idx, alg = ext->alg, set_key = 1;
- unsigned long flags;
- int err = -EINVAL;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- /* Determine and validate the key index */
- idx = encoding->flags & IW_ENCODE_INDEX;
- if (idx) {
- if ((idx < 1) || (idx > 4))
- goto out;
- idx--;
- } else
- idx = priv->tx_key;
-
- if (encoding->flags & IW_ENCODE_DISABLED)
- alg = IW_ENCODE_ALG_NONE;
-
- if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) {
- /* Clear any TKIP TX key we had */
- (void) orinoco_clear_tkip_key(priv, priv->tx_key);
- }
-
- if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
- priv->tx_key = idx;
- set_key = ((alg == IW_ENCODE_ALG_TKIP) ||
- (ext->key_len > 0)) ? 1 : 0;
- }
-
- if (set_key) {
- /* Set the requested key first */
- switch (alg) {
- case IW_ENCODE_ALG_NONE:
- priv->encode_alg = ORINOCO_ALG_NONE;
- err = orinoco_set_key(priv, idx, ORINOCO_ALG_NONE,
- NULL, 0, NULL, 0);
- break;
-
- case IW_ENCODE_ALG_WEP:
- if (ext->key_len <= 0)
- goto out;
-
- priv->encode_alg = ORINOCO_ALG_WEP;
- err = orinoco_set_key(priv, idx, ORINOCO_ALG_WEP,
- ext->key, ext->key_len, NULL, 0);
- break;
-
- case IW_ENCODE_ALG_TKIP:
- {
- u8 *tkip_iv = NULL;
-
- if (!priv->has_wpa ||
- (ext->key_len > sizeof(struct orinoco_tkip_key)))
- goto out;
-
- priv->encode_alg = ORINOCO_ALG_TKIP;
-
- if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
- tkip_iv = &ext->rx_seq[0];
-
- err = orinoco_set_key(priv, idx, ORINOCO_ALG_TKIP,
- ext->key, ext->key_len, tkip_iv,
- ORINOCO_SEQ_LEN);
-
- err = __orinoco_hw_set_tkip_key(priv, idx,
- ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
- priv->keys[idx].key,
- tkip_iv, ORINOCO_SEQ_LEN, NULL, 0);
- if (err)
- printk(KERN_ERR "%s: Error %d setting TKIP key"
- "\n", dev->name, err);
-
- goto out;
- }
- default:
- goto out;
- }
- }
- err = -EINPROGRESS;
- out:
- orinoco_unlock(priv, &flags);
-
- return err;
-}
-
-static int orinoco_ioctl_get_encodeext(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- struct iw_point *encoding = &wrqu->encoding;
- struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
- int idx, max_key_len;
- unsigned long flags;
- int err;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- err = -EINVAL;
- max_key_len = encoding->length - sizeof(*ext);
- if (max_key_len < 0)
- goto out;
-
- idx = encoding->flags & IW_ENCODE_INDEX;
- if (idx) {
- if ((idx < 1) || (idx > 4))
- goto out;
- idx--;
- } else
- idx = priv->tx_key;
-
- encoding->flags = idx + 1;
- memset(ext, 0, sizeof(*ext));
-
- switch (priv->encode_alg) {
- case ORINOCO_ALG_NONE:
- ext->alg = IW_ENCODE_ALG_NONE;
- ext->key_len = 0;
- encoding->flags |= IW_ENCODE_DISABLED;
- break;
- case ORINOCO_ALG_WEP:
- ext->alg = IW_ENCODE_ALG_WEP;
- ext->key_len = min(priv->keys[idx].key_len, max_key_len);
- memcpy(ext->key, priv->keys[idx].key, ext->key_len);
- encoding->flags |= IW_ENCODE_ENABLED;
- break;
- case ORINOCO_ALG_TKIP:
- ext->alg = IW_ENCODE_ALG_TKIP;
- ext->key_len = min(priv->keys[idx].key_len, max_key_len);
- memcpy(ext->key, priv->keys[idx].key, ext->key_len);
- encoding->flags |= IW_ENCODE_ENABLED;
- break;
- }
-
- err = 0;
- out:
- orinoco_unlock(priv, &flags);
-
- return err;
-}
-
-static int orinoco_ioctl_set_auth(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- hermes_t *hw = &priv->hw;
- struct iw_param *param = &wrqu->param;
- unsigned long flags;
- int ret = -EINPROGRESS;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- switch (param->flags & IW_AUTH_INDEX) {
- case IW_AUTH_WPA_VERSION:
- case IW_AUTH_CIPHER_PAIRWISE:
- case IW_AUTH_CIPHER_GROUP:
- case IW_AUTH_RX_UNENCRYPTED_EAPOL:
- case IW_AUTH_PRIVACY_INVOKED:
- case IW_AUTH_DROP_UNENCRYPTED:
- /*
- * orinoco does not use these parameters
- */
- break;
-
- case IW_AUTH_KEY_MGMT:
- /* wl_lkm implies value 2 == PSK for Hermes I
- * which ties in with WEXT
- * no other hints tho :(
- */
- priv->key_mgmt = param->value;
- break;
-
- case IW_AUTH_TKIP_COUNTERMEASURES:
- /* When countermeasures are enabled, shut down the
- * card; when disabled, re-enable the card. This must
- * take effect immediately.
- *
- * TODO: Make sure that the EAPOL message is getting
- * out before card disabled
- */
- if (param->value) {
- priv->tkip_cm_active = 1;
- ret = hermes_enable_port(hw, 0);
- } else {
- priv->tkip_cm_active = 0;
- ret = hermes_disable_port(hw, 0);
- }
- break;
-
- case IW_AUTH_80211_AUTH_ALG:
- if (param->value & IW_AUTH_ALG_SHARED_KEY)
- priv->wep_restrict = 1;
- else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM)
- priv->wep_restrict = 0;
- else
- ret = -EINVAL;
- break;
-
- case IW_AUTH_WPA_ENABLED:
- if (priv->has_wpa) {
- priv->wpa_enabled = param->value ? 1 : 0;
- } else {
- if (param->value)
- ret = -EOPNOTSUPP;
- /* else silently accept disable of WPA */
- priv->wpa_enabled = 0;
- }
- break;
-
- default:
- ret = -EOPNOTSUPP;
- }
-
- orinoco_unlock(priv, &flags);
- return ret;
-}
-
-static int orinoco_ioctl_get_auth(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- struct iw_param *param = &wrqu->param;
- unsigned long flags;
- int ret = 0;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- switch (param->flags & IW_AUTH_INDEX) {
- case IW_AUTH_KEY_MGMT:
- param->value = priv->key_mgmt;
- break;
-
- case IW_AUTH_TKIP_COUNTERMEASURES:
- param->value = priv->tkip_cm_active;
- break;
-
- case IW_AUTH_80211_AUTH_ALG:
- if (priv->wep_restrict)
- param->value = IW_AUTH_ALG_SHARED_KEY;
- else
- param->value = IW_AUTH_ALG_OPEN_SYSTEM;
- break;
-
- case IW_AUTH_WPA_ENABLED:
- param->value = priv->wpa_enabled;
- break;
-
- default:
- ret = -EOPNOTSUPP;
- }
-
- orinoco_unlock(priv, &flags);
- return ret;
-}
-
-static int orinoco_ioctl_set_genie(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- u8 *buf;
- unsigned long flags;
-
- /* cut off at IEEE80211_MAX_DATA_LEN */
- if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
- (wrqu->data.length && (extra == NULL)))
- return -EINVAL;
-
- if (wrqu->data.length) {
- buf = kmalloc(wrqu->data.length, GFP_KERNEL);
- if (buf == NULL)
- return -ENOMEM;
-
- memcpy(buf, extra, wrqu->data.length);
- } else
- buf = NULL;
-
- if (orinoco_lock(priv, &flags) != 0) {
- kfree(buf);
- return -EBUSY;
- }
-
- kfree(priv->wpa_ie);
- priv->wpa_ie = buf;
- priv->wpa_ie_len = wrqu->data.length;
-
- if (priv->wpa_ie) {
- /* Looks like wl_lkm wants to check the auth alg, and
- * somehow pass it to the firmware.
- * Instead it just calls the key mgmt rid
- * - we do this in set auth.
- */
- }
-
- orinoco_unlock(priv, &flags);
- return 0;
-}
-
-static int orinoco_ioctl_get_genie(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- unsigned long flags;
- int err = 0;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) {
- wrqu->data.length = 0;
- goto out;
- }
-
- if (wrqu->data.length < priv->wpa_ie_len) {
- err = -E2BIG;
- goto out;
- }
-
- wrqu->data.length = priv->wpa_ie_len;
- memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
-
-out:
- orinoco_unlock(priv, &flags);
- return err;
-}
-
-static int orinoco_ioctl_set_mlme(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct orinoco_private *priv = ndev_priv(dev);
- struct iw_mlme *mlme = (struct iw_mlme *)extra;
- unsigned long flags;
- int ret = 0;
-
- if (orinoco_lock(priv, &flags) != 0)
- return -EBUSY;
-
- switch (mlme->cmd) {
- case IW_MLME_DEAUTH:
- /* silently ignore */
- break;
-
- case IW_MLME_DISASSOC:
-
- ret = orinoco_hw_disassociate(priv, mlme->addr.sa_data,
- mlme->reason_code);
- break;
-
- default:
- ret = -EOPNOTSUPP;
- }
-
- orinoco_unlock(priv, &flags);
- return ret;
-}
-
static int orinoco_ioctl_getretry(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *rrq,
@@ -1521,12 +819,12 @@ static const iw_handler orinoco_handler[] = {
STD_IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy),
STD_IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy),
STD_IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy),
- STD_IW_HANDLER(SIOCSIWAP, orinoco_ioctl_setwap),
- STD_IW_HANDLER(SIOCGIWAP, orinoco_ioctl_getwap),
+ STD_IW_HANDLER(SIOCSIWAP, cfg80211_wext_siwap),
+ STD_IW_HANDLER(SIOCGIWAP, cfg80211_wext_giwap),
STD_IW_HANDLER(SIOCSIWSCAN, cfg80211_wext_siwscan),
STD_IW_HANDLER(SIOCGIWSCAN, cfg80211_wext_giwscan),
- STD_IW_HANDLER(SIOCSIWESSID, orinoco_ioctl_setessid),
- STD_IW_HANDLER(SIOCGIWESSID, orinoco_ioctl_getessid),
+ STD_IW_HANDLER(SIOCSIWESSID, cfg80211_wext_siwessid),
+ STD_IW_HANDLER(SIOCGIWESSID, cfg80211_wext_giwessid),
STD_IW_HANDLER(SIOCSIWRATE, orinoco_ioctl_setrate),
STD_IW_HANDLER(SIOCGIWRATE, orinoco_ioctl_getrate),
STD_IW_HANDLER(SIOCSIWRTS, orinoco_ioctl_setrts),
@@ -1534,17 +832,15 @@ static const iw_handler orinoco_handler[] = {
STD_IW_HANDLER(SIOCSIWFRAG, orinoco_ioctl_setfrag),
STD_IW_HANDLER(SIOCGIWFRAG, orinoco_ioctl_getfrag),
STD_IW_HANDLER(SIOCGIWRETRY, orinoco_ioctl_getretry),
- STD_IW_HANDLER(SIOCSIWENCODE, orinoco_ioctl_setiwencode),
- STD_IW_HANDLER(SIOCGIWENCODE, orinoco_ioctl_getiwencode),
+ STD_IW_HANDLER(SIOCSIWENCODE, cfg80211_wext_siwencode),
+ STD_IW_HANDLER(SIOCGIWENCODE, cfg80211_wext_giwencode),
STD_IW_HANDLER(SIOCSIWPOWER, orinoco_ioctl_setpower),
STD_IW_HANDLER(SIOCGIWPOWER, orinoco_ioctl_getpower),
- STD_IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie),
- STD_IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie),
- STD_IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme),
- STD_IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth),
- STD_IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth),
- STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext),
- STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext),
+ STD_IW_HANDLER(SIOCSIWGENIE, cfg80211_wext_siwgenie),
+ STD_IW_HANDLER(SIOCSIWMLME, cfg80211_wext_siwmlme),
+ STD_IW_HANDLER(SIOCSIWAUTH, cfg80211_wext_siwauth),
+ STD_IW_HANDLER(SIOCGIWAUTH, cfg80211_wext_giwauth),
+ STD_IW_HANDLER(SIOCSIWENCODEEXT, cfg80211_wext_siwencodeext),
};
--
1.6.3.3
^ permalink raw reply related
* [RFC 5/5] cfg80211: scan before connect if we don't have the bss
From: David Kilroy @ 2009-08-19 0:04 UTC (permalink / raw)
To: linux-wireless; +Cc: orinoco-devel, David Kilroy
In-Reply-To: <1250640253-18434-1-git-send-email-kilroyd@googlemail.com>
The connect_result callback relies on cfg80211 having the bss
information (via beacons/probes). For a fullmac driver, this information
is only likely to be present after a scan. Userspace is not guaranteed
to scan before connecting (e.g. wpa_supplicant ap_scan=2 in wext mode),
so before calling ->connect do an explicit ->scan if we don't have the
bss in our list.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
---
net/wireless/sme.c | 150 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 110 insertions(+), 40 deletions(-)
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 9ddc00e..6dc7981 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -26,11 +26,13 @@ struct cfg80211_conn {
CFG80211_CONN_AUTHENTICATING,
CFG80211_CONN_ASSOCIATE_NEXT,
CFG80211_CONN_ASSOCIATING,
+ CFG80211_CONN_DELAYED_CONNECT,
} state;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
u8 *ie;
size_t ie_len;
bool auto_auth, prev_bssid_valid;
+ bool connect_after_scan;
};
@@ -148,6 +150,19 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
NULL, 0,
WLAN_REASON_DEAUTH_LEAVING);
return err;
+ case CFG80211_CONN_DELAYED_CONNECT:
+ BUG_ON(!rdev->ops->connect);
+ err = rdev->ops->connect(&rdev->wiphy, wdev->netdev,
+ &wdev->conn->params);
+ kfree(wdev->conn->ie);
+ kfree(wdev->conn);
+ wdev->conn = NULL;
+ if (err) {
+ wdev->connect_keys = NULL;
+ wdev->sme_state = CFG80211_SME_IDLE;
+ wdev->ssid_len = 0;
+ }
+ return err;
default:
return 0;
}
@@ -234,6 +249,12 @@ static void __cfg80211_sme_scan_done(struct net_device *dev)
wdev->conn->state != CFG80211_CONN_SCAN_AGAIN)
return;
+ if (wdev->conn->connect_after_scan) {
+ wdev->conn->state = CFG80211_CONN_DELAYED_CONNECT;
+ schedule_work(&rdev->conn_work);
+ return;
+ }
+
if (!cfg80211_get_conn_bss(wdev)) {
/* not found */
if (wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)
@@ -655,6 +676,52 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
}
EXPORT_SYMBOL(cfg80211_disconnected);
+static int cfg80211_conn_clone(struct wireless_dev *wdev,
+ struct cfg80211_connect_params *connect)
+{
+ if (WARN_ON(wdev->conn))
+ return -EINPROGRESS;
+
+ wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL);
+ if (!wdev->conn)
+ return -ENOMEM;
+
+ memcpy(&wdev->conn->params, connect, sizeof(*connect));
+ if (connect->bssid) {
+ wdev->conn->params.bssid = wdev->conn->bssid;
+ memcpy(wdev->conn->bssid, connect->bssid, ETH_ALEN);
+ }
+
+ if (connect->ie) {
+ wdev->conn->ie = kmemdup(connect->ie, connect->ie_len,
+ GFP_KERNEL);
+ wdev->conn->params.ie = wdev->conn->ie;
+ if (!wdev->conn->ie) {
+ kfree(wdev->conn);
+ wdev->conn = NULL;
+ return -ENOMEM;
+ }
+ }
+
+ if (connect->auth_type == NL80211_AUTHTYPE_AUTOMATIC) {
+ wdev->conn->auto_auth = true;
+ /* start with open system ... should mostly work */
+ wdev->conn->params.auth_type =
+ NL80211_AUTHTYPE_OPEN_SYSTEM;
+ } else {
+ wdev->conn->auto_auth = false;
+ }
+
+ memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
+ wdev->ssid_len = connect->ssid_len;
+ wdev->conn->params.ssid = wdev->ssid;
+ wdev->conn->params.ssid_len = connect->ssid_len;
+
+ wdev->conn->connect_after_scan = false;
+
+ return 0;
+}
+
int __cfg80211_connect(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_connect_params *connect,
@@ -710,46 +777,12 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
if (!rdev->ops->auth || !rdev->ops->assoc)
return -EOPNOTSUPP;
- if (WARN_ON(wdev->conn))
- return -EINPROGRESS;
-
- wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL);
- if (!wdev->conn)
- return -ENOMEM;
-
/*
* Copy all parameters, and treat explicitly IEs, BSSID, SSID.
*/
- memcpy(&wdev->conn->params, connect, sizeof(*connect));
- if (connect->bssid) {
- wdev->conn->params.bssid = wdev->conn->bssid;
- memcpy(wdev->conn->bssid, connect->bssid, ETH_ALEN);
- }
-
- if (connect->ie) {
- wdev->conn->ie = kmemdup(connect->ie, connect->ie_len,
- GFP_KERNEL);
- wdev->conn->params.ie = wdev->conn->ie;
- if (!wdev->conn->ie) {
- kfree(wdev->conn);
- wdev->conn = NULL;
- return -ENOMEM;
- }
- }
-
- if (connect->auth_type == NL80211_AUTHTYPE_AUTOMATIC) {
- wdev->conn->auto_auth = true;
- /* start with open system ... should mostly work */
- wdev->conn->params.auth_type =
- NL80211_AUTHTYPE_OPEN_SYSTEM;
- } else {
- wdev->conn->auto_auth = false;
- }
-
- memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
- wdev->ssid_len = connect->ssid_len;
- wdev->conn->params.ssid = wdev->ssid;
- wdev->conn->params.ssid_len = connect->ssid_len;
+ err = cfg80211_conn_clone(wdev, connect);
+ if (err)
+ return err;
/* don't care about result -- but fill bssid & channel */
if (!wdev->conn->params.bssid || !wdev->conn->params.channel)
@@ -791,18 +824,55 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
return err;
} else {
+ struct cfg80211_bss *bss;
+
wdev->sme_state = CFG80211_SME_CONNECTING;
wdev->connect_keys = connkeys;
+
+ bss = cfg80211_get_bss(wdev->wiphy, NULL, connect->bssid,
+ connect->ssid, connect->ssid_len,
+ WLAN_CAPABILITY_ESS,
+ WLAN_CAPABILITY_ESS);
+ if (!bss) {
+ /* We don't have a matching BSS.
+ *
+ * This means __connect_result will fail,
+ * unless the driver provides scan results
+ * between now and then. So do an explicit
+ * scan, and try connect later.
+ */
+ err = cfg80211_conn_clone(wdev, connect);
+ if (!err) {
+ wdev->conn->connect_after_scan = true;
+ err = cfg80211_conn_scan(wdev);
+
+ if (!err)
+ return 0;
+ }
+
+ /* Failed to clone (or scan), so we can't
+ * delay the connect. Free everything up and
+ * go ahead with the connect */
+ if (wdev->conn)
+ kfree(wdev->conn->ie);
+ kfree(wdev->conn);
+ wdev->conn = NULL;
+
+ } else {
+ cfg80211_put_bss(bss);
+
+ memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
+ wdev->ssid_len = connect->ssid_len;
+ }
+
err = rdev->ops->connect(&rdev->wiphy, dev, connect);
if (err) {
wdev->connect_keys = NULL;
wdev->sme_state = CFG80211_SME_IDLE;
+ wdev->ssid_len = 0;
return err;
}
- memcpy(wdev->ssid, connect->ssid, connect->ssid_len);
- wdev->ssid_len = connect->ssid_len;
-
return 0;
}
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH] cfg80211: allow cfg80211_connect_result with bssid == NULL
From: Zhu Yi @ 2009-08-19 6:29 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Zhu Yi, Johannes Berg
In case of connection failure, the bssid info is not a must have.
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
net/wireless/sme.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index b78a111..bc9584a 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -435,7 +435,8 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
return;
ev->type = EVENT_CONNECT_RESULT;
- memcpy(ev->cr.bssid, bssid, ETH_ALEN);
+ if (bssid)
+ memcpy(ev->cr.bssid, bssid, ETH_ALEN);
ev->cr.req_ie = ((u8 *)ev) + sizeof(*ev);
ev->cr.req_ie_len = req_ie_len;
memcpy((void *)ev->cr.req_ie, req_ie, req_ie_len);
--
1.6.0.4
^ permalink raw reply related
* Re: [PATCH] cfg80211: allow cfg80211_connect_result with bssid == NULL
From: Johannes Berg @ 2009-08-19 7:30 UTC (permalink / raw)
To: Zhu Yi; +Cc: linville, linux-wireless
In-Reply-To: <1250663378-9113-1-git-send-email-yi.zhu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 331 bytes --]
On Wed, 2009-08-19 at 14:29 +0800, Zhu Yi wrote:
> In case of connection failure, the bssid info is not a must have.
Good point, thanks. In fact, the original __cfg80211_connect_result()
did handle a NULL bssid, but the event stuff lost it. I think you should
also pass NULL in core.c when is_zero_ether_addr()?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [RFC 5/5] cfg80211: scan before connect if we don't have the bss
From: Johannes Berg @ 2009-08-19 7:48 UTC (permalink / raw)
To: David Kilroy; +Cc: linux-wireless
In-Reply-To: <1250640253-18434-6-git-send-email-kilroyd@googlemail.com>
[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]
On Wed, 2009-08-19 at 01:04 +0100, David Kilroy wrote:
> @@ -791,18 +824,55 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
>
> return err;
> } else {
> + struct cfg80211_bss *bss;
> +
> wdev->sme_state = CFG80211_SME_CONNECTING;
> wdev->connect_keys = connkeys;
> +
> + bss = cfg80211_get_bss(wdev->wiphy, NULL, connect->bssid,
> + connect->ssid, connect->ssid_len,
> + WLAN_CAPABILITY_ESS,
> + WLAN_CAPABILITY_ESS);
Hmm. What if the bssid isn't set? Then the card might select a different
BSS than the one we have on the scan list.
> + /* Failed to clone (or scan), so we can't
> + * delay the connect. Free everything up and
> + * go ahead with the connect */
> + if (wdev->conn)
> + kfree(wdev->conn->ie);
> + kfree(wdev->conn);
> + wdev->conn = NULL;
and that would then run into the warning and the problem anyway? Better
to just reject with -ENOMEM I think? Also, I really don't think you
should use wdev->conn anywhere in this code path, because some code
looks at that to figure out whether or not the cfg80211 SME is used.
> + } else {
> + cfg80211_put_bss(bss);
> err = rdev->ops->connect(&rdev->wiphy, dev, connect);
And it's all racy too -- by the time the driver calls connect_result(),
the BSS might have expired after it was found here now.
I don't think this is really feasible to implement in cfg80211. Couldn't
the driver do a probe to the BSS that the device selected, and report
that before the connect result?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [PATCH] cfg80211: fix leaks of wdev->conn->ie
From: Johannes Berg @ 2009-08-19 7:52 UTC (permalink / raw)
To: David Kilroy; +Cc: linux-wireless
In-Reply-To: <1250639011-18258-1-git-send-email-kilroyd@googlemail.com>
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
On Wed, 2009-08-19 at 00:43 +0100, David Kilroy wrote:
> This only occurs in the following error situations:
> - driver calls connect_result with failure
> - error scheduling authentication on connect
> - error initiating scan (to get BSSID and channel) on
> connect
> - userspace calls disconnect while in the SCANNING or
> SCAN_AGAIN states
>
> Signed-off-by: David Kilroy <kilroyd@googlemail.com>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> ---
>
> I came across this while looking at my orinoco scanning issue. It's
> possible I'm wrong...
Yes, looks like I forgot these, thanks!
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> ---
>
> net/wireless/sme.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/net/wireless/sme.c b/net/wireless/sme.c
> index 6fb6a70..9ddc00e 100644
> --- a/net/wireless/sme.c
> +++ b/net/wireless/sme.c
> @@ -395,6 +395,8 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
>
> if (status != WLAN_STATUS_SUCCESS) {
> wdev->sme_state = CFG80211_SME_IDLE;
> + if (wdev->conn)
> + kfree(wdev->conn->ie);
> kfree(wdev->conn);
> wdev->conn = NULL;
> kfree(wdev->connect_keys);
> @@ -779,6 +781,7 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
> }
> }
> if (err) {
> + kfree(wdev->conn->ie);
> kfree(wdev->conn);
> wdev->conn = NULL;
> wdev->sme_state = CFG80211_SME_IDLE;
> @@ -848,6 +851,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
> (wdev->conn->state == CFG80211_CONN_SCANNING ||
> wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)) {
> wdev->sme_state = CFG80211_SME_IDLE;
> + kfree(wdev->conn->ie);
> kfree(wdev->conn);
> wdev->conn = NULL;
> wdev->ssid_len = 0;
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH V2] cfg80211: allow cfg80211_connect_result with bssid == NULL
From: Zhu Yi @ 2009-08-19 8:08 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Zhu Yi, Johannes Berg
In case of connection failure, the bssid info is not a must have.
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
V2: change a __cfg80211_connect_result() caller to used NULL instead of zero addr
net/wireless/core.c | 4 +++-
net/wireless/sme.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index e630648..8eddf98 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -12,6 +12,7 @@
#include <linux/debugfs.h>
#include <linux/notifier.h>
#include <linux/device.h>
+#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>
#include <net/genetlink.h>
#include <net/cfg80211.h>
@@ -309,7 +310,8 @@ static void cfg80211_process_events(struct wireless_dev *wdev)
switch (ev->type) {
case EVENT_CONNECT_RESULT:
__cfg80211_connect_result(
- wdev->netdev, ev->cr.bssid,
+ wdev->netdev, is_zero_ether_addr(ev->cr.bssid) ?
+ NULL : ev->cr.bssid,
ev->cr.req_ie, ev->cr.req_ie_len,
ev->cr.resp_ie, ev->cr.resp_ie_len,
ev->cr.status,
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 8e2ef54..dbd8211 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -458,7 +458,8 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
return;
ev->type = EVENT_CONNECT_RESULT;
- memcpy(ev->cr.bssid, bssid, ETH_ALEN);
+ if (bssid)
+ memcpy(ev->cr.bssid, bssid, ETH_ALEN);
ev->cr.req_ie = ((u8 *)ev) + sizeof(*ev);
ev->cr.req_ie_len = req_ie_len;
memcpy((void *)ev->cr.req_ie, req_ie, req_ie_len);
--
1.6.0.4
^ permalink raw reply related
* Re: [PATCH V2] cfg80211: allow cfg80211_connect_result with bssid == NULL
From: Johannes Berg @ 2009-08-19 8:12 UTC (permalink / raw)
To: Zhu Yi; +Cc: linville, linux-wireless
In-Reply-To: <1250669302-11362-1-git-send-email-yi.zhu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
On Wed, 2009-08-19 at 16:08 +0800, Zhu Yi wrote:
> In case of connection failure, the bssid info is not a must have.
>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Zhu Yi <yi.zhu@intel.com>
> ---
> V2: change a __cfg80211_connect_result() caller to used NULL instead of zero addr
Thanks.
Acked-by: Johannes Berg <johannes@sipsolutions.net>
> net/wireless/core.c | 4 +++-
> net/wireless/sme.c | 3 ++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net/wireless/core.c b/net/wireless/core.c
> index e630648..8eddf98 100644
> --- a/net/wireless/core.c
> +++ b/net/wireless/core.c
> @@ -12,6 +12,7 @@
> #include <linux/debugfs.h>
> #include <linux/notifier.h>
> #include <linux/device.h>
> +#include <linux/etherdevice.h>
> #include <linux/rtnetlink.h>
> #include <net/genetlink.h>
> #include <net/cfg80211.h>
> @@ -309,7 +310,8 @@ static void cfg80211_process_events(struct wireless_dev *wdev)
> switch (ev->type) {
> case EVENT_CONNECT_RESULT:
> __cfg80211_connect_result(
> - wdev->netdev, ev->cr.bssid,
> + wdev->netdev, is_zero_ether_addr(ev->cr.bssid) ?
> + NULL : ev->cr.bssid,
> ev->cr.req_ie, ev->cr.req_ie_len,
> ev->cr.resp_ie, ev->cr.resp_ie_len,
> ev->cr.status,
> diff --git a/net/wireless/sme.c b/net/wireless/sme.c
> index 8e2ef54..dbd8211 100644
> --- a/net/wireless/sme.c
> +++ b/net/wireless/sme.c
> @@ -458,7 +458,8 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
> return;
>
> ev->type = EVENT_CONNECT_RESULT;
> - memcpy(ev->cr.bssid, bssid, ETH_ALEN);
> + if (bssid)
> + memcpy(ev->cr.bssid, bssid, ETH_ALEN);
> ev->cr.req_ie = ((u8 *)ev) + sizeof(*ev);
> ev->cr.req_ie_len = req_ie_len;
> memcpy((void *)ev->cr.req_ie, req_ie, req_ie_len);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) now ready for testing!
From: Mark Huijgen @ 2009-08-19 8:42 UTC (permalink / raw)
To: Gábor Stefanik; +Cc: Broadcom Wireless, linux-wireless
In-Reply-To: <69e28c910908181329r4b6b7cc8w3c9c0d79dda3730c@mail.gmail.com>
Gábor Stefanik wrote:
> Hello World!
>
> Great news for Broadcom BCM4310/4312/4315 (PCI 14e4:4315) users:
> LP-PHY support is now at the point where it can be tested for functionality!
>
> So, go ahead, give it a try, and let's rock!
>
Patches applied, well manually, cause I wasn't able to extract a working
version from the emails or the weblink provided. Whats the recommended
method to apply these git patches on mailinglists?
Here goes:
# modprobe b43 verbose=3
[ 1596.228088] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
0x4243)
[ 1596.228100] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
vendor 0x4243)
[ 1596.228110] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
[ 1596.228120] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
[ 1596.248050] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
[ 1596.256780] ssb: SPROM revision 8 detected.
[ 1596.276093] ssb: Sonics Silicon Backplane found on PCI device
0000:10:00.0
[ 1596.281108] b43-phy2: Broadcom 4312 WLAN found (core revision 15)
[ 1596.324046] b43-phy2 debug: Found PHY: Analog 6, Type 5, Revision 1
[ 1596.324060] b43-phy2 debug: Found Radio: Manuf 0x17F, Version 0x2062,
Revision 2
[ 1596.348233] phy2: Selected rate control algorithm 'minstrel'
[ 1596.348349] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
FW13 ]
# ifconfig wlan0 up
SIOCSIFFLAGS: Input/output error
[ 1689.356055] b43 ssb0:0: firmware: requesting b43/ucode15.fw
[ 1689.703918] b43 ssb0:0: firmware: requesting b43/lp0initvals15.fw
[ 1689.710418] b43 ssb0:0: firmware: requesting b43/lp0bsinitvals15.fw
[ 1689.852058] b43-phy2: Loading firmware version 410.2160 (2007-05-26
15:32:10)
[ 1689.854963] b43-phy2 debug: b2062: Using crystal tab entry 19200 kHz.
[ 1689.855468] b43-phy2 debug: RC calib: Failed to switch to channel 7,
error = -5
[ 1689.860016] b43-phy2 debug: Switch to init channel failed, error = -5.
[ 1689.860543] b43-phy2 ERROR: PHY init: Channel switch to default failed
Interface is not coming up, so cannot scan:
# iwlist wlan0 scan
wlan0 Interface doesn't support scanning : Network is down
# iwconfig wlan0
wlan0 IEEE 802.11bg Mode:Managed Access Point: Not-Associated
Tx-Power=0 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
# iw dev wlan0 info
Interface wlan0
ifindex 5
type managed
# iw phy phy2 info
Wiphy phy2
Band 1:
Frequencies:
* 2412 MHz [1] (27.0 dBm)
* 2417 MHz [2] (27.0 dBm)
* 2422 MHz [3] (27.0 dBm)
* 2427 MHz [4] (27.0 dBm)
* 2432 MHz [5] (27.0 dBm)
* 2437 MHz [6] (27.0 dBm)
* 2442 MHz [7] (27.0 dBm)
* 2447 MHz [8] (27.0 dBm)
* 2452 MHz [9] (27.0 dBm)
* 2457 MHz [10] (27.0 dBm)
* 2462 MHz [11] (27.0 dBm)
* 2467 MHz [12] (disabled)
* 2472 MHz [13] (disabled)
* 2484 MHz [14] (disabled)
Bitrates (non-HT):
* 1.0 Mbps
* 2.0 Mbps (short preamble supported)
* 5.5 Mbps (short preamble supported)
* 11.0 Mbps (short preamble supported)
* 6.0 Mbps
* 9.0 Mbps
* 12.0 Mbps
* 18.0 Mbps
* 24.0 Mbps
* 36.0 Mbps
* 48.0 Mbps
* 54.0 Mbps
max # scan SSIDs: 4
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point
^ permalink raw reply
* Re: [PATCH 2/3] Add rfkill support to compal-laptop
From: Alan Jenkins @ 2009-08-19 8:51 UTC (permalink / raw)
To: Mario Limonciello
Cc: Johannes Berg, Marcel Holtmann, cezary.jackiewicz, linux-acpi,
linux-kernel, linux-wireless@vger.kernel.org
In-Reply-To: <4A8B246D.7050004@dell.com>
On 8/18/09, Mario Limonciello <mario_limonciello@dell.com> wrote:
> Hi Guys:
Hi again Mario
> Alan Jenkins wrote:
>
>> ... but you *do* need to unregister wifi_rfkill here, before you go on
>> to destroy it.
>>
>> +err_wifi:
>> + rfkill_destroy(wifi_rfkill);
>> +
>> + return ret;
>> +}
>>
>> Regards
>> Alan
>>
> I think I've addressed this properly now and only go through each of the
> error handlers as necessary.
Yes, that looks better. I'm still a bit confused about poll(), I'll
have to leave that for Johannes to verify. Feel free to add
Reviewed-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Regards
Alan
^ permalink raw reply
* Re: [PATCH 2/3] Add rfkill support to compal-laptop
From: Johannes Berg @ 2009-08-19 9:01 UTC (permalink / raw)
To: Mario Limonciello
Cc: Alan Jenkins, Marcel Holtmann, cezary.jackiewicz, linux-acpi,
linux-kernel, linux-wireless@vger.kernel.org
In-Reply-To: <4A8B246D.7050004@dell.com>
[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]
Ah, heh, thanks Alan for pointing out there was a patch here :)
> +static void compal_rfkill_poll(struct rfkill *rfkill, void *data)
> +{
> + unsigned long radio = (unsigned long) data;
> + u8 result;
> + bool hw_blocked;
> + bool sw_blocked;
> +
> + ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
> +
> + hw_blocked = !(result & (KILLSWITCH_MASK | radio));
I don't quite understand the "| radio" bit since that seems to be the
soft kill bit according to rfkill_set()?
> + sw_blocked = rfkill_set_hw_state(rfkill, hw_blocked);
> +
> + rfkill_set_sw_state(rfkill, sw_blocked);
This is wrong. You can remove the entire part about sw_blocked, almost.
> +static int compal_rfkill_set(void *data, bool blocked)
> +{
> + unsigned long radio = (unsigned long) data;
> + u8 result, value;
> +
> + ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
> +
> + if ((result & KILLSWITCH_MASK) == 0)
> + return -EINVAL;
Anyhow, here you reject the request to set the soft bit. I suspect you
could let it go through but it would only change the soft bit in the
BIOS, nothing else really.
Two options:
1) You can let it go though, in that case do that, and remove the sw
block stuff from poll() completely.
2) You can't let it go through. In this case, you need to leave set as
it is, but implement poll like this:
sw_block = rfkill_set_hw_state(rfkill, hw_blocked);
compal_rfkill_set(data, sw_block);
so that when the user soft-blocks the device while hard-blocked, the
soft block is still honoured after pushing the button on the laptop.
Also, I'm not entirely clear about the semantics -- you've called the
bit KILLSWITCH_MASK, but does it really control all technologies as a
hard block, i.e. it toggles both the bluetooth and wireless hard block?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [PATCH 00/29] mwl8k update to version 0.10
From: Lennert Buytenhek @ 2009-08-19 9:32 UTC (permalink / raw)
To: linville, linux-wireless; +Cc: Johannes Berg
In-Reply-To: <20090818103043.GA6171@mail.wantstofly.org>
On Tue, Aug 18, 2009 at 12:30:43PM +0200, Lennert Buytenhek wrote:
> The following changes since commit f0602f40fe362f4ee15aad719d5cf7021de61914:
> Bob Copeland (1):
> wl1251: correct definitions for 0th bit defines
>
> are available in the git repository at:
>
> git://git.marvell.com/mwl8k.git master
>
> Lennert Buytenhek (29):
> mwl8k: remove various unused struct members and defines
> mwl8k: s/IEEE80211_ADDR_LEN/ETH_ALEN/g
> mwl8k: sort firmware command list by opcode, and trim unused commands
> mwl8k: various coding style cleanups
> mwl8k: remove MWL8K_RADIO_* defines
> mwl8k: remove MWL8K_RADIO_*_PREAMBLE defines
> mwl8k: remove MWL8K_WMM_* defines
> mwl8k: remove MWL8K_*_SLOTTIME defines
> mwl8k: fix mwl8k_configure_filter() parameter lifetime issue
> mwl8k: ->add_interface() is not called for monitor interfaces
> mwl8k: dma header manipulations can't fail
> mwl8k: don't touch 'command done' interrupt during firmware load
> mwl8k: don't hardcode the number of transmit queues
> mwl8k: no need to hold ->tx_lock while setting the hardware interrupt mask
> mwl8k: implement rfkill
Johannes pointed out that this subject line is nonsense, which it
is as the patch itself implements IEEE80211_CONF_IDLE, so I've replaced
this commit message by "mwl8k: implement idle mode" and updated the
master branch (renaming the old one to master.old). No code changes.
^ permalink raw reply
* [PATCH v2] ar9170: refactor configure_filter
From: Christian Lamparter @ 2009-08-19 10:43 UTC (permalink / raw)
To: linux-wireless; +Cc: John Linville
In-Reply-To: <200908190126.31928.chunkeey@web.de>
Thanks to "mac80211: allow configure_filter callback to sleep",
we no longer have to defer the work to the workqueue.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
---
please test!
changes to v1:
- re-based
- fixed possible WARN_ON in ieee80211_configure_filter
on module unload
---
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h
index 95f8256..ce40724 100644
--- a/drivers/net/wireless/ath/ar9170/ar9170.h
+++ b/drivers/net/wireless/ath/ar9170/ar9170.h
@@ -185,10 +185,8 @@ struct ar9170 {
bool disable_offload;
/* filter settings */
- struct work_struct filter_config_work;
- u64 cur_mc_hash, want_mc_hash;
- u32 cur_filter, want_filter;
- unsigned long filter_changed;
+ u64 cur_mc_hash;
+ u32 cur_filter;
unsigned int filter_state;
bool sniffer_enabled;
@@ -261,10 +259,6 @@ struct ar9170_tx_info {
#define IS_STARTED(a) (((struct ar9170 *)a)->state >= AR9170_STARTED)
#define IS_ACCEPTING_CMD(a) (((struct ar9170 *)a)->state >= AR9170_IDLE)
-#define AR9170_FILTER_CHANGED_MODE BIT(0)
-#define AR9170_FILTER_CHANGED_MULTICAST BIT(1)
-#define AR9170_FILTER_CHANGED_FRAMEFILTER BIT(2)
-
/* exported interface */
void *ar9170_alloc(size_t priv_size);
int ar9170_register(struct ar9170 *ar, struct device *pdev);
@@ -278,8 +272,8 @@ int ar9170_nag_limiter(struct ar9170 *ar);
int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
int ar9170_init_mac(struct ar9170 *ar);
int ar9170_set_qos(struct ar9170 *ar);
-int ar9170_update_multicast(struct ar9170 *ar);
-int ar9170_update_frame_filter(struct ar9170 *ar);
+int ar9170_update_multicast(struct ar9170 *ar, const u64 mc_hast);
+int ar9170_update_frame_filter(struct ar9170 *ar, const u32 filter);
int ar9170_set_operating_mode(struct ar9170 *ar);
int ar9170_set_beacon_timers(struct ar9170 *ar);
int ar9170_set_dyn_sifs_ack(struct ar9170 *ar);
diff --git a/drivers/net/wireless/ath/ar9170/mac.c b/drivers/net/wireless/ath/ar9170/mac.c
index d9f1f46..6004936 100644
--- a/drivers/net/wireless/ath/ar9170/mac.c
+++ b/drivers/net/wireless/ath/ar9170/mac.c
@@ -238,39 +238,31 @@ static int ar9170_set_mac_reg(struct ar9170 *ar, const u32 reg, const u8 *mac)
return ar9170_regwrite_result();
}
-int ar9170_update_multicast(struct ar9170 *ar)
+int ar9170_update_multicast(struct ar9170 *ar, const u64 mc_hash)
{
int err;
ar9170_regwrite_begin(ar);
- ar9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_H,
- ar->want_mc_hash >> 32);
- ar9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_L,
- ar->want_mc_hash);
-
+ ar9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_H, mc_hash >> 32);
+ ar9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_L, mc_hash);
ar9170_regwrite_finish();
err = ar9170_regwrite_result();
-
if (err)
return err;
- ar->cur_mc_hash = ar->want_mc_hash;
-
+ ar->cur_mc_hash = mc_hash;
return 0;
}
-int ar9170_update_frame_filter(struct ar9170 *ar)
+int ar9170_update_frame_filter(struct ar9170 *ar, const u32 filter)
{
int err;
- err = ar9170_write_reg(ar, AR9170_MAC_REG_FRAMETYPE_FILTER,
- ar->want_filter);
-
+ err = ar9170_write_reg(ar, AR9170_MAC_REG_FRAMETYPE_FILTER, filter);
if (err)
return err;
- ar->cur_filter = ar->want_filter;
-
+ ar->cur_filter = filter;
return 0;
}
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index d30f33d..658b323 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -1232,8 +1232,6 @@ static int ar9170_op_start(struct ieee80211_hw *hw)
mutex_lock(&ar->mutex);
- ar->filter_changed = 0;
-
/* reinitialize queues statistics */
memset(&ar->tx_stats, 0, sizeof(ar->tx_stats));
for (i = 0; i < __AR9170_NUM_TXQ; i++)
@@ -1296,7 +1294,6 @@ static void ar9170_op_stop(struct ieee80211_hw *hw)
#ifdef CONFIG_AR9170_LEDS
cancel_delayed_work_sync(&ar->led_work);
#endif
- cancel_work_sync(&ar->filter_config_work);
cancel_work_sync(&ar->beacon_work);
mutex_lock(&ar->mutex);
@@ -1973,8 +1970,7 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw,
}
ar->cur_filter = 0;
- ar->want_filter = AR9170_MAC_REG_FTF_DEFAULTS;
- err = ar9170_update_frame_filter(ar);
+ err = ar9170_update_frame_filter(ar, AR9170_MAC_REG_FTF_DEFAULTS);
if (err)
goto unlock;
@@ -1992,8 +1988,7 @@ static void ar9170_op_remove_interface(struct ieee80211_hw *hw,
mutex_lock(&ar->mutex);
ar->vif = NULL;
- ar->want_filter = 0;
- ar9170_update_frame_filter(ar);
+ ar9170_update_frame_filter(ar, 0);
ar9170_set_beacon_timers(ar);
dev_kfree_skb(ar->beacon);
ar->beacon = NULL;
@@ -2065,41 +2060,6 @@ out:
return err;
}
-static void ar9170_set_filters(struct work_struct *work)
-{
- struct ar9170 *ar = container_of(work, struct ar9170,
- filter_config_work);
- int err;
-
- if (unlikely(!IS_STARTED(ar)))
- return ;
-
- mutex_lock(&ar->mutex);
- if (test_and_clear_bit(AR9170_FILTER_CHANGED_MODE,
- &ar->filter_changed)) {
- err = ar9170_set_operating_mode(ar);
- if (err)
- goto unlock;
- }
-
- if (test_and_clear_bit(AR9170_FILTER_CHANGED_MULTICAST,
- &ar->filter_changed)) {
- err = ar9170_update_multicast(ar);
- if (err)
- goto unlock;
- }
-
- if (test_and_clear_bit(AR9170_FILTER_CHANGED_FRAMEFILTER,
- &ar->filter_changed)) {
- err = ar9170_update_frame_filter(ar);
- if (err)
- goto unlock;
- }
-
-unlock:
- mutex_unlock(&ar->mutex);
-}
-
static u64 ar9170_op_prepare_multicast(struct ieee80211_hw *hw, int mc_count,
struct dev_addr_list *mclist)
{
@@ -2126,6 +2086,11 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
{
struct ar9170 *ar = hw->priv;
+ if (unlikely(!IS_ACCEPTING_CMD(ar)))
+ return ;
+
+ mutex_lock(&ar->mutex);
+
/* mask supported flags */
*new_flags &= FIF_ALLMULTI | FIF_CONTROL | FIF_BCN_PRBRESP_PROMISC |
FIF_PROMISC_IN_BSS | FIF_FCSFAIL | FIF_PLCPFAIL;
@@ -2136,12 +2101,10 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
*/
if (changed_flags & FIF_ALLMULTI && *new_flags & FIF_ALLMULTI)
- multicast = ~0ULL;
+ multicast = ~0ULL;
- if (multicast != ar->want_mc_hash) {
- ar->want_mc_hash = multicast;
- set_bit(AR9170_FILTER_CHANGED_MULTICAST, &ar->filter_changed);
- }
+ if (multicast != ar->cur_mc_hash)
+ ar9170_update_multicast(ar, multicast);
if (changed_flags & FIF_CONTROL) {
u32 filter = AR9170_MAC_REG_FTF_PSPOLL |
@@ -2152,24 +2115,22 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
AR9170_MAC_REG_FTF_CFE_ACK;
if (*new_flags & FIF_CONTROL)
- ar->want_filter = ar->cur_filter | filter;
+ filter |= ar->cur_filter;
else
- ar->want_filter = ar->cur_filter & ~filter;
+ filter &= (~ar->cur_filter);
- set_bit(AR9170_FILTER_CHANGED_FRAMEFILTER,
- &ar->filter_changed);
+ ar9170_update_frame_filter(ar, filter);
}
if (changed_flags & FIF_PROMISC_IN_BSS) {
ar->sniffer_enabled = ((*new_flags) & FIF_PROMISC_IN_BSS) != 0;
- set_bit(AR9170_FILTER_CHANGED_MODE,
- &ar->filter_changed);
+ ar9170_set_operating_mode(ar);
}
- if (likely(IS_STARTED(ar)))
- ieee80211_queue_work(ar->hw, &ar->filter_config_work);
+ mutex_unlock(&ar->mutex);
}
+
static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf,
@@ -2423,9 +2384,6 @@ static void ar9170_sta_notify(struct ieee80211_hw *hw,
default:
break;
}
-
- if (IS_STARTED(ar) && ar->filter_changed)
- ieee80211_queue_work(ar->hw, &ar->filter_config_work);
}
static int ar9170_get_stats(struct ieee80211_hw *hw,
@@ -2596,7 +2554,6 @@ void *ar9170_alloc(size_t priv_size)
skb_queue_head_init(&ar->tx_pending[i]);
}
ar9170_rx_reset_rx_mpdu(ar);
- INIT_WORK(&ar->filter_config_work, ar9170_set_filters);
INIT_WORK(&ar->beacon_work, ar9170_new_beacon);
INIT_DELAYED_WORK(&ar->tx_janitor, ar9170_tx_janitor);
INIT_LIST_HEAD(&ar->tx_ampdu_list);
^ permalink raw reply related
* [PATCH] ath9k: Fix bug in retrieving average beacon rssi
From: Vasanthakumar Thiagarajan @ 2009-08-19 10:53 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis.Rodriguez, Jouni.Malinen, ath9k-devel
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
---
drivers/net/wireless/ath/ath9k/ani.h | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index 1199245..6273fd0 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -18,15 +18,10 @@
#define ANI_H
#define HAL_PROCESS_ANI 0x00000001
-#define ATH9K_RSSI_EP_MULTIPLIER (1<<7)
#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI))
-#define HAL_EP_RND(x, mul) \
- ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
-#define BEACON_RSSI(ahp) \
- HAL_EP_RND(ahp->stats.ast_nodestats.ns_avgbrssi, \
- ATH9K_RSSI_EP_MULTIPLIER)
+#define BEACON_RSSI(ahp) (ahp->stats.ast_nodestats.ns_avgbrssi)
#define ATH9K_ANI_OFDM_TRIG_HIGH 500
#define ATH9K_ANI_OFDM_TRIG_LOW 200
--
1.5.5.1
^ permalink raw reply related
* [PATCH] ath9k: Nuke struct ath9k_node_stats
From: Vasanthakumar Thiagarajan @ 2009-08-19 10:53 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis.Rodriguez, Jouni.Malinen, ath9k-devel
In-Reply-To: <1250679220-30392-1-git-send-email-vasanth@atheros.com>
Other than ns_avgbrssi (Average beacon rssi) no data of
ath9k_node_stats is being used anywhere. Nuke this structure
and move its only useful member to ar5416Anistate. Also cleanup
this redundant data in ath_softc.
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
---
drivers/net/wireless/ath/ath9k/ani.c | 6 +-----
drivers/net/wireless/ath/ath9k/ani.h | 15 +++------------
drivers/net/wireless/ath/ath9k/ath9k.h | 1 -
drivers/net/wireless/ath/ath9k/main.c | 9 +++------
drivers/net/wireless/ath/ath9k/recv.c | 2 +-
5 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index f264097..a7cbb07 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -538,7 +538,6 @@ void ath9k_ani_reset(struct ath_hw *ah)
}
void ath9k_hw_ani_monitor(struct ath_hw *ah,
- const struct ath9k_node_stats *stats,
struct ath9k_channel *chan)
{
struct ar5416AniState *aniState;
@@ -550,7 +549,6 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah,
return;
aniState = ah->curani;
- ah->stats.ast_nodestats = *stats;
listenTime = ath9k_hw_ani_get_listen_time(ah);
if (listenTime < 0) {
@@ -693,8 +691,7 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah,
* any of the MIB counters overflow/trigger so don't assume we're
* here because a PHY error counter triggered.
*/
-void ath9k_hw_procmibevent(struct ath_hw *ah,
- const struct ath9k_node_stats *stats)
+void ath9k_hw_procmibevent(struct ath_hw *ah)
{
u32 phyCnt1, phyCnt2;
@@ -706,7 +703,6 @@ void ath9k_hw_procmibevent(struct ath_hw *ah,
/* Clear the mib counters and save them in the stats */
ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
- ah->stats.ast_nodestats = *stats;
if (!DO_ANI(ah))
return;
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index 6273fd0..4e1ab94 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -21,7 +21,7 @@
#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI))
-#define BEACON_RSSI(ahp) (ahp->stats.ast_nodestats.ns_avgbrssi)
+#define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
#define ATH9K_ANI_OFDM_TRIG_HIGH 500
#define ATH9K_ANI_OFDM_TRIG_LOW 200
@@ -60,13 +60,6 @@ struct ath9k_mib_stats {
u32 beacons;
};
-struct ath9k_node_stats {
- u32 ns_avgbrssi;
- u32 ns_avgrssi;
- u32 ns_avgtxrssi;
- u32 ns_avgtxrate;
-};
-
struct ar5416AniState {
struct ath9k_channel *c;
u8 noiseImmunityLevel;
@@ -110,21 +103,19 @@ struct ar5416Stats {
u32 ast_ani_reset;
u32 ast_ani_lzero;
u32 ast_ani_lneg;
+ u32 avgbrssi;
struct ath9k_mib_stats ast_mibstats;
- struct ath9k_node_stats ast_nodestats;
};
#define ah_mibStats stats.ast_mibstats
void ath9k_ani_reset(struct ath_hw *ah);
void ath9k_hw_ani_monitor(struct ath_hw *ah,
- const struct ath9k_node_stats *stats,
struct ath9k_channel *chan);
void ath9k_enable_mib_counters(struct ath_hw *ah);
void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
u32 *rxf_pcnt, u32 *txf_pcnt);
-void ath9k_hw_procmibevent(struct ath_hw *ah,
- const struct ath9k_node_stats *stats);
+void ath9k_hw_procmibevent(struct ath_hw *ah);
void ath9k_hw_ani_setup(struct ath_hw *ah);
void ath9k_hw_ani_init(struct ath_hw *ah);
void ath9k_hw_ani_disable(struct ath_hw *ah);
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 2c9f662..70bdd92 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -603,7 +603,6 @@ struct ath_softc {
int beacon_interval;
struct ath_ani ani;
- struct ath9k_node_stats nodestats;
#ifdef CONFIG_ATH9K_DEBUG
struct ath9k_debug debug;
#endif
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 2f9c149..f92b47d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -384,7 +384,7 @@ static void ath_ani_calibrate(unsigned long data)
if (longcal || shortcal || aniflag) {
/* Call ANI routine if necessary */
if (aniflag)
- ath9k_hw_ani_monitor(ah, &sc->nodestats, ah->curchan);
+ ath9k_hw_ani_monitor(ah, ah->curchan);
/* Perform calibration if necessary */
if (longcal || shortcal) {
@@ -589,7 +589,7 @@ irqreturn_t ath_isr(int irq, void *dev)
* it will clear whatever condition caused
* the interrupt.
*/
- ath9k_hw_procmibevent(ah, &sc->nodestats);
+ ath9k_hw_procmibevent(ah);
ath9k_hw_set_interrupts(ah, sc->imask);
}
@@ -940,10 +940,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
ath_beacon_config(sc, vif);
/* Reset rssi stats */
- sc->nodestats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER;
- sc->nodestats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER;
- sc->nodestats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
- sc->nodestats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER;
+ sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
ath_start_ani(sc);
} else {
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 61dbdd2..7b62c22 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -222,7 +222,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
/* Update Beacon RSSI, this is used by ANI. */
if (ieee80211_is_beacon(fc))
- sc->nodestats.ns_avgbrssi = ds->ds_rxstat.rs_rssi;
+ sc->sc_ah->stats.avgbrssi = ds->ds_rxstat.rs_rssi;
rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
rx_status->band = hw->conf.channel->band;
--
1.5.5.1
^ permalink raw reply related
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) now ready for testing!
From: Gábor Stefanik @ 2009-08-19 11:28 UTC (permalink / raw)
To: Mark Huijgen; +Cc: Broadcom Wireless, linux-wireless
In-Reply-To: <4A8BBB02.4020203@huijgen.tk>
2009/8/19 Mark Huijgen <mark.sf.net@huijgen.tk>:
> Gábor Stefanik wrote:
>> Hello World!
>>
>> Great news for Broadcom BCM4310/4312/4315 (PCI 14e4:4315) users:
>> LP-PHY support is now at the point where it can be tested for functionality!
>>
>> So, go ahead, give it a try, and let's rock!
>>
> Patches applied, well manually, cause I wasn't able to extract a working
> version from the emails or the weblink provided. Whats the recommended
> method to apply these git patches on mailinglists?
>
> Here goes:
>
> # modprobe b43 verbose=3
> [ 1596.228088] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
> 0x4243)
> [ 1596.228100] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
> vendor 0x4243)
> [ 1596.228110] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
> [ 1596.228120] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
> [ 1596.248050] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
> [ 1596.256780] ssb: SPROM revision 8 detected.
> [ 1596.276093] ssb: Sonics Silicon Backplane found on PCI device
> 0000:10:00.0
> [ 1596.281108] b43-phy2: Broadcom 4312 WLAN found (core revision 15)
> [ 1596.324046] b43-phy2 debug: Found PHY: Analog 6, Type 5, Revision 1
> [ 1596.324060] b43-phy2 debug: Found Radio: Manuf 0x17F, Version 0x2062,
> Revision 2
> [ 1596.348233] phy2: Selected rate control algorithm 'minstrel'
> [ 1596.348349] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
> FW13 ]
>
> # ifconfig wlan0 up
> SIOCSIFFLAGS: Input/output error
>
> [ 1689.356055] b43 ssb0:0: firmware: requesting b43/ucode15.fw
> [ 1689.703918] b43 ssb0:0: firmware: requesting b43/lp0initvals15.fw
> [ 1689.710418] b43 ssb0:0: firmware: requesting b43/lp0bsinitvals15.fw
> [ 1689.852058] b43-phy2: Loading firmware version 410.2160 (2007-05-26
> 15:32:10)
> [ 1689.854963] b43-phy2 debug: b2062: Using crystal tab entry 19200 kHz.
> [ 1689.855468] b43-phy2 debug: RC calib: Failed to switch to channel 7,
> error = -5
> [ 1689.860016] b43-phy2 debug: Switch to init channel failed, error = -5.
Hmm, error -5 is EIO, which in the channel switch code is used to
represent "PLL charge pump out of range". This is specifically the
error I was trying to fix... could you try without the 2 extra
patches? Maybe I did something wrong. (Without the 2 patches, channels
1..6 and 9..11 (12...14 not tested) throw this error, but channels 7
and 8 work.)
Also try extracting firmware from
ftp://downloads.netgear.com/files/GPL/WNDR3300-V1.0.29_gpl_src.zip's
wl_apsta.o file (newer than the one on mirror.openwrt.org - you may
need to add the extraction defines to fwcutter first; there is a
script in the fwcutter git tree, probably also in tarballs, that
generates extraction lists.) This is the firmware the specs are
written for; it's possible that the current firmware is simply not
good for LP-PHY (or maybe it needs code based on older specs).
> [ 1689.860543] b43-phy2 ERROR: PHY init: Channel switch to default failed
>
> Interface is not coming up, so cannot scan:
> # iwlist wlan0 scan
> wlan0 Interface doesn't support scanning : Network is down
When testing mac80211 drivers, always use "iw dev wlan0 scan", not
"iwlist wlan0 scan". (Though this shouldn't affect your results in
this case.)
Try bringing up the interface in monitor mode.
Also, try changing get_default_chan to return 7 instead of 1.
>
>
> # iwconfig wlan0
> wlan0 IEEE 802.11bg Mode:Managed Access Point: Not-Associated
> Tx-Power=0 dBm
> Retry long limit:7 RTS thr:off Fragment thr:off
> Encryption key:off
> Power Management:off
>
> # iw dev wlan0 info
> Interface wlan0
> ifindex 5
> type managed
>
> # iw phy phy2 info
> Wiphy phy2
> Band 1:
> Frequencies:
> * 2412 MHz [1] (27.0 dBm)
> * 2417 MHz [2] (27.0 dBm)
> * 2422 MHz [3] (27.0 dBm)
> * 2427 MHz [4] (27.0 dBm)
> * 2432 MHz [5] (27.0 dBm)
> * 2437 MHz [6] (27.0 dBm)
> * 2442 MHz [7] (27.0 dBm)
> * 2447 MHz [8] (27.0 dBm)
> * 2452 MHz [9] (27.0 dBm)
> * 2457 MHz [10] (27.0 dBm)
> * 2462 MHz [11] (27.0 dBm)
> * 2467 MHz [12] (disabled)
> * 2472 MHz [13] (disabled)
> * 2484 MHz [14] (disabled)
> Bitrates (non-HT):
> * 1.0 Mbps
> * 2.0 Mbps (short preamble supported)
> * 5.5 Mbps (short preamble supported)
> * 11.0 Mbps (short preamble supported)
> * 6.0 Mbps
> * 9.0 Mbps
> * 12.0 Mbps
> * 18.0 Mbps
> * 24.0 Mbps
> * 36.0 Mbps
> * 48.0 Mbps
> * 54.0 Mbps
> max # scan SSIDs: 4
> Supported interface modes:
> * IBSS
> * managed
> * AP
> * AP/VLAN
> * WDS
> * monitor
> * mesh point
>
>
>
>
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply
* Re: [PATCH] b43: LP-PHY: Implement spec updates and remove resolved FIXMEs
From: Gábor Stefanik @ 2009-08-19 11:30 UTC (permalink / raw)
To: John Linville, Michael Buesch, Larry Finger
Cc: Mark Huijgen, Broadcom Wireless, linux-wireless
In-Reply-To: <4A8AE255.9030102@gmail.com>
John, please hold off this patch for now, it appears to be causing
regressions. I will investigate this.
2009/8/18 Gábor Stefanik <netrolller.3d@gmail.com>:
> Larry has started re-checking all current routines against a new
> version of the Broadcom MIPS driver. This patch implements the first
> round of changes he documented on the specs wiki.
>
> Also remove a few FIXMEs regarding missing initial values for variables
> with dynamic initial values where reading the values has been implemented.
>
> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> ---
> drivers/net/wireless/b43/phy_lp.c | 98
> +++++++++++++++++++------------
> drivers/net/wireless/b43/phy_lp.h | 18 +++---
> drivers/net/wireless/b43/tables_lpphy.c | 12 ++++-
> 3 files changed, 82 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_lp.c
> b/drivers/net/wireless/b43/phy_lp.c
> index 242338f..6c69cdb 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -719,9 +719,39 @@ static void lpphy_set_bb_mult(struct b43_wldev *dev, u8
> bb_mult)
> b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult << 8);
> }
>
> -static void lpphy_disable_crs(struct b43_wldev *dev)
> +static void lpphy_set_deaf(struct b43_wldev *dev, bool user)
> {
> + struct b43_phy_lp *lpphy = dev->phy.lp;
> +
> + if (user)
> + lpphy->crs_usr_disable = 1;
> + else
> + lpphy->crs_sys_disable = 1;
> b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
> +}
> +
> +static void lpphy_clear_deaf(struct b43_wldev *dev, bool user)
> +{
> + struct b43_phy_lp *lpphy = dev->phy.lp;
> +
> + if (user)
> + lpphy->crs_usr_disable = 0;
> + else
> + lpphy->crs_sys_disable = 0;
> +
> + if (!lpphy->crs_usr_disable && !lpphy->crs_sys_disable) {
> + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
> + b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
> + 0xFF1F, 0x60);
> + else
> + b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
> + 0xFF1F, 0x20);
> + }
> +}
> +
> +static void lpphy_disable_crs(struct b43_wldev *dev, bool user)
> +{
> + lpphy_set_deaf(dev, user);
> b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
> b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
> @@ -749,12 +779,9 @@ static void lpphy_disable_crs(struct b43_wldev *dev)
> b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
> }
>
> -static void lpphy_restore_crs(struct b43_wldev *dev)
> +static void lpphy_restore_crs(struct b43_wldev *dev, bool user)
> {
> - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
> - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
> - else
> - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
> + lpphy_clear_deaf(dev, user);
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
> }
> @@ -800,10 +827,11 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
> b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
> 0xF800, rf_gain);
> } else {
> - pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB)) & 0x7F00;
> + pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB)) & 0x1FC0;
> + pa_gain <<= 2;
> b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
> (gains.pga << 8) | gains.gm);
> - b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
> + b43_phy_maskset(dev, B43_PHY_OFDM(0xFB),
> 0x8000, gains.pad | pa_gain);
> b43_phy_write(dev, B43_PHY_OFDM(0xFC),
> (gains.pga << 8) | gains.gm);
> @@ -817,7 +845,7 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
> b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFF7F, 1 <<
> 7);
> b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xBFFF, 1 <<
> 14);
> }
> - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFBF, 1 << 6);
> + b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFBF, 1 << 6);
> }
>
> static void lpphy_rev0_1_set_rx_gain(struct b43_wldev *dev, u32 gain)
> @@ -857,33 +885,33 @@ static void lpphy_rev2plus_set_rx_gain(struct
> b43_wldev *dev, u32 gain)
> }
> }
>
> -static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
> +static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
> {
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE);
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFEF);
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFBF);
> if (dev->phy.rev >= 2) {
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFEFF);
> - if (b43_current_band(dev->wl) != IEEE80211_BAND_2GHZ)
> - return;
> - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFBFF);
> - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFF7);
> + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
> + b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFBFF);
> + b43_phy_mask(dev, B43_PHY_OFDM(0xE5), 0xFFF7);
> + }
> } else {
> b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFDFF);
> }
> }
>
> -static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
> +static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
> {
> b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x1);
> b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x10);
> b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x40);
> if (dev->phy.rev >= 2) {
> b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x100);
> - if (b43_current_band(dev->wl) != IEEE80211_BAND_2GHZ)
> - return;
> - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x400);
> - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x8);
> + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
> + b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x400);
> + b43_phy_set(dev, B43_PHY_OFDM(0xE5), 0x8);
> + }
> } else {
> b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x200);
> }
> @@ -1002,26 +1030,22 @@ static u32 lpphy_qdiv_roundup(u32 dividend, u32
> divisor, u8 precision)
> {
> u32 quotient, remainder, rbit, roundup, tmp;
>
> - if (divisor == 0) {
> - quotient = 0;
> - remainder = 0;
> - } else {
> - quotient = dividend / divisor;
> - remainder = dividend % divisor;
> - }
> + if (divisor == 0)
> + return 0;
> +
> + quotient = dividend / divisor;
> + remainder = dividend % divisor;
>
> rbit = divisor & 0x1;
> roundup = (divisor >> 1) + rbit;
> - precision--;
>
> - while (precision != 0xFF) {
> + while (precision != 0) {
> tmp = remainder - roundup;
> quotient <<= 1;
> - remainder <<= 1;
> - if (remainder >= roundup) {
> + if (remainder >= roundup)
> remainder = (tmp << 1) + rbit;
> - quotient--;
> - }
> + else
> + remainder <<= 1;
> precision--;
> }
>
> @@ -1123,11 +1147,11 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
> *dev)
> struct b43_phy_lp *lpphy = dev->phy.lp;
> struct lpphy_iq_est iq_est;
> struct lpphy_tx_gains tx_gains;
> - static const u32 ideal_pwr_table[22] = {
> + static const u32 ideal_pwr_table[21] = {
> 0x10000, 0x10557, 0x10e2d, 0x113e0, 0x10f22, 0x0ff64,
> 0x0eda2, 0x0e5d4, 0x0efd1, 0x0fbe8, 0x0b7b8, 0x04b35,
> 0x01a5e, 0x00a0b, 0x00444, 0x001fd, 0x000ff, 0x00088,
> - 0x0004c, 0x0002c, 0x0001a, 0xc0006,
> + 0x0004c, 0x0002c, 0x0001a,
> };
> bool old_txg_ovr;
> u8 old_bbmult;
> @@ -1145,7 +1169,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
> *dev)
> "RC calib: Failed to switch to channel 7, error = %d",
> err);
> }
> - old_txg_ovr = (b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) >> 6) & 1;
> + old_txg_ovr = !!(b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) & 0x40);
> old_bbmult = lpphy_get_bb_mult(dev);
> if (old_txg_ovr)
> tx_gains = lpphy_get_tx_gains(dev);
> @@ -1160,7 +1184,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
> *dev)
> old_txpctl = lpphy->txpctl_mode;
>
> lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF);
> - lpphy_disable_crs(dev);
> + lpphy_disable_crs(dev, true);
> loopback = lpphy_loopback(dev);
> if (loopback == -1)
> goto finish;
> @@ -1193,7 +1217,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
> *dev)
> lpphy_stop_ddfs(dev);
>
> finish:
> - lpphy_restore_crs(dev);
> + lpphy_restore_crs(dev, true);
> b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, old_rf_ovrval);
> b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, old_rf_ovr);
> b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVRVAL, old_afe_ovrval);
> diff --git a/drivers/net/wireless/b43/phy_lp.h
> b/drivers/net/wireless/b43/phy_lp.h
> index 99cb038..e158d1f 100644
> --- a/drivers/net/wireless/b43/phy_lp.h
> +++ b/drivers/net/wireless/b43/phy_lp.h
> @@ -825,11 +825,11 @@ struct b43_phy_lp {
> enum b43_lpphy_txpctl_mode txpctl_mode;
>
> /* Transmit isolation medium band */
> - u8 tx_isolation_med_band; /* FIXME initial value? */
> + u8 tx_isolation_med_band;
> /* Transmit isolation low band */
> - u8 tx_isolation_low_band; /* FIXME initial value? */
> + u8 tx_isolation_low_band;
> /* Transmit isolation high band */
> - u8 tx_isolation_hi_band; /* FIXME initial value? */
> + u8 tx_isolation_hi_band;
>
> /* Max transmit power medium band */
> u16 max_tx_pwr_med_band;
> @@ -848,7 +848,7 @@ struct b43_phy_lp {
> s16 txpa[3], txpal[3], txpah[3];
>
> /* Receive power offset */
> - u8 rx_pwr_offset; /* FIXME initial value? */
> + u8 rx_pwr_offset;
>
> /* TSSI transmit count */
> u16 tssi_tx_count;
> @@ -864,16 +864,16 @@ struct b43_phy_lp {
> s8 tx_pwr_idx_over; /* FIXME initial value? */
>
> /* RSSI vf */
> - u8 rssi_vf; /* FIXME initial value? */
> + u8 rssi_vf;
> /* RSSI vc */
> - u8 rssi_vc; /* FIXME initial value? */
> + u8 rssi_vc;
> /* RSSI gs */
> - u8 rssi_gs; /* FIXME initial value? */
> + u8 rssi_gs;
>
> /* RC cap */
> u8 rc_cap; /* FIXME initial value? */
> /* BX arch */
> - u8 bx_arch; /* FIXME initial value? */
> + u8 bx_arch;
>
> /* Full calibration channel */
> u8 full_calib_chan; /* FIXME initial value? */
> @@ -885,6 +885,8 @@ struct b43_phy_lp {
> /* Used for "Save/Restore Dig Filt State" */
> u16 dig_flt_state[9];
>
> + bool crs_usr_disable, crs_sys_disable;
> +
> unsigned int pdiv;
> };
>
> diff --git a/drivers/net/wireless/b43/tables_lpphy.c
> b/drivers/net/wireless/b43/tables_lpphy.c
> index 2721310..60d472f 100644
> --- a/drivers/net/wireless/b43/tables_lpphy.c
> +++ b/drivers/net/wireless/b43/tables_lpphy.c
> @@ -2367,7 +2367,17 @@ static void lpphy_rev2plus_write_gain_table(struct
> b43_wldev *dev, int offset,
> tmp = data.pad << 16;
> tmp |= data.pga << 8;
> tmp |= data.gm;
> - tmp |= 0x7f000000;
> + if (dev->phy.rev >= 3) {
> + if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
> + tmp |= 0x10 << 24;
> + else
> + tmp |= 0x70 << 24;
> + } else {
> + if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
> + tmp |= 0x14 << 24;
> + else
> + tmp |= 0x7F << 24;
> + }
> b43_lptab_write(dev, B43_LPTAB32(7, 0xC0 + offset), tmp);
> tmp = data.bb_mult << 20;
> tmp |= data.dac << 28;
> --
> 1.6.2.4
>
>
>
>
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply
* Re: [PATCH 2/3] Add rfkill support to compal-laptop
From: Cezary Jackiewicz @ 2009-08-19 11:43 UTC (permalink / raw)
To: Johannes Berg
Cc: Mario Limonciello, Alan Jenkins, Marcel Holtmann, linux-acpi,
linux-kernel, linux-wireless@vger.kernel.org
In-Reply-To: <1250672475.25419.7.camel@johannes.local>
> Also, I'm not entirely clear about the semantics -- you've called the
> bit KILLSWITCH_MASK, but does it really control all technologies as a
> hard block, i.e. it toggles both the bluetooth and wireless hard block?
In compal's laptop - yes. Switch disables all radios, bluetooth and wifi.
--
Cezary
^ permalink raw reply
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!
From: Mark Huijgen @ 2009-08-19 12:43 UTC (permalink / raw)
To: Gábor Stefanik; +Cc: Broadcom Wireless, linux-wireless
In-Reply-To: <69e28c910908190428s46f3d25dnb2f2d8591f99618f@mail.gmail.com>
Gábor Stefanik wrote:
> 2009/8/19 Mark Huijgen <mark.sf.net@huijgen.tk>:
>
>> Gábor Stefanik wrote:
>>
>>> Hello World!
>>>
>>> Great news for Broadcom BCM4310/4312/4315 (PCI 14e4:4315) users:
>>> LP-PHY support is now at the point where it can be tested for functionality!
>>>
>>> So, go ahead, give it a try, and let's rock!
>>>
>>>
>> Patches applied, well manually, cause I wasn't able to extract a working
>> version from the emails or the weblink provided. Whats the recommended
>> method to apply these git patches on mailinglists?
>>
>> Here goes:
>>
>> # modprobe b43 verbose=3
>> [ 1596.228088] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
>> 0x4243)
>> [ 1596.228100] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
>> vendor 0x4243)
>> [ 1596.228110] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
>> [ 1596.228120] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
>> [ 1596.248050] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
>> [ 1596.256780] ssb: SPROM revision 8 detected.
>> [ 1596.276093] ssb: Sonics Silicon Backplane found on PCI device
>> 0000:10:00.0
>> [ 1596.281108] b43-phy2: Broadcom 4312 WLAN found (core revision 15)
>> [ 1596.324046] b43-phy2 debug: Found PHY: Analog 6, Type 5, Revision 1
>> [ 1596.324060] b43-phy2 debug: Found Radio: Manuf 0x17F, Version 0x2062,
>> Revision 2
>> [ 1596.348233] phy2: Selected rate control algorithm 'minstrel'
>> [ 1596.348349] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
>> FW13 ]
>>
>> # ifconfig wlan0 up
>> SIOCSIFFLAGS: Input/output error
>>
>> [ 1689.356055] b43 ssb0:0: firmware: requesting b43/ucode15.fw
>> [ 1689.703918] b43 ssb0:0: firmware: requesting b43/lp0initvals15.fw
>> [ 1689.710418] b43 ssb0:0: firmware: requesting b43/lp0bsinitvals15.fw
>> [ 1689.852058] b43-phy2: Loading firmware version 410.2160 (2007-05-26
>> 15:32:10)
>> [ 1689.854963] b43-phy2 debug: b2062: Using crystal tab entry 19200 kHz.
>> [ 1689.855468] b43-phy2 debug: RC calib: Failed to switch to channel 7,
>> error = -5
>> [ 1689.860016] b43-phy2 debug: Switch to init channel failed, error = -5.
>>
>
> Hmm, error -5 is EIO, which in the channel switch code is used to
> represent "PLL charge pump out of range". This is specifically the
> error I was trying to fix... could you try without the 2 extra
> patches? Maybe I did something wrong. (Without the 2 patches, channels
> 1..6 and 9..11 (12...14 not tested) throw this error, but channels 7
> and 8 work.)
>
Same error without the patches, but 1 less error in dmesg. The 'RC
calib: Failed to switch to channel 7, error = -5' is gone now.
> Also try extracting firmware from
> ftp://downloads.netgear.com/files/GPL/WNDR3300-V1.0.29_gpl_src.zip's
> wl_apsta.o file (newer than the one on mirror.openwrt.org - you may
> need to add the extraction defines to fwcutter first; there is a
> script in the fwcutter git tree, probably also in tarballs, that
> generates extraction lists.) This is the firmware the specs are
> written for; it's possible that the current firmware is simply not
> good for LP-PHY (or maybe it needs code based on older specs).
>
After running the included python script, patching the cutter and
extracting firmware, I now get ucode version 478.104 in dmesg. Next test
is also without the 2 patches. Following log is from modprobe+ifconfig
wlan0 up:
[14600.712104] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
0x4243)
[14600.712116] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
vendor 0x4243)
[14600.712126] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
[14600.712136] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
[14600.732052] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
[14600.740727] ssb: SPROM revision 8 detected.
[14600.760093] ssb: Sonics Silicon Backplane found on PCI device
0000:10:00.0
[14600.816481] b43-phy5: Broadcom 4312 WLAN found (core revision 15)
[14600.860044] b43-phy5 debug: Found PHY: Analog 6, Type 5, Revision 1
[14600.860058] b43-phy5 debug: Found Radio: Manuf 0x17F, Version 0x2062,
Revision 2
[14600.884250] phy5: Selected rate control algorithm 'minstrel'
[14600.884367] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
FW13 ]
[14611.192054] b43 ssb0:0: firmware: requesting b43/ucode15.fw
[14611.206016] b43 ssb0:0: firmware: requesting b43/lp0initvals15.fw
[14611.211387] b43 ssb0:0: firmware: requesting b43/lp0bsinitvals15.fw
[14611.364058] b43-phy5: Loading firmware version 478.104 (2008-07-01
00:50:23)
[14611.367051] b43-phy5 debug: b2062: Using crystal tab entry 19200 kHz.
[14611.371875] b43-phy5 debug: Switch to init channel failed, error = -5.
[14611.372406] b43-phy5 ERROR: PHY init: Channel switch to default failed
Still the "SIOCSIFFLAGS: Input/output error" on ifconfig wlan0 up.
>
>> [ 1689.860543] b43-phy2 ERROR: PHY init: Channel switch to default failed
>>
>> Interface is not coming up, so cannot scan:
>> # iwlist wlan0 scan
>> wlan0 Interface doesn't support scanning : Network is down
>>
>
> When testing mac80211 drivers, always use "iw dev wlan0 scan", not
> "iwlist wlan0 scan". (Though this shouldn't affect your results in
> this case.)
>
OK will do. Never used iw before your other mail about iw phy and friends :)
> Try bringing up the interface in monitor mode.
> Also, try changing get_default_chan to return 7 instead of 1.
>
Tested default_chan 7, *with* the 2 patches and the interface comes up!
Scan results show a lot of the AP's around here, but only AP's of
channel 6 and higher.
The closest AP here is actually on channel 1 and is not showing. It
seems there is a problem with channel 1?
Dmesg for modprobe+ifconfig wlan0 up:
[ 478.516094] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
0x4243)
[ 478.516106] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
vendor 0x4243)
[ 478.516116] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
[ 478.516125] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
[ 478.536053] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
[ 478.544729] ssb: SPROM revision 8 detected.
[ 478.564094] ssb: Sonics Silicon Backplane found on PCI device
0000:10:00.0
[ 478.569257] b43-phy3: Broadcom 4312 WLAN found (core revision 15)
[ 478.612046] b43-phy3 debug: Found PHY: Analog 6, Type 5, Revision 1
[ 478.612061] b43-phy3 debug: Found Radio: Manuf 0x17F, Version 0x2062,
Revision 2
[ 478.636235] phy3: Selected rate control algorithm 'minstrel'
[ 478.636347] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
FW13 ]
[ 483.116055] b43 ssb0:0: firmware: requesting b43/ucode15.fw
[ 483.120545] b43 ssb0:0: firmware: requesting b43/lp0initvals15.fw
[ 483.127002] b43 ssb0:0: firmware: requesting b43/lp0bsinitvals15.fw
[ 483.280059] b43-phy3: Loading firmware version 478.104 (2008-07-01
00:50:23)
[ 483.283053] b43-phy3 debug: b2062: Using crystal tab entry 19200 kHz.
[ 483.296062] b43-phy3 debug: Chip initialized
[ 483.296272] b43-phy3 debug: 64-bit DMA initialized
[ 483.317545] Registered led device: b43-phy3::tx
[ 483.317568] Registered led device: b43-phy3::rx
[ 483.317589] Registered led device: b43-phy3::radio
[ 483.317649] b43-phy3 debug: Wireless interface started
[ 483.317669] b43-phy3 debug: Adding Interface type 2
# wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant.conf
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 4 value 0x0 - Trying to associate with 00:30:f1:f9:10:45
(SSID='default' freq=2462 MHz)
Associated with 00:30:f1:f9:10:45
WPA: Key negotiation completed with 00:30:f1:f9:10:45 [PTK=TKIP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to 00:30:f1:f9:10:45 completed (auth)
[id=0 id_str=]
Well, what do you know, it actually does WPA authentication already!
Means TX must be working too.
I am also able to get an IP address with a dhcp client.
dmesg from wpa_supplicant part:
[ 618.820622] wlan0: direct probe to AP 00:30:f1:f9:10:45 (try 1)
[ 618.824200] wlan0 direct probe responded
[ 618.824204] wlan0: authenticate with AP 00:30:f1:f9:10:45 (try 1)
[ 618.825886] wlan0: authenticated
[ 618.825902] wlan0: associate with AP 00:30:f1:f9:10:45 (try 1)
[ 618.828148] wlan0: RX AssocResp from 00:30:f1:f9:10:45 (capab=0x431
status=0 aid=10)
[ 618.828151] wlan0: associated
This AP is on channel 11.
I don't have time for further testing today, but results are promising!
Mark
^ permalink raw reply
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!
From: Johannes Berg @ 2009-08-19 13:04 UTC (permalink / raw)
To: Mark Huijgen; +Cc: Gábor Stefanik, Broadcom Wireless, linux-wireless
In-Reply-To: <4A8BF35E.1090507@huijgen.tk>
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
On Wed, 2009-08-19 at 14:43 +0200, Mark Huijgen wrote:
> After running the included python script, patching the cutter and
> extracting firmware, I now get ucode version 478.104 in dmesg. Next test
> is also without the 2 patches. Following log is from modprobe+ifconfig
> wlan0 up:
Not really surprising, the firmware is for the MAC _only_, it doesn't
really ever touch the PHY, so it's very unlikely to matter.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!
From: Gábor Stefanik @ 2009-08-19 13:26 UTC (permalink / raw)
To: Mark Huijgen, Johannes Berg, Larry Finger
Cc: Broadcom Wireless, linux-wireless
In-Reply-To: <1250687066.1067.25.camel@johannes.local>
On Wed, Aug 19, 2009 at 3:04 PM, Johannes Berg<johannes@sipsolutions.net> wrote:
> On Wed, 2009-08-19 at 14:43 +0200, Mark Huijgen wrote:
>
>> After running the included python script, patching the cutter and
>> extracting firmware, I now get ucode version 478.104 in dmesg. Next test
>> is also without the 2 patches. Following log is from modprobe+ifconfig
>> wlan0 up:
>
> Not really surprising, the firmware is for the MAC _only_, it doesn't
> really ever touch the PHY, so it's very unlikely to matter.
>
> johannes
>
Actually, the output does change with the new firmware.
Current outputs:
1. Patches not applied, old firmware, default chan = 1: the channel
switch to 7 during calibration works, but nothing else.
2. Patches applied, old firmware, default chan = 1: no channels work
(not even the channel 7 switch in the calibration routine), ifup
fails.
3. Patches not applied, new firmware, default chan = 1 (I got this
from Larry in private mail): only channels 7 and 8 work, but ifup
works(?).
(4. Patches applied, new firmware, default chan = 1: please test!)
(5. Patches not applied, old firmware, default chan = 7: probably ifup
succeeds, but only channel 7 works. Not tested.)
(6. Patches applied, old firmware, default chan = 7: unknown, probably
doesn't work at all.)
(7. Patches not applied, new firmware, default chan = 7: Unknown.)
8. Patches applied, new firmware, default chan = 7: interface comes
up, scans (but only channels 6 and above show results), associates to
WPA AP on channel 11 and gets DHCP address (meaning, both TX and RX
working)!
Notice that 2 and 8 only differ in the FW ver and the default channel,
and in 8 (with new firmware), the switch to channel 7 during RC
calibration (before the switch to default channel) works - in 2, it
fails. Looks like the routines reverse-engineered from the newer
driver depend on the firmware included in that driver; or maybe the
old firmware simply doesn't properly handle LP-PHY. Initvals are also
a possible candidate for this. (Larry, what do you think about this?)
Mark, could you produce a dmesg output with the new firmware, patches
applied, and channel set to 1? Post the output of dmesg after scanning
& probably associating, if possible. (Scan/assoc may produce messages
in dmesg.)
(The news about TX working is great by the way!)
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!
From: Mark Huijgen @ 2009-08-19 13:49 UTC (permalink / raw)
To: Gábor Stefanik
Cc: Johannes Berg, Larry Finger, Broadcom Wireless, linux-wireless
In-Reply-To: <69e28c910908190626s46fd0bfer5cc9dec9c5bb1c24@mail.gmail.com>
Gábor Stefanik wrote:
> Mark, could you produce a dmesg output with the new firmware, patches
> applied, and channel set to 1? Post the output of dmesg after scanning
> & probably associating, if possible. (Scan/assoc may produce messages
> in dmesg.)
>
I tested this already, but with default chan set to 1, I cannot get the
interface up.
This is somewhere in my mail, but it got a bit messy after I noticed
that after
changing some of the code my modules got installed in another directory
(-dirty).
I just restarted the notebook, but now the results are different again...
New firmware, with patches applied and default channel 7:
[ 72.160057] b43-phy1: Loading firmware version 478.104 (2008-07-01
00:50:23)
[ 72.163484] b43-phy1 debug: RC calib: Failed to switch to channel 7,
error = -5
[ 72.168100] b43-phy1 debug: Switch to init channel failed, error = -5.
Recompile module with default chan 1, patches still applied and new
firmware,
# modprobe -r b43 && modprobe b43 verbose=3 && ifconfig wlan0 up
[ 430.259877] b43-phy2 debug: Switch to init channel failed, error = -5.
Recompile again, but with default chan back to 7, still patched and
still new firmware.
So same as in first situation:
# modprobe -r b43 && modprobe b43 verbose=3 && ifconfig wlan0 up
[ 524.748062] b43-phy3 debug: Chip initialized
And I can get my interface up and working!
Without this procedure I have not been able to get a working chip. Seems
the partially
initialized state after each try, allows the next try to get a bit
further. And together with
the default channel switching between 1 and 7, I get a working chip, but
a chip that does
not seem to be able to find my AP thats on channel 1.
If I now change default chan to 1 again, I am getting the same error as
in step 2 above.
I have not been able to get the interface up with default chan set to 1.
Mark
^ permalink raw reply
* Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!
From: Gábor Stefanik @ 2009-08-19 13:54 UTC (permalink / raw)
To: Mark Huijgen
Cc: Johannes Berg, Larry Finger, Broadcom Wireless, linux-wireless
In-Reply-To: <4A8C02D8.7080309@huijgen.tk>
2009/8/19 Mark Huijgen <mark.sf.net@huijgen.tk>:
> Gábor Stefanik wrote:
>> Mark, could you produce a dmesg output with the new firmware, patches
>> applied, and channel set to 1? Post the output of dmesg after scanning
>> & probably associating, if possible. (Scan/assoc may produce messages
>> in dmesg.)
>>
> I tested this already, but with default chan set to 1, I cannot get the
> interface up.
> This is somewhere in my mail, but it got a bit messy after I noticed
> that after
> changing some of the code my modules got installed in another directory
> (-dirty).
>
> I just restarted the notebook, but now the results are different again...
>
> New firmware, with patches applied and default channel 7:
> [ 72.160057] b43-phy1: Loading firmware version 478.104 (2008-07-01
> 00:50:23)
> [ 72.163484] b43-phy1 debug: RC calib: Failed to switch to channel 7,
> error = -5
> [ 72.168100] b43-phy1 debug: Switch to init channel failed, error = -5.
>
> Recompile module with default chan 1, patches still applied and new
> firmware,
> # modprobe -r b43 && modprobe b43 verbose=3 && ifconfig wlan0 up
>
> [ 430.259877] b43-phy2 debug: Switch to init channel failed, error = -5.
>
> Recompile again, but with default chan back to 7, still patched and
> still new firmware.
> So same as in first situation:
> # modprobe -r b43 && modprobe b43 verbose=3 && ifconfig wlan0 up
>
> [ 524.748062] b43-phy3 debug: Chip initialized
>
> And I can get my interface up and working!
>
> Without this procedure I have not been able to get a working chip. Seems
> the partially
> initialized state after each try, allows the next try to get a bit
> further. And together with
> the default channel switching between 1 and 7, I get a working chip, but
> a chip that does
> not seem to be able to find my AP thats on channel 1.
>
> If I now change default chan to 1 again, I am getting the same error as
> in step 2 above.
> I have not been able to get the interface up with default chan set to 1.
>
> Mark
>
>
What do you see in dmesg after running a scan?
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox