mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
wifi: cfg80211: nan: add Instant Communication support
Add NL80211_NAN_CONF_INSTANT_COMM flag to let user space request that the NAN synchronization logic starts Instant Communication (IC) as defined in Chapter 13 of the Wi-Fi Aware Specification v4.0. Add NL80211_NAN_CAPA_INSTANT_COMM for drivers to advertise it. The capability requires configurable synchronization support, and IC requests are rejected if it isn't advertised. When IC is enabled, user space must also configure the discovery beacon interval. The IC schedule is expected to be configured by user space. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20261005084458.3666739-2-ilan.peer@intel.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
cd9c0566b5
commit
ef650cdd44
|
|
@ -4193,9 +4193,12 @@ struct cfg80211_nan_band_config {
|
|||
* that can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF.
|
||||
* @scan_period: period (in seconds) between NAN scans.
|
||||
* @scan_dwell_time: dwell time (in milliseconds) for NAN scans.
|
||||
* @discovery_beacon_interval: interval (in TUs) for discovery beacons.
|
||||
* @discovery_beacon_interval: interval (in TUs) for discovery beacons. Must be
|
||||
* greater than 0 when @instant_comm is true.
|
||||
* @enable_dw_notification: flag to enable/disable discovery window
|
||||
* notifications.
|
||||
* @instant_comm: if true, start Instant Communication (IC) as defined in
|
||||
* Chapter 13 of the Wi-Fi Aware Specification v4.0.
|
||||
* @band_cfgs: array of band specific configurations, indexed by
|
||||
* &enum nl80211_band values.
|
||||
* @extra_nan_attrs: pointer to additional NAN attributes.
|
||||
|
|
@ -4211,6 +4214,7 @@ struct cfg80211_nan_conf {
|
|||
u16 scan_dwell_time;
|
||||
u8 discovery_beacon_interval;
|
||||
bool enable_dw_notification;
|
||||
bool instant_comm;
|
||||
struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];
|
||||
const u8 *extra_nan_attrs;
|
||||
u16 extra_nan_attrs_len;
|
||||
|
|
@ -6307,10 +6311,13 @@ struct wiphy_radio {
|
|||
* @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable
|
||||
* synchronization.
|
||||
* @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload.
|
||||
* @WIPHY_NAN_FLAGS_INSTANT_COMM: Device can switch to Instant Communication
|
||||
* (IC) mode. Can only be set along with %WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC.
|
||||
*/
|
||||
enum wiphy_nan_flags {
|
||||
WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),
|
||||
WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),
|
||||
WIPHY_NAN_FLAGS_INSTANT_COMM = BIT(2),
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7895,6 +7895,11 @@ enum nl80211_nan_band_conf_attributes {
|
|||
* the upcoming discovery window with
|
||||
* %NL80211_CMD_NAN_NEXT_DW_NOTIFICATION.
|
||||
* This is a flag attribute.
|
||||
* @NL80211_NAN_CONF_INSTANT_COMM: If set, the NAN synchronization logic will
|
||||
* start Instant Communication (IC) as defined in Chapter 13 of the
|
||||
* Wi-Fi Aware Specification v4.0.
|
||||
* %NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL must be set as well.
|
||||
* This is a flag attribute.
|
||||
* @NUM_NL80211_NAN_CONF_ATTR: Internal.
|
||||
* @NL80211_NAN_CONF_ATTR_MAX: Highest NAN configuration attribute.
|
||||
*
|
||||
|
|
@ -7910,6 +7915,7 @@ enum nl80211_nan_conf_attributes {
|
|||
NL80211_NAN_CONF_SCAN_DWELL_TIME,
|
||||
NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL,
|
||||
NL80211_NAN_CONF_NOTIFY_DW,
|
||||
NL80211_NAN_CONF_INSTANT_COMM,
|
||||
|
||||
/* keep last */
|
||||
NUM_NL80211_NAN_CONF_ATTR,
|
||||
|
|
@ -9126,6 +9132,11 @@ enum nl80211_s1g_short_beacon_attrs {
|
|||
* specification Table 79 (Capabilities field).
|
||||
* @NL80211_NAN_CAPA_PHY: nested attribute containing band-agnostic
|
||||
* capabilities for NAN data path. See &enum nl80211_nan_phy_cap_attr.
|
||||
* @NL80211_NAN_CAPA_INSTANT_COMM: Flag attribute indicating that the device
|
||||
* can switch to Instant Communication (IC) mode, as defined in Chapter 13
|
||||
* of the Wi-Fi Aware Specification v4.0. Can only be set if
|
||||
* %NL80211_NAN_CAPA_CONFIGURABLE_SYNC is set. When IC is enabled, the IC
|
||||
* schedule is expected to be configured by user space.
|
||||
* @__NL80211_NAN_CAPABILITIES_LAST: Internal
|
||||
* @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute.
|
||||
*/
|
||||
|
|
@ -9139,6 +9150,7 @@ enum nl80211_nan_capabilities {
|
|||
NL80211_NAN_CAPA_MAX_CHANNEL_SWITCH_TIME,
|
||||
NL80211_NAN_CAPA_CAPABILITIES,
|
||||
NL80211_NAN_CAPA_PHY,
|
||||
NL80211_NAN_CAPA_INSTANT_COMM,
|
||||
/* keep last */
|
||||
__NL80211_NAN_CAPABILITIES_LAST,
|
||||
NL80211_NAN_CAPABILITIES_MAX = __NL80211_NAN_CAPABILITIES_LAST - 1,
|
||||
|
|
|
|||
|
|
@ -964,6 +964,11 @@ int wiphy_register(struct wiphy *wiphy)
|
|||
(!wiphy->nan_capa.phy.ht.ht_supported || wiphy->n_radio > 1)))
|
||||
return -EINVAL;
|
||||
|
||||
if (WARN_ON((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
|
||||
!(wiphy->nan_capa.flags &
|
||||
WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC)))
|
||||
return -EINVAL;
|
||||
|
||||
if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -687,6 +687,7 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {
|
|||
[NL80211_NAN_CONF_DISCOVERY_BEACON_INTERVAL] =
|
||||
NLA_POLICY_RANGE(NLA_U8, 50, 200),
|
||||
[NL80211_NAN_CONF_NOTIFY_DW] = { .type = NLA_FLAG },
|
||||
[NL80211_NAN_CONF_INSTANT_COMM] = { .type = NLA_FLAG },
|
||||
};
|
||||
|
||||
static const struct netlink_range_validation nl80211_punct_bitmap_range = {
|
||||
|
|
@ -3037,6 +3038,10 @@ static int nl80211_put_nan_capa(struct wiphy *wiphy, struct sk_buff *msg)
|
|||
nla_put_flag(msg, NL80211_NAN_CAPA_USERSPACE_DE))
|
||||
goto fail;
|
||||
|
||||
if ((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM) &&
|
||||
nla_put_flag(msg, NL80211_NAN_CAPA_INSTANT_COMM))
|
||||
goto fail;
|
||||
|
||||
if (nla_put_u8(msg, NL80211_NAN_CAPA_OP_MODE,
|
||||
wiphy->nan_capa.op_mode) ||
|
||||
nla_put_u8(msg, NL80211_NAN_CAPA_NUM_ANTENNAS,
|
||||
|
|
@ -16789,6 +16794,23 @@ static int nl80211_parse_nan_conf(struct wiphy *wiphy,
|
|||
conf->enable_dw_notification =
|
||||
nla_get_flag(attrs[NL80211_NAN_CONF_NOTIFY_DW]);
|
||||
|
||||
conf->instant_comm = nla_get_flag(attrs[NL80211_NAN_CONF_INSTANT_COMM]);
|
||||
if (conf->instant_comm) {
|
||||
if (!(wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_INSTANT_COMM)) {
|
||||
NL_SET_ERR_MSG_ATTR(info->extack,
|
||||
attrs[NL80211_NAN_CONF_INSTANT_COMM],
|
||||
"Instant Communication is not supported");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (!conf->discovery_beacon_interval) {
|
||||
NL_SET_ERR_MSG_ATTR(info->extack,
|
||||
attrs[NL80211_NAN_CONF_INSTANT_COMM],
|
||||
"Instant Communication requires a discovery beacon interval");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (!conf->band_cfgs[NL80211_BAND_5GHZ].chan &&
|
||||
(!conf->bands || conf->bands & BIT(NL80211_BAND_5GHZ))) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user