linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helmut Schaa <helmut.schaa@googlemail.com>
To: linux-wireless@vger.kernel.org
Cc: tomas.winkler@intel.com, yi.zhu@intel.com
Subject: iwlwifi - rfkill only works if the interface is up
Date: Mon, 1 Dec 2008 13:11:17 +0100	[thread overview]
Message-ID: <200812011311.17346.helmut.schaa@gmail.com> (raw)

Hi,

Since the patch "iwlwifi: delay firmware loading from pci_probe to network
interface open" was merged, the driver's killswitch does not work anymore
when the interface is down. The patch comment contains two arguments for 
that behaviour:

1) ... Because kernel initializes network devices subsystem before hard disk
and SATA subsystem, it is impossible to get the firmware image from hard disk
in the PCI probe handler. ...

2) For better power saving ...

The current driver behavior is as follows:

- iwl_pci_probe initializes the driver but disables the device, at this point
  changing the killswitch state will not be noticed by the driver and thus
  the killswitch state in sysfs will not reflect the real state

- iwl_mac_start (which is called when at least one interface goes up) starts
  the device and loads the firmware if the killswitch is disabled. Otherwise
  the driver will just enable the interrupts and allows the interface to go
  up.

However, if the device fires the interrupt CSR_INT_BIT_RF_KILL the code in
iwl_irq_tasklet will _not_ restart the card, although the driver already
allowed the interface to go up. That should easily be fixable with a patch
similar to the following (the comment should be changed too):

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index b935e9d..e2f160b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1504,8 +1504,11 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
 		 * the driver as well won't allow loading if RFKILL is set
 		 * therefore no need to restart the driver from this handler
 		 */
-		if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status))
+		if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
 			clear_bit(STATUS_RF_KILL_HW, &priv->status);
+			if (priv->is_open)
+				queue_work(priv->workqueue, &priv->restart);
+		}
 
 		handled |= CSR_INT_BIT_RF_KILL;
 	}

Nevertheless, I'm wondering if the current behaviour (even with the patch above)
makes much sense. I mean, the user space cannot rely on the rfkill state
unless an appropriate interface is up. As the device is able to report the
killswitch state without firmware being loaded the following approach could
be feasible:

- iwl_pci_probe enables the device and enables the interrupts
- iwl_mac_start just loads the firmware
- iwl_mac_stop just releases the firmware but leaves the interrupts enabled

Thanks,
Helmut

             reply	other threads:[~2008-12-01 12:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 12:11 Helmut Schaa [this message]
2008-12-01 13:08 ` iwlwifi - rfkill only works if the interface is up Tomas Winkler
2008-12-01 15:04   ` Helmut Schaa
2008-12-01 17:43     ` Tomas Winkler
2009-01-05 14:43       ` Helmut Schaa
2008-12-01 15:30   ` Marcel Holtmann
2008-12-01 15:34     ` Helmut Schaa
2008-12-01 15:59       ` Marcel Holtmann
2008-12-01 16:16         ` Helmut Schaa
2008-12-01 21:12         ` John W. Linville
2008-12-01 21:50           ` Helmut Schaa
2008-12-03 22:48             ` Dan Williams
2008-12-02 12:59         ` Henrique de Moraes Holschuh
2008-12-02 13:14           ` Marcel Holtmann
2008-12-02 15:03             ` Henrique de Moraes Holschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200812011311.17346.helmut.schaa@gmail.com \
    --to=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    --cc=yi.zhu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).