cfg80211: fix NAN bands definition

The nl80211_nan_dual_band_conf enumeration doesn't make much sense.
The default value is assigned to a bit, which makes it weird if the
default bit and other bits are set at the same time.

To improve this, get rid of NL80211_NAN_BAND_DEFAULT and add a wiphy
configuration to let the drivers define which bands are supported.
This is exposed to the userspace, which then can make a decision on
which band(s) to use.  Additionally, rename all "dual_band" elements
to "bands", to make things clearer.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Luca Coelho
2017-02-08 15:00:34 +02:00
committed by Johannes Berg
parent bee427b862
commit 8585989d14
7 changed files with 86 additions and 63 deletions

View File

@@ -10,7 +10,7 @@
* Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
* Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
* Copyright 2008 Colin McCabe <colin@cozybit.com>
* Copyright 2015 Intel Deutschland GmbH
* Copyright 2015-2017 Intel Deutschland GmbH
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -854,12 +854,15 @@
* cfg80211_scan_done().
*
* @NL80211_CMD_START_NAN: Start NAN operation, identified by its
* %NL80211_ATTR_WDEV interface. This interface must have been previously
* created with %NL80211_CMD_NEW_INTERFACE. After it has been started, the
* NAN interface will create or join a cluster. This command must have a
* valid %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
* %NL80211_ATTR_NAN_DUAL attributes.
* After this command NAN functions can be added.
* %NL80211_ATTR_WDEV interface. This interface must have been
* previously created with %NL80211_CMD_NEW_INTERFACE. After it
* has been started, the NAN interface will create or join a
* cluster. This command must have a valid
* %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
* %NL80211_ATTR_BANDS attributes. If %NL80211_ATTR_BANDS is
* omitted or set to 0, it means don't-care and the device will
* decide what to use. After this command NAN functions can be
* added.
* @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by
* its %NL80211_ATTR_WDEV interface.
* @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined
@@ -880,10 +883,14 @@
* This command is also used as a notification sent when a NAN function is
* terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID
* and %NL80211_ATTR_COOKIE attributes.
* @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN configuration. NAN
* must be operational (%NL80211_CMD_START_NAN was executed).
* It must contain at least one of the following attributes:
* %NL80211_ATTR_NAN_MASTER_PREF, %NL80211_ATTR_NAN_DUAL.
* @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN
* configuration. NAN must be operational (%NL80211_CMD_START_NAN
* was executed). It must contain at least one of the following
* attributes: %NL80211_ATTR_NAN_MASTER_PREF,
* %NL80211_ATTR_BANDS. If %NL80211_ATTR_BANDS is omitted, the
* current configuration is not changed. If it is present but
* set to zero, the configuration is changed to don't-care
* (i.e. the device can decide what to do).
* @NL80211_CMD_NAN_FUNC_MATCH: Notification sent when a match is reported.
* This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
* %NL80211_ATTR_COOKIE.
@@ -1963,10 +1970,13 @@ enum nl80211_commands {
* %NL80211_CMD_CHANGE_NAN_CONFIG. Its type is u8 and it can't be 0.
* Also, values 1 and 255 are reserved for certification purposes and
* should not be used during a normal device operation.
* @NL80211_ATTR_NAN_DUAL: NAN dual band operation config (see
* &enum nl80211_nan_dual_band_conf). This attribute is used with
* %NL80211_CMD_START_NAN and optionally with
* %NL80211_CMD_CHANGE_NAN_CONFIG.
* @NL80211_ATTR_BANDS: operating bands configuration. This is a u32
* bitmask of BIT(NL80211_BAND_*) as described in %enum
* nl80211_band. For instance, for NL80211_BAND_2GHZ, bit 0
* would be set. This attribute is used with
* %NL80211_CMD_START_NAN and %NL80211_CMD_CHANGE_NAN_CONFIG, and
* it is optional. If no bands are set, it means don't-care and
* the device will decide what to use.
* @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See
* &enum nl80211_nan_func_attributes for description of this nested
* attribute.
@@ -2397,7 +2407,7 @@ enum nl80211_attrs {
NL80211_ATTR_MESH_PEER_AID,
NL80211_ATTR_NAN_MASTER_PREF,
NL80211_ATTR_NAN_DUAL,
NL80211_ATTR_BANDS,
NL80211_ATTR_NAN_FUNC,
NL80211_ATTR_NAN_MATCH,
@@ -5070,21 +5080,6 @@ enum nl80211_bss_select_attr {
NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
};
/**
* enum nl80211_nan_dual_band_conf - NAN dual band configuration
*
* Defines the NAN dual band mode of operation
*
* @NL80211_NAN_BAND_DEFAULT: device default mode
* @NL80211_NAN_BAND_2GHZ: 2.4GHz mode
* @NL80211_NAN_BAND_5GHZ: 5GHz mode
*/
enum nl80211_nan_dual_band_conf {
NL80211_NAN_BAND_DEFAULT = 1 << 0,
NL80211_NAN_BAND_2GHZ = 1 << 1,
NL80211_NAN_BAND_5GHZ = 1 << 2,
};
/**
* enum nl80211_nan_function_type - NAN function type
*