From e1ab680c9871034fa2a4491717404cdf05dd18c9 Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Tue, 4 Apr 2023 17:41:56 +0530 Subject: [PATCH] Add QCA vendor subcommand to request audio transport switch Add a new sub command QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH to request the audio data transport switch in both the command and event path. This is used when two or more audio data transports are available between peers. Signed-off-by: Purushottam Kushwaha --- src/common/qca-vendor.h | 121 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) diff --git a/src/common/qca-vendor.h b/src/common/qca-vendor.h index 5dab120d0..db0a0ce2e 100644 --- a/src/common/qca-vendor.h +++ b/src/common/qca-vendor.h @@ -1132,6 +1132,39 @@ enum qca_radiotap_vendor_ids { * Uses the attributes defined in * enum qca_wlan_vendor_attr_tdls_disc_rsp_ext. * + * @QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH: This vendor subcommand is + * used to configure and indicate the audio transport switch in both + * command and event paths. This is used when two or more audio transports + * (e.g., WLAN and Bluetooth) are available between peers. + * + * If the driver needs to perform operations like scan, connection, + * roaming, RoC, etc. and AP concurrency policy is set to either + * QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO or + * QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING, the driver sends + * audio transport switch event to userspace. Userspace application upon + * receiving the event, can try to switch to the requested audio transport. + * The userspace uses this command to send the status of transport + * switching (either confirm or reject) to the driver using this + * subcommand. The driver continues with the pending operation either upon + * receiving the command from userspace or after waiting for a timeout from + * sending the event to userspace. The driver can request userspace to + * switch to WLAN upon availability of WLAN audio transport once after the + * concurrent operations are completed. + * + * Userspace can also request audio transport switch from non-WLAN to WLAN + * using this subcommand to the driver. The driver can accept or reject + * depending on other concurrent operations in progress. The driver returns + * success if it can allow audio transport when it receives the command or + * appropriate kernel error code otherwise. Userspace indicates the audio + * transport switch from WLAN to non-WLAN using this subcommand and the + * driver can do other concurrent operations without needing to send any + * event to userspace. This subcommand is used by userspace only when the + * driver advertises support for + * QCA_WLAN_VENDOR_FEATURE_ENHANCED_AUDIO_EXPERIENCE_OVER_WLAN. + * + * The attributes used with this command are defined in enum + * qca_wlan_vendor_attr_audio_transport_switch. + * * @QCA_NL80211_VENDOR_SUBCMD_TX_LATENCY: This vendor subcommand is used to * configure, retrieve, and report per-link transmit latency statistics. * @@ -1452,7 +1485,7 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_TID_TO_LINK_MAP = 229, QCA_NL80211_VENDOR_SUBCMD_LINK_RECONFIG = 230, QCA_NL80211_VENDOR_SUBCMD_TDLS_DISC_RSP_EXT = 231, - /* 232 - reserved for QCA */ + QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH = 232, QCA_NL80211_VENDOR_SUBCMD_TX_LATENCY = 233, /* 234 - reserved for QCA */ QCA_NL80211_VENDOR_SUBCMD_SDWF_PHY_OPS = 235, @@ -18047,4 +18080,90 @@ enum qca_wlan_vendor_attr_usd { QCA_WLAN_VENDOR_ATTR_USD_AFTER_LAST - 1, }; +/** + * enum qca_wlan_audio_transport_switch_type - Represents the possible transport + * switch types. + * + * @QCA_WLAN_AUDIO_TRANSPORT_SWITCH_TYPE_NON_WLAN: Request to route audio data + * via non-WLAN transport (e.g., Bluetooth). + * + * @QCA_WLAN_AUDIO_TRANSPORT_SWITCH_TYPE_WLAN: Request to route audio data via + * WLAN transport. + */ +enum qca_wlan_audio_transport_switch_type { + QCA_WLAN_AUDIO_TRANSPORT_SWITCH_TYPE_NON_WLAN = 0, + QCA_WLAN_AUDIO_TRANSPORT_SWITCH_TYPE_WLAN = 1, +}; + +/** + * enum qca_wlan_audio_transport_switch_status - Represents the status of audio + * transport switch request. + * + * @QCA_WLAN_AUDIO_TRANSPORT_SWITCH_STATUS_REJECTED: Request to switch transport + * has been rejected. For example, when transport switch is requested from WLAN + * to non-WLAN transport, user space modules and peers would evaluate the switch + * request and may not be ready for switch and hence switch to non-WLAN + * transport gets rejected. + * + * @QCA_WLAN_AUDIO_TRANSPORT_SWITCH_STATUS_COMPLETED: Request to switch + * transport has been completed. This is sent only in the command path. For + * example, when the driver had requested for audio transport switch and + * userspace modules as well as peers are ready for the switch, userspace module + * switches the transport and sends the subcommand with status completed to the + * driver. + */ +enum qca_wlan_audio_transport_switch_status { + QCA_WLAN_AUDIO_TRANSPORT_SWITCH_STATUS_REJECTED = 0, + QCA_WLAN_AUDIO_TRANSPORT_SWITCH_STATUS_COMPLETED = 1, +}; + +/** + * enum qca_wlan_audio_transport_switch_reason - Represents the reason of audio + * transport switch request. + * + * @QCA_WLAN_AUDIO_TRANSPORT_SWITCH_REASON_TERMINATING: Requester transport is + * terminating. After this indication, requester module may not be available to + * process further request on its transport. For example, to handle a high + * priority concurrent interface, WLAN transport needs to terminate and hence + * indicates switch to a non-WLAN transport with reason terminating. User space + * modules switch to non-WLAN immediately without waiting for further + * confirmation. + */ +enum qca_wlan_audio_transport_switch_reason { + QCA_WLAN_AUDIO_TRANSPORT_SWITCH_REASON_TERMINATING = 0, +}; + +/** + * enum qca_wlan_vendor_attr_audio_transport_switch - Attributes used by + * %QCA_NL80211_VENDOR_SUBCMD_AUDIO_TRANSPORT_SWITCH vendor command. + * + * @QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_TYPE: u8 attribute. Indicates + * the transport switch type from one of the values in enum + * qca_wlan_audio_transport_switch_type. This is mandatory attribute in both + * command and event path. This attribute is included in both requests and + * responses. + * + * @QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_STATUS: u8 attribute. Indicates + * the transport switch status from one of the values in enum + * qca_wlan_audio_transport_switch_status. This is optional attribute and used + * in both command and event path. This attribute must not be included in + * requests. + * + * @QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_REASON: u8 attribute. Indicates + * the transport switch reason from one of the values in enum + * qca_wlan_audio_transport_switch_reason. This is optional attribute and used + * in both command and event path. + */ +enum qca_wlan_vendor_attr_audio_transport_switch { + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_TYPE = 1, + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_STATUS = 2, + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_REASON = 3, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_MAX = + QCA_WLAN_VENDOR_ATTR_AUDIO_TRANSPORT_SWITCH_AFTER_LAST - 1, +}; + #endif /* QCA_VENDOR_H */