06 Mar, 2017

2 commits

  • Sharing DFS channel state across multiple wiphys (radios) could
    be useful with multiple radios on the system. When one radio
    completes CAC and markes the channel available another radio
    can use this information and start beaconing without really doing
    CAC.

    Whenever there is a state change in dfs channel associated to
    a particular wiphy the the same state change is propagated to
    other wiphys having the same DFS reg domain configuration.
    Also when a new wiphy is created the dfs channel state of
    other existing wiphys of same DFS domain is copied.

    Signed-off-by: Vasanthakumar Thiagarajan
    Signed-off-by: Johannes Berg

    Vasanthakumar Thiagarajan
     
  • DFS requirement for ETSI domain (section 4.7.1.4 in
    ETSI EN 301 893 V1.8.1) is the only one which explicitly
    states that once DFS channel is marked as available afer
    the CAC, this channel will remain in available state even
    moving to a different operating channel. But the same is
    not explicitly stated in FCC DFS requirement. Also, Pre-CAC
    requriements are not explicitly mentioned in FCC requirement.
    Current implementation in keeping DFS channel in available
    state is same as described in ETSI domain.

    For non-ETSI DFS domain, this patch gives a grace period of 2 seconds
    since the completion of successful CAC before moving the channel's
    DFS state to 'usable' from 'available' state. The same grace period
    is checked against the channel's dfs_state_entered timestamp while
    deciding if a DFS channel is available for operation. There is a new
    radar event, NL80211_RADAR_PRE_CAC_EXPIRED, reported when DFS channel
    is moved from available to usable state after the grace period. Also
    make sure the DFS channel state is reset to usable once the beaconing
    operation on that channel is brought down (like stop_ap, leave_ibss
    and leave_mesh) in non-ETSI domain.

    Signed-off-by: Vasanthakumar Thiagarajan
    Signed-off-by: Johannes Berg

    Vasanthakumar Thiagarajan
     

12 Apr, 2016

1 commit

  • This enum is already perfectly aliased to enum nl80211_band, and
    the only reason for it is that we get IEEE80211_NUM_BANDS out of
    it. There's no really good reason to not declare the number of
    bands in nl80211 though, so do that and remove the cfg80211 one.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

01 Apr, 2015

1 commit

  • Patch eeca9fce1d71a4955855ceb0c3b13c1eb9db27c1 (cfg80211: Schedule
    timeout for all CRDA call) introduced a regression, where in case
    that crda is not installed (or not configured properly etc.), the
    regulatory core will needlessly continue to call it, polluting the
    log with the following log:

    "cfg80211: Calling CRDA to update world regulatory domain"

    Fix this by limiting the number of continuous CRDA request failures.

    Signed-off-by: Ilan Peer
    Signed-off-by: Johannes Berg

    Ilan peer
     

06 Mar, 2015

1 commit

  • Previously, the indoor setting configuration assumed that as
    long as a station interface is connected, the indoor environment
    setting does not change. However, this assumption is problematic
    as:

    - It is possible that a station interface is connected to a mobile
    AP, e.g., softAP or a P2P GO, where it is possible that both the
    station and the mobile AP move out of the indoor environment making
    the indoor setting invalid. In such a case, user space has no way to
    invalidate the setting.
    - A station interface disconnection does not necessarily imply that
    the device is no longer operating in an indoor environment, e.g.,
    it is possible that the station interface is roaming but is still
    stays indoor.

    To handle the above, extend the indoor configuration API to allow
    user space to indicate a change of indoor settings, and allow it to
    indicate weather it controls the indoor setting, such that:

    1. If the user space process explicitly indicates that it is going
    to control the indoor setting, do not clear the indoor setting
    internally, unless the socket is released. The user space process
    should use the NL80211_ATTR_SOCKET_OWNER attribute in the command
    to state that it is going to control the indoor setting.
    2. Reset the indoor setting when restoring the regulatory settings in
    case it is not owned by a user space process.

    Based on the above, a user space tool that continuously monitors the
    indoor settings, i.e., tracking power setting, location etc., can
    indicate environment changes to the regulatory core.

    It should be noted that currently user space is the only provided mechanism
    used to hint to the regulatory core over the indoor/outdoor environment --
    while the country IEs do have an environment setting this has been completely
    ignored by the regulatory core by design for a while now since country IEs
    typically can contain bogus data.

    Acked-by: Luis R. Rodriguez
    Signed-off-by: ArikX Nemtsov
    Signed-off-by: Ilan Peer
    Signed-off-by: Johannes Berg

    Ilan peer
     

