04 Feb, 2011

1 commit

  • Currently cfg80211 only configures the PSM state to the driver upon creation
    of a new virtual interface, but not after interface type change. The mac80211
    on the other hand reinitializes its sdata structure every time the interface
    type is changed, losing the PSM configuration.

    Hence, if the interface type is changed to, say, ad-hoc and then back to
    managed, "iw wlan0 get power_save" will claim that PSM is enabled, when in
    fact on mac80211 level it is not.

    Fix this in cfg80211 by configuring the PSM state to the driver each time
    the interface is brought up instead of just when the interface is created.

    Signed-off-by: Juuso Oikarinen
    Signed-off-by: John W. Linville

    Juuso Oikarinen
     

21 Dec, 2010

1 commit

  • Userspace will now be allowed to toggle between the default path
    selection algorithm (HWMP, implemented in the kernel), and a vendor
    specific alternative. Also in the same patch, allow userspace to add
    information elements to mesh beacons. This is accordance with the
    Extensible Path Selection Framework specified in version 7.0 of the
    802.11s draft.

    Signed-off-by: Javier Cardona
    Signed-off-by: John W. Linville

    Javier Cardona
     

07 Dec, 2010

1 commit

  • Instead of tying mesh activity to interface up,
    add join and leave commands for mesh. Since we
    must be backward compatible, let cfg80211 handle
    joining a mesh if a mesh ID was pre-configured
    when the device goes up.

    Note that this therefore must modify mac80211 as
    well since mac80211 needs to lose the logic to
    start the mesh on interface up.

    We now allow querying mesh parameters before the
    mesh is connected, which simply returns defaults.
    Setting them (internally renamed to "update") is
    only allowed while connected. Specify them with
    the new mesh join command instead where needed.

    In mac80211, beaconing must now also follow the
    mesh enabled/not enabled state, which is done
    by testing the mesh ID.

    Signed-off-by: Javier Cardona
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

25 Nov, 2010

1 commit


12 Oct, 2010

1 commit

  • This reverts commit 5a254ffe3ffdfa84fe076009bd8e88da412180d2.

    The commit failed to take into account that allocated wireless devices
    (wiphys) are not added into the device list upon allocation, but only
    when they are registered. Therefore, it opened up a race between
    allocating and registering a name, so that if two processes allocate and
    register concurrently ("alloc, alloc, register, register" rather than
    "alloc, register, alloc, register") the code will attempt to use the
    same name twice.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

06 Oct, 2010

1 commit


25 Sep, 2010

1 commit


17 Sep, 2010

2 commits


01 Sep, 2010

