All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Matthew Garrett <mjg@redhat.com>,
	Tomas Winkler <tomasw@gmail.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	Ivo van Doorn <ivdoorn@gmail.com>,
	linux-wireless@vger.kernel.org, Dmitry Torokhov <dtor@mail.ru>
Subject: Re: [PATCH 01/12] rfkill: clarify meaning of rfkill states
Date: Thu, 12 Jun 2008 11:43:04 -0400	[thread overview]
Message-ID: <1213285384.6589.28.camel@localhost.localdomain> (raw)
In-Reply-To: <20080610041136.GA20310@khazad-dum.debian.net>

On Tue, 2008-06-10 at 01:11 -0300, Henrique de Moraes Holschuh wrote:
> On Sun, 08 Jun 2008, Matthew Garrett wrote:
> > On Fri, Jun 06, 2008 at 11:14:19AM -0300, Henrique de Moraes Holschuh wrote:
> > > 1. Every transmitter shall have ONE, and just ONE (not zero, not two,
> > > not more) rfkill class attached.  For those transmitters lacking support
> > > in hardware to make it block, the drivers shall quiesce them and avoid
> > > doing anything to cause transmissions, or even use bus tricks to power
> > > the device down (i.e. the driver will emulate a switch capable of doing
> > > the blocking).
> > 
> > How do we enforce this? iwl4965 provides an rfkill device, but hp-wmi 
> > will also provide one for the wifi. If I swap out the wireless card for 
> > something else, I may lose the card-specific rfkill device.
> 
> Let's define some very STRICT terminology to avoid confusion.
> 
> rfkill class:  the sysfs rfkill class, related to struct rfkill.
> 
> rfkill class attached [to a Linux struct device]: a device whose
>   struct device was given to rfkill_allocate() as the parent.
> 
> transmitter:  part of a wireless device.  So far, every wireless device
> I have seen has only one transmitter from the kernel PoV.  A device
> with two transmitters would be able to transmit two different information
> streams at the same time, with different parameters (such as frequency,
> power).
> 
> transmitter != switch, so hp-wmi, thinkpad-acpi, and anything else that is
> not an actual wireless hardware device IS NOT INCLUDED in that "one and just
> one" constraint.  In fact, thinkpad-acpi has two rfkill classes attached to
> its main platform device, one for the bluetooth softswitch, and another for
> the wwan softswitch.
> 
> So, "Every transmitter shall have ONE and just ONE rfkill class attached."
> just means that you call rfkill_allocate with that device as the parent just
> ONCE per transmitter (and everything I have seen so far has just one
> transmitter).
> 
> Which also means that, for wireless drivers (which have transmitters), you
> need to synthesize the "device rfkill state" to give to that rfkill class.
> THE TRANSMITTER MIGHT BE UNDER THE EFFECT OF MORE THAN ONE RFKILL LINE.
> 
> And if the device [transmitter] has NO rfkill capabilities by itself, we
> emulate the minimum of one in software [per transmitter].   If the device
> has one input pin for rfkill, that one is also taken into account when
> generating the state for the ONLY ONE rfkill class attached to that device
> [per transmitter], etc.
> 
> Now, firmware switches are different, and something for another email that
> I haven't typed in yet (busy in real life right now).
> 
> An example:
> 
> ipw4965 probably has two rfkill controls in itself (an input pin for a
> hardkill line, and an R/W IO register to help its driver (ilw4965) implement
> a rfkill softswitch).  Those TWO rfkill inputs are to be combined into just
> ONE rfkill class which will be attached to the Linux device provided by
> ilw4965.  This is the end of the story from the PoC of the ilw4965 module.
> 
> hp-wmi probably has one softswitch it controls, that ends up connected to
> that input pin in the ipw4965 card so you end up being able to use a hp-wmi
> softswitch to hardkill the ipw4965 card.  This IS expected, and it will not
> matter or break anything.  In the current rfkill incarnation, rfkill doesn't
> understand or know or want to know about rfkill switch topology as it
> stands.
> 
> Did I manage to get the idea across, this time?  Remember, I am not
> describing the rfkill class interactions for switches in that email, JUST
> for wireless drivers, which hp-wmi, thinkpad-acpi, etc are not...
> 
> What happens on the hp-wmi side when the ipw4965 card is removed, is to be
> explained in the other email about switches, but it is not much.  Basically,
> hp-wmi has to be written in such a way that it won't matter for the user,
> and THERE is the real reason why one must never confuse the softswitch
> control with input devices.  Remember that as long as rfkill-input is
> loaded, if anything sends a "change all WLAN rfkill switches" input event,
> all WLAN rfkill switches WILL be changed, regardless of whether they are
> wired among themselves, or completely independent.

As you've explained it, I believe this will work IFF we take your
suggestion and add a 3rd state RADIO_SW_BLOCKED to go along with
RADIO_HW_BLOCKED and RADIO_UNBLOCKED.

In this system, if NM wants to softblock a wifi device for example, it
would likely just turn off the transmitter with 'SIOCSIWTXPOW', thus the
wifi device itself would report it's rfkill state as RADIO_SW_BLOCKED.
NM would then be aware that it could be re-enabled at any time through
software.

If the user then hits the hardkill switch, the wifi device would report
RADIO_HW_BLOCKED, and NM would be aware that the user must unkill the
transmitter with a physical switch.

It gets a bit interesting when unrelated killswitches like hp-wmi and
thinkpad-acpi are used, because if those just softkill the radio, you
could end up in the situation where the radio itself is RADIO_UNBLOCKED
but the struct rfkill created by hp-wmi is RADIO_SW_BLOCKED if BIOS
doesn't track the actual state of the radio too.  How do we fix that?

Dan


  parent reply	other threads:[~2008-06-12 15:43 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04  3:10 [GIT PATCH] rkfill improvements for -next Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 01/12] rfkill: clarify meaning of rfkill states Henrique de Moraes Holschuh
2008-06-04  3:32   ` Pavel Roskin
2008-06-04  3:39     ` Henrique de Moraes Holschuh
2008-06-04 20:27   ` Dan Williams
2008-06-04 20:32     ` Dan Williams
2008-06-04 23:07     ` Tomas Winkler
2008-06-05  0:38       ` Henrique de Moraes Holschuh
2008-06-05  8:33         ` Tomas Winkler
2008-06-05 12:38           ` Henrique de Moraes Holschuh
2008-06-05 12:12         ` Dan Williams
2008-06-05 13:03           ` Henrique de Moraes Holschuh
2008-06-05 14:46             ` Dan Williams
2008-06-05 20:13               ` Henrique de Moraes Holschuh
2008-06-06  3:26                 ` Dan Williams
2008-06-06 13:24                   ` Dan Williams
2008-06-06 14:14                     ` Henrique de Moraes Holschuh
2008-06-06 14:27                       ` Dan Williams
2008-06-07 12:09                         ` Tomas Winkler
2008-06-08 20:16                       ` Matthew Garrett
2008-06-10  4:11                         ` Henrique de Moraes Holschuh
2008-06-11 17:10                           ` Tomas Winkler
2008-06-12 18:03                             ` Henrique de Moraes Holschuh
2008-06-12 15:43                           ` Dan Williams [this message]
2008-06-12 16:31                             ` Henrique de Moraes Holschuh
2008-06-05 16:03         ` Ivo van Doorn
2008-06-05 16:36           ` Tomas Winkler
2008-06-05 17:42             ` Henrique de Moraes Holschuh
2008-06-05 17:54               ` Tomas Winkler
2008-06-05 20:16                 ` Henrique de Moraes Holschuh
2008-06-05 17:53           ` Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 02/12] rfkill: fix minor typo in kernel doc Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 03/12] rfkill: handle SW_RFKILL_ALL events Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 04/12] rfkill: add parameter to disable radios by default Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 05/12] rfkill: add read-write rfkill switch support Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 06/12] rfkill: add the WWAN radio type Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 07/12] rfkill: rework suspend and resume handlers Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 08/12] rfkill: add notifier chains support Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 09/12] rfkill: add type string helper Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 10/12] rfkill: add uevent notifications Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 11/12] rfkill: do not allow userspace to override ALL RADIOS OFF Henrique de Moraes Holschuh
2008-06-04  3:10 ` [PATCH 12/12] rfkill: document rw rfkill switches and clarify input subsystem interactions Henrique de Moraes Holschuh
  -- strict thread matches above, loose matches on Subject: below --
2008-06-22 15:38 [GIT PATCH] rfkill rework for 2.6.27 (v2) Henrique de Moraes Holschuh
2008-06-22 15:38 ` [PATCH 01/12] rfkill: clarify meaning of rfkill states 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=1213285384.6589.28.camel@localhost.localdomain \
    --to=dcbw@redhat.com \
    --cc=dtor@mail.ru \
    --cc=hmh@hmh.eng.br \
    --cc=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mjg@redhat.com \
    --cc=tomasw@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.