16 Mar, 2017

1 commit


06 Mar, 2017

1 commit

  • As moving average is not considering fractional part, it will
    get stuck at the same level after certain state. For example,
    with current values, it can get stuck at 96. Fortunately the
    current threshold 95%, but if it were increased to 96 or more
    mesh paths would never be deactivated. Fix failure average
    movement by using EWMA helpers, which does take into account
    fractional parts.

    Signed-off-by: Rajkumar Manoharan
    [johannes: pick a larger EWMA factor for more precision with
    the limited range that we will feed into it, adjust to new API]
    Signed-off-by: Johannes Berg

    Manoharan, Rajkumar
     

12 Sep, 2016

1 commit

  • A fixed mpath was not quite being treated as such:

    1) if a PERR frame was received, a fixed mpath was
    deactivated.

    2) queued path discovery for fixed mpath was potentially
    being considered, changing mpath state.

    3) other mpath flags were potentially being inherited when
    fixing the mpath. Just assign PATH_FIXED and SN_VALID.

    This solves several issues when fixing a mesh path in one
    direction. The reverse direction mpath should probably
    also be fixed, or root announcements at least be enabled.

    Signed-off-by: Thomas Pedersen
    Signed-off-by: Johannes Berg

    Pedersen, Thomas
     

06 Apr, 2016

2 commits

  • Since we have converted the mesh path tables to rhashtable, we are
    no longer swapping out the entire mesh_pathtbl pointer with RCU.
    As a result, we no longer need indirection to the hlist head for
    the gates list and can simply embed it, saving a pair of
    pointer-sized allocations.

    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     
  • The mesh_path_reclaim() function, called from an rcu callback, cancels
    the mesh_path_timer associated with a mesh path. Unfortunately, this
    call can happen much later, perhaps after the hash table itself is
    destroyed.

    Such a situation led to the following crash in mesh_path_send_to_gates()
    when dereferencing the tbl pointer:

    [ 23.901661] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
    [ 23.905516] IP: [] mesh_path_send_to_gates+0x2b/0x740
    [ 23.908757] PGD 99ca067 PUD 99c4067 PMD 0
    [ 23.910789] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
    [ 23.913485] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.5.0-rc6-wt+ #43
    [ 23.916675] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
    [ 23.920471] task: ffffffff81685500 ti: ffffffff81678000 task.ti: ffffffff81678000
    [ 23.922619] RIP: 0010:[] [] mesh_path_send_to_gates+0x2b/0x740
    [ 23.925237] RSP: 0018:ffff88000b403d30 EFLAGS: 00010286
    [ 23.926739] RAX: 0000000000000000 RBX: ffff880009bc0d20 RCX: 0000000000000102
    [ 23.928796] RDX: 000000000000002e RSI: 0000000000000001 RDI: ffff880009bc0d20
    [ 23.930895] RBP: ffff88000b403e18 R08: 0000000000000001 R09: 0000000000000001
    [ 23.932917] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880009c20940
    [ 23.936370] R13: ffff880009bc0e70 R14: ffff880009c21c40 R15: ffff880009bc0d20
    [ 23.939823] FS: 0000000000000000(0000) GS:ffff88000b400000(0000) knlGS:0000000000000000
    [ 23.943688] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 23.946429] CR2: 0000000000000008 CR3: 00000000099c5000 CR4: 00000000000006b0
    [ 23.949861] Stack:
    [ 23.950840] 000000000000002e ffff880009c20940 ffff88000b403da8 ffffffff8109e551
    [ 23.954467] ffffffff82711be2 000000000000002e 0000000000000000 ffffffff8166a5f5
    [ 23.958141] 0000000000685ce8 0000000000000246 ffff880009bc0d20 ffff880009c20940
    [ 23.961801] Call Trace:
    [ 23.962987]
    [ 23.963963] [] ? vprintk_emit+0x351/0x5e0
    [ 23.966782] [] ? vprintk_default+0x1f/0x30
    [ 23.969529] [] ? printk+0x48/0x50
    [ 23.971956] [] mesh_path_timer+0x133/0x160
    [ 23.974707] [] ? mesh_nexthop_resolve+0x230/0x230
    [ 23.977775] [] call_timer_fn+0xce/0x330
    [ 23.980448] [] ? call_timer_fn+0x5/0x330
    [ 23.983126] [] ? mesh_nexthop_resolve+0x230/0x230
    [ 23.986091] [] run_timer_softirq+0x22c/0x390

    Instead of cancelling in the RCU callback, set a new flag to prevent the
    timer from being rearmed, and then cancel the timer synchronously when
    freeing the mesh path. This leaves mesh_path_reclaim() doing nothing
    but kfree, so switch to kfree_rcu().

    Fixes: 3b302ada7f0a ("mac80211: mesh: move path tables into if_mesh")
    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     