17 Dec, 2014

1 commit

  • If a wiphy-idx is specified, the kernel will return the wiphy specific
    regdomain, if such exists. Otherwise return the global regdom.

    When no wiphy-idx is specified, return the global regdomain as well as
    all wiphy-specific regulatory domains in the system, via a new nested
    list of attributes.

    Add a new attribute for each wiphy-specific regdomain, for usermode to
    identify it as such.

    Signed-off-by: Arik Nemtsov
    Signed-off-by: Johannes Berg

    Arik Nemtsov
     

09 Apr, 2014

3 commits

  • Allow GO operation on a channel marked with IEEE80211_CHAN_INDOOR_ONLY
    iff there is a user hint indicating that the platform is operating in
    an indoor environment, i.e., the platform is a printer or media center
    device.

    Signed-off-by: Ilan Peer
    Signed-off-by: Johannes Berg

    Ilan Peer
     
  • Add the option to hint the wireless core that it is operating in an indoor
    environment.

    Signed-off-by: Ilan Peer
    Signed-off-by: Johannes Berg

    Ilan Peer
     
  • Allow GO operation on a channel marked with IEEE80211_CHAN_GO_CONCURRENT
    iff there is an active station interface that is associated to
    an AP operating on the same channel in the 2 GHz band or the same UNII band
    (in the 5 GHz band). This relaxation is not allowed if the channel is
    marked with IEEE80211_CHAN_RADAR.

    Note that this is a permissive approach to the FCC definitions,
    that require a clear assessment that the device operating the AP is
    an authorized master, i.e., with radar detection and DFS capabilities.

    It is assumed that such restrictions are enforced by user space.
    Furthermore, it is assumed, that if the conditions that allowed for
    the operation of the GO on such a channel change, i.e., the station
    interface disconnected from the AP, it is the responsibility of user
    space to evacuate the GO from the channel.

    Signed-off-by: Ilan Peer
    Signed-off-by: Johannes Berg

    Ilan Peer
     

25 Feb, 2014

1 commit


05 Feb, 2014

1 commit

  • In case we will get regulatory request with rule
    where max_bandwidth_khz is set to 0 handle this
    case as a special one.

    If max_bandwidth_khz == 0 we should calculate maximum
    available bandwidth base on all frequency contiguous rules.
    In case we need auto calculation we just have to set:

    country PL: DFS-ETSI
    (2402 - 2482 @ 40), (N/A, 20)
    (5170 - 5250 @ AUTO), (N/A, 20)
    (5250 - 5330 @ AUTO), (N/A, 20), DFS
    (5490 - 5710 @ 80), (N/A, 27), DFS

    This mean we will calculate maximum bw for rules where
    AUTO (N/A) were set, 160MHz (5330 - 5170) in example above.
    So we will get:
    (5170 - 5250 @ 160), (N/A, 20)
    (5250 - 5330 @ 160), (N/A, 20), DFS

    In other case:
    country FR: DFS-ETSI
    (2402 - 2482 @ 40), (N/A, 20)
    (5170 - 5250 @ AUTO), (N/A, 20)
    (5250 - 5330 @ 80), (N/A, 20), DFS
    (5490 - 5710 @ 80), (N/A, 27), DFS

    We will get 80MHz (5250 - 5170):
    (5170 - 5250 @ 80), (N/A, 20)
    (5250 - 5330 @ 80), (N/A, 20), DFS

    Base on this calculations we will set correct channel
    bandwidth flags (eg. IEEE80211_CHAN_NO_80MHZ).

    We don't need any changes in CRDA or internal regulatory.

    Signed-off-by: Janusz Dziedzic
    [extend nl80211 description a bit, fix typo]
    Signed-off-by: Johannes Berg

    Janusz Dziedzic
     

03 Dec, 2013

1 commit

  • This can be used outside of the regulatory context for any checks
    on the DFS region. The central cfg80211 dfs_region is always used
    and if it does not match with the wiphy a debug print is issued.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Johannes Berg

    Luis R. Rodriguez
     

26 Nov, 2013

2 commits


09 Oct, 2013

