1: 4f3c04d165f2 = 1: 813bd81fc792 wifi: nl80211: reject NAN function add/delete when Discovery Engine is in userspace  2: 3bbaa6ca2379 ! 2: 73c0fb149aed wifi: nl80211/cfg80211: extend NAN function and configuration for discovery offload @@ include/net/cfg80211.h: struct cfg80211_nan_func_filter {  + * @security_required: if true, the SDEA Security Required bit is set. Requires  + * @data_path_required and %NL80211_EXT_FEATURE_SECURE_NAN.  + * @gtk_required: if true, the SDEA GTK Required bit is set for GTK protection -+ * of group-addressed data frames. Requires %NL80211_EXT_FEATURE_SECURE_NAN. ++ * of group-addressed data frames. Requires ++ * %NL80211_EXT_FEATURE_SECURE_NAN.  + * @pairing_bootstrap_methods: bitmap of supported NAN pairing  + * bootstrapping methods per the Wi-Fi Aware Specification Table 9-321.  + * @csids: array of u32 NAN Cipher Suite ID (CSID) selectors supported by @@ include/uapi/linux/nl80211.h: enum nl80211_nan_func_term_reason {  + * @NL80211_NAN_FUNC_DATA_PATH_REQUIRED: flag attribute. Sets the SDEA "Data  + * Path Required" bit.  + * @NL80211_NAN_FUNC_SECURITY_REQUIRED: flag attribute. Sets the SDEA -+ * "Security Required" bit. Requires -+ * @NL80211_NAN_FUNC_DATA_PATH_REQUIRED and -+ * %NL80211_EXT_FEATURE_SECURE_NAN. ++ * "Security Required" bit. Requires @NL80211_NAN_FUNC_DATA_PATH_REQUIRED ++ * and %NL80211_EXT_FEATURE_SECURE_NAN.  + * @NL80211_NAN_FUNC_GTK_REQUIRED: flag attribute. Sets the SDEA "GTK  + * Required" bit for GTK protection of group-addressed data frames.  + * Requires %NL80211_EXT_FEATURE_SECURE_NAN. @@ net/wireless/nl80211.c: static int nl80211_nan_add_func(struct sk_buff *skb,  + int len = nla_len(tb[NL80211_NAN_FUNC_CSIDS]);  + int n = len / sizeof(u32);  + -+ func->csids = kmemdup(nla_data(tb[NL80211_NAN_FUNC_CSIDS]), -+ len, GFP_KERNEL); ++ func->csids = ++ kmemdup(nla_data(tb[NL80211_NAN_FUNC_CSIDS]), ++ len, GFP_KERNEL);  + if (!func->csids) {  + err = -ENOMEM;  + goto out; @@ net/wireless/nl80211.c: static int nl80211_nan_add_func(struct sk_buff *skb,  + if (tb[NL80211_NAN_FUNC_ND_PMK]) {  + int len = nla_len(tb[NL80211_NAN_FUNC_ND_PMK]);  + -+ func->nd_pmk = kmemdup(nla_data(tb[NL80211_NAN_FUNC_ND_PMK]), -+ len, GFP_KERNEL); ++ func->nd_pmk = ++ kmemdup(nla_data(tb[NL80211_NAN_FUNC_ND_PMK]), ++ len, GFP_KERNEL);  + if (!func->nd_pmk) {  + err = -ENOMEM;  + goto out;  3: 643b06d88042 ! 3: 0cc275d9b356 wifi: nl80211/cfg80211: extend NAN match indication for discovery offload @@ include/uapi/linux/nl80211.h  + * %NL80211_ATTR_COOKIE. It may also contain %NL80211_ATTR_FRAME,  + * %NL80211_ATTR_WIPHY_FREQ, and %NL80211_ATTR_RX_SIGNAL_DBM so userspace  + * can parse any attribute in the received SDF. The frame is the complete -+ * received management frame, including the 802.11 header. It is reported as -+ * received and, for protected frames, after decryption, as with received -+ * frames reported with %NL80211_CMD_FRAME. This lets userspace distinguish -+ * protected (Protected Dual of Public Action) and unprotected frames. ++ * received management frame, including the 802.11 header. It is reported ++ * as received and, for protected frames, after decryption, as with ++ * received frames reported with %NL80211_CMD_FRAME. This lets userspace ++ * distinguish protected (Protected Dual of Public Action) and unprotected ++ * frames. * * @NL80211_CMD_UPDATE_CONNECT_PARAMS: Update one or more connect parameters * for subsequent roaming cases if the driver or firmware uses internal @@ net/wireless/nl80211.c: void cfg80211_nan_match(struct wireless_dev *wdev,  - nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, match->addr))  + nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, match->addr) ||  + (match->frame && match->frame_len && -+ nla_put(msg, NL80211_ATTR_FRAME, match->frame_len, match->frame)) || ++ nla_put(msg, NL80211_ATTR_FRAME, match->frame_len, ++ match->frame)) ||  + (match->freq &&  + nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, match->freq)) ||  + (match->rssi_valid &&  4: a2a101c72d08 ! 4: f072354e589a wifi: nl80211/cfg80211: add NAN ranging FTM capability @@ include/uapi/linux/nl80211.h: enum nl80211_peer_measurement_ftm_capa { * specification "PR Implementation Consideration Draft 1.9 rev 1" where * PD stands for proximity detection  + * @NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT: flag attribute indicating -+ * that the device supports NAN ranging between two NAN devices as -+ * defined in the "Wi-Fi Aware Specification v4.0, clause 8". NAN ranging -+ * uses ASAP and a single burst, irrespective of whether ++ * that the device supports NAN ranging between two NAN devices as defined ++ * in the "Wi-Fi Aware Specification v4.0, clause 8". NAN ranging uses ASAP ++ * and a single burst, irrespective of whether  + * %NL80211_PMSR_FTM_CAPA_ATTR_ASAP is advertised. * * @NUM_NL80211_PMSR_FTM_TYPE_CAPA_ATTR: internal @@ net/wireless/nl80211.c: nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_ca return -ENOBUFS;   + if (cap->ftm.type.nan_support && -+ nla_put_flag(msg, NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT)) ++ nla_put_flag(msg, ++ NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT))  + return -ENOBUFS;  + nla_nest_end(msg, pd_caps);  5: e5079c86c7ec ! 5: 9764f31bffe5 wifi: nl80211/cfg80211: advertise NAN ranging support @@ include/uapi/linux/nl80211.h: enum nl80211_s1g_short_beacon_attrs { * schedule is expected to be configured by user space.  + * @NL80211_NAN_CAPA_OFFLOAD_RANGING: flag attribute. Firmware supports the  + * fully offloaded NAN ranging procedure, including ranging session setup, -+ * update, and termination, FTM protocol and procedure, and ranging reports. ++ * update, and termination, FTM protocol and procedure, and ranging ++ * reports. * @__NL80211_NAN_CAPABILITIES_LAST: Internal * @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute. */  6: 81ce4e9f0536 ! 6: 2efedb11ca7d wifi: nl80211/cfg80211: add support for request-based NAN ranging @@ include/uapi/linux/nl80211.h: enum nl80211_peer_measurement_resp { * Wi-Fi Alliance specification "Proximity Ranging (PR) Implementation * Consideration Draft 1.9 Rev 1"  + * @NL80211_PMSR_FTM_REQ_TYPE_NAN: NAN ranging between two NAN devices as -+ * defined in the "Wi-Fi Aware Specification v4.0, clause 8". -+ * Must be issued on a %NL80211_IFTYPE_NAN interface. -+ * ASAP mode and a single burst are implied. If -+ * %NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP is present, it must be zero. ++ * defined in the "Wi-Fi Aware Specification v4.0, clause 8". Must be ++ * issued on a %NL80211_IFTYPE_NAN interface. ASAP mode and a single burst ++ * are implied. If %NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP is present, it ++ * must be zero. * @NUM_NL80211_PMSR_FTM_REQ_TYPE: internal * @NL80211_PMSR_FTM_REQ_TYPE_MAX: highest request type value */  7: 0bddbf6b3eee ! 7: 33b9b3670cd2 wifi: nl80211/cfg80211: add support for discovery-based NAN ranging @@ net/wireless/nl80211.c: static int nl80211_nan_add_func(struct sk_buff *skb,  + func->ftms_per_burst =  + nla_get_u8(tb[NL80211_NAN_FUNC_FTMS_PER_BURST]);  + if (pmsr_capa->ftm.max_ftms_per_burst && -+ func->ftms_per_burst > pmsr_capa->ftm.max_ftms_per_burst) { ++ func->ftms_per_burst > ++ pmsr_capa->ftm.max_ftms_per_burst) {  + NL_SET_ERR_MSG_ATTR(info->extack,  + tb[NL80211_NAN_FUNC_FTMS_PER_BURST],  + "NAN FTMs per burst exceeds device limit"); @@ net/wireless/nl80211.c: static int nl80211_nan_add_func(struct sk_buff *skb,  + }  +  + if (tb[NL80211_NAN_FUNC_CHAN]) { -+ /* Reuse info->attrs for chandef parsing; the original contents -+ * are no longer needed. ++ /* Reuse info->attrs for chandef parsing; the original ++ * contents are no longer needed.  + */  + memset(info->attrs, 0,  + sizeof(*info->attrs) * (NL80211_ATTR_MAX + 1));  8: 7612215fa556 = 8: a1e6501f29c0 wifi: nl80211/cfg80211: add ranging results to NAN match event  9: 2cced7735cca ! 9: df0b147e249c wifi: nl80211: add NDP offload capability advertisement @@ include/net/cfg80211.h: struct mgmt_frame_regs { * information such as committed DW, etc. When updating an existing peer * schedule, the full new schedule is provided - partial updates are not * supported, and the new schedule completely replaces the previous one. -+ * Not supported when %WIPHY_NAN_FLAGS_OFFLOAD_NDP is set; the device learns -+ * and manages peer schedules for offloaded NDPs. ++ * Not supported when %WIPHY_NAN_FLAGS_OFFLOAD_NDP is set; the device ++ * learns and manages peer schedules for offloaded NDPs. * * @nan_set_non_evac_channels: set the list of local schedule channels that * must not be evacuated for concurrent operations. The provided list @@ include/net/cfg80211.h: struct wiphy_radio {  + * teardown handshake with its peer, including NDP Request/Response/Confirm  + * and security handshakes. Within the local NAN schedule configured by  + * userspace, the device negotiates NDLs for offloaded NDPs, including NDC, -+ * immutable schedules, and schedule updates, honoring NDP QoS requirements. -+ * Userspace continues to configure the local schedule with ++ * immutable schedules, and schedule updates, honoring NDP QoS ++ * requirements. Userspace continues to configure the local schedule with  + * %NL80211_CMD_NAN_SET_LOCAL_SCHED and its non-evacuable channels with -+ * %NL80211_CMD_NAN_SET_NON_EVAC_CHANNELS. The device learns and manages peer -+ * NAN schedules; userspace must not set them with ++ * %NL80211_CMD_NAN_SET_NON_EVAC_CHANNELS. The device learns and manages ++ * peer NAN schedules; userspace must not set them with  + * %NL80211_CMD_NAN_SET_PEER_SCHED. The device assigns NDP IDs for locally  + * initiated NDPs, derives, installs, and removes PTKs and, when requested, -+ * GTKs. The device creates and removes NDI peer stations for offloaded NDPs. -+ * Userspace must not add those NDI peer stations or their -+ * keys. NDP offload is supported on all bands in -+ * &struct wiphy.nan_supported_bands. The device supplies the band-specific ++ * GTKs. The device creates and removes NDI peer stations for offloaded ++ * NDPs. NDP offload is supported on all bands in ++ * &wiphy.nan_supported_bands. The device supplies the band-specific  + * capabilities, such as the HE 6 GHz band and EHT capabilities, and the  + * regulatory information in the frames it builds. The driver implements -+ * @nan_ndp_initiate, -+ * @nan_ndp_respond, and -+ * @nan_ndp_terminate callbacks. It supports ++ * the &cfg80211_ops.nan_ndp_initiate, &cfg80211_ops.nan_ndp_respond, and ++ * &cfg80211_ops.nan_ndp_terminate callbacks. It supports  + * %NL80211_CMD_NAN_NDP_INITIATE, %NL80211_CMD_NAN_NDP_RESPOND, and -+ * %NL80211_CMD_NAN_NDP_TERMINATE, and -+ * reports peer requests, setup status, and termination with -+ * cfg80211_nan_ndp_request(), cfg80211_nan_ndp_status(), and -+ * cfg80211_nan_ndp_terminated(). Secure NDPs require -+ * %NL80211_EXT_FEATURE_SECURE_NAN. ++ * %NL80211_CMD_NAN_NDP_TERMINATE, and reports peer requests, setup status, ++ * and termination with cfg80211_nan_ndp_request(), ++ * cfg80211_nan_ndp_status(), and cfg80211_nan_ndp_terminated(). Secure ++ * NDPs require %NL80211_EXT_FEATURE_SECURE_NAN. */ enum wiphy_nan_flags { WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0), @@ include/net/cfg80211.h: struct wiphy_radio { /**  ## include/uapi/linux/nl80211.h ## -@@ - * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, - * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents - * peer's MLD address for MLO pairwise key. The link to add MLO -- * group key is identified by %NL80211_ATTR_MLO_LINK_ID. -+ * group key is identified by %NL80211_ATTR_MLO_LINK_ID. For an NDI peer -+ * station participating in an offloaded NDP, userspace must not add keys; -+ * the device manages the NDP keys. - * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX - * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address - * for MLO pairwise key. The link to delete group key is identified by -@@ - * @NL80211_CMD_SET_STATION: Set station attributes for station identified by - * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the -- * interface identified by %NL80211_ATTR_IFINDEX. -+ * interface identified by %NL80211_ATTR_IFINDEX. For an offloaded NDP, -+ * the device creates and removes the NDI peer station; userspace must not -+ * add a duplicate station. - * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC - * or, if no MAC address given, all stations, on the interface identified - * by %NL80211_ATTR_IFINDEX. For MLD station, MLD address is used in  @@ * channels that remain in the new schedule keep their marking, channels * that are removed simply lose it, and newly added channels are @@ include/uapi/linux/nl80211.h * @NL80211_CMD_UPDATE_BEACON: Update the beacon and other templates of an AP * interface, but only that. Same attributes as %NL80211_CMD_SET_BEACON, * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL are required, -@@ include/uapi/linux/nl80211.h: enum nl80211_commands { - * the update failed. - * @NL80211_ATTR_NAN_NMI_MAC: The address of the NMI station to which this NDI - * station belongs. Used with %NL80211_CMD_NEW_STATION when adding an NDI -- * station. -+ * station. With %NL80211_NAN_CAPA_OFFLOAD_NDP, the device creates and removes -+ * NDI peer stations for offloaded NDPs; userspace must not add duplicates. - * @NL80211_ATTR_NAN_ULW: (Binary) The initial ULW(s) as published by the - * peer, as defined in the Wi-Fi Aware (TM) 4.0 specification Table 109 - * (Unaligned Schedule attribute format). Used to configure the device  @@ include/uapi/linux/nl80211.h: enum nl80211_s1g_short_beacon_attrs { - * @NL80211_NAN_CAPA_OFFLOAD_RANGING: flag attribute. Firmware supports the * fully offloaded NAN ranging procedure, including ranging session setup, - * update, and termination, FTM protocol and procedure, and ranging reports. + * update, and termination, FTM protocol and procedure, and ranging + * reports.  + * @NL80211_NAN_CAPA_OFFLOAD_NDP: flag attribute. The device performs the  + * complete NAN Data Path setup and teardown handshake with the peer, -+ * including NDP Request/Response/Confirm and the security handshake. Within -+ * the local NAN schedule configured by userspace, the device negotiates NDLs -+ * for offloaded NDPs, including NDC, immutable schedules, and schedule -+ * updates, honoring NDP QoS requirements. Userspace continues to configure -+ * the local schedule with %NL80211_CMD_NAN_SET_LOCAL_SCHED and its -+ * non-evacuable channels with %NL80211_CMD_NAN_SET_NON_EVAC_CHANNELS. The -+ * device learns and manages peer NAN schedules; userspace must not set them -+ * with %NL80211_CMD_NAN_SET_PEER_SCHED. The device assigns NDP IDs for -+ * locally initiated NDPs and derives, installs, and removes data path keys -+ * (PTK and, when requested, GTK). The device creates and removes NDI peer -+ * stations for offloaded NDPs. Userspace must not add those NDI peer stations -+ * or their keys. NDP offload is supported on every band that the device -+ * reports for NAN in %NL80211_ATTR_BANDS. The device supplies the band-specific -+ * capabilities, such as the HE 6 GHz band and EHT capabilities, and the -+ * regulatory information in the frames it builds. The device supports -+ * %NL80211_CMD_NAN_NDP_INITIATE, -+ * %NL80211_CMD_NAN_NDP_RESPOND, and -+ * %NL80211_CMD_NAN_NDP_TERMINATE, and reports peer requests, setup status, -+ * and termination with %NL80211_CMD_NAN_NDP_INITIATE, -+ * %NL80211_CMD_NAN_NDP_STATUS, and %NL80211_CMD_NAN_NDP_TERMINATE. -+ * Secure NDPs additionally require %NL80211_EXT_FEATURE_SECURE_NAN. ++ * including NDP Request/Response/Confirm and the security handshake. ++ * Within the local NAN schedule configured by userspace, the device ++ * negotiates NDLs for offloaded NDPs, including NDC, immutable schedules, ++ * and schedule updates, honoring NDP QoS requirements. Userspace continues ++ * to configure the local schedule with %NL80211_CMD_NAN_SET_LOCAL_SCHED ++ * and its non-evacuable channels with ++ * %NL80211_CMD_NAN_SET_NON_EVAC_CHANNELS. The device learns and manages ++ * peer NAN schedules; userspace must not set them with ++ * %NL80211_CMD_NAN_SET_PEER_SCHED. The device assigns NDP IDs for locally ++ * initiated NDPs and derives, installs, and removes data path keys (PTK ++ * and, when requested, GTK). The device creates and removes NDI peer ++ * stations for offloaded NDPs. Userspace must not add those NDI peer ++ * stations or their keys. NDP offload is supported on every band that the ++ * device reports for NAN in %NL80211_ATTR_BANDS. The device supplies the ++ * band-specific capabilities, such as the HE 6 GHz band and EHT ++ * capabilities, and the regulatory information in the frames it builds. ++ * The device supports %NL80211_CMD_NAN_NDP_INITIATE, ++ * %NL80211_CMD_NAN_NDP_RESPOND, and %NL80211_CMD_NAN_NDP_TERMINATE, and ++ * reports peer requests, setup status, and termination with ++ * %NL80211_CMD_NAN_NDP_INITIATE, %NL80211_CMD_NAN_NDP_STATUS, and ++ * %NL80211_CMD_NAN_NDP_TERMINATE. Secure NDPs additionally require ++ * %NL80211_EXT_FEATURE_SECURE_NAN. * @__NL80211_NAN_CAPABILITIES_LAST: Internal * @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute. */ 10: 04eaa5e34f90 ! 10: ea9c96cd2585 wifi: nl80211/cfg80211: add support for NDP initiation in offload mode @@ include/net/cfg80211.h: struct mgmt_frame_regs { * offloaded NDPs, userspace configures these channels for the device to * consider while negotiating NDL schedules. * -+ * @nan_ndp_initiate: Initiate a NAN Data Path session as the initiator. -+ * Only valid if the driver has set %WIPHY_NAN_FLAGS_OFFLOAD_NDP. -+ * The driver must set params->ndp_id to the assigned NDP ID (1-255) on -+ * success. Each accepted setup attempt completes asynchronously with one -+ * status notification, including on failure or timeout. If the device cannot -+ * meet the QoS requirements in @params, it reports setup failure with the -+ * Wi-Fi Aware reason QoS_UNACCEPTABLE. ++ * @nan_ndp_initiate: Initiate a NAN Data Path session as the initiator. Only ++ * valid if the driver has set %WIPHY_NAN_FLAGS_OFFLOAD_NDP. The driver ++ * must set params->ndp_id to the assigned NDP ID (1-255) on success. Each ++ * accepted setup attempt completes asynchronously with one status ++ * notification, including on failure or timeout. If the device cannot meet ++ * the QoS requirements in @params, it reports setup failure with the Wi-Fi ++ * Aware reason QoS_UNACCEPTABLE.  + * * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS * @@ include/uapi/linux/nl80211.h * addresses (%NL80211_ATTR_MLO_LINKS, each nested link with * %NL80211_ATTR_MLO_LINK_ID, %NL80211_ATTR_BSSID and %NL80211_ATTR_MAC). * -+ * @NL80211_CMD_NAN_NDP_INITIATE: Initiate NAN Data Path (NDP) setup -+ * as the initiator. Requires %NL80211_NAN_CAPA_OFFLOAD_NDP, -+ * %NL80211_ATTR_MAC (peer NMI), and %NL80211_ATTR_NAN_NDP. The NDI -+ * interface specified in %NL80211_NAN_NDP_ATTR_INIT_NDI must already -+ * exist as a %NL80211_IFTYPE_NAN_DATA interface. For a locally -+ * initiated NDP, the driver assigns the NDP ID and returns it in the -+ * %NL80211_ATTR_NAN_NDP reply. -+ * %NL80211_NAN_NDP_ATTR_TRANSPORT_PORT and ++ * @NL80211_CMD_NAN_NDP_INITIATE: Initiate NAN Data Path (NDP) setup as the ++ * initiator. Requires %NL80211_NAN_CAPA_OFFLOAD_NDP, %NL80211_ATTR_MAC ++ * (peer NMI), and %NL80211_ATTR_NAN_NDP. The NDI interface specified in ++ * %NL80211_NAN_NDP_ATTR_INIT_NDI must already exist as a ++ * %NL80211_IFTYPE_NAN_DATA interface. For a locally initiated NDP, the ++ * driver assigns the NDP ID and returns it in the %NL80211_ATTR_NAN_NDP ++ * reply. %NL80211_NAN_NDP_ATTR_TRANSPORT_PORT and  + * %NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL may be supplied together to  + * include transport information in the NDPE Service Info TLV.  + * %NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS and  + * %NL80211_NAN_NDP_ATTR_QOS_MAX_LATENCY may be supplied as NDL QoS -+ * requirements. The device uses them to allocate the NDL schedule within the -+ * user-configured local schedule. If the device cannot meet the QoS ++ * requirements. The device uses them to allocate the NDL schedule within ++ * the user-configured local schedule. If the device cannot meet the QoS  + * requirements, setup fails and the status notification reports the Wi-Fi -+ * Aware reason QoS_UNACCEPTABLE. -+ * Each accepted setup attempt completes asynchronously with exactly one -+ * %NL80211_CMD_NAN_NDP_STATUS notification, including on failure or timeout. ++ * Aware reason QoS_UNACCEPTABLE. Each accepted setup attempt completes ++ * asynchronously with exactly one %NL80211_CMD_NAN_NDP_STATUS ++ * notification, including on failure or timeout.  + * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes {  + * to match the NDP to a service.  + * @NL80211_NAN_NDP_ATTR_SERVICE_ID: binary NAN service ID derived from the  + * service name, %NL80211_NAN_FUNC_SERVICE_ID_LEN bytes. -+ * @NL80211_NAN_NDP_ATTR_INIT_NDI: ETH_ALEN-byte initiator NDI MAC address. -+ * For locally initiated NDPs, the corresponding -+ * %NL80211_IFTYPE_NAN_DATA interface must exist. ++ * @NL80211_NAN_NDP_ATTR_INIT_NDI: ETH_ALEN-byte initiator NDI MAC address. For ++ * locally initiated NDPs, the corresponding %NL80211_IFTYPE_NAN_DATA ++ * interface must exist.  + * @NL80211_NAN_NDP_ATTR_RESP_NDI: ETH_ALEN-byte responder NDI MAC address.  + * @NL80211_NAN_NDP_ATTR_SSI: binary. Service-specific info carried in  + * the NDP setup frames. @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes {  + * @NL80211_NAN_NDP_ATTR_GTK_CIPHER: u32 GTK cipher suite ID. Required if  + * @NL80211_NAN_NDP_ATTR_GTK_REQUIRED is set.  + * @NL80211_NAN_NDP_ATTR_IPV6_INTF_ID: binary IPv6 link-local interface -+ * identifier, %NL80211_NAN_NDP_IPV6_INTF_ID_LEN bytes. The driver conveys it -+ * in the NDPE attribute and selects NDP or NDPE based on peer capabilities. ++ * identifier, %NL80211_NAN_NDP_IPV6_INTF_ID_LEN bytes. The driver conveys ++ * it in the NDPE attribute and selects NDP or NDPE based on peer ++ * capabilities.  + * @NL80211_NAN_NDP_ATTR_TRANSPORT_PORT: u16 transport port. Must be supplied -+ * with @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL. The driver carries the pair -+ * in the NDPE Service Info TLV (Generic Service Protocol). If the peer does -+ * not support NDPE, the values are not conveyed. ++ * with @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL. The driver carries the ++ * pair in the NDPE Service Info TLV (Generic Service Protocol). If the ++ * peer does not support NDPE, the values are not conveyed.  + * @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL: u8 IANA protocol number. Must be  + * supplied with @NL80211_NAN_NDP_ATTR_TRANSPORT_PORT. -+ * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field -+ * of the NDL QoS attribute, specifying the minimum number of NAN time slots ++ * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field of ++ * the NDL QoS attribute, specifying the minimum number of NAN time slots  + * required for this NDP. Absent or 0 means no preference.  + * @NL80211_NAN_NDP_ATTR_QOS_MAX_LATENCY: optional u16 Maximum Latency field of -+ * the NDL QoS attribute, specifying the maximum number of NAN slots between -+ * two non-contiguous NDL CRBs. Absent or 0xffff means no preference. ++ * the NDL QoS attribute, specifying the maximum number of NAN slots ++ * between two non-contiguous NDL CRBs. Absent or 0xffff means no ++ * preference.  + * @__NL80211_NAN_NDP_ATTR_LAST: Internal.  + * @NL80211_NAN_NDP_ATTR_MAX: Highest NDP attribute.  + */ @@ net/wireless/trace.h: TRACE_EVENT(rdev_nan_set_non_evac_channels,  + RDEV_NAN_NDP_INITIATE_FMT_3 RDEV_NAN_NDP_INITIATE_FMT_4  + RDEV_NAN_NDP_INITIATE_FMT_5  + ", transport_info: %d, transport_port: %u, transport_protocol: %u", -+ WIPHY_PR_ARG, WDEV_PR_ARG, __entry->peer_nmi, __entry->init_ndi, -+ __entry->publish_id, ++ WIPHY_PR_ARG, WDEV_PR_ARG, __entry->peer_nmi, ++ __entry->init_ndi, __entry->publish_id,  + __print_array(__entry->service_id,  + NL80211_NAN_FUNC_SERVICE_ID_LEN, sizeof(u8)),  + __entry->ssi_len, 11: 72ab90d3b81e ! 11: 5b202062f993 wifi: nl80211/cfg80211: add support for NDP response in offload mode @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_initiate { * enum cfg80211_nan_conf_changes - indicates changed fields in NAN * configuration  @@ include/net/cfg80211.h: struct mgmt_frame_regs { - * status notification, including on failure or timeout. If the device cannot - * meet the QoS requirements in @params, it reports setup failure with the - * Wi-Fi Aware reason QoS_UNACCEPTABLE. -+ * @nan_ndp_respond: Respond to an incoming NDP request as the responder. -+ * Only valid if the driver has set %WIPHY_NAN_FLAGS_OFFLOAD_NDP. Returning -+ * success acknowledges the response command only; setup outcome is reported -+ * asynchronously after the handshake. If the accepted response's QoS -+ * requirements cannot be met, the driver reports setup failure with the -+ * Wi-Fi Aware reason QoS_UNACCEPTABLE. + * notification, including on failure or timeout. If the device cannot meet + * the QoS requirements in @params, it reports setup failure with the Wi-Fi + * Aware reason QoS_UNACCEPTABLE. ++ * @nan_ndp_respond: Respond to an incoming NDP request as the responder. Only ++ * valid if the driver has set %WIPHY_NAN_FLAGS_OFFLOAD_NDP. Returning ++ * success acknowledges the response command only; setup outcome is ++ * reported asynchronously after the handshake. If the accepted response's ++ * QoS requirements cannot be met, the driver reports setup failure with ++ * the Wi-Fi Aware reason QoS_UNACCEPTABLE. * * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS * @@ include/net/cfg80211.h: struct cfg80211_ops {  ## include/uapi/linux/nl80211.h ##  @@ - * Aware reason QoS_UNACCEPTABLE. - * Each accepted setup attempt completes asynchronously with exactly one - * %NL80211_CMD_NAN_NDP_STATUS notification, including on failure or timeout. -+ * @NL80211_CMD_NAN_NDP_RESPOND: Respond to a received NDP request as -+ * the responder. Requires %NL80211_NAN_CAPA_OFFLOAD_NDP. The NDI -+ * interface specified in %NL80211_NAN_NDP_ATTR_RESP_NDI must already -+ * exist as a %NL80211_IFTYPE_NAN_DATA interface. Carries -+ * %NL80211_ATTR_NAN_NDP nested with %NL80211_NAN_NDP_ATTR_* fields. -+ * The command reply only acknowledges that the response was accepted for -+ * processing; setup outcome is reported asynchronously by -+ * %NL80211_CMD_NAN_NDP_STATUS. -+ * Transport port and protocol may be supplied together only when accepting. -+ * NDL QoS attributes may also be supplied only when accepting. If the device -+ * cannot meet the QoS requirements in an accepted response, setup fails and -+ * the status notification reports the Wi-Fi Aware reason QoS_UNACCEPTABLE. + * Aware reason QoS_UNACCEPTABLE. Each accepted setup attempt completes + * asynchronously with exactly one %NL80211_CMD_NAN_NDP_STATUS + * notification, including on failure or timeout. ++ * @NL80211_CMD_NAN_NDP_RESPOND: Respond to a received NDP request as the ++ * responder. Requires %NL80211_NAN_CAPA_OFFLOAD_NDP. The NDI interface ++ * specified in %NL80211_NAN_NDP_ATTR_RESP_NDI must already exist as a ++ * %NL80211_IFTYPE_NAN_DATA interface. Carries %NL80211_ATTR_NAN_NDP nested ++ * with %NL80211_NAN_NDP_ATTR_* fields. The command reply only acknowledges ++ * that the response was accepted for processing; setup outcome is reported ++ * asynchronously by %NL80211_CMD_NAN_NDP_STATUS. Transport port and ++ * protocol may be supplied together only when accepting. NDL QoS ++ * attributes may also be supplied only when accepting. If the device ++ * cannot meet the QoS requirements in an accepted response, setup fails ++ * and the status notification reports the Wi-Fi Aware reason ++ * QoS_UNACCEPTABLE. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use @@ include/uapi/linux/nl80211.h: enum nl80211_commands { /* add new commands above here */   @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { - * For locally initiated NDPs, the corresponding - * %NL80211_IFTYPE_NAN_DATA interface must exist. - * @NL80211_NAN_NDP_ATTR_RESP_NDI: ETH_ALEN-byte responder NDI MAC address. -+ * When accepting with %NL80211_CMD_NAN_NDP_RESPOND, this must identify an + * @NL80211_NAN_NDP_ATTR_INIT_NDI: ETH_ALEN-byte initiator NDI MAC address. For + * locally initiated NDPs, the corresponding %NL80211_IFTYPE_NAN_DATA + * interface must exist. +- * @NL80211_NAN_NDP_ATTR_RESP_NDI: ETH_ALEN-byte responder NDI MAC address. ++ * @NL80211_NAN_NDP_ATTR_RESP_NDI: ETH_ALEN-byte responder NDI MAC address. When ++ * accepting with %NL80211_CMD_NAN_NDP_RESPOND, this must identify an  + * existing local %NL80211_IFTYPE_NAN_DATA interface. * @NL80211_NAN_NDP_ATTR_SSI: binary. Service-specific info carried in * the NDP setup frames. * @NL80211_NAN_NDP_ATTR_CIPHER_SUITE: u32 NAN cipher suite ID; 0 for open NDP.  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { - * identifier, %NL80211_NAN_NDP_IPV6_INTF_ID_LEN bytes. The driver conveys it - * in the NDPE attribute and selects NDP or NDPE based on peer capabilities. + * it in the NDPE attribute and selects NDP or NDPE based on peer + * capabilities. * @NL80211_NAN_NDP_ATTR_TRANSPORT_PORT: u16 transport port. Must be supplied -- * with @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL. The driver carries the pair -- * in the NDPE Service Info TLV (Generic Service Protocol). If the peer does -- * not support NDPE, the values are not conveyed. +- * with @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL. The driver carries the +- * pair in the NDPE Service Info TLV (Generic Service Protocol). If the +- * peer does not support NDPE, the values are not conveyed.  + * with @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL. The pair may be used in  + * %NL80211_CMD_NAN_NDP_INITIATE and in an accepting -+ * %NL80211_CMD_NAN_NDP_RESPOND. The driver carries these values in the NDPE -+ * Service Info TLV (Generic Service Protocol). If the peer does not support -+ * NDPE, these values are not conveyed. ++ * %NL80211_CMD_NAN_NDP_RESPOND. The driver carries these values in the ++ * NDPE Service Info TLV (Generic Service Protocol). If the peer does not ++ * support NDPE, these values are not conveyed. * @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL: u8 IANA protocol number. Must be * supplied with @NL80211_NAN_NDP_ATTR_TRANSPORT_PORT. - * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field - * of the NDL QoS attribute, specifying the minimum number of NAN time slots + * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field of + * the NDL QoS attribute, specifying the minimum number of NAN time slots  - * required for this NDP. Absent or 0 means no preference.  + * required for this NDP. Absent or 0 means no preference. Used with  + * %NL80211_CMD_NAN_NDP_INITIATE and an accepting  + * %NL80211_CMD_NAN_NDP_RESPOND. * @NL80211_NAN_NDP_ATTR_QOS_MAX_LATENCY: optional u16 Maximum Latency field of - * the NDL QoS attribute, specifying the maximum number of NAN slots between -- * two non-contiguous NDL CRBs. Absent or 0xffff means no preference. -+ * two non-contiguous NDL CRBs. Absent or 0xffff means no preference. Used -+ * with %NL80211_CMD_NAN_NDP_INITIATE and an accepting + * the NDL QoS attribute, specifying the maximum number of NAN slots + * between two non-contiguous NDL CRBs. Absent or 0xffff means no +- * preference. ++ * preference. Used with %NL80211_CMD_NAN_NDP_INITIATE and an accepting  + * %NL80211_CMD_NAN_NDP_RESPOND.  + * @NL80211_NAN_NDP_ATTR_ACCEPT: flag. If present in  + * %NL80211_CMD_NAN_NDP_RESPOND, it accepts the request; if absent, it is 12: 7682f61a0028 ! 12: 0ef74cf6630c wifi: nl80211/cfg80211: add support for NDP termination in offload mode @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_respond { * enum cfg80211_nan_conf_changes - indicates changed fields in NAN * configuration  @@ include/net/cfg80211.h: struct mgmt_frame_regs { - * asynchronously after the handshake. If the accepted response's QoS - * requirements cannot be met, the driver reports setup failure with the - * Wi-Fi Aware reason QoS_UNACCEPTABLE. -+ * @nan_ndp_terminate: Terminate an NDP session or cancel NDP setup in -+ * progress. cfg80211 also uses it to cancel a locally initiated setup -+ * whose NDP ID reply could not be delivered to userspace. Only valid if -+ * the driver has set %WIPHY_NAN_FLAGS_OFFLOAD_NDP. Returning success -+ * acknowledges the request; report completion asynchronously with + * reported asynchronously after the handshake. If the accepted response's + * QoS requirements cannot be met, the driver reports setup failure with + * the Wi-Fi Aware reason QoS_UNACCEPTABLE. ++ * @nan_ndp_terminate: Terminate an NDP session or cancel NDP setup in progress. ++ * cfg80211 also uses it to cancel a locally initiated setup whose NDP ID ++ * reply could not be delivered to userspace. Only valid if the driver has ++ * set %WIPHY_NAN_FLAGS_OFFLOAD_NDP. Returning success acknowledges the ++ * request; report completion asynchronously with  + * cfg80211_nan_ndp_terminated(). * * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS @@ include/net/cfg80211.h: struct cfg80211_ops {  ## include/uapi/linux/nl80211.h ##  @@ - * NDL QoS attributes may also be supplied only when accepting. If the device - * cannot meet the QoS requirements in an accepted response, setup fails and - * the status notification reports the Wi-Fi Aware reason QoS_UNACCEPTABLE. + * cannot meet the QoS requirements in an accepted response, setup fails + * and the status notification reports the Wi-Fi Aware reason + * QoS_UNACCEPTABLE.  + * @NL80211_CMD_NAN_NDP_TERMINATE: Terminate an NDP or cancel setup in progress.  + * Requires %NL80211_NAN_CAPA_OFFLOAD_NDP. Carries %NL80211_ATTR_NAN_NDP -+ * nested with %NL80211_NAN_NDP_ATTR_ID, %NL80211_NAN_NDP_ATTR_INIT_NDI -+ * and optionally %NL80211_NAN_NDP_ATTR_REASON. -+ * The command reply acknowledges the request; teardown completion is -+ * reported asynchronously by the termination notification. ++ * nested with %NL80211_NAN_NDP_ATTR_ID, %NL80211_NAN_NDP_ATTR_INIT_NDI and ++ * optionally %NL80211_NAN_NDP_ATTR_REASON. The command reply acknowledges ++ * the request; teardown completion is reported asynchronously by the ++ * termination notification. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use 13: c04f82fc7632 ! 13: 604d538aeb9d wifi: nl80211/cfg80211: add support for NDP request indication @@ include/net/cfg80211.h: cfg80211_s1g_get_primary_sibling(struct wiphy *wiphy,  + * result once, including on rejection, failure, or timeout. Only valid when  + * %WIPHY_NAN_FLAGS_OFFLOAD_NDP is set.  + */ -+void cfg80211_nan_ndp_request(struct wireless_dev *wdev, -+ const struct cfg80211_nan_ndp_request_params *params, -+ gfp_t gfp); ++void ++cfg80211_nan_ndp_request(struct wireless_dev *wdev, ++ const struct cfg80211_nan_ndp_request_params *params, ++ gfp_t gfp);  + /** * cfg80211_incumbent_signal_notify - Notify userspace of incumbent signal detection @@ include/net/cfg80211.h: cfg80211_s1g_get_primary_sibling(struct wiphy *wiphy,  ## include/uapi/linux/nl80211.h ##  @@ - * Aware reason QoS_UNACCEPTABLE. - * Each accepted setup attempt completes asynchronously with exactly one - * %NL80211_CMD_NAN_NDP_STATUS notification, including on failure or timeout. -+ * This command is also used as a notification when an NDP Request is -+ * received from a peer. The notification carries %NL80211_ATTR_MAC and -+ * %NL80211_ATTR_NAN_NDP with the received parameters. Userspace must ensure -+ * the responder NDI exists before sending @NL80211_CMD_NAN_NDP_RESPOND. -+ * Each indicated request is a setup attempt and completes with exactly one -+ * %NL80211_CMD_NAN_NDP_STATUS notification, including on failure or timeout. - * @NL80211_CMD_NAN_NDP_RESPOND: Respond to a received NDP request as - * the responder. Requires %NL80211_NAN_CAPA_OFFLOAD_NDP. The NDI - * interface specified in %NL80211_NAN_NDP_ATTR_RESP_NDI must already + * requirements, setup fails and the status notification reports the Wi-Fi + * Aware reason QoS_UNACCEPTABLE. Each accepted setup attempt completes + * asynchronously with exactly one %NL80211_CMD_NAN_NDP_STATUS ++ * notification, including on failure or timeout. This command is also used ++ * as a notification when an NDP Request is received from a peer. The ++ * notification carries %NL80211_ATTR_MAC and %NL80211_ATTR_NAN_NDP with ++ * the received parameters. Userspace must ensure the responder NDI exists ++ * before sending %NL80211_CMD_NAN_NDP_RESPOND. Each indicated request is a ++ * setup attempt and completes with exactly one %NL80211_CMD_NAN_NDP_STATUS + * notification, including on failure or timeout. + * @NL80211_CMD_NAN_NDP_RESPOND: Respond to a received NDP request as the + * responder. Requires %NL80211_NAN_CAPA_OFFLOAD_NDP. The NDI interface  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { * %NL80211_CMD_NAN_NDP_INITIATE and in an accepting - * %NL80211_CMD_NAN_NDP_RESPOND. The driver carries these values in the NDPE - * Service Info TLV (Generic Service Protocol). If the peer does not support -- * NDPE, these values are not conveyed. -+ * NDPE, these values are not conveyed. Peer-request notifications include -+ * the pair when it was included by the peer. + * %NL80211_CMD_NAN_NDP_RESPOND. The driver carries these values in the + * NDPE Service Info TLV (Generic Service Protocol). If the peer does not +- * support NDPE, these values are not conveyed. ++ * support NDPE, these values are not conveyed. Peer-request notifications ++ * include the pair when it was included by the peer. * @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL: u8 IANA protocol number. Must be * supplied with @NL80211_NAN_NDP_ATTR_TRANSPORT_PORT. - * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field + * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field of  ## net/wireless/nl80211.c ##  @@ net/wireless/nl80211.c: static int nl80211_nan_ndp_terminate(struct sk_buff *skb, @@ net/wireless/nl80211.c: static int nl80211_nan_ndp_terminate(struct sk_buff *skb  + msg, 0, NL80211_MCGRP_NAN, gfp);  +}  + -+void cfg80211_nan_ndp_request(struct wireless_dev *wdev, -+ const struct cfg80211_nan_ndp_request_params *params, -+ gfp_t gfp) ++void ++cfg80211_nan_ndp_request(struct wireless_dev *wdev, ++ const struct cfg80211_nan_ndp_request_params *params, ++ gfp_t gfp)  +{  + struct wiphy *wiphy = wdev->wiphy;  + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); @@ net/wireless/nl80211.c: static int nl80211_nan_ndp_terminate(struct sk_buff *skb  + void *hdr;  +  + if (WARN_ON_ONCE(!params->peer_nmi || !params->init_ndi || -+ !params->ndp_id || wdev->iftype != NL80211_IFTYPE_NAN || ++ !params->ndp_id || ++ wdev->iftype != NL80211_IFTYPE_NAN ||  + !(wiphy->nan_capa.flags &  + WIPHY_NAN_FLAGS_OFFLOAD_NDP)))  + return; 14: 17fc0be0fa86 ! 14: b1f011152f8e wifi: nl80211/cfg80211: add support for NDP status indication @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_request_params { /** * enum cfg80211_nan_conf_changes - indicates changed fields in NAN * configuration -@@ include/net/cfg80211.h: void cfg80211_nan_ndp_request(struct wireless_dev *wdev, - const struct cfg80211_nan_ndp_request_params *params, - gfp_t gfp); +@@ include/net/cfg80211.h: cfg80211_nan_ndp_request(struct wireless_dev *wdev, + const struct cfg80211_nan_ndp_request_params *params, + gfp_t gfp);   +/**  + * cfg80211_nan_ndp_status - notify userspace that NDP setup is complete @@ include/net/cfg80211.h: void cfg80211_nan_ndp_request(struct wireless_dev *wdev,  + * including failure and timeout (for example, when the peer does not respond).  + * Only valid when %WIPHY_NAN_FLAGS_OFFLOAD_NDP is set.  + */ -+void cfg80211_nan_ndp_status(struct wireless_dev *wdev, -+ const struct cfg80211_nan_ndp_status_params *params, -+ gfp_t gfp); ++void ++cfg80211_nan_ndp_status(struct wireless_dev *wdev, ++ const struct cfg80211_nan_ndp_status_params *params, ++ gfp_t gfp);  + /** * cfg80211_incumbent_signal_notify - Notify userspace of incumbent signal detection @@ include/net/cfg80211.h: void cfg80211_nan_ndp_request(struct wireless_dev *wdev,  ## include/uapi/linux/nl80211.h ##  @@ - * and optionally %NL80211_NAN_NDP_ATTR_REASON. - * The command reply acknowledges the request; teardown completion is - * reported asynchronously by the termination notification. -+ * @NL80211_CMD_NAN_NDP_STATUS: Notification-only event sent to userspace on -+ * the initiator and responder sides when NDP setup finishes, successfully or -+ * not. If %NL80211_NAN_NDP_ATTR_ACCEPT is present, setup succeeded and + * optionally %NL80211_NAN_NDP_ATTR_REASON. The command reply acknowledges + * the request; teardown completion is reported asynchronously by the + * termination notification. ++ * @NL80211_CMD_NAN_NDP_STATUS: Notification-only event sent to userspace on the ++ * initiator and responder sides when NDP setup finishes, successfully or ++ * not. It carries %NL80211_ATTR_MAC and %NL80211_ATTR_NAN_NDP, including ++ * transport information when it was included by the peer. If ++ * %NL80211_NAN_NDP_ATTR_ACCEPT is present, setup succeeded and  + * %NL80211_NAN_NDP_ATTR_RESP_NDI is present; otherwise the notification -+ * carries %NL80211_NAN_NDP_ATTR_REASON. Also carries %NL80211_ATTR_MAC and -+ * %NL80211_ATTR_NAN_NDP. Exactly one status notification is sent for each -+ * setup attempt, whether initiated locally or from an indicated peer request. -+ * It is sent after success, failure, or timeout, including when the peer does -+ * not respond. -+ * %NL80211_ATTR_NAN_NDP, including transport information when it was -+ * included by the peer. ++ * carries %NL80211_NAN_NDP_ATTR_REASON. Exactly one status notification is ++ * sent for each setup attempt, whether initiated locally or from an ++ * indicated peer request. It is sent after success, failure, or timeout, ++ * including when the peer does not respond. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use @@ include/uapi/linux/nl80211.h: enum nl80211_commands {   @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { * %NL80211_CMD_NAN_NDP_INITIATE and in an accepting - * %NL80211_CMD_NAN_NDP_RESPOND. The driver carries these values in the NDPE - * Service Info TLV (Generic Service Protocol). If the peer does not support -- * NDPE, these values are not conveyed. Peer-request notifications include -- * the pair when it was included by the peer. -+ * NDPE, these values are not conveyed. Peer-request and status notifications -+ * include the pair when it was included by the peer. + * %NL80211_CMD_NAN_NDP_RESPOND. The driver carries these values in the + * NDPE Service Info TLV (Generic Service Protocol). If the peer does not +- * support NDPE, these values are not conveyed. Peer-request notifications +- * include the pair when it was included by the peer. ++ * support NDPE, these values are not conveyed. Peer-request and status ++ * notifications include the pair when it was included by the peer. * @NL80211_NAN_NDP_ATTR_TRANSPORT_PROTOCOL: u8 IANA protocol number. Must be * supplied with @NL80211_NAN_NDP_ATTR_TRANSPORT_PORT. - * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field + * @NL80211_NAN_NDP_ATTR_QOS_MIN_SLOTS: optional u8 Minimum Time Slots field of  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { * %NL80211_CMD_NAN_NDP_RESPOND. * @NL80211_NAN_NDP_ATTR_ACCEPT: flag. If present in * %NL80211_CMD_NAN_NDP_RESPOND, it accepts the request; if absent, it is  - * rejected. -+ * rejected. In %NL80211_CMD_NAN_NDP_STATUS it indicates setup succeeded and -+ * @NL80211_NAN_NDP_ATTR_RESP_NDI is present. ++ * rejected. In %NL80211_CMD_NAN_NDP_STATUS it indicates setup succeeded ++ * and @NL80211_NAN_NDP_ATTR_RESP_NDI is present. * @NL80211_NAN_NDP_ATTR_REASON: u8 Wi-Fi Aware reason code, not an IEEE 802.11 * reason code (%NL80211_ATTR_REASON_CODE). Used for rejection with  - * %NL80211_CMD_NAN_NDP_RESPOND. @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { */  ## net/wireless/nl80211.c ## -@@ net/wireless/nl80211.c: void cfg80211_nan_ndp_request(struct wireless_dev *wdev, +@@ net/wireless/nl80211.c: cfg80211_nan_ndp_request(struct wireless_dev *wdev, } EXPORT_SYMBOL(cfg80211_nan_ndp_request);  -+void cfg80211_nan_ndp_status(struct wireless_dev *wdev, -+ const struct cfg80211_nan_ndp_status_params *params, -+ gfp_t gfp) ++void ++cfg80211_nan_ndp_status(struct wireless_dev *wdev, ++ const struct cfg80211_nan_ndp_status_params *params, ++ gfp_t gfp)  +{  + struct wiphy *wiphy = wdev->wiphy;  + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); @@ net/wireless/nl80211.c: void cfg80211_nan_ndp_request(struct wireless_dev *wdev,  + void *hdr;  +  + if (WARN_ON_ONCE(!params->peer_nmi || !params->init_ndi || -+ !params->ndp_id || wdev->iftype != NL80211_IFTYPE_NAN || ++ !params->ndp_id || ++ wdev->iftype != NL80211_IFTYPE_NAN ||  + !(wiphy->nan_capa.flags &  + WIPHY_NAN_FLAGS_OFFLOAD_NDP)))  + return; 15: 8232e134f2ea ! 15: b3fce5a6d0aa wifi: nl80211/cfg80211: add support for NDP terminated indication @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_status_params {  + * @init_ndi: initiator NDI MAC address  + * @reason: Wi-Fi Aware reason code for termination  + * @locally_generated: if true, teardown was initiated or detected locally -+ * (userspace or device) rather than by a peer termination request. Includes -+ * NDI down/removal, NAN stop, and peer loss. ++ * (userspace or device) rather than by a peer termination request. ++ * Includes NDI down/removal, NAN stop, and peer loss.  + */  +struct cfg80211_nan_ndp_terminated_params {  + const u8 *peer_nmi; @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_status_params { /** * enum cfg80211_nan_conf_changes - indicates changed fields in NAN * configuration -@@ include/net/cfg80211.h: void cfg80211_nan_ndp_status(struct wireless_dev *wdev, - const struct cfg80211_nan_ndp_status_params *params, - gfp_t gfp); +@@ include/net/cfg80211.h: cfg80211_nan_ndp_status(struct wireless_dev *wdev, + const struct cfg80211_nan_ndp_status_params *params, + gfp_t gfp);   +/**  + * cfg80211_nan_ndp_terminated - notify userspace that an NDP was terminated @@ include/net/cfg80211.h: void cfg80211_nan_ndp_status(struct wireless_dev *wdev,  + * The locally_generated field is true when teardown was initiated or detected  + * locally (userspace or device), and false when the peer initiated it.  + */ -+void cfg80211_nan_ndp_terminated(struct wireless_dev *wdev, -+ const struct cfg80211_nan_ndp_terminated_params *params, -+ gfp_t gfp); ++void ++cfg80211_nan_ndp_terminated(struct wireless_dev *wdev, ++ const struct cfg80211_nan_ndp_terminated_params *params, ++ gfp_t gfp);  + /** * cfg80211_incumbent_signal_notify - Notify userspace of incumbent signal detection @@ include/net/cfg80211.h: void cfg80211_nan_ndp_status(struct wireless_dev *wdev,  ## include/uapi/linux/nl80211.h ##  @@ - * and optionally %NL80211_NAN_NDP_ATTR_REASON. - * The command reply acknowledges the request; teardown completion is - * reported asynchronously by the termination notification. -+ * This command is also used as a notification when an NDP is terminated. -+ * The notification carries %NL80211_ATTR_MAC and %NL80211_ATTR_NAN_NDP with -+ * %NL80211_NAN_NDP_ATTR_ID, %NL80211_NAN_NDP_ATTR_INIT_NDI, -+ * %NL80211_NAN_NDP_ATTR_REASON, and, when applicable, -+ * %NL80211_NAN_NDP_ATTR_LOCALLY_GENERATED. Exactly one notification is sent -+ * for each established NDP that terminates, including teardown due to NDI -+ * down/removal, NAN stop, or peer loss. - * @NL80211_CMD_NAN_NDP_STATUS: Notification-only event sent to userspace on - * the initiator and responder sides when NDP setup finishes, successfully or - * not. If %NL80211_NAN_NDP_ATTR_ACCEPT is present, setup succeeded and + * nested with %NL80211_NAN_NDP_ATTR_ID, %NL80211_NAN_NDP_ATTR_INIT_NDI and + * optionally %NL80211_NAN_NDP_ATTR_REASON. The command reply acknowledges + * the request; teardown completion is reported asynchronously by the +- * termination notification. ++ * termination notification. This command is also used as a notification ++ * when an NDP is terminated. The notification carries %NL80211_ATTR_MAC ++ * and %NL80211_ATTR_NAN_NDP with %NL80211_NAN_NDP_ATTR_ID, ++ * %NL80211_NAN_NDP_ATTR_INIT_NDI, %NL80211_NAN_NDP_ATTR_REASON, and, when ++ * applicable, %NL80211_NAN_NDP_ATTR_LOCALLY_GENERATED. Exactly one ++ * notification is sent for each established NDP that terminates, including ++ * teardown due to NDI down/removal, NAN stop, or peer loss. + * @NL80211_CMD_NAN_NDP_STATUS: Notification-only event sent to userspace on the + * initiator and responder sides when NDP setup finishes, successfully or + * not. It carries %NL80211_ATTR_MAC and %NL80211_ATTR_NAN_NDP, including  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { * reason code (%NL80211_ATTR_REASON_CODE). Used for rejection with * %NL80211_CMD_NAN_NDP_RESPOND, setup failure with @@ include/uapi/linux/nl80211.h: enum nl80211_nan_ndp_attributes { __NL80211_NAN_NDP_ATTR_LAST,  ## net/wireless/nl80211.c ## -@@ net/wireless/nl80211.c: void cfg80211_nan_ndp_status(struct wireless_dev *wdev, +@@ net/wireless/nl80211.c: cfg80211_nan_ndp_status(struct wireless_dev *wdev, } EXPORT_SYMBOL(cfg80211_nan_ndp_status);  -+void cfg80211_nan_ndp_terminated(struct wireless_dev *wdev, -+ const struct cfg80211_nan_ndp_terminated_params *params, -+ gfp_t gfp) ++void ++cfg80211_nan_ndp_terminated(struct wireless_dev *wdev, ++ const struct cfg80211_nan_ndp_terminated_params *params, ++ gfp_t gfp)  +{  + struct wiphy *wiphy = wdev->wiphy;  + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); @@ net/wireless/nl80211.c: void cfg80211_nan_ndp_status(struct wireless_dev *wdev,  + void *hdr;  +  + if (WARN_ON_ONCE(!params->peer_nmi || !params->init_ndi || -+ !params->ndp_id || wdev->iftype != NL80211_IFTYPE_NAN || ++ !params->ndp_id || ++ wdev->iftype != NL80211_IFTYPE_NAN ||  + !(wiphy->nan_capa.flags &  + WIPHY_NAN_FLAGS_OFFLOAD_NDP)))  + return; 16: b0dcd0654ff7 ! 16: 9e7085afdea0 wifi: nl80211/cfg80211: support updating an offloaded NAN publish function @@ include/net/cfg80211.h: struct cfg80211_nan_func {  + * struct cfg80211_nan_update_publish - update NAN publish service info  + *  + * @cookie: non-zero cookie of the active publish function to update -+ * @serv_spec_info: replacement service-specific information. The pointer is -+ * valid only for the duration of the callback and must not be retained. ++ * @serv_spec_info: replacement service-specific information  + * @serv_spec_info_len: length of @serv_spec_info. A zero length clears the  + * current service-specific information.  + */ @@ include/net/cfg80211.h: struct mgmt_frame_regs { * cfg80211_free_nan_func(). * On success the driver should assign an instance_id in the * provided @nan_func. -+ * @nan_update_publish: Update the service-specific information of an active -+ * NAN publish function identified by the cookie in @params. Return -ENOENT if ++ * @nan_update_publish: Update the service-specific information of an active NAN ++ * publish function identified by the cookie in @params. Return -ENOENT if  + * the cookie does not identify an active publish function of this wdev; -+ * subscribe functions cannot be updated. The service-info pointer is valid -+ * only for the duration of the callback. ++ * subscribe functions cannot be updated. * @del_nan_func: Delete a NAN function. * @nan_change_conf: changes NAN configuration. The changed parameters must * be specified in @changes (using &enum cfg80211_nan_conf_changes); @@ include/uapi/linux/nl80211.h * 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_UPDATE_NAN_PUBLISH: Update only the service-specific -+ * information of an active NAN publish function. The function is identified -+ * by a non-zero %NL80211_ATTR_COOKIE. Supply the new information as ++ * @NL80211_CMD_UPDATE_NAN_PUBLISH: Update only the service-specific information ++ * of an active NAN publish function. The function is identified by a ++ * non-zero %NL80211_ATTR_COOKIE. Supply the new information as  + * %NL80211_NAN_FUNC_SERVICE_INFO nested in %NL80211_ATTR_NAN_FUNC. A  + * zero-length service-info attribute clears the current value. All other  + * function parameters remain unchanged, and the update does not change the 17: 432c8a041918 ! 17: ee9c369604a6 wifi: nl80211/cfg80211: allow extra NAN attributes in offloaded functions @@ Commit message attributes that the device appends to the frames of the function. This keeps pairing, and the NAN Identity Key, in user space.  - Validate the attribute framing, bound the length like information - elements, and only accept the attribute if the driver advertises - NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS. + Accept only the NAN Identity Resolution attribute and Vendor Specific + attributes. The device builds all other attributes of these frames from + the function and NAN configuration, so restricting the list keeps user + space from adding duplicate or conflicting attributes and makes the + accepted content explicit. Add the two attribute IDs to + ieee80211-nan.h. + + Validate the attribute framing and types, bound the length like + information elements, and only accept the attribute if the driver + advertises NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS.  Signed-off-by: Vinay Gannevaram  Signed-off-by: Shivani Baranwal   + ## include/linux/ieee80211-nan.h ## +@@ + #define NAN_ATTR_CLUSTER_INFO 0x01 + #define NAN_ATTR_SERVICE_ID_LIST 0x02 + #define NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST 0x28 ++#define NAN_ATTR_NAN_IDENTITY_RESOLUTION 0x2b ++#define NAN_ATTR_VENDOR_SPECIFIC 0xdd +  + struct ieee80211_nan_attr { + u8 attr; + ## include/net/cfg80211.h ##  @@ include/net/cfg80211.h: struct cfg80211_nan_func_filter { * @chandef: channel definition for FTM ranging. * @range_report: if true, a NAN Ranging Report is required after the FTM * session.  + * @extra_attrs: additional NAN attributes to append to the Service Discovery -+ * Frames transmitted for this function. It must not contain attributes that -+ * the device adds itself, such as the Service Descriptor attribute or -+ * attributes derived from other function fields. Typical uses include the -+ * NAN Identity Resolution attribute for pairing verification in Publish and -+ * Subscribe messages. The driver is responsible for ensuring the resulting ++ * Frames transmitted for this function. cfg80211 accepts only the NAN ++ * Identity Resolution attribute, used for pairing verification in Publish ++ * and Subscribe messages, and Vendor Specific attributes. The driver ++ * appends them unmodified and is responsible for ensuring the resulting  + * frame fits its supported limits.  + * @extra_attrs_len: length of @extra_attrs. */ @@ include/net/cfg80211.h: struct cfg80211_nan_func {  /**  @@ include/net/cfg80211.h: struct wiphy_radio { - * cfg80211_nan_ndp_request(), cfg80211_nan_ndp_status(), and - * cfg80211_nan_ndp_terminated(). Secure NDPs require - * %NL80211_EXT_FEATURE_SECURE_NAN. + * and termination with cfg80211_nan_ndp_request(), + * cfg80211_nan_ndp_status(), and cfg80211_nan_ndp_terminated(). Secure + * NDPs require %NL80211_EXT_FEATURE_SECURE_NAN.  + * @WIPHY_NAN_FLAGS_FUNC_EXTRA_ATTRS: Driver accepts additional per-function -+ * NAN attributes when the Discovery Engine is offloaded. This flag cannot -+ * be used with %WIPHY_NAN_FLAGS_USERSPACE_DE. ++ * NAN attributes when the Discovery Engine is offloaded. */ enum wiphy_nan_flags { WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0), @@ include/uapi/linux/nl80211.h: enum nl80211_nan_func_term_reason {  + * @NL80211_NAN_FUNC_EXTRA_ATTRS: binary attribute containing additional NAN  + * attributes to append to Service Discovery Frames transmitted for this  + * function. Each attribute is encoded as a one-octet ID, a two-octet -+ * little-endian length, and that many body octets. It must not contain -+ * attributes that the device adds itself, such as the Service Descriptor -+ * attribute or attributes derived from other function attributes. Typical -+ * uses include the NAN Identity Resolution attribute for pairing -+ * verification in Publish and Subscribe messages. Requires -+ * %NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS. ++ * little-endian length, and that many body octets. Only the NAN Identity ++ * Resolution attribute, used for pairing verification in Publish and ++ * Subscribe messages, and Vendor Specific attributes are accepted; any ++ * other attribute is rejected. The device appends the attributes ++ * unmodified. Requires %NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS. * * @NUM_NL80211_NAN_FUNC_ATTR: internal * @NL80211_NAN_FUNC_ATTR_MAX: highest NAN function attribute @@ include/uapi/linux/nl80211.h: enum nl80211_nan_func_attributes { /* keep last */ NUM_NL80211_NAN_FUNC_ATTR,  @@ include/uapi/linux/nl80211.h: enum nl80211_s1g_short_beacon_attrs { - * and termination with %NL80211_CMD_NAN_NDP_INITIATE, - * %NL80211_CMD_NAN_NDP_STATUS, and %NL80211_CMD_NAN_NDP_TERMINATE. - * Secure NDPs additionally require %NL80211_EXT_FEATURE_SECURE_NAN. + * %NL80211_CMD_NAN_NDP_INITIATE, %NL80211_CMD_NAN_NDP_STATUS, and + * %NL80211_CMD_NAN_NDP_TERMINATE. Secure NDPs additionally require + * %NL80211_EXT_FEATURE_SECURE_NAN.  + * @NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS: flag attribute. The device accepts  + * %NL80211_NAN_FUNC_EXTRA_ATTRS for NAN functions when the NAN Discovery -+ * Engine is offloaded. This capability is not available when -+ * %NL80211_NAN_CAPA_USERSPACE_DE is set. ++ * Engine is offloaded. * @__NL80211_NAN_CAPABILITIES_LAST: Internal * @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute. */ @@ net/wireless/nl80211.c: static int validate_nan_pmk(const struct nlattr *attr,  +  + while (pos < len) {  + u16 attr_len; ++ u8 attr_id;  +  + if (len - pos < 3) {  + NL_SET_ERR_MSG_ATTR(extack, attr, @@ net/wireless/nl80211.c: static int validate_nan_pmk(const struct nlattr *attr,  + return -EINVAL;  + }  + ++ attr_id = data[pos]; ++ if (attr_id != NAN_ATTR_NAN_IDENTITY_RESOLUTION && ++ attr_id != NAN_ATTR_VENDOR_SPECIFIC) { ++ NL_SET_ERR_MSG_ATTR(extack, attr, ++ "NAN function extra attribute type is not allowed"); ++ return -EINVAL; ++ } ++  + attr_len = get_unaligned_le16(data + pos + 1);  + pos += 3;  + if (attr_len > len - pos) { @@ net/wireless/nl80211.c: static int nl80211_nan_add_func(struct sk_buff *skb,  + goto out;  + }  + -+ func->extra_attrs_len = nla_len(tb[NL80211_NAN_FUNC_EXTRA_ATTRS]); ++ func->extra_attrs_len = ++ nla_len(tb[NL80211_NAN_FUNC_EXTRA_ATTRS]);  + func->extra_attrs =  + kmemdup(nla_data(tb[NL80211_NAN_FUNC_EXTRA_ATTRS]),  + func->extra_attrs_len, GFP_KERNEL); 18: cd7afb6b5d9f ! 18: b296a394915d wifi: nl80211/cfg80211: add NAN group key capabilities to NAN functions @@ include/net/cfg80211.h: struct cfg80211_nan_peer_sched { * @gtk_required: if true, GTK protection is required for group-addressed data  - * frames  + * frames. IGTK and BIGTK follow the service group-key support, see -+ * &struct cfg80211_nan_func.group_keys. ++ * &cfg80211_nan_func.group_keys. * @gtk_cipher: GTK cipher suite ID, valid when @gtk_required is true * @ipv6_intf_id: IPv6 link-local interface identifier, or NULL if absent * @ndp_id: output NDP ID assigned by the driver on success (1-255) @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_initiate { * @gtk_required: if true, GTK protection is required for group-addressed data  - * frames  + * frames. IGTK and BIGTK follow the service group-key support, see -+ * &struct cfg80211_nan_func.group_keys. ++ * &cfg80211_nan_func.group_keys. * @gtk_cipher: GTK cipher suite ID, valid when @gtk_required is true * @ipv6_intf_id: IPv6 link-local interface identifier, or NULL if absent * @transport_info: if true, convey @transport_port and @transport_protocol to @@ include/net/cfg80211.h: struct cfg80211_nan_ndp_terminate {  - * @gtk_required: if true, initiator requires GTK protection  + * @gtk_required: if true, the initiator requires GTK protection. IGTK and  + * BIGTK follow the service group-key support, see -+ * &struct cfg80211_nan_func.group_keys. ++ * &cfg80211_nan_func.group_keys. * @gtk_cipher: GTK cipher suite ID, included when @gtk_required is true * @ipv6_intf_id: initiator's IPv6 link-local interface identifier, or NULL * if absent @@ include/net/cfg80211.h: struct cfg80211_nan_func_filter { * @security_required: if true, the SDEA Security Required bit is set. Requires * @data_path_required and %NL80211_EXT_FEATURE_SECURE_NAN. * @gtk_required: if true, the SDEA GTK Required bit is set for GTK protection -- * of group-addressed data frames. Requires %NL80211_EXT_FEATURE_SECURE_NAN. -+ * of group-addressed data frames. This is independent of @group_keys, which -+ * advertises service group-key support. Requires +- * of group-addressed data frames. Requires ++ * of group-addressed data frames. This is independent of @group_keys, ++ * which advertises service group-key support. Requires  + * %NL80211_EXT_FEATURE_SECURE_NAN. -+ * @group_keys: group-key support of the service, advertised in the Cipher -+ * Suite Info attribute of the Service Discovery Frames of this function, as ++ * @group_keys: group-key support of the service, advertised in the Cipher Suite ++ * Info attribute of the Service Discovery Frames of this function, as  + * defined by &enum nl80211_nan_group_keys. With  + * %WIPHY_NAN_FLAGS_OFFLOAD_NDP the device also uses it for NDPs of the  + * service: it advertises it in NDP setup frames (an NDP initiator uses its @@ include/net/cfg80211.h: struct cfg80211_nan_func_filter {  + * %NL80211_EXT_FEATURE_SECURE_NAN.  + * @bip_gmac_256: if true, IGTK and BIGTK use NCS-BIP-GMAC-256 instead of  + * NCS-BIP-CMAC-128. Requires @group_keys and -+ * %NL80211_EXT_FEATURE_SECURE_NAN. + * %NL80211_EXT_FEATURE_SECURE_NAN. * @pairing_bootstrap_methods: bitmap of supported NAN pairing * bootstrapping methods per the Wi-Fi Aware Specification Table 9-321. - * @csids: array of u32 NAN Cipher Suite ID (CSID) selectors supported by  @@ include/net/cfg80211.h: struct cfg80211_nan_func { bool data_path_required; bool security_required; @@ include/net/cfg80211.h: struct cfg80211_nan_func { u32 *csids; u8 num_csids;  @@ include/net/cfg80211.h: struct wiphy_radio { - * %NL80211_CMD_NAN_SET_NON_EVAC_CHANNELS. The device learns and manages peer - * NAN schedules; userspace must not set them with + * %NL80211_CMD_NAN_SET_NON_EVAC_CHANNELS. The device learns and manages + * peer NAN schedules; userspace must not set them with * %NL80211_CMD_NAN_SET_PEER_SCHED. The device assigns NDP IDs for locally  - * initiated NDPs, derives, installs, and removes PTKs and, when requested, -- * GTKs. The device creates and removes NDI peer stations for offloaded NDPs. -- * Userspace must not add those NDI peer stations or their -+ * initiated NDPs, derives, installs, and removes PTKs and, when negotiated, -+ * GTKs, IGTKs, and BIGTKs (see &struct cfg80211_nan_func.group_keys). The -+ * device creates and removes NDI peer stations for offloaded NDPs. Userspace -+ * must not add those NDI peer stations or their - * keys. NDP offload is supported on all bands in - * &struct wiphy.nan_supported_bands. The device supplies the band-specific +- * GTKs. The device creates and removes NDI peer stations for offloaded ++ * initiated NDPs, derives, installs, and removes PTKs and, when ++ * negotiated, GTKs, IGTKs, and BIGTKs (see &cfg80211_nan_func.group_keys). ++ * The device creates and removes NDI peer stations for offloaded + * NDPs. NDP offload is supported on all bands in + * &wiphy.nan_supported_bands. The device supplies the band-specific * capabilities, such as the HE 6 GHz band and EHT capabilities, and the - * regulatory information in the frames it builds. The driver implements -- * @nan_ndp_initiate, -- * @nan_ndp_respond, and -+ * @nan_ndp_initiate, @nan_ndp_respond, and - * @nan_ndp_terminate callbacks. It supports - * %NL80211_CMD_NAN_NDP_INITIATE, %NL80211_CMD_NAN_NDP_RESPOND, and - * %NL80211_CMD_NAN_NDP_TERMINATE, and  ## include/uapi/linux/nl80211.h ##  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_publish_type { @@ include/uapi/linux/nl80211.h: enum nl80211_nan_publish_type { * enum nl80211_nan_func_term_reason - NAN functions termination reason *  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_func_term_reason { - * %NL80211_EXT_FEATURE_SECURE_NAN. + * and %NL80211_EXT_FEATURE_SECURE_NAN. * @NL80211_NAN_FUNC_GTK_REQUIRED: flag attribute. Sets the SDEA "GTK * Required" bit for GTK protection of group-addressed data frames.  - * Requires %NL80211_EXT_FEATURE_SECURE_NAN. @@ include/uapi/linux/nl80211.h: enum nl80211_nan_func_term_reason { * NAN pairing bootstrapping methods as defined in Wi-Fi Aware * specification Table 9-321. Each bit corresponds to one method. Requires  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_func_term_reason { - * uses include the NAN Identity Resolution attribute for pairing - * verification in Publish and Subscribe messages. Requires - * %NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS. + * Subscribe messages, and Vendor Specific attributes are accepted; any + * other attribute is rejected. The device appends the attributes + * unmodified. Requires %NL80211_NAN_CAPA_FUNC_EXTRA_ATTRS.  + * @NL80211_NAN_FUNC_GROUP_KEYS: u8 attribute, see &enum nl80211_nan_group_keys.  + * Group-key support of the service, advertised in the Cipher Suite Info  + * attribute of the Service Discovery Frames of this function. With @@ include/uapi/linux/nl80211.h: enum nl80211_nan_conf_attributes { * @NL80211_NAN_NDP_ATTR_GTK_REQUIRED is set. * @NL80211_NAN_NDP_ATTR_IPV6_INTF_ID: binary IPv6 link-local interface  @@ include/uapi/linux/nl80211.h: enum nl80211_s1g_short_beacon_attrs { - * device learns and manages peer NAN schedules; userspace must not set them - * with %NL80211_CMD_NAN_SET_PEER_SCHED. The device assigns NDP IDs for - * locally initiated NDPs and derives, installs, and removes data path keys -- * (PTK and, when requested, GTK). The device creates and removes NDI peer -+ * (PTK and, when negotiated, GTK, IGTK, and BIGTK, see + * peer NAN schedules; userspace must not set them with + * %NL80211_CMD_NAN_SET_PEER_SCHED. The device assigns NDP IDs for locally + * initiated NDPs and derives, installs, and removes data path keys (PTK +- * and, when requested, GTK). The device creates and removes NDI peer ++ * and, when negotiated, GTK, IGTK, and BIGTK, see  + * %NL80211_NAN_FUNC_GROUP_KEYS). The device creates and removes NDI peer - * stations for offloaded NDPs. Userspace must not add those NDI peer stations - * or their keys. NDP offload is supported on every band that the device - * reports for NAN in %NL80211_ATTR_BANDS. The device supplies the band-specific + * stations for offloaded NDPs. Userspace must not add those NDI peer + * stations or their keys. NDP offload is supported on every band that the + * device reports for NAN in %NL80211_ATTR_BANDS. The device supplies the  ## net/wireless/nl80211.c ##  @@ net/wireless/nl80211.c: nl80211_nan_func_policy[NL80211_NAN_FUNC_ATTR_MAX + 1] = { 19: e2f0e5fe57c0 ! 19: acb0602f1eab wifi: nl80211/cfg80211: select the 5 GHz NAN channel for IC @@ include/uapi/linux/nl80211.h: enum nl80211_nan_band_conf_attributes { * 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. -+ * If %NL80211_NAN_CONF_INSTANT_COMM_5GHZ is set, IC uses the configured 5 GHz -+ * NAN discovery channel; otherwise it uses the 2.4 GHz discovery channel. - * This is a flag attribute. +- * This is a flag attribute. ++ * If %NL80211_NAN_CONF_INSTANT_COMM_5GHZ is set, IC uses the configured ++ * 5 GHz NAN discovery channel; otherwise it uses the 2.4 GHz discovery ++ * channel. This is a flag attribute. * @NL80211_NAN_CONF_PAIRING_SETUP: flag attribute. Enables NAN pairing setup * and is advertised as "Pairing Setup Enabled" in the DCEA. Only valid for + * devices that offload the NAN Discovery Engine (i.e. without  @@ include/uapi/linux/nl80211.h: enum nl80211_nan_band_conf_attributes { * valid for devices that offload the NAN Discovery Engine (i.e. without * %NL80211_NAN_CAPA_USERSPACE_DE) and requires @@ include/uapi/linux/nl80211.h: enum nl80211_nan_band_conf_attributes {  + * @NL80211_NAN_CONF_INSTANT_COMM_5GHZ: optional flag, valid only together with  + * %NL80211_NAN_CONF_INSTANT_COMM and when a 5 GHz NAN band configuration  + * provides a discovery channel. When set, IC uses that 5 GHz channel; -+ * otherwise IC uses the 2.4 GHz NAN discovery channel. Wi-Fi Aware v4.0 uses -+ * 5 GHz when the intended peer is known to support it. ++ * otherwise IC uses the 2.4 GHz NAN discovery channel. Wi-Fi Aware v4.0 ++ * uses 5 GHz when the intended peer is known to support it. * @NUM_NL80211_NAN_CONF_ATTR: Internal. * @NL80211_NAN_CONF_ATTR_MAX: Highest NAN configuration attribute. *  -: ------------ > 20: a2999e15e3d9 wifi: nl80211/cfg80211: allow 6 GHz channels for NAN data paths  -: ------------ > 21: fe2a93efcee0 wifi: nl80211/cfg80211: add Max NDL Idle Period configuration for NDP offload