05 Apr, 2016

5 commits

  • In the time since the mesh path table was implemented as an
    RCU-traversable, dynamically growing hash table, a generic RCU
    hashtable implementation was added to the kernel.

    Switch the mesh path table over to rhashtable to remove some code
    and also gain some features like automatic shrinking.

    Cc: Thomas Graf
    Cc: netdev@vger.kernel.org
    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     
  • The mesh path table uses a struct mesh_node in its hlists in
    order to support a resizable hash table: the mesh_node provides
    an indirection to the actual mesh path so that two different
    bucket lists can point to the same path entry.

    However, for the known gates list, we don't need this indirection
    because there is ever only one list. So we can just embed the
    hlist_node in the mesh path itself, which simplifies things a bit
    and saves a linear search whenever we need to find an item in
    the list.

    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     
  • Remove duplicate code to allocate and initialize a mesh
    path or mesh proxy path.

    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     
  • Now that the sdata pointer is the same for all entries of a
    path table, hashing it is pointless, so hash only the address.

    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     
  • The mesh path and mesh gate hashtables are global, containing
    all of the mpaths for every mesh interface, but the paths are
    all tied logically to a single interface. The common case is
    just a single mesh interface, so optimize for that by moving
    the global hashtable into the per-interface struct.

    Doing so allows us to drop sdata pointer comparisons inside
    the lookups and also saves a few bytes of BSS and data.

    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     

24 Feb, 2016

4 commits


04 Dec, 2015

1 commit


17 Nov, 2015

1 commit

  • When using call_rcu(), the called function may be delayed quite
    significantly, and without a matching rcu_barrier() there's no
    way to be sure it has finished.
    Therefore, global state that could be gone/freed/reused should
    never be touched in the callback.

    Fix this in mesh by moving the atomic_dec() into the caller;
    that's not really a problem since we already unlinked the path
    and it will be destroyed anyway.

    This fixes a crash Jouni observed when running certain tests in
    a certain order, in which the mesh interface was torn down, the
    memory reused for a function pointer (work struct) and running
    that then crashed since the pointer had been decremented by 1,
    resulting in an invalid instruction byte stream.

    Cc: stable@vger.kernel.org
    Fixes: eb2b9311fd00 ("mac80211: mesh path table implementation")
    Reported-by: Jouni Malinen
    Signed-off-by: Johannes Berg

    Johannes Berg
     

09 Oct, 2014

1 commit


27 Aug, 2014

1 commit

  • The "rcu_dereference()" calls are used directly in conditions.
    Since their return values are never dereferenced it is recommended to
    use "rcu_access_pointer()" instead of "rcu_dereference()".
    Therefore, this patch makes the replacements.

    The following Coccinelle semantic patch was used:
    @@
    @@

    (
    if(
    ()) {...}
    |
    while(
    ()) {...}
    )

    Signed-off-by: Andreea-Cristina Bernat
    Signed-off-by: Johannes Berg

    Andreea-Cristina Bernat
     

29 Apr, 2014

1 commit

  • These BUG_ON statements should never trigger, but in the unlikely
    event that somebody does manage don't stop everything but simply
    exit the code path with an error.

    Leave the one BUG_ON where changing it would result in a NULL
    pointer dereference.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

26 Nov, 2013

1 commit


08 Apr, 2013