1 commit


03 Jan, 2013

3 commits

  • To simplify the locking and not require cfg80211_mutex
    (which nl80211 uses to access the global regdomain) and
    also to make it possible for drivers to access their
    wiphy->regd safely, use RCU to protect these pointers.

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

    Johannes Berg
     
  • There's a bug with the world regulatory domain, it
    can be updated any time which is different from all
    other regdomains that can only be updated once after
    a request for them. Fix this by adding a check for
    "processed" to the reg_is_valid_request() function
    and clear that when doing a request.

    While looking at this I also found another locking
    bug, last_request is protected by the reg_mutex not
    the cfg80211_mutex so the code in nl80211 is racy.
    Remove that code as it only tries to prevent an
    allocation in an error case, which isn't necessary.
    Then the function can also become static and locking
    in nl80211 can have a smaller scope.

    Also change __set_regdom() to do the checks earlier
    and not different for world/other regdomains.

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

    Johannes Berg
     
  • Clean up various things like indentation, extra
    parentheses, too many/few line breaks, etc.

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

    Johannes Berg
     

30 Nov, 2012

1 commit

  • When a BSS struct is updated, the IEs are currently
    overwritten or freed. This can lead to races if some
    other CPU is accessing the BSS struct and using the
    IEs concurrently.

    Fix this by always allocating the IEs in a new struct
    that holds the data and length and protecting access
    to this new struct with RCU.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

17 Jul, 2012

3 commits

  • Now that we have wiphy_regulatory_register() we can
    tuck away the core's regulatory_update() call there
    and make it static.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Johannes Berg

    Luis R. Rodriguez
     
  • This makes it clearer what we're doing. This now makes a bit
    more sense given that regardless of the wiphy if the cell
    base station hint feature is supported we will be modifying the
    way the regulatory core behaves.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Johannes Berg

    Luis R. Rodriguez
     
  • Cellular base stations can provide hints to cfg80211 about
    where they think we are. This can be done for example on
    a cell phone. To enable these hints we simply allow them
    through as user regulatory hints but we allow userspace
    to clasify the hint as either coming directly from the
    user or coming from a cellular base station. This option
    is only available when you enable
    CONFIG_CFG80211_CERTIFICATION_ONUS.

    The base station hints themselves will not be processed
    by the core unless at least one device on the system
    supports this feature.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Johannes Berg

    Luis R. Rodriguez
     

05 Jan, 2012

1 commit

  • Following the tradition we have had with ath5k, ath9k, CRDA,
    wireless-regdb I'd like to license this code under the permissive ISC
    license for the code sharing purposes with other OSes, it'd sure be nice
    to help the landscape in this area. Although I am %82.89 owner of the
    regulatory code I have asked every contributor to the regulatory code
    and have receieved positive Acked-bys from everyone except two deceased
    entities:

    o Frans Pop RIP 2010 [0]
    - Frans Pop
    - Frans Pop
    o Nokia RIP February, 11, 2011 [1], [2]
    - ext-yuri.ershov@nokia.com
    - kalle.valo@nokia.com

    Frans Pop's contribution was a simple patch 55f98938, titled,
    "wireless: remove trailing space in messages" which just add a \n
    to some printk lines. I'm going to treat these additions as
    uncopyrightable.

    As for the contributions made by employees on behalf of Nokia
    my contact point was Petri Karhula but
    after one month he noted he had not been able to get traction from the
    legal department on this request, as such it I proceeded by replacing
    their contributions in previous patches.

    The end goal is to help a clean rewrite that starts in userspace
    that is shared under ISC license which currently is taking place with
    the regulatory simulator [3].

    [0] http://lists.debian.org/debian-devel/2011/12/msg00263.html
    [1] http://press.nokia.com/2011/02/11/nokia-outlines-new-strategy-introduces-new-leadership-operational-structure/
    [2] http://NokiaPlanB.com
    [3] git://github.com/mcgrof/regsim.git

    Acked-by: Thadeu Lima de Souza Cascardo
    Acked-by: Dan Carpenter
    Acked-by: Mihai Moldovan
    Acked-by: Uwe Kleine-König
    Acked-by: Sven Neumann
    Acked-by: Johannes Berg
    Acked-by: Tomas Winkler
    Acked-by: Tony Vroon
    Acked-by: Pavel Roskin
    Acked-by: Bob Copeland
    Acked-by: Lucas De Marchi
    Acked-by: Pat Erley
    Acked-by: Tejun Heo
    Acked-by: John W. Linville
    Acked-by: Chris Wright
    Acked-by: Joe Perches
    Acked-by: Paul Gortmaker
    Acked-by: John Gordon
    Acked-by: Simon Barber
    Acked-by: Rajkumar Manoharan
    Acked-by: Jiri Benc
    Acked-by: Bruno Randolf
    Acked-by: Scott James Remnant
    Acked-by: Roel Kluin
    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: John W. Linville

    Luis R. Rodriguez
     