1 commit

  • Otherwise lockdep complains...

    https://bugzilla.kernel.org/show_bug.cgi?id=17311

    [ INFO: possible circular locking dependency detected ]
    2.6.36-rc2-git4 #12
    -------------------------------------------------------
    kworker/0:3/3630 is trying to acquire lock:
    (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0x12/0x14

    but task is already holding lock:
    (rfkill_global_mutex){+.+.+.}, at: []
    rfkill_switch_all+0x24/0x49 [rfkill]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #2 (rfkill_global_mutex){+.+.+.}:
    [] lock_acquire+0x120/0x15b
    [] __mutex_lock_common+0x54/0x52e
    [] mutex_lock_nested+0x34/0x39
    [] rfkill_register+0x2b/0x29c [rfkill]
    [] wiphy_register+0x1ae/0x270 [cfg80211]
    [] ieee80211_register_hw+0x1b4/0x3cf [mac80211]
    [] iwl_ucode_callback+0x9e9/0xae3 [iwlagn]
    [] request_firmware_work_func+0x54/0x6f
    [] kthread+0x8c/0x94
    [] kernel_thread_helper+0x4/0x10

    -> #1 (cfg80211_mutex){+.+.+.}:
    [] lock_acquire+0x120/0x15b
    [] __mutex_lock_common+0x54/0x52e
    [] mutex_lock_nested+0x34/0x39
    [] cfg80211_get_dev_from_ifindex+0x1b/0x7c [cfg80211]
    [] cfg80211_wext_giwscan+0x58/0x990 [cfg80211]
    [] ioctl_standard_iw_point+0x1a8/0x272
    [] ioctl_standard_call+0x91/0xa7
    [] T.723+0xbd/0x12c
    [] wext_handle_ioctl+0x31/0x6d
    [] dev_ioctl+0x63d/0x67a
    [] sock_ioctl+0x48/0x21d
    [] do_vfs_ioctl+0x4ba/0x509
    [] sys_ioctl+0x51/0x74
    [] system_call_fastpath+0x16/0x1b

    -> #0 (rtnl_mutex){+.+.+.}:
    [] __lock_acquire+0xa93/0xd9a
    [] lock_acquire+0x120/0x15b
    [] __mutex_lock_common+0x54/0x52e
    [] mutex_lock_nested+0x34/0x39
    [] rtnl_lock+0x12/0x14
    [] cfg80211_rfkill_set_block+0x1a/0x7b [cfg80211]
    [] rfkill_set_block+0x80/0xd5 [rfkill]
    [] __rfkill_switch_all+0x3f/0x6f [rfkill]
    [] rfkill_switch_all+0x38/0x49 [rfkill]
    [] rfkill_op_handler+0x105/0x136 [rfkill]
    [] process_one_work+0x248/0x403
    [] worker_thread+0x139/0x214
    [] kthread+0x8c/0x94
    [] kernel_thread_helper+0x4/0x10

    Signed-off-by: John W. Linville
    Acked-by: Johannes Berg

    John W. Linville
     

25 Aug, 2010

1 commit

  • Allow userspace to register for more than just
    action frames by giving the frame subtype, and
    make it possible to use this in various modes
    as well.

    With some tweaks and some added functionality
    this will, in the future, also be usable in AP
    mode and be able to replace the cooked monitor
    interface currently used in that case.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

17 Aug, 2010

1 commit

  • Enable using network namespaces with
    wireless devices even when sysfs is
    enabled using the same infrastructure
    that was built for netdevs.

    Signed-off-by: Johannes Berg
    Acked-by: "Eric W. Biederman"
    Signed-off-by: John W. Linville

    Johannes Berg
     

28 Jul, 2010

1 commit

  • Save a few bytes of text

    (allyesconfig)
    $ size drivers/net/wireless/built-in.o*
    text data bss dec hex filename
    3924568 100548 871056 4896172 4ab5ac drivers/net/wireless/built-in.o.new
    3926520 100548 871464 4898532 4abee4 drivers/net/wireless/built-in.o.old

    $ size net/wireless/core.o*
    text data bss dec hex filename
    12843 216 3768 16827 41bb net/wireless/core.o.new
    12328 216 3656 16200 3f48 net/wireless/core.o

    Signed-off-by: Joe Perches
    Signed-off-by: John W. Linville

    Joe Perches
     

22 Jul, 2010

1 commit

  • device_add() is called before adding the phy to the cfg80211 device
    list.

    So if a userspace program uses sysfs uevents to detect new phy
    devices, and queries nl80211 to get phy info, it can get ENODEV even
    though the phy exists in sysfs.

    An easy workaround is to hold the cfg80211 mutex until the phy is
    present in sysfs/cfg80211/debugfs.

    Signed-off-by: Maxime Bizon
    Signed-off-by: John W. Linville

    Maxime Bizon
     

19 Jun, 2010

1 commit


06 May, 2010

1 commit


28 Apr, 2010

1 commit

  • Now that the mac80211 is choosing dynamic ps timeouts based on the ps-qos
    network latency configuration, configure a default value of -1 as the dynamic
    ps timeout in cfg80211. This value allows the mac80211 to determine the value
    to be used.

    Signed-off-by: Juuso Oikarinen
    Signed-off-by: John W. Linville

    Juuso Oikarinen
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

20 Feb, 2010

1 commit

  • The most needed command from nl80211, which Wireless Extensions had,
    is support for power save mode. Add a simple command to make it possible
    to enable and disable power save via nl80211.

    I was also planning about extending the interface, for example adding the
    timeout value, but after thinking more about this I decided not to do it.
    Basically there were three reasons:

    Firstly, the parameters for power save are very much hardware dependent.
    Trying to find a unified interface which would work with all hardware, and
    still make sense to users, will be very difficult.

    Secondly, IEEE 802.11 power save implementation in Linux is still in state
    of flux. We have a long way to still to go and there is no way to predict
    what kind of implementation we will have after few years. And because we
    need to support nl80211 interface a long time, practically forever, adding
    now parameters to nl80211 might create maintenance problems later on.

    Third issue are the users. Power save parameters are mostly used for
    debugging, so debugfs is better, more flexible, interface for this.
    For example, wpa_supplicant currently doesn't configure anything related
    to power save mode. It's better to strive that kernel can automatically
    optimise the power save parameters, like with help of pm qos network
    and other traffic parameters.

    Later on, when we have better understanding of power save, we can extend
    this command with more features, if there's a need for that.

    Signed-off-by: Kalle Valo
    Signed-off-by: John W. Linville

    Kalle Valo
     

16 Feb, 2010

1 commit

  • This implements a new command to register for action frames
    that userspace wants to handle instead of the in-kernel
    rejection. It is then responsible for rejecting ones that
    it decided not to handle. There is no unregistration, but
    the socket can be closed for that.

    Frames that are not registered for will not be forwarded
    to userspace and will be rejected by the kernel, the
    cfg80211 API helps implementing that.

    Additionally, this patch adds a new command that allows
    doing action frame transmission from userspace. It can be
    used either to exchange action frames on the current
    operational channel (e.g., with the AP with which we are
    currently associated) or to exchange off-channel Public
    Action frames with the remain-on-channel command.

    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Jouni Malinen
     

23 Jan, 2010

1 commit

  • If a device has multiple MAC addresses, userspace will
    need to know about that. Similarly, if it allows the
    MAC addresses to vary by a bitmask.

    If a driver exports multiple addresses, it is assumed
    that it will be able to deal with that many different
    addresses, which need not necessarily match the ones
    programmed into the device; if a mask is set then the
    device should deal addresses within that mask based
    on an arbitrary "base address".

    To test it all and show how it is used, add support
    to hwsim even though it can't actually deal with
    addresses different from the default.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

20 Jan, 2010

2 commits


13 Jan, 2010

1 commit

  • The new attribute NL80211_ATTR_WIPHY_COVERAGE_CLASS sets IEEE 802.11
    Coverage Class, which depends on maximum distance of nodes in a
    wireless network. It's required for long distance links (more than a few
    hundred meters).

    The attribute is now ignored by two non-mac80211 drivers, rndis and
    iwmc3200wifi, together with WIPHY_PARAM_RETRY_SHORT and
    WIPHY_PARAM_RETRY_LONG. If it turns out to be a problem, we could split
    set_wiphy_params callback or add new capability bits.

    Signed-off-by: Lukas Turek
    Signed-off-by: John W. Linville

    Lukáš Turek
     

