10 Nov, 2011

1 commit


01 Oct, 2011

1 commit

  • The flaglock in struct sta_info has long been
    something that I wanted to get rid of, this
    finally does the conversion to atomic bitops.

    The conversion itself is straight-forward in
    most places, a few things needed to change a
    bit since we can no longer use multiple bits
    at the same time.

    On x86-64, this is a fairly significant code
    size reduction:
    text data bss dec hex
    427861 23648 1008 452517 6e7a5 before
    425383 23648 976 450007 6ddd7 after

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

    Johannes Berg
     

16 Jul, 2011

1 commit

  • When suspending with all netdevs down, the device
    is stopped but we still call a number of driver
    callbacks that the driver might not expect. The
    same happens during resume, we might call a few
    callbacks without starting the driver. Fix this
    by checking open_count around more things and
    exiting quickly if it is 0.

    Also, while at this I noticed that the coverage
    class isn't reprogrammed after resume, so add
    that.

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

    Johannes Berg
     

06 Jul, 2011

1 commit

  • If the driver can't support WoWLAN in the current
    state, this patch allows it to return 1 from the
    suspend callback to do the normal deconfiguration
    instead of using suspend/resume calls. Note that
    if it does this, resume won't be called.

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

    Johannes Berg
     

21 Jun, 2011

1 commit

  • Cancel all relevant timers/works before suspending (wowlan).

    This patch handles the following warning:
    WARNING: at net/mac80211/util.c:565 queueing ieee80211 work while going to suspend
    Backtrace:
    [] (ieee80211_can_queue_work+0x0/0x4c [mac80211])
    [] (ieee80211_queue_work+0x0/0x30 [mac80211])
    [] (ieee80211_sta_timer+0x0/0x3c [mac80211])
    [] (run_timer_softirq+0x0/0x220)
    [] (__do_softirq+0x0/0x130)
    [] (irq_exit+0x0/0xb4)
    [] (ipi_timer+0x0/0x4c)
    [] (do_local_timer+0x0/0x88)
    [] (cpu_idle+0x0/0xe0)
    [] (rest_init+0x0/0xe0)
    [] (start_kernel+0x0/0x314)

    Signed-off-by: Eliad Peller
    Signed-off-by: John W. Linville

    Eliad Peller
     

06 May, 2011

1 commit

  • This adds basic support for the new WoWLAN
    configuration in mac80211. The behaviour is
    completely offloaded to the driver though,
    with two new callbacks (suspend/resume).

    Options for the driver include a complete
    reconfiguration after wakeup, and exposing
    all the triggers it wants to support.

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

    Johannes Berg
     

26 Apr, 2011

1 commit

  • Currently, the code to tear down BA sessions will
    execute after queues are stopped, but attempt to
    send frames, so those frames will just get queued,
    which isn't intended. Move this code to before to
    tear down the sessions properly.

    Additionally, after stopping queues, flush the TX
    queues in the driver driver to make sure all the
    frames went out.

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

    Johannes Berg
     

07 Oct, 2010

2 commits

  • This is partial revert and fix for commit
    85f72bc839705294b32b6c16b491c0422f0a71b3 "mac80211: only cancel
    software-based scans on suspend"

    When cfg80211 request the scan and mac80211 perform some management work,
    we defer the scan request. We do not canceling such requests when calling
    ieee80211_scan_cancel(), because of SCAN_SW_SCANNING bit check just
    before the call. So fix that problem.

    Another problem, which commit 85f72bc839705294b32b6c16b491c0422f0a71b3
    tries to solve, is we can not cancel HW scan. Hence patch make
    ieee80211_scan_cancel() ignore HW scan (see code comments). Keeping
    local->mtx lock assures that the deferred scan will not become
    "working" HW scan.

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

    Stanislaw Gruszka
     
  • When roaming while we have active BA session,
    we can end up transmitting delBA frames to
    the old AP while we're already on the new AP's
    channel, which can cause warnings.

    Simply avoid sending those frames, but still
    tear down the internal session state, since
    they are not really necessary anyway as we
    will implicitly disassociate when sending the
    association to the new AP.

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

    Johannes Berg
     

02 Sep, 2010

1 commit


15 Jun, 2010

2 commits

  • IBSS, managed and mesh modes all have their
    own work struct, and in the future we want
    to also use it in other modes to process
    frames from the now common skb queue.

    This also makes the skb queue and work safe
    to use from other interface types.

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

    Johannes Berg
     
  • A number of places use RCU locking for accessing
    the station list, even though they do not need
    to. Use mutex locking instead to prepare for the
    locking changes I want to make. The mlme code is
    also using a WLAN_STA_DISASSOC flag that has the
    same meaning as WLAN_STA_BLOCK_BA, so use that.

    While doing so, combine places where we loop
    over stations twice, and optimise away some of
    the loops by checking if the hardware supports
    aggregation at all first.

    Also fix a more theoretical race condition: right
    now we could resume, set up an aggregation session,
    and right after tear it down again due to the code
    that is needed for hardware reconfiguration here.
    Also mark add a comment to that code marking it as
    a workaround.

    Finally, remove a pointless aggregation disabling
    loop when an interface is stopped, directly after
    that we remove all stations from it which will also
    disable all aggregation sessions that may still be
    active, and does so in a race-free way unlike the
    current loop that doesn't block new sessions.

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

    Johannes Berg
     