22 Nov, 2011

1 commit

  • The wireless-regdb now has support for mapping a country to
    one DFS region. CRDA sends this to us now so process it
    so we can provide that hint to drivers. This will later be
    used by code for processing DFS in a way that meets the
    criteria for the DFS region the country belongs to.

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

    Luis R. Rodriguez
     

15 Sep, 2011

1 commit

  • The function wiphy_update_regulatory() uses the static variable
    last_request and thus needs to be called with reg_mutex held.
    This is the case for all users in reg.c, but the function was
    exported for use by wiphy_register(), from where it is called
    without the lock being held.

    Fix this by making wiphy_update_regulatory() private and introducing
    regulatory_update() as a wrapper that acquires and holds the lock.

    Signed-off-by: Sven Neumann
    Cc: John W. Linville
    Cc: Luis R. Rodriguez
    Cc: Daniel Mack
    Cc: linux-wireless@vger.kernel.org
    Acked-by: Luis R. Rodriguez
    Signed-off-by: John W. Linville

    Sven Neumann
     

10 Mar, 2011

1 commit

  • Regulatory devices issue change uevents to inform userspace of a need
    to call the crda tool; however these can often be sent before udevd is
    running, and were not previously included in the results of
    udevadm trigger (which requests a new change event using the /uevent
    attribute of the sysfs object).

    Add a uevent function to the device type which includes the COUNTRY
    information from the last request if it has yet to be processed, the
    case of multiple requests is already handled in the code by checking
    whether an unprocessed one is queued in the same manner and refusing
    to queue a new one.

    The existing udev rule continues to work as before.

    Signed-off-by: Scott James Remnant
    Acked-By: Kay Sievers
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: John W. Linville

    Scott James Remnant
     

19 Jun, 2010

1 commit


02 Feb, 2010

1 commit

  • This adds a new regulatory hint to be used when we know all
    devices have been disconnected and idle. This can happen
    when we suspend, for instance. When we disconnect we can
    no longer assume the same regulatory rules learned from
    a country IE or beacon hints are applicable so restore
    regulatory settings to an initial state.

    Since driver hints are cached on the wiphy that called
    the hint, those hints are not reproduced onto cfg80211
    as the wiphy will respect its own wiphy->regd regardless.

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

    Luis R. Rodriguez
     

16 Jan, 2010

1 commit

  • In practice APs do not send country IE channel triplets for channels
    the AP is not operating on and if they were to do so they would have
    to use the regulatory extension which we currently do not process.
    No AP has been seen in practice that does this though so just drop
    those country IEs.

    Additionally it has been noted the first series of country IE
    channels triplets are specific to the band the AP sends. Propagate
    the band on which the country IE was found on reject the country
    IE then if the triplets are ever oustide of the band.

    Although we now won't process country IE information with multiple
    band information we leave the intersection work as is as it is
    technically possible for someone to want to eventually process these
    type of country IEs with regulatory extensions.

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

    Luis R. Rodriguez
     

13 Aug, 2009

1 commit


05 Aug, 2009

1 commit

  • Since the bss is always set now once we are connected, if the
    bss has its own information element we refer to it and pass that
    instead of relying on mac80211's parsing.

    Now all cfg80211 drivers get country IE support, automatically and
    we reduce the call overhead that we had on mac80211 which called this
    upon every beacon and instead now call this only upon a successfull
    connection by a STA on cfg80211.

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

    Luis R. Rodriguez
     

04 Aug, 2009