1 commit

  • Most times that mesh_path_add() is called, it is followed by
    a lookup to get the just-added mpath. We can instead just
    return the new mpath in the case that we allocated one (or the
    existing one if already there), so do that. Also, reorder the
    code in mesh_path_add a bit so that we don't need to allocate
    in the pre-existing case.

    Signed-off-by: Bob Copeland
    Signed-off-by: Johannes Berg

    Bob Copeland
     

28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

15 Feb, 2013

2 commits


05 Feb, 2013

1 commit

  • Add routines to
    - maintain a PS mode for each peer and a non-peer PS mode
    - indicate own PS mode in transmitted frames
    - track neighbor STAs power modes
    - buffer frames when neighbors are in PS mode
    - add TIM and Awake Window IE to beacons
    - release frames in Mesh Peer Service Periods

    Add local_pm to sta_info to represent the link-specific power
    mode at this station towards the remote station. When a peer
    link is established, use the default power mode stored in mesh
    config. Update the PS status if the peering status of a neighbor
    changes.
    Maintain a mesh power mode for non-peer mesh STAs. Set the
    non-peer power mode to active mode during peering. Authenticated
    mesh peering is currently not working when either node is
    configured to be in power save mode.

    Indicate the current power mode in transmitted frames. Use QoS
    Nulls to indicate mesh power mode transitions.
    For performance reasons, calls to the function setting the frame
    flags are placed in HWMP routing routines, as there the STA
    pointer is already available.

    Add peer_pm to sta_info to represent the peer's link-specific
    power mode towards the local station. Add nonpeer_pm to
    represent the peer's power mode towards all non-peer stations.
    Track power modes based on received frames.

    Add the ps_data structure to ieee80211_if_mesh (for TIM map, PS
    neighbor counter and group-addressed frame buffer).

    Set WLAN_STA_PS flag for STA in PS mode to use the unicast frame
    buffering routines in the tx path. Update num_sta_ps to buffer
    and release group-addressed frames after DTIM beacons.

    Announce the awake window duration in beacons if in light or
    deep sleep mode towards any peer or non-peer. Create a TIM IE
    similarly to AP mode and add it to mesh beacons. Parse received
    Awake Window IEs and check TIM IEs for buffered frames.

    Release frames towards peers in mesh Peer Service Periods. Use
    the corresponding trigger frames and monitor the MPSP status.
    Append a QoS Null as trigger frame if neccessary to properly end
    the MPSP. Currently, in HT channels MPSPs behave imperfectly and
    show large delay spikes and frame losses.

    Signed-off-by: Marco Porsch
    Signed-off-by: Ivan Bezyazychnyy
    Signed-off-by: Mike Krinkin
    Signed-off-by: Max Filippov
    Signed-off-by: Johannes Berg

    Marco Porsch
     

20 Aug, 2012

2 commits


31 Jul, 2012

1 commit


11 Jul, 2012

1 commit


24 Jun, 2012

1 commit

  • There are a few things that make the logging and
    debugging in mac80211 less useful than it should
    be right now:
    * a lot of messages should be pr_info, not pr_debug
    * wholesale use of pr_debug makes it require *both*
    Kconfig and dynamic configuration
    * there are still a lot of ifdefs
    * the style is very inconsistent, sometimes the
    sdata->name is printed in front

    Clean up everything, introducing new macros and
    separating out the station MLME debugging into
    a new Kconfig symbol.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

06 Jun, 2012

1 commit


10 May, 2012

1 commit

  • Use the new bool function ether_addr_equal to add
    some clarity and reduce the likelihood for misuse
    of compare_ether_addr for sorting.

    Done via cocci script:

    $ cat compare_ether_addr.cocci
    @@
    expression a,b;
    @@
    - !compare_ether_addr(a, b)
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - compare_ether_addr(a, b)
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) == 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) != 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) == 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) != 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !!ether_addr_equal(a, b)
    + ether_addr_equal(a, b)

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

13 Apr, 2012

1 commit


21 Mar, 2012

