20 Dec, 2011

1 commit

  • Currently code allows three (HT_AGG_MAX_RETRIES) unanswered addba
    requests. When this limit is reached aggregation is turned off for
    given TID permanently. This doesn't seem right: three requests is
    not that much, some 'blackout' can happen, but effect of it affects
    whole connection indefinitely.
    This patch increases number of retries to 15. Also, when there have
    been 3 or more retries it splits further retries apart by 15 seconds
    instead of sending them in very short period of time.

    Signed-off-by: Nikolay Martynov
    Signed-off-by: John W. Linville

    Nikolay Martynov
     

16 Dec, 2011

1 commit

  • Currently BAR, ADDBA and DELBA frames are always sent using AC_VO. If
    the TID for which a BA session is established is assigned to a different
    queue BAR, ADDBA and DELBA frames can "overtake" frames of the according
    BA session.

    Hence, always put BA session related frames into the same queue as the
    BA sessions data frames.

    Signed-off-by: Helmut Schaa
    Signed-off-by: John W. Linville

    Helmut Schaa
     

15 Dec, 2011

1 commit


14 Dec, 2011

1 commit

  • When a station leaves suddenly while ampdu traffic to that station is still
    running, there is a possibility that the ampdu pending queues are not freed due
    to a race condition leading to memory leaks. In '__sta_info_destroy' when we
    attempt to destroy the ampdu sessions in 'ieee80211_sta_tear_down_BA_sessions',
    the driver calls 'ieee80211_stop_tx_ba_cb_irqsafe' to delete the ampdu
    structures (tid_tx) and splice the pending queues and this job gets queued in
    sdata workqueue. However, the sta entry can get destroyed before the above work
    gets scheduled and hence the race.

    Purging the queues and freeing the tid_tx to avoid the leak. The better solution
    would be to fix the race, but that can be taken up in a separate patch.

    Signed-off-by: Nishant Sarmukadam
    Signed-off-by: Yogesh Ashok Powar
    Signed-off-by: John W. Linville

    Yogesh Ashok Powar
     

08 Dec, 2011

1 commit

  • Emmanuel noticed that when mac80211 stops the queues
    for aggregation that can leave a packet pending. This
    packet will be given to the driver after the AMPDU
    callback, but as a non-aggregated packet which messes
    up the sequence number etc.

    I also noticed by looking at the code that if packets
    are being processed while we clear the WANT_START bit,
    they might see it cleared already and queue up on
    tid_tx->pending. If the driver then rejects the new
    aggregation session we leak the packet.

    Fix both of these issues by changing this code to not
    stop the queues at all. Instead, let packets queue up
    on the tid_tx->pending queue instead of letting them
    get to the driver, and add code to recover properly
    in case the driver rejects the session.

    (The patch looks large because it has to move two
    functions to before their new use.)

    Cc: stable@vger.kernel.org
    Reported-by: Emmanuel Grumbach
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

07 Dec, 2011

2 commits

  • The HT mode is set by iw (previous patchsets).
    The interface is set into the specified HT mode.
    HT mode and capabilities are announced in beacons.

    If we add a station that uses HT also, the fastest matching HT mode will
    be used for transmission. That means if we are using HT40+ and we add a station
    running on HT40-, we would transfer at HT20.

    If we join an IBSS with HT40, but the secondary channel is not
    available, we will fall back into HT20 as well.

    Allow frame aggregation to start in IBSS mode.

    Signed-off-by: Alexander Simon
    [siwu@hrz.tu-chemnitz.de: Updates]
    * remove implicit channel_type enum assumptions
    * use rate_control_rate_init() if channel type changed
    * remove channel flags check
    * activate HT IBSS feature support
    * slightly reword commit message
    * rebase on wireless-testing

    Signed-off-by: Simon Wunderlich
    Signed-off-by: Mathias Kretschmer
    Reviewed-by: Johannes Berg
    Signed-off-by: John W. Linville

    Alexander Simon
     
  • * Follow 802.11n-2009 9.13.3.1 for protection mode and ADDBA
    * Send ADDBA only to HT STAs - implement 11.5.1.1 partially

    Signed-off-by: Simon Wunderlich
    Signed-off-by: Mathias Kretschmer
    Reviewed-by: Johannes Berg
    Signed-off-by: John W. Linville

    Simon Wunderlich
     

