From 11821ab3d15bafa0c70eb2e0497431a91ba5740e Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Thu, 8 Apr 2021 17:13:48 +0530 Subject: [PATCH] Add QCA vendor interface to query usable channels Add QCA vendor interface for userspace to get information of usable channels for different interface types from the driver/firmware. Signed-off-by: Vamsi Krishna --- src/common/qca-vendor.h | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/src/common/qca-vendor.h b/src/common/qca-vendor.h index e88b95f8a..2c4e40d3c 100644 --- a/src/common/qca-vendor.h +++ b/src/common/qca-vendor.h @@ -704,6 +704,14 @@ enum qca_radiotap_vendor_ids { * configure the concurrent session policies when multiple STA interfaces * are (getting) active. The attributes used by this command are defined * in enum qca_wlan_vendor_attr_concurrent_sta_policy. + * + * @QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS: Userspace can use this command + * to query usable channels for different interface types such as STA, + * AP, P2P GO, P2P Client, NAN, etc. The driver shall report all usable + * channels in the response based on country code, different static + * configurations, concurrency combinations, etc. The attributes used + * with this command are defined in + * enum qca_wlan_vendor_attr_usable_channels. */ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0, @@ -891,6 +899,7 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_WIFI_FW_STATS = 195, QCA_NL80211_VENDOR_SUBCMD_MBSSID_TX_VDEV_STATUS = 196, QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY = 197, + QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS = 198, }; enum qca_wlan_vendor_attr { @@ -10818,4 +10827,107 @@ enum qca_sta_connect_fail_reason_codes { QCA_STA_CONNECT_FAIL_REASON_ASSOC_NO_RESP_RECEIVED = 7, }; +/** + * enum qca_wlan_vendor_usable_channels_filter - Bitmask of different + * filters defined in this enum are used in attribute + * %QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_FILTER_MASK. + * + * @QCA_WLAN_VENDOR_FILTER_CELLULAR_COEX: When this bit is set, the driver + * shall filter the channels which are not usable because of coexistence with + * cellular radio. + * @QCA_WLAN_VENDOR_FILTER_WLAN_CONCURRENCY: When this bit is set, the driver + * shall filter the channels which are not usable because of existing active + * interfaces in the driver and will result in Multi Channel Concurrency, etc. + * + */ +enum qca_wlan_vendor_usable_channels_filter { + QCA_WLAN_VENDOR_FILTER_CELLULAR_COEX = 0, + QCA_WLAN_VENDOR_FILTER_WLAN_CONCURRENCY = 1, +}; + +/** + * enum qca_wlan_vendor_attr_chan_info - Attributes used inside + * %QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_CHAN_INFO nested attribute. + * + * @QCA_WLAN_VENDOR_ATTR_CHAN_INFO_PRIMARY_FREQ: + * u32 attribute, required. Indicates the center frequency of the primary + * channel in MHz. + * + * @QCA_WLAN_VENDOR_ATTR_CHAN_INFO_SEG0_FREQ: + * u32 attribute. Indicates the center frequency of the primary segment of the + * channel in MHz. This attribute is required when reporting 40 MHz, 80 MHz, + * 160 MHz, and 320 MHz channels. + * + * @QCA_WLAN_VENDOR_ATTR_CHAN_INFO_SEG1_FREQ: + * u32 attribute. Indicates the center frequency of the secondary segment of + * 80+80 channel in MHz. This attribute is required only when + * QCA_WLAN_VENDOR_ATTR_CHAN_INFO_BANDWIDTH is set to NL80211_CHAN_WIDTH_80P80. + * + * @QCA_WLAN_VENDOR_ATTR_CHAN_INFO_BANDWIDTH: + * u32 attribute, required. Indicates the bandwidth of the channel, possible + * values are defined in enum nl80211_chan_width. + * + * @QCA_WLAN_VENDOR_ATTR_CHAN_INFO_IFACE_MODE_MASK: + * u32 attribute, required. Indicates all the interface types for which this + * channel is usable. This attribute encapsulates bitmasks of interface types + * defined in enum nl80211_iftype. + * + */ +enum qca_wlan_vendor_attr_chan_info { + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_PRIMARY_FREQ = 1, + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_SEG0_FREQ = 2, + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_SEG1_FREQ = 3, + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_BANDWIDTH = 4, + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_IFACE_MODE_MASK = 5, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_MAX = + QCA_WLAN_VENDOR_ATTR_CHAN_INFO_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_usable_channels - Attributes used by + * %QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS vendor command. + * + * @QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_BAND_MASK: + * u32 attribute. Indicates the bands from which the channels should be reported + * in response. This attribute encapsulates bit masks of bands defined in enum + * nl80211_band. Optional attribute, if not present in the request the driver + * shall return channels from all supported bands. + * + * @QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_IFACE_MODE_MASK: + * u32 attribute. Indicates all the interface types for which the usable + * channels information is requested. This attribute encapsulates bitmasks of + * interface types defined in enum nl80211_iftype. Optional attribute, if not + * present in the request the driver shall send information of all supported + * interface modes. + * + * @QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_FILTER_MASK: + * u32 attribute. This attribute carries information of all filters that shall + * be applied while populating usable channels information by the driver. This + * attribute carries bit masks of different filters defined in enum + * qca_wlan_vendor_usable_channels_filter. Optional attribute, if not present + * in the request the driver shall send information of channels without applying + * any of the filters that can be configured through this attribute. + * + * @QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_CHAN_INFO: + * Nested attribute. This attribute shall be used by the driver to send + * usability information of each channel. The attributes defined in enum + * qca_wlan_vendor_attr_chan_info are used inside this attribute. + */ +enum qca_wlan_vendor_attr_usable_channels { + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_BAND_MASK = 1, + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_IFACE_MODE_MASK = 2, + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_FILTER_MASK = 3, + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_CHAN_INFO = 4, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_MAX = + QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_AFTER_LAST - 1, +}; + #endif /* QCA_VENDOR_H */