12 Jan, 2010

1 commit


29 Nov, 2009

1 commit

  • This patch moves the works cleanup, scan and events to a cfg80211
    dedicated workqueue.

    Platform driver like eeepc-laptop ought to use works to rfkill (as
    new rfkill does lock in rfkill_unregister and the platform driver is
    called from rfkill_switch_all which also lock the same mutex).
    This raise a new issue in itself that the work scheduled by the platform
    driver to the global worqueue calls wiphy_unregister which flush_work
    scan and event works (which thus flush works on the global workqueue inside
    a work on the global workqueue) and also put on hold the wdev_cleanup_work
    (which prevents the dev_put on netdev thus indefinite Usage count error on
    wifi device).

    Signed-off-by: Johannes Berg
    Signed-off-by: Alban Browaeys
    Signed-off-by: John W. Linville

    Alban Browaeys
     

25 Nov, 2009

1 commit


20 Nov, 2009

2 commits

  • A number of people have tried to add a wireless interface
    (in managed mode) to a bridge and then complained that it
    doesn't work. It cannot work, however, because in 802.11
    networks all packets need to be acknowledged and as such
    need to be sent to the right address. Promiscuous doesn't
    help here. The wireless address format used for these
    links has only space for three addresses, the
    * transmitter, which must be equal to the sender (origin)
    * receiver (on the wireless medium), which is the AP in
    the case of managed mode
    * the recipient (destination), which is on the APs local
    network segment

    In an IBSS, it is similar, but the receiver and recipient
    must match and the third address is used as the BSSID.

    To avoid such mistakes in the future, disallow adding a
    wireless interface to a bridge.

    Felix has recently added a four-address mode to the AP
    and client side that can be used (after negotiating that
    it is possible, which must happen out-of-band by setting
    up both sides) for bridging, so allow that case.

    Signed-off-by: Johannes Berg
    Acked-by: Stephen Hemminger
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • We've accumulated a number of options for wiphys
    which make more sense as flags as we keep adding
    more. Convert the existing ones.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