08 Apr, 2010

1 commit


09 Feb, 2010

1 commit

  • Many drivers would like to sleep during station
    addition and removal, and currently have a high
    complexity there from not being able to.

    This introduces two new callbacks sta_add() and
    sta_remove() that drivers can implement instead
    of using sta_notify() and that can sleep, and
    the new sta_add() callback is also allowed to
    fail.

    The reason we didn't do this previously is that
    the IBSS code wants to insert stations from the
    RX path, which is a tasklet, so cannot sleep.
    This patch will keep the station allocation in
    that path, but moves adding the station to the
    driver out of line. Since the addition can now
    fail, we can have IBSS peer structs the driver
    rejected -- in that case we still talk to the
    station but never tell the driver about it in
    the control.sta pointer. If there will ever be
    a driver that has a low limit on the number of
    stations and that cannot talk to any stations
    that are not known to it, we need to do come up
    with a new strategy of handling larger IBSSs,
    maybe quicker expiry or rejecting peers.

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

    Johannes Berg
     

29 Dec, 2009

2 commits

  • All its members (vif, mac_addr, type) are now available
    in the vif struct directly, so we can pass that instead
    of the conf struct. I generated this patch (except the
    mac80211 and header file changes) with this semantic
    patch:

    @@
    identifier conf, fn, hw;
    type tp;
    @@
    tp fn(struct ieee80211_hw *hw,
    -struct ieee80211_if_init_conf *conf)
    +struct ieee80211_vif *vif)
    {
    type
    +vif->type
    |
    -conf->mac_addr
    +vif->addr
    |
    -conf->vif
    +vif
    )
    ...>
    }

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

    Johannes Berg
     
  • Instead of always using netif_running(sdata->dev)
    use ieee80211_sdata_running(sdata) now which is
    just an inline containing netif_running() for now.

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

    Johannes Berg
     

22 Dec, 2009

2 commits

  • It's not all that useful to have the vif/sdata pointer,
    we'd rather refer to the interfaces by their name.

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

    Johannes Berg
     
  • For bluetooth 3, we will most likely not have
    a netdev for a virtual interface (sdata), so
    prepare for that by reducing the reliance on
    having a netdev. This patch moves the name
    and address fields into the sdata struct and
    uses them from there all over. Some work is
    needed to keep them sync'ed, but that's not
    a lot of work and in slow paths anyway.

    In doing so, this also reduces the number of
    pointer dereferences in many places, because
    of things like sdata->dev->dev_addr becoming
    sdata->vif.addr.

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

    Johannes Berg
     

29 Aug, 2009

1 commit

  • Since configure_filter can sleep now, any multicast
    configuration needed to be postponed to a work struct.
    This, however, lead to a problem that we could queue
    the work, stop the device and then afterwards invoke
    configure_filter which may lead to driver hangs and is
    a bug. To fix this, we can just cancel the filter work
    since it's unnecessary to do after stopping the hw.

    Since there are various places that call drv_stop, and
    two of them do very similar things, the code for them
    can be put into a shared function at the same time.

    Signed-off-by: Johannes Berg
    Reported-by: Lennert Buytenhek
    Tested-by: Lennert Buytenhek
    Signed-off-by: John W. Linville

    Johannes Berg
     

05 Aug, 2009

2 commits

  • The mac80211 workqueue exists to enable mac80211 and drivers
    to queue their own work on a single threaded workqueue. mac80211
    takes care to flush the workqueue during suspend but we never
    really had requirements on drivers for how they should use
    the workqueue in consideration for suspend.

    We extend mac80211 to document how the mac80211 workqueue should
    be used, how it should not be used and finally move raw access to
    the workqueue to mac80211 only. Drivers and mac80211 use helpers
    to queue work onto the mac80211 workqueue:

    * ieee80211_queue_work()
    * ieee80211_queue_delayed_work()

    These helpers will now warn if mac80211 already completed its
    suspend cycle and someone is trying to queue work. mac80211
    flushes the mac80211 workqueue prior to suspend a few times,
    but we haven't taken the care to ensure drivers won't add more
    work after suspend. To help with this we add a warning when
    someone tries to add work and mac80211 already completed the
    suspend cycle.

    Drivers should ensure they cancel any work or delayed work
    in the mac80211 stop() callback.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: John W. Linville

    Luis R. Rodriguez
     
  • When downing interfaces, it's a good idea to tell the driver to
    stop sending beacons; that way the driver doesn't need special
    code in ops->remove_interface() when it should already handle the
    case in bss_info_changed().

    This fixes a potential crash with at least ath5k since the vif
    pointer will be nullified while beacon interrupts are still active.

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

    Bob Copeland
     

