Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: cfg80211: Advertise supported NAN capabilities

Allow drivers to specify the supported NAN capabilities and support
advertising the NAN capabilities to 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/20250908140015.2976966556f5.Ic6e43b10049573180c909dad806f279cfb31143e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Ilan Peer and committed by
Johannes Berg
b9c3d426 3cbadd84

+96
+17
include/linux/ieee80211.h
··· 6065 6065 _data + ieee80211_mle_common_size(_data),\ 6066 6066 _len - ieee80211_mle_common_size(_data)) 6067 6067 6068 + /* NAN operation mode, as defined in Wi-Fi Aware (TM) specification Table 81 */ 6069 + #define NAN_OP_MODE_PHY_MODE_VHT 0x01 6070 + #define NAN_OP_MODE_PHY_MODE_HE 0x10 6071 + #define NAN_OP_MODE_PHY_MODE_MASK 0x11 6072 + #define NAN_OP_MODE_80P80MHZ 0x02 6073 + #define NAN_OP_MODE_160MHZ 0x04 6074 + #define NAN_OP_MODE_PNDL_SUPPRTED 0x08 6075 + 6076 + /* NAN Device capabilities, as defined in Wi-Fi Aware (TM) specification 6077 + * Table 79 6078 + */ 6079 + #define NAN_DEV_CAPA_DFS_OWNER 0x01 6080 + #define NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED 0x02 6081 + #define NAN_DEV_CAPA_SIM_NDP_RX_SUPPORTED 0x04 6082 + #define NAN_DEV_CAPA_NDPE_SUPPORTED 0x08 6083 + #define NAN_DEV_CAPA_S3_SUPPORTED 0x10 6084 + 6068 6085 #endif /* LINUX_IEEE80211_H */
+38
include/net/cfg80211.h
··· 5711 5711 u32 antenna_mask; 5712 5712 }; 5713 5713 5714 + /** 5715 + * enum wiphy_nan_flags - NAN capabilities 5716 + * 5717 + * @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable 5718 + * synchronization. 5719 + * @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload. 5720 + */ 5721 + enum wiphy_nan_flags { 5722 + WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0), 5723 + WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1), 5724 + }; 5725 + 5726 + /** 5727 + * struct wiphy_nan_capa - NAN capabilities 5728 + * 5729 + * This structure describes the NAN capabilities of a wiphy. 5730 + * 5731 + * @flags: NAN capabilities flags, see &enum wiphy_nan_flags 5732 + * @op_mode: NAN operation mode, as defined in Wi-Fi Aware (TM) specification 5733 + * Table 81. 5734 + * @n_antennas: number of antennas supported by the device for Tx/Rx. Lower 5735 + * nibble indicates the number of TX antennas and upper nibble indicates the 5736 + * number of RX antennas. Value 0 indicates the information is not 5737 + * available. 5738 + * @max_channel_switch_time: maximum channel switch time in milliseconds. 5739 + * @dev_capabilities: NAN device capabilities as defined in Wi-Fi Aware (TM) 5740 + * specification Table 79 (Capabilities field). 5741 + */ 5742 + struct wiphy_nan_capa { 5743 + u32 flags; 5744 + u8 op_mode; 5745 + u8 n_antennas; 5746 + u16 max_channel_switch_time; 5747 + u8 dev_capabilities; 5748 + }; 5749 + 5714 5750 #define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff 5715 5751 5716 5752 /** ··· 5920 5884 * bitmap of &enum nl80211_band values. For instance, for 5921 5885 * NL80211_BAND_2GHZ, bit 0 would be set 5922 5886 * (i.e. BIT(NL80211_BAND_2GHZ)). 5887 + * @nan_capa: NAN capabilities 5923 5888 * 5924 5889 * @txq_limit: configuration of internal TX queue frame limit 5925 5890 * @txq_memory_limit: configuration internal TX queue memory limit ··· 6102 6065 u32 bss_select_support; 6103 6066 6104 6067 u8 nan_supported_bands; 6068 + struct wiphy_nan_capa nan_capa; 6105 6069 6106 6070 u32 txq_limit; 6107 6071 u32 txq_memory_limit;
+41
net/wireless/nl80211.c
··· 2605 2605 return -ENOBUFS; 2606 2606 } 2607 2607 2608 + static int nl80211_put_nan_capa(struct wiphy *wiphy, struct sk_buff *msg) 2609 + { 2610 + struct nlattr *nan_caps; 2611 + 2612 + nan_caps = nla_nest_start(msg, NL80211_ATTR_NAN_CAPABILITIES); 2613 + if (!nan_caps) 2614 + return -ENOBUFS; 2615 + 2616 + if (wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC && 2617 + nla_put_flag(msg, NL80211_NAN_CAPA_CONFIGURABLE_SYNC)) 2618 + goto fail; 2619 + 2620 + if ((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_USERSPACE_DE) && 2621 + nla_put_flag(msg, NL80211_NAN_CAPA_USERSPACE_DE)) 2622 + goto fail; 2623 + 2624 + if (nla_put_u8(msg, NL80211_NAN_CAPA_OP_MODE, 2625 + wiphy->nan_capa.op_mode) || 2626 + nla_put_u8(msg, NL80211_NAN_CAPA_NUM_ANTENNAS, 2627 + wiphy->nan_capa.n_antennas) || 2628 + nla_put_u16(msg, NL80211_NAN_CAPA_MAX_CHANNEL_SWITCH_TIME, 2629 + wiphy->nan_capa.max_channel_switch_time) || 2630 + nla_put_u8(msg, NL80211_NAN_CAPA_CAPABILITIES, 2631 + wiphy->nan_capa.dev_capabilities)) 2632 + goto fail; 2633 + 2634 + nla_nest_end(msg, nan_caps); 2635 + 2636 + return 0; 2637 + 2638 + fail: 2639 + nla_nest_cancel(msg, nan_caps); 2640 + return -ENOBUFS; 2641 + } 2642 + 2608 2643 struct nl80211_dump_wiphy_state { 2609 2644 s64 filter_wiphy; 2610 2645 long start; ··· 3290 3255 break; 3291 3256 case 17: 3292 3257 if (nl80211_put_radios(&rdev->wiphy, msg)) 3258 + goto nla_put_failure; 3259 + 3260 + state->split_start++; 3261 + break; 3262 + case 18: 3263 + if (nl80211_put_nan_capa(&rdev->wiphy, msg)) 3293 3264 goto nla_put_failure; 3294 3265 3295 3266 /* done */