Skip to contentSkip to conversation

iwlwifi driver 06/13 updates

PATCH In review Zhu Yi 4 participants 11 messages Jun 13, 2008 Networking drivers (wireless)

lore
Share & tools
lore

Zhu Yi

author
#0 lore raw

cover iwlwifi driver 06/13 updates

Hi John,

Below 3 patches are based on the wireless-testing tip today. Please apply.

Thanks,
-yi

[PATCH 1/3] iwlwifi: adding channels to sysfs [PATCH 2/3] iwlwifi: remove 4965 prefix from iwl4965_ucode [PATCH 3/3] iwlwifi: unify SW rf-kill flow

author
#1 lore raw

PATCH 1/3 iwlwifi: adding channels to sysfs

From: Ester Kummer <[email protected]>

This patch returns channel list to sysfs.

---
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   58 ++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl4965-base.c +56 -2
index 81a1c22..c179b21 100644
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
 			     struct device_attribute *attr, char *buf)
 {
-	/* all this shit doesn't belong into sysfs anyway */
-	return 0;
+
+	struct iwl_priv *priv = dev_get_drvdata(d);
+	struct ieee80211_channel *channels = NULL;
+	const struct ieee80211_supported_band *supp_band = NULL;
+	int len = 0, i;
+	int count = 0;
+
+	if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
+		return -EAGAIN;
+
+	supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
+	channels = supp_band->channels;
+	count = supp_band->n_channels;
+
+	len += sprintf(&buf[len],
+			"Displaying %d channels in 2.4GHz band "
+			"(802.11bg):\n", count);
+
+	for (i = 0; i < count; i++)
+		len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n",
+				ieee80211_frequency_to_channel(
+				channels[i].center_freq),
+				channels[i].max_power,
+				channels[i].flags & IEEE80211_CHAN_RADAR ?
+				" (IEEE 802.11h required)" : "",
+				(!(channels[i].flags & IEEE80211_CHAN_NO_IBSS)
+				|| (channels[i].flags &
+				IEEE80211_CHAN_RADAR)) ? "" :
+				", IBSS",
+				channels[i].flags &
+				IEEE80211_CHAN_PASSIVE_SCAN ?
+				"passive only" : "active/passive");
+
+	supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
+	channels = supp_band->channels;
+	count = supp_band->n_channels;
+
+	len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band "
+			"(802.11a):\n", count);
+
+	for (i = 0; i < count; i++)
+		len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n",
+				ieee80211_frequency_to_channel(
+				channels[i].center_freq),
+				channels[i].max_power,
+				channels[i].flags & IEEE80211_CHAN_RADAR ?
+				" (IEEE 802.11h required)" : "",
+				((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
+				|| (channels[i].flags &
+				IEEE80211_CHAN_RADAR)) ? "" :
+				", IBSS",
+				channels[i].flags &
+				IEEE80211_CHAN_PASSIVE_SCAN ?
+				"passive only" : "active/passive");
+
+	return len;
 }
 
 static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
Signature · 1 line
1.5.3.6
author
#2 lore raw

PATCH 2/3 iwlwifi: remove 4965 prefix from iwl4965_ucode

From: Ron Rindjunsky <[email protected]>

The patch removes 4965 prefix from iwl4965_ucode.

---
 drivers/net/wireless/iwlwifi/iwl-dev.h      |    2 +-
 drivers/net/wireless/iwlwifi/iwl4965-base.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl-dev.h +1 -1
index e6188f0..c508b11 100644
@@ -480,7 +480,7 @@ struct fw_desc {
 };
 
 /* uCode file layout */