30 Jul, 2009

1 commit

  • Jan reported that his b43-based laptop hangs during suspend.
    The problem turned out to be mac80211 asking the driver to
    stop the hardware before removing interfaces, and interface
    removal caused b43 to touch the hardware (while down, which
    causes the hang).

    This patch fixes mac80211 to do reorder these operations to
    have them in the correct order -- first remove interfaces
    and then stop the hardware. Some more code is necessary to
    be able to do so in a race-free manner, in particular it is
    necessary to not process frames received during quiescing.

    Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13337.

    Reported-by: Jan Scholz
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

21 May, 2009

1 commit

  • We forgot to cancel all timers in mac80211 when suspending.
    In particular we forgot to deal with some things that can
    cause hardware reconfiguration -- while it is down.

    While at it we go ahead and add a warning in ieee80211_sta_work()
    if its run while the suspend->resume cycle is in effect. This
    should not happen and if it does it would indicate there is
    a bug lurking in either mac80211 or mac80211 drivers.

    With this now wpa_supplicant doesn't blink when I go to suspend
    and resume where as before there where issues with some timers
    running during the suspend->resume cycle. This caused a lot of
    incorrect assumptions and would at times bring back the device
    in an incoherent, but mostly recoverable, state.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

07 May, 2009

1 commit

  • In order to later add tracing or verifications to the driver
    calls mac80211 makes, this patch adds static inline wrappers
    for all operations.

    All calls are now written as

    drv_(local, ...);

    instead of

    local->ops->(&local->hw, ...);

    Where necessary, the wrappers also do existence checking and
    return default values as appropriate.

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

    Johannes Berg
     

23 Apr, 2009

2 commits

  • Some hardware defects may require the hardware to be re-initialised
    completely from scratch. Drivers would need much information (for
    instance the current MAC address, crypto keys, beaconing information,
    etc.) stored duplicated from mac80211 to be able to do this, so let
    mac80211 help them.

    The new ieee80211_restart_hw() function requires the same code as
    resuming, so move that code into a new ieee80211_reconfig() function
    in util.c and leave only the suspend code in pm.c.

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

    Johannes Berg
     
  • In the normal WPA or RSN case keys are only configured after
    associating, so we should do that in that order when resuming
    as well. It shouldn't really matter since we do not send any
    data at either point, but iwlwifi prefers it this way and it
    does seem more natural.

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

    Johannes Berg
     

28 Mar, 2009

4 commits

  • When mac80211 resumes, it currently doesn't reconfigure the interfaces
    entirely and also doesn't reconfigure BSS information -- fix this.

    Also, to be able to test this, add a debugfs file that just calls
    the suspend/resume code to see what happens when we go through that,
    without needing the time-consuming suspend/resume cycle.

    (Original version broke the build for CONFIG_PM=n. Define alternative
    functions for that situation. -- JWL)

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

    Johannes Berg
     
  • When the driver has been notified with a STA_REMOVE, it tears down
    the internal ADDBA state. On resume, trying to initiate aggregation would
    fail because mac80211 has not cleared the operational state for that .
    This can be fixed by tearing down the existing sessions on a suspend.

    Also, the driver can initiate a new BA session when suspend is in progress.
    This is fixed by marking the station as being in suspend state and
    denying ADDBA requests for such STAs.

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

    Sujith
     
  • To avoid concurrent manipulations of the sta list (which shouldn't
    be possible at this point, but anyway) we need to hold the sta_lock
    around iterating the list.

    At the same time, we do not need to iterate the list at all if
    the driver doesn't want to be notified.

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

    Johannes Berg
     
  • Even though userland probably cannot submit packets, there might
    still be some coming, and that's no good when the driver doesn't
    expect them. Stop the queues across suspend/resume.

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

    Johannes Berg
     

30 Jan, 2009

2 commits

  • Drivers can theoretically queue more work in one of their callbacks
    from mac80211 suspend, so let's flush it once more to be on the safe
    side, just before calling ->stop().

    Signed-off-by: Bob Copeland
    Signed-off-by: John W. Linville

    Bob Copeland
     
  • This patch introduces suspend and resume callbacks to mac80211,
    allowing mac80211 to quiesce its state (bringing down interfaces,
    removing keys, etc) in preparation for suspend. cfg80211 will call
    the suspend hook before the device suspend, and resume hook after
    the device resume.

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

    Bob Copeland