1 commit

  • A regression was added through patch a4ed90d6:

    "cfg80211: respect API on orig_flags on channel for beacon hint"

    We did indeed respect _orig flags but the intention was not clearly
    stated in the commit log. This patch fixes firmware issues picked
    up by iwlwifi when we lift passive scan of beaconing restrictions
    on channels its EEPROM has been configured to always enable.

    By doing so though we also disallowed beacon hints on devices
    registering their wiphy with custom world regulatory domains
    enabled, this happens to be currently ath5k, ath9k and ar9170.
    The passive scan and beacon restrictions on those devices would
    never be lifted even if we did find a beacon and the hardware did
    support such enhancements when world roaming.

    Since Johannes indicates iwlwifi firmware cannot be changed to
    allow beacon hinting we set up a flag now to specifically allow
    drivers to disable beacon hints for devices which cannot use them.

    We enable the flag on iwlwifi to disable beacon hints and by default
    enable it for all other drivers. It should be noted beacon hints lift
    passive scan flags and beacon restrictions when we receive a beacon from
    an AP on any 5 GHz non-DFS channels, and channels 12-14 on the 2.4 GHz
    band. We don't bother with channels 1-11 as those channels are allowed
    world wide.

    This should fix world roaming for ath5k, ath9k and ar9170, thereby
    improving scan time when we receive the first beacon from any AP,
    and also enabling beaconing operation (AP/IBSS/Mesh) on cards which
    would otherwise not be allowed to do so. Drivers not using custom
    regulatory stuff (wiphy_apply_custom_regulatory()) were not affected
    by this as the orig_flags for the channels would have been cleared
    upon wiphy registration.

    I tested this with a world roaming ath5k card.

    Cc: Jouni Malinen
    Signed-off-by: Luis R. Rodriguez
    Reviewed-by: Johannes Berg
    Signed-off-by: John W. Linville

    Luis R. Rodriguez
     

28 Feb, 2009

3 commits

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

    Luis R. Rodriguez
     
  • When devices are world roaming they cannot beacon or do active scan
    on 5 GHz or on channels 12, 13 and 14 on the 2 GHz band. Although
    we have a good regulatory API some cards may _always_ world roam, this
    is also true when a system does not have CRDA present. Devices doing world
    roaming can still passive scan, if they find a beacon from an AP on
    one of the world roaming frequencies we make the assumption we can do
    the same and we also remove the passive scan requirement.

    This adds support for providing beacon regulatory hints based on scans.
    This works for devices that do either hardware or software scanning.
    If a channel has not yet been marked as having had a beacon present
    on it we queue the beacon hint processing into the workqueue.

    All wireless devices will benefit from beacon regulatory hints from
    any wireless device on a system including new devices connected to
    the system at a later time.

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

    Luis R. Rodriguez
     
  • All regulatory hints (core, driver, userspace and 11d) are now processed in
    a workqueue.

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

    Luis R. Rodriguez
     

10 Feb, 2009

1 commit


30 Jan, 2009

1 commit


26 Nov, 2008

1 commit

  • This adds country IE parsing to mac80211 and enables its usage
    within the new regulatory infrastructure in cfg80211. We parse
    the country IEs only on management beacons for the BSSID you are
    associated to and disregard the IEs when the country and environment
    (indoor, outdoor, any) matches the already processed country IE.

    To avoid following misinformed or outdated APs we build and use
    a regulatory domain out of the intersection between what the AP
    provides us on the country IE and what CRDA is aware is allowed
    on the same country.

    A secondary device is allowed to follow only the same country IE
    as it make no sense for two devices on a system to be in two
    different countries.

    In the case the AP is using country IEs for an incorrect country
    the user may help compliance further by setting the regulatory
    domain before or after the IE is parsed and in that case another
    intersection will be performed.

    CONFIG_WIRELESS_OLD_REGULATORY is supported but requires CRDA
    present.

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

    Luis R. Rodriguez
     

01 Nov, 2008

2 commits

  • The code needs to be split out and cleaned up, so as a
    first step remove the capability, to add it back in a
    subsequent patch as a separate function. Also remove the
    publically facing return value of the function and the
    wiphy argument. A number of internal functions go from
    being generic helpers to just being used for alpha2
    setting.

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

    Johannes Berg
     
  • This mutex is wrong, we use cfg80211_drv_mutex (which should
    possibly be renamed to just cfg80211_mutex) everywhere except
    in one place, fix that and get rid of the extra mutex.

    Also get rid of a spurious regulatory_requests list definition.

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

    Johannes Berg