-struct iwl4965_ucode {
+struct iwl_ucode {
 	__le32 ver;		/* major/minor/subminor */
 	__le32 inst_size;	/* bytes of runtime instructions */
 	__le32 data_size;	/* bytes of runtime data */
drivers/net/wireless/iwlwifi/iwl4965-base.c +1 -1
index c179b21..a9da17c 100644
@@ -2002,7 +2002,7 @@ static void iwl4965_nic_start(struct iwl_priv *priv)
  */
 static int iwl4965_read_ucode(struct iwl_priv *priv)
 {
-	struct iwl4965_ucode *ucode;
+	struct iwl_ucode *ucode;
 	int ret;
 	const struct firmware *ucode_raw;
 	const char *name = priv->cfg->fw_name;
Signature · 1 line
1.5.3.6
author
#3 lore raw

PATCH 3/3 iwlwifi: unify SW rf-kill flow

From: Emmanuel Grumbach <[email protected]>

This patch unifies SW rf-kill flow between 4965 and 5000. It enables SW RF-kill for 5000. This patch also solves a bug in iwl4965_mac_config:
bad mutex locking balance.

---
 drivers/net/wireless/iwlwifi/iwl-4965.c     |    1 -
 drivers/net/wireless/iwlwifi/iwl-core.c     |   87 ++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-core.h     |   13 +++-
 drivers/net/wireless/iwlwifi/iwl-dev.h      |    1 -
 drivers/net/wireless/iwlwifi/iwl-rfkill.c   |    4 +-
 drivers/net/wireless/iwlwifi/iwl-rfkill.h   |    1 -
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   90 ++-------------------------
 7 files changed, 103 insertions(+), 94 deletions(-)
drivers/net/wireless/iwlwifi/iwl-4965.c +0 -1
index 9662fae..df345cb 100644
@@ -3388,7 +3388,6 @@ static struct iwl_lib_ops iwl4965_lib = {
 		.check_version = iwl4965_eeprom_check_version,
 		.query_addr = iwlcore_eeprom_query_addr,
 	},
-	.radio_kill_sw = iwl4965_radio_kill_sw,
 	.set_power = iwl4965_set_power,
 	.send_tx_power	= iwl4965_send_tx_power,
 	.update_chain_flags = iwl4965_update_chain_flags,
drivers/net/wireless/iwlwifi/iwl-core.c +87 -0

90 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-core.h +9 -4
index 6626665..2838093 100644
@@ -128,8 +128,6 @@ struct iwl_lib_ops {
 	int (*is_valid_rtc_data_addr)(u32 addr);
 	/* 1st ucode load */
 	int (*load_ucode)(struct iwl_priv *priv);
-	/* rfkill */
-	int (*radio_kill_sw)(struct iwl_priv *priv, int disable_radio);
 	 /* power management */
 	struct {
 		int (*init)(struct iwl_priv *priv);
@@ -243,6 +241,13 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id);
  ****************************************************/
 int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force);
 
+/*****************************************************
+ * RF -Kill - here and not in iwl-rfkill.h to be available when
+ * RF-kill subsystem is not compiled.
+ ****************************************************/
+void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv);
+int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv);
+
 /*******************************************************************************
  * Rate
  ******************************************************************************/
@@ -359,10 +364,10 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
 	return iwl_is_ready(priv);
 }
 
+extern void iwl_rf_kill_ct_config(struct iwl_priv *priv);
 extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags);
 extern int iwl_verify_ucode(struct iwl_priv *priv);
-extern void iwl_rf_kill_ct_config(struct iwl_priv *priv);
-int iwl_send_lq_cmd(struct iwl_priv *priv,
+extern int iwl_send_lq_cmd(struct iwl_priv *priv,
 		    struct iwl_link_quality_cmd *lq, u8 flags);
 
 static inline int iwl_send_rxon_assoc(struct iwl_priv *priv)
drivers/net/wireless/iwlwifi/iwl-dev.h +0 -1
index c508b11..81ff4c2 100644
@@ -653,7 +653,6 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
 
 struct iwl_priv;
 
-extern int iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio);
 /*
  * Forward declare iwl-4965.c functions for iwl-base.c
  */