03 Dec, 2011

1 commit


29 Nov, 2011

5 commits

  • This fixes frequent WARN_ONs when using AP VLAN + aggregation, as these vifs
    are virtual and not registered with drivers.
    Use sta_info_get_bss instead of sta_info_get in aggregation callbacks, so
    that these callbacks can find the station entry when called with the AP vif.

    Signed-off-by: Felix Fietkau
    Signed-off-by: John W. Linville

    Felix Fietkau
     
  • Currently tx aggregation is not being timed out even if timeout is
    specified when aggregation is opened. Tx tid stays active until delba
    arrives from recipient (i.e. recipient times out tid when it is
    inactive).
    The problem with this approach is that delba can get lost in the air
    and tx tid will stay perpetually opened on the originator while closed
    on recipient thus all data sent via this tid will be lost.
    This patch implements tx tid timeouting in way very similar to rx tid
    timeouting.

    Signed-off-by: Nikolay Martynov
    Signed-off-by: John W. Linville

    Nikolay Martynov
     
  • When a packet is supposed to sent be as an a-MPDU, mac80211 sets
    IEEE80211_TX_CTL_AMPDU to let the driver know. On the other
    hand, mac80211 configures the driver for aggregration with the
    ampdu_action callback.
    There is race between these two mechanisms since the following
    scenario can occur when the BA agreement is torn down:

    Tx softIRQ drv configuration
    ========== =================

    check OPERATIONAL bit
    Set the TX_CTL_AMPDU bit in the packet

    clear OPERATIONAL bit
    stop Tx AGG
    Pass Tx packet to the driver.

    In that case the driver would get a packet with TX_CTL_AMPDU set
    although it has already been notified that the BA session has been
    torn down.

    To fix this, we need to synchronize all the Qdisc activity after we
    cleared the OPERATIONAL bit. After that step, all the following
    packets will be buffered until the driver reports it is ready to get
    new packets for this RA / TID. This buffering allows not to run into
    another race that would send packets with TX_CTL_AMPDU unset while
    the driver hasn't been requested to tear down the BA session yet.

    This race occurs in practice and iwlwifi complains with a WARN_ON
    when it happens.

    Cc: stable@kernel.org
    Signed-off-by: Emmanuel Grumbach
    Reviewed-by: Johannes Berg
    Signed-off-by: John W. Linville

    Emmanuel Grumbach
     
  • If addBA responses comes in just after addba_resp_timer has
    expired mac80211 will still accept it and try to open the
    aggregation session. This causes drivers to be confused and
    in some cases even crash.

    This patch fixes the race condition and makes sure that if
    addba_resp_timer has expired addBA response is not longer
    accepted and we do not try to open half-closed session.

    Cc: stable@vger.kernel.org
    Signed-off-by: Nikolay Martynov
    [some adjustments]
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Nikolay Martynov
     
  • Nikolay noticed (by code review) that mac80211 can
    attempt to stop an aggregation session while it is
    already being stopped. So to fix it, check whether
    stop is already being done and bail out if so.

    Also move setting the STOPPING state into the lock
    so things are properly atomic.

    Cc: stable@vger.kernel.org
    Reported-by: Nikolay Martynov
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

23 Nov, 2011

1 commit


09 Nov, 2011

1 commit


01 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
     

15 Sep, 2011

1 commit


14 Sep, 2011

2 commits


23 Aug, 2011

1 commit


09 Aug, 2011

1 commit

  • If we receive an ADDBA response with status code 0 and a buf_size of 0
    we should stop the TX BA session as otherwise we'll end up queuing
    frames in ieee80211_tx_prep_agg forever instead of sending them out as
    non AMPDUs.

    This fixes a problem with AVM Fritz Stick N wireless devices where
    frames to this device are not transmitted anymore by mac80211.

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

    Helmut Schaa
     

21 May, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1446 commits)
    macvlan: fix panic if lowerdev in a bond
    tg3: Add braces around 5906 workaround.
    tg3: Fix NETIF_F_LOOPBACK error
    macvlan: remove one synchronize_rcu() call
    networking: NET_CLS_ROUTE4 depends on INET
    irda: Fix error propagation in ircomm_lmp_connect_response()
    irda: Kill set but unused variable 'bytes' in irlan_check_command_param()
    irda: Kill set but unused variable 'clen' in ircomm_connect_indication()
    rxrpc: Fix set but unused variable 'usage' in rxrpc_get_transport()
    be2net: Kill set but unused variable 'req' in lancer_fw_download()
    irda: Kill set but unused vars 'saddr' and 'daddr' in irlan_provider_connect_indication()
    atl1c: atl1c_resume() is only used when CONFIG_PM_SLEEP is defined.
    rxrpc: Fix set but unused variable 'usage' in rxrpc_get_peer().
    rxrpc: Kill set but unused variable 'local' in rxrpc_UDP_error_handler()
    rxrpc: Kill set but unused variable 'sp' in rxrpc_process_connection()
    rxrpc: Kill set but unused variable 'sp' in rxrpc_rotate_tx_window()
    pkt_sched: Kill set but unused variable 'protocol' in tc_classify()
    isdn: capi: Use pr_debug() instead of ifdefs.
    tg3: Update version to 3.119
    tg3: Apply rx_discards fix to 5719/5720
    ...

    Fix up trivial conflicts in arch/x86/Kconfig and net/mac80211/agg-tx.c
    as per Davem.

    Linus Torvalds
     

17 May, 2011

2 commits

  • This adds sparse RCU annotations to most of
    mac80211, only the mesh code remains to be
    done.

    Due the the previous patches, the annotations
    are pretty simple. The only thing that this
    actually changes is removing the RCU usage of
    key->sta in debugfs since this pointer isn't
    actually an RCU-managed pointer (it only has
    a single assignment done before the key even
    goes live). As that is otherwise harmless, I
    decided to make it part of this patch.

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

    Johannes Berg
     
  • During my quest to make mac80211 not have any RCU
    warnings from sparse, I came across the a-MPDU code
    again and it wasn't quite clear why it isn't racy.
    So instead of assigning the tid_tx array with just
    the spinlock held in ieee80211_start_tx_ba_session
    use a separate temporary array protected only by
    the spinlock and protect all assignments to the
    "live" array by both the spinlock and the mutex so
    that other code is easily verified to be correct.

    Due to pointer assignment atomicity I don't think
    this is a real issue, but I'm not sure, especially
    on Alpha the current code might be problematic.

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

    Johannes Berg
     

08 May, 2011

1 commit


20 Jan, 2011

2 commits

  • Currently, mac80211 always advertises that it may send
    up to 64 subframes in an aggregate. This is fine, since
    it's the max, but might as well be set to zero instead
    since it doesn't have any information.

    However, drivers might have that information, so allow
    them to set a variable giving it, which will then be
    used. The default of zero will be fine since to the
    peer that means we don't know and it will just use its
    own limit for the buffer size.

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

    Johannes Berg
     
  • The aggregation code currently doesn't implement the
    buffer size negotiation. It will always request a max
    buffer size (which is fine, if a little pointless, as
    the mac80211 code doesn't know and might just use 0
    instead), but if the peer requests a smaller size it
    isn't possible to honour this request.

    In order to fix this, look at the buffer size in the
    addBA response frame, keep track of it and pass it to
    the driver in the ampdu_action callback when called
    with the IEEE80211_AMPDU_TX_OPERATIONAL action. That
    way the driver can limit the number of subframes in
    aggregates appropriately.

    Note that this doesn't fix any drivers apart from the
    addition of the new argument -- they all need to be
    updated separately to use this variable!

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

    Johannes Berg
     

16 Dec, 2010

1 commit

  • Allow drivers or rate control algorithms to specify BlockAck session
    timeout when initiating an ADDBA transaction. This is useful in cases
    where maintaining persistent BA sessions does not incur any overhead.

    The current timeout value of 5000 TUs is retained for all non ath9k/ath9k_htc
    drivers.

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

    Sujith Manoharan
     

07 Oct, 2010

2 commits

  • 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
     
  • We never delete the addBA response timer, which
    is typically fine, but if the station it belongs
    to is deleted very quickly after starting the BA
    session, before the peer had a chance to reply,
    the timer may fire after the station struct has
    been freed already. Therefore, we need to delete
    the timer in a suitable spot -- best when the
    session is being stopped (which will happen even
    then) in which case the delete will be a no-op
    most of the time.

    I've reproduced the scenario and tested the fix.

    This fixes the crash reported at
    http://mid.gmane.org/4CAB6F96.6090701@candelatech.com

    Cc: stable@kernel.org
    Reported-by: Ben Greear
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

15 Jun, 2010

9 commits

  • Even before the recent changes, the documentation
    for TX aggregation was somewhat out of date. Update
    it and also add documentation for the RX side.

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

    Johannes Berg
     
  • To prepare for allowing drivers to sleep in
    ampdu_action, change the locking in the TX
    aggregation code to use the mutex the RX part
    already uses. The spinlock is still necessary
    around some code to avoid races with TX, but
    now we can also synchronize_net() to avoid
    getting an inconsistent sequence number.

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

    Johannes Berg
     
  • Since we want the code to be able to sleep
    in the future, it must not be called from
    the timer directly. To achieve that, simply
    call the function drivers would call, and
    also use RCU in the timer to get the struct
    so we don't need to rely on the spinlock in
    the future.

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

    Johannes Berg
     
  • Move the block-ack session works into common
    code, since it will be needed for RX agg too
    in the next patches.

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

    Johannes Berg
     
  • When the driver or rate control requests starting
    or stopping an aggregation session, that currently
    causes a direct callback into the driver, which
    could potentially cause locking problems. Also,
    the functions need to be callable from contexts
    that cannot sleep, and thus will interfere with
    making the ampdu_action callback sleeping.

    To address these issues, add a new work item for
    each station that will process any start or stop
    requests out of line.

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

    Johannes Berg
     
  • mac80211 currently maintains the ampdu_lock to
    avoid starting a queue due to one aggregation
    session while another aggregation session needs
    the queue stopped.

    We can do better, however, and instead refcount
    the queue stops for this particular purpose,
    thus removing the need for the lock. This will
    help making ampdu_action able to sleep.

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

    Johannes Berg
     
  • The non-irqsafe aggregation start/stop done
    callbacks are currently only used by ath9k_htc,
    and can cause callbacks into the driver again.
    This might lead to locking issues, which will
    only get worse as we modify locking. To avoid
    trouble, remove the non-irqsafe versions and
    change ath9k_htc to use those instead.

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

    Johannes Berg
     
  • Currently we allocate some memory for each TX
    aggregation session and additionally keep a
    state bitmap indicating the state it is in.
    By using RCU to protect the pointer, moving
    the state into the structure and some locking
    trickery we can avoid locking when the TX agg
    session is fully operational.

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

    Johannes Berg
     
  • This moves the aggregation callback processing
    to the per-sdata skb queue and a work function
    rather than the tasklet.

    Unfortunately, this means that it extends the
    pkt_type hack to that skb queue. However, it
    will enable making ampdu_action API changes
    gradually, my current plan is to get rid of
    this again by forcing drivers to only return
    from ampdu_action() when everything is done,
    thus removing the callbacks completely.

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

    Johannes Berg