1 commit

  • Pull networking merge from David Miller:
    "1) Move ixgbe driver over to purely page based buffering on receive.
    From Alexander Duyck.

    2) Add receive packet steering support to e1000e, from Bruce Allan.

    3) Convert TCP MD5 support over to RCU, from Eric Dumazet.

    4) Reduce cpu usage in handling out-of-order TCP packets on modern
    systems, also from Eric Dumazet.

    5) Support the IP{,V6}_UNICAST_IF socket options, making the wine
    folks happy, from Erich Hoover.

    6) Support VLAN trunking from guests in hyperv driver, from Haiyang
    Zhang.

    7) Support byte-queue-limtis in r8169, from Igor Maravic.

    8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but
    was never properly implemented, Jiri Benc fixed that.

    9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang.

    10) Support kernel side dump filtering by ctmark in netfilter
    ctnetlink, from Pablo Neira Ayuso.

    11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker.

    12) Add new peek socket options to assist with socket migration, from
    Pavel Emelyanov.

    13) Add sch_plug packet scheduler whose queue is controlled by
    userland daemons using explicit freeze and release commands. From
    Shriram Rajagopalan.

    14) Fix FCOE checksum offload handling on transmit, from Yi Zou."

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits)
    Fix pppol2tp getsockname()
    Remove printk from rds_sendmsg
    ipv6: fix incorrent ipv6 ipsec packet fragment
    cpsw: Hook up default ndo_change_mtu.
    net: qmi_wwan: fix build error due to cdc-wdm dependecy
    netdev: driver: ethernet: Add TI CPSW driver
    netdev: driver: ethernet: add cpsw address lookup engine support
    phy: add am79c874 PHY support
    mlx4_core: fix race on comm channel
    bonding: send igmp report for its master
    fs_enet: Add MPC5125 FEC support and PHY interface selection
    net: bpf_jit: fix BPF_S_LDX_B_MSH compilation
    net: update the usage of CHECKSUM_UNNECESSARY
    fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx
    net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso
    ixgbe: Fix issues with SR-IOV loopback when flow control is disabled
    net/hyperv: Fix the code handling tx busy
    ixgbe: fix namespace issues when FCoE/DCB is not enabled
    rtlwifi: Remove unused ETH_ADDR_LEN defines
    igbvf: Use ETH_ALEN
    ...

    Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and
    drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.

    Linus Torvalds
     

08 Mar, 2012

1 commit

  • smatch was complaining:

    CHECK net/mac80211/mesh_pathtbl.c
    net/mac80211/mesh_pathtbl.c:562 mesh_path_add() error: double lock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:580 mesh_path_add() error: double unlock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:589 mesh_path_add() error: double unlock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:691 mpp_path_add() error: double lock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:707 mpp_path_add() error: double unlock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:716 mpp_path_add() error: double unlock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:814 mesh_path_flush_by_nexthop() error:
    double lock 'bottom_half:'
    net/mac80211/mesh_pathtbl.c:819 mesh_path_flush_by_nexthop() error:
    double unlock 'bottom_half:'
    net/mac80211/mesh_pathtbl.c:887 mesh_path_del() error: double lock
    'bottom_half:'
    net/mac80211/mesh_pathtbl.c:901 mesh_path_del() error: double unlock
    'bottom_half:'

    So don't lock / unlock with _bh() while bottom halves are already
    disabled.

    Reported-by: Johannes Berg
    Signed-off-by: Thomas Pedersen
    Signed-off-by: John W. Linville

    Thomas Pedersen
     

06 Mar, 2012

1 commit


22 Feb, 2012

1 commit


09 Feb, 2012

1 commit

  • If you want to use mesh support from mac80211 on a recent
    kernel on 2.6.24 you'll run into a name clash when compiling
    against include/linux/namei.h, so rename this routine.

    /home/mcgrof/tmp/compat-wireless-3.2.5-1/net/mac80211/mesh_pathtbl.c: At top level:
    /home/mcgrof/tmp/compat-wireless-3.2.5-1/net/mac80211/mesh_pathtbl.c:342:26: error: conflicting types for ‘path_lookup’
    include/linux/namei.h:71:12: note: previous declaration of ‘path_lookup’ was here

    Although this could sit as a separate patch in compat-wireless it seems
    best to just merge upstream.

    Cc: Javier Cardona
    Signed-off-by: Luis R. Rodriguez
    Acked-by: Javier Cardona
    Signed-off-by: John W. Linville

    Luis R. Rodriguez
     

29 Nov, 2011

2 commits