19 Nov, 2009

1 commit


31 Oct, 2009

1 commit

  • We can save a lot of code and pointers in the structs
    by using debugfs_remove_recursive().

    First, change cfg80211 to use debugfs_remove_recursive()
    so that drivers do not need to clean up any files they
    added to the per-wiphy debugfs (if and only if they are
    ok to be accessed until after wiphy_unregister!).

    Then also make mac80211 use debugfs_remove_recursive()
    where necessary -- it need not remove per-wiphy files
    as cfg80211 now removes those, but netdev etc. files
    still need to be handled but can now be removed without
    needing struct dentry pointers to all of them.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

12 Oct, 2009

1 commit


08 Oct, 2009

2 commits

  • Signed-off-by: John W. Linville

    John W. Linville
     
  • Refactor wext to
    * split out iwpriv handling
    * split out iwspy handling
    * split out procfs support
    * allow cfg80211 to have wireless extensions compat code
    w/o CONFIG_WIRELESS_EXT

    After this, drivers need to
    - select WIRELESS_EXT - for wext support
    - select WEXT_PRIV - for iwpriv support
    - select WEXT_SPY - for iwspy support

    except cfg80211 -- which gets new hooks in wext-core.c
    and can then get wext handlers without CONFIG_WIRELESS_EXT.

    Wireless extensions procfs support is auto-selected
    based on PROC_FS and anything that requires the wext core
    (i.e. WIRELESS_EXT or CFG80211_WEXT).

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

05 Oct, 2009

1 commit


29 Aug, 2009

2 commits

  • When the interface type changes while connected, and the
    driver does not require the interface to be down for a
    type change, it is currently possible to get very strange
    results unless the driver takes special care, which it
    shouldn't have to.

    To fix this, take care to disconnect/leave IBSS when
    changing the interface type -- even if the driver may fail
    the call. Also process all events that may be pending to
    avoid running into a situation where an event is reported
    but only processed after the type has already changed,
    which would lead to missing events and warnings.

    A side effect of this is that you will have disconnected
    or left the IBSS even if the mode change ultimately fails,
    but since the intention was to change it and thus leave or
    disconnect, this is not a problem.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • When we lose a scan, cfg80211 tries to clean up after
    the driver. However, it currently does this too early,
    it does this in GOING_DOWN already instead of DOWN, so
    it may happen with mac80211. Besides fixing this, also
    make it more robust by leaking the scan request so if
    the driver later actually finishes the scan, it won't
    crash. Also check in ___cfg80211_scan_done whether a
    scan request is still pending and exit if not.

    Reported-by: Felix Fietkau
    Signed-off-by: Johannes Berg
    Tested-by: Felix Fietkau
    Signed-off-by: John W. Linville

    Johannes Berg
     

20 Aug, 2009

3 commits

  • In case of connection failure, the bssid info is not a must have.

    Signed-off-by: Zhu Yi
    Acked-by: Johannes Berg
    Signed-off-by: John W. Linville

    Zhu Yi
     
  • My patch "cfg80211: fix deadlock" broke the code it
    was supposed to fix, the scan request checking. But
    it's not trivial to put it back the way it was, since
    the original patch had a deadlock.

    Now do it in a completely new way: queue the check
    off to a work struct, where we can freely lock. But
    that has some more complications, like needing to
    wait for it to be done before the wiphy/rdev can be
    destroyed, so some code is required to handle that.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • When removing an interface with nl80211, cfg80211 will
    deadlock in the netdev notifier because we're already
    holding rdev->mtx and try to acquire it again to verify
    the scan has been done.

    This bug was introduced by my patch
    "cfg80211: check for and abort dangling scan requests".

    To fix this, move the dangling scan request check into
    wiphy_unregister(). This will not be able to catch all
    cases right away, but if the scan problem happens with
    a manual ifdown or so it will be possible to remedy it
    by removing the module/device.

    Additionally, add comments about the deadlock scenario.

    Reported-by: Christian Lamparter
    Signed-off-by: Johannes Berg
    Tested-by: Christian Lamparter
    Tested-by: Kalle Valo
    Signed-off-by: John W. Linville

    Johannes Berg