drivers/net/wireless/iwlwifi/iwl-rfkill.c +2 -2
index 59c8a71..5f09874 100644
@@ -55,13 +55,13 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
 
 	switch (state) {
 	case RFKILL_STATE_ON:
-		priv->cfg->ops->lib->radio_kill_sw(priv, 0);
+		iwl_radio_kill_sw_enable_radio(priv);
 		/* if HW rf-kill is set dont allow ON state */
 		if (iwl_is_rfkill(priv))
 			err = -EBUSY;
 		break;
 	case RFKILL_STATE_OFF:
-		priv->cfg->ops->lib->radio_kill_sw(priv, 1);
+		iwl_radio_kill_sw_disable_radio(priv);
 		if (!iwl_is_rfkill(priv))
 			err = -EBUSY;
 		break;
drivers/net/wireless/iwlwifi/iwl-rfkill.h +0 -1
index a7f04b8..b3c04db 100644
@@ -33,7 +33,6 @@ struct iwl_priv;
 #include <linux/rfkill.h>
 #include <linux/input.h>
 
-
 #ifdef CONFIG_IWLWIFI_RFKILL
 struct iwl_rfkill_mngr {
 	struct rfkill *rfkill;
drivers/net/wireless/iwlwifi/iwl4965-base.c +5 -85

111 lines not on this page · raw message

Signature · 1 line
1.5.3.6
maintainer
#4 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

In reply to Zhu Yi
Quoted 16 lines · Zhu Yi

From: Ester Kummer <[email protected]>

This patch returns channel list to sysfs.

---
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   58 ++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -0
index 81a1c22..c179b21 100644

drivers/net/wireless/iwlwifi/iwl4965-base.c static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, · line 4126

Quoted 5 lines
drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -2
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
 			     struct device_attribute *attr, char *buf)
 {
-	/* all this shit doesn't belong into sysfs anyway */
-	return 0;

Hehe. Do you really have to? You can query this information with nl80211. I don't know why you need all that sysfs stuff anyway.

johannes

#5 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

Quoted 12 lines · Johannes Berg
Quoted 11 lines · Zhu Yi

From: Ester Kummer <[email protected]>

This patch returns channel list to sysfs.

---
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   58 ++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/wireless/iwlwifi/iwl4965-base.c static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, · line 4126

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -2
index 81a1c22..c179b21 100644
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-     /* all this shit doesn't belong into sysfs anyway */
-     return 0;

Hehe. Do you really have to? You can query this information with nl80211. I don't know why you need all that sysfs stuff anyway.

I'm not sure why Yi has cut off the log message but original was

'This patch returns channel list to sysfs. This is requirement for validation purposes'

Our automation is build around sysfs and wext and I'm not going to rewrite it now.

Tomas

maintainer
#6 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

Quoted 18 lines
Quoted 4 lines
Quoted 4 lines
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   58 ++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/wireless/iwlwifi/iwl4965-base.c static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, · line 4126

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -2
index 81a1c22..c179b21 100644
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-     /* all this shit doesn't belong into sysfs anyway */
-     return 0;

Hehe. Do you really have to? You can query this information with nl80211. I don't know why you need all that sysfs stuff anyway.

Quoted 7 lines

I'm not sure why Yi has cut off the log message but original was

'This patch returns channel list to sysfs. This is requirement for validation purposes'

Our automation is build around sysfs and wext and I'm not going to rewrite it now.

If you managed to get along without this for so long, why is it needed in upstream now?

Remember, sysfs is API. You don't get to change it gratuitously, so neither should you add to it gratuitously. And we already _have_ API for this particular thing which is not dependent on a particular hardware/driver to boot!

johannes

#7 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

Quoted 20 lines · Johannes Berg
Quoted 20 lines
Quoted 4 lines
Quoted 4 lines
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   58 ++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/wireless/iwlwifi/iwl4965-base.c static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, · line 4126

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -2
index 81a1c22..c179b21 100644
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-     /* all this shit doesn't belong into sysfs anyway */
-     return 0;

Hehe. Do you really have to? You can query this information with nl80211. I don't know why you need all that sysfs stuff anyway.

I'm not sure why Yi has cut off the log message but original was

Quoted 8 lines
Quoted 5 lines

'This patch returns channel list to sysfs. This is requirement for validation purposes'

Our automation is build around sysfs and wext and I'm not going to rewrite it now.

If you managed to get along without this for so long, why is it needed in upstream now?

We didn't run without it, We were developing HW 5000 on older kernel now I just merging it upstream. See my announcement Try to imagine that there is world on totally different planet with different gravitation constant,

Quoted 4 lines

Remember, sysfs is API. You don't get to change it gratuitously, so neither should you add to it gratuitously. And we already _have_ API for this particular thing which is not dependent on a particular hardware/driver to boot!

Agree. We've just returned what was there before
I think you understand what legacy means after your try to replace wext. It will take time
till we switch to new API. Unfortunately cannot fix everything in one day.

Tomas

Quoted 3 lines

johannes

maintainer
#8 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

Quoted 8 lines
Quoted 3 lines

If you managed to get along without this for so long, why is it needed in upstream now?

We didn't run without it, We were developing HW 5000 on older kernel now I just merging it upstream. See my announcement Try to imagine that there is world on totally different planet with different gravitation constant,

Heh. But that still doesn't explain why you're pushing this API into the upstream kernel.

Quoted 9 lines
Quoted 5 lines

Remember, sysfs is API. You don't get to change it gratuitously, so neither should you add to it gratuitously. And we already _have_ API for this particular thing which is not dependent on a particular hardware/driver to boot!

Agree. We've just returned what was there before
I think you understand what legacy means after your try to replace wext. It will take time
till we switch to new API. Unfortunately cannot fix everything in one day.

I know, and that's why wext will stay around for a long time to come. I'm well aware of that, and I think you're aware of that as well. I just don't see the point of _adding_ to the problem with gratuitous API proliferation when apparently you can very well manage to live without this piece.

Couldn't you move it all to debugfs, which is understood to not really be API, and change your verification scripts to use /sys/debug instead of /sys?

johannes

#10 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

In reply to Tomas Winkler
Quoted 36 lines · On Friday 13 June 2008 14:11:36 Tomas Winkler wrote:
Quoted 20 lines · Johannes Berg
Quoted 20 lines
Quoted 4 lines
Quoted 4 lines
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   58 ++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/wireless/iwlwifi/iwl4965-base.c static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, · line 4126

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -2
index 81a1c22..c179b21 100644
@@ -4122,8 +4122,62 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
 static ssize_t show_channels(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-     /* all this shit doesn't belong into sysfs anyway */
-     return 0;

Hehe. Do you really have to? You can query this information with nl80211. I don't know why you need all that sysfs stuff anyway.

I'm not sure why Yi has cut off the log message but original was

Quoted 8 lines
Quoted 5 lines

'This patch returns channel list to sysfs. This is requirement for validation purposes'

Our automation is build around sysfs and wext and I'm not going to rewrite it now.

If you managed to get along without this for so long, why is it needed in upstream now?

We didn't run without it, We were developing HW 5000 on older kernel now I just merging it upstream. See my announcement Try to imagine that there is world on totally different planet with different gravitation constant,

Quoted 8 lines
Quoted 4 lines

Remember, sysfs is API. You don't get to change it gratuitously, so neither should you add to it gratuitously. And we already _have_ API for this particular thing which is not dependent on a particular hardware/driver to boot!

Agree. We've just returned what was there before
I think you understand what legacy means after your try to replace wext. It will take time
till we switch to new API. Unfortunately cannot fix everything in one day.

IMO a compromise could be to put this API under a default-off kconfig option with a big fat warning that the API is supposed to be deleted and replaced by cfg80211 soon. So this would only be temporary API for special purposes that nobody should actually use. But if somebody needs to, he can do so and has no loss of functionality for the time until the correct API is established.

Signature · 1 line
Greetings Michael.
#9 lore raw

Re: [PATCH 1/3] iwlwifi: adding channels to sysfs

In reply to Johannes Berg
Quoted 11 lines · Johannes Berg
Quoted 8 lines
Quoted 3 lines

If you managed to get along without this for so long, why is it needed in upstream now?

We didn't run without it, We were developing HW 5000 on older kernel now I just merging it upstream. See my announcement Try to imagine that there is world on totally different planet with different gravitation constant,

Heh. But that still doesn't explain why you're pushing this API into the upstream kernel.

Because the testing automation didn't change a.k.a user space.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Remember, sysfs is API. You don't get to change it gratuitously, so neither should you add to it gratuitously. And we already _have_ API for this particular thing which is not dependent on a particular hardware/driver to boot!

Quoted 8 lines
Quoted 4 lines

Agree. We've just returned what was there before
I think you understand what legacy means after your try to replace wext. It will take time
till we switch to new API. Unfortunately cannot fix everything in one day.

I know, and that's why wext will stay around for a long time to come. I'm well aware of that, and I think you're aware of that as well. I just don't see the point of _adding_ to the problem with gratuitous API

It's not __adding__ it's __restoring__ even the entry it self was never removed.

Quoted 2 lines

proliferation when apparently you can very well manage to live without this piece.

I 've just tried to explain to you that I cannot live without it...probably without much success

Quoted 3 lines

Couldn't you move it all to debugfs, which is understood to not really be API, and change your verification scripts to use /sys/debug instead of /sys?

There is so much junk in current iwlwifi sysfs that remains there form the time 0 where debugfs was not around so I'm not sure what's your point here. Cleaning it is currently not my highest priority, let first make driver works properly then we can clean it up. Will it make you happy if we schedule to remove it before 2.6.27 merging window.

Tomas