qcacmn: Add support to handle WMI_MLO_LINK_STATE_SWITCH_EVENTID

Register event handler for WMI_MLO_LINK_STATE_SWITCH_EVENTID.
Add target if event handler for the
WMI_MLO_LINK_STATE_SWITCH_EVENTID event, and register
corresponding mlo manager callbacks.

Add extract API for link state switch event parameters received
Call the diag event API from MLO manager post extracting the
event

Change-Id: Ib588ee87a5c37c6a34c86ce8cbf134a273c6461b
CRs-Fixed: 3610041
This commit is contained in:
Vijay Raj 2023-09-05 07:10:09 -07:00 committed by Rahul Choudhary
parent 429dc9c9e6
commit 75a684099b
12 changed files with 223 additions and 0 deletions

View File

@ -217,6 +217,53 @@ target_if_send_mlo_link_switch_cnf_cmd(struct wlan_objmgr_psoc *psoc,
return wmi_send_mlo_link_switch_req_cnf_cmd(wmi_handle, params);
}
static int
target_if_mlo_link_state_switch_event_handler(ol_scn_t scn, uint8_t *data,
uint32_t datalen)
{
struct wlan_objmgr_psoc *psoc;
struct wmi_unified *wmi_handle;
struct wlan_lmac_if_mlo_rx_ops *mlo_rx_ops;
struct mlo_link_switch_state_info evt_params;
QDF_STATUS status;
if (!scn || !data) {
target_if_err("scn: 0x%pK, data: 0x%pK", scn, data);
return -EINVAL;
}
psoc = target_if_get_psoc_from_scn_hdl(scn);
if (!psoc) {
target_if_err("null psoc");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("wmi_handle is null");
return -EINVAL;
}
mlo_rx_ops = target_if_mlo_get_rx_ops(psoc);
if (!mlo_rx_ops || !mlo_rx_ops->mlo_link_state_switch_event_handler) {
target_if_err("callback not registered");
return -EINVAL;
}
status = wmi_extract_mlo_link_state_switch_evt(wmi_handle, data,
datalen,
&evt_params);
if (QDF_IS_STATUS_ERROR(status)) {
target_if_err("Unable to extract link state switch params");
goto exit;
}
status = mlo_rx_ops->mlo_link_state_switch_event_handler(psoc,
&evt_params);
exit:
return qdf_status_to_os_return(status);
}
static int
target_if_mlo_link_switch_request_event_handler(ol_scn_t scn, uint8_t *data,
uint32_t datalen)
@ -282,6 +329,17 @@ target_if_mlo_register_link_switch_event_handler(struct wmi_unified *wmi_handle)
wmi_mlo_link_switch_request_eventid,
target_if_mlo_link_switch_request_event_handler,
WMI_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status))
target_if_err("Register event:%d failed",
wmi_mlo_link_switch_request_eventid);
status = wmi_unified_register_event_handler(
wmi_handle, wmi_mlo_link_state_switch_eventid,
target_if_mlo_link_state_switch_event_handler,
WMI_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status))
target_if_err("Register event:%d failed",
wmi_mlo_link_state_switch_eventid);
return status;
}

View File

@ -1580,6 +1580,8 @@ struct wlan_lmac_if_mlo_tx_ops {
* @mlo_link_disable_request_handler: function ptr for mlo link disable request
* @mlo_link_switch_request_handler: Handler function pointer to deliver link
* switch request params from FW to host.
* @mlo_link_state_switch_event_handler: Function pointer to handle link state
* switch event
*/
struct wlan_lmac_if_mlo_rx_ops {
QDF_STATUS
@ -1601,6 +1603,9 @@ struct wlan_lmac_if_mlo_rx_ops {
QDF_STATUS
(*mlo_link_switch_request_handler)(struct wlan_objmgr_psoc *psoc,
void *evt_params);
QDF_STATUS
(*mlo_link_state_switch_event_handler)(struct wlan_objmgr_psoc *psoc,
struct mlo_link_switch_state_info *info);
#endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE */
};
#endif

View File

@ -982,6 +982,8 @@ wlan_lmac_if_mlo_rx_link_switch_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
{
rx_ops->mlo_rx_ops.mlo_link_switch_request_handler =
mlo_mgr_link_switch_request_params;
rx_ops->mlo_rx_ops.mlo_link_state_switch_event_handler =
mlo_mgr_link_state_switch_info_handler;
}
#else
static inline void

View File

@ -523,6 +523,18 @@ mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
*/
QDF_STATUS mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc *psoc,
void *evt_params);
/**
* mlo_mgr_link_state_switch_info_handler() - Handle Link State change related
* information and generate corresponding connectivity logging event
* @psoc: Pointer to PSOC object
* @info: Source info to be sent for the logging event
*
* Return: QDF_STATUS
*/
QDF_STATUS
mlo_mgr_link_state_switch_info_handler(struct wlan_objmgr_psoc *psoc,
struct mlo_link_switch_state_info *info);
/**
* mlo_mgr_link_switch_complete() - Link switch complete notification to FW
* @vdev: VDV object manager

View File

@ -1496,6 +1496,36 @@ struct mlo_link_disable_request_evt_params {
uint32_t link_id_bitmap;
};
#define MAX_LINK_SWITCH_TLV 5
/**
* struct mlo_link_switch_params - Structure to hold link State switch
* related parameters
* @mld_addr: MLD address
* @active_link_bitmap: Bitmap of ieee link id for active links
* @prev_link_bitmap: Bitmap of ieee link id for previous active links
* @fw_timestamp: Firmware timestamp in milliseconds
* @reason_code: Reason code for the switch
*/
struct mlo_link_switch_params {
struct qdf_mac_addr mld_addr;
uint32_t active_link_bitmap;
uint32_t prev_link_bitmap;
uint32_t fw_timestamp;
uint32_t reason_code;
};
/**
* struct mlo_link_switch_state_info - Structure to hold the link switch
* related parameters corresponding to all the TLV received in link state switch
* event.
* @num_params: Number of the link switch parameters
* @link_switch_param: Link switch parameters
*/
struct mlo_link_switch_state_info {
uint8_t num_params;
struct mlo_link_switch_params link_switch_param[MAX_LINK_SWITCH_TLV];
};
#ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
/**
* struct peer_ptqm_migrate_entry - peer ptqm migrate entry

View File

@ -1083,6 +1083,19 @@ QDF_STATUS mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc *psoc,
return status;
}
QDF_STATUS
mlo_mgr_link_state_switch_info_handler(struct wlan_objmgr_psoc *psoc,
struct mlo_link_switch_state_info *info)
{
uint8_t i;
for (i = 0; i < info->num_params; i++)
wlan_connectivity_mld_link_status_event(psoc,
&info->link_switch_param[i]);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS mlo_mgr_link_switch_complete(struct wlan_objmgr_vdev *vdev)
{
enum mlo_link_switch_req_state state;

View File

@ -267,6 +267,21 @@ QDF_STATUS wmi_extract_mlo_link_disable_request_evt(
struct wmi_unified *wmi,
void *buf,
struct mlo_link_disable_request_evt_params *params);
/**
* wmi_extract_mlo_link_state_switch_evt() - Extract the MLO link switch state
* event parameters
* @wmi: wmi handle
* @buf: pointer to event buffer
* @len: event data length
* @info: Info on link switch state change event
*
* Return: QDF_STATUS
*/
QDF_STATUS
wmi_extract_mlo_link_state_switch_evt(struct wmi_unified *wmi, void *buf,
uint8_t len,
struct mlo_link_switch_state_info *info);
#endif /* WLAN_FEATURE_11BE */
#ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE

View File

@ -5303,6 +5303,7 @@ typedef enum {
wmi_mlo_link_disable_request_eventid,
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
wmi_mlo_link_switch_request_eventid,
wmi_mlo_link_state_switch_eventid,
#endif
#endif
wmi_pdev_fips_extend_event_id,

View File

@ -3208,6 +3208,11 @@ QDF_STATUS (*extract_mlo_link_disable_request_evt_param)(
struct mlo_link_disable_request_evt_params *params);
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
QDF_STATUS (*extract_mlo_link_state_switch_evt)(
struct wmi_unified *wmi_handle,
void *buf, uint8_t len,
struct mlo_link_switch_state_info *params);
QDF_STATUS
(*extract_mlo_link_switch_request_event)(struct wmi_unified *wmi_handle,
void *buf,

View File

@ -104,6 +104,18 @@ wmi_extract_mlo_link_switch_request_evt(struct wmi_unified *wmi,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS
wmi_extract_mlo_link_state_switch_evt(struct wmi_unified *wmi,
void *buf, uint8_t len,
struct mlo_link_switch_state_info *info)
{
if (wmi->ops->extract_mlo_link_state_switch_evt)
return wmi->ops->extract_mlo_link_state_switch_evt(
wmi, buf, len, info);
return QDF_STATUS_SUCCESS;
}
#endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE */
QDF_STATUS wmi_send_mlo_link_state_request_cmd(

View File

@ -1277,6 +1277,72 @@ extract_mlo_link_disable_request_evt_param_tlv(
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
static QDF_STATUS
extract_mlo_link_state_switch_event_tlv(struct wmi_unified *wmi_handle,
void *evt_buf, uint8_t len,
struct mlo_link_switch_state_info *info)
{
WMI_MLO_LINK_STATE_SWITCH_EVENTID_param_tlvs *param_buf = evt_buf;
wmi_mlo_link_state_switch_req_evt_fixed_param *fixed_param;
wmi_mlo_link_state_switch_trigger_reason *lnk_switch_param;
uint8_t i, num_tlv, rem_len;
if (!param_buf) {
wmi_err("param buf is NULL");
return QDF_STATUS_E_NULL_VALUE;
}
fixed_param = param_buf->fixed_param;
if (!fixed_param) {
wmi_err("fixed param is NULL");
return QDF_STATUS_E_NULL_VALUE;
}
num_tlv = fixed_param->link_state_switch_count;
if (num_tlv > MAX_LINK_SWITCH_TLV)
num_tlv = MAX_LINK_SWITCH_TLV;
rem_len = len - sizeof(*fixed_param);
if (rem_len <
num_tlv * sizeof(wmi_mlo_link_state_switch_trigger_reason)) {
wmi_err_rl("Invalid link state switch TLVs rem_len:%d num_tlv:%d",
rem_len, num_tlv);
return QDF_STATUS_E_INVAL;
}
lnk_switch_param = param_buf->switch_trigger_reason;
if (!lnk_switch_param) {
wmi_err_rl("No TLV is present");
return QDF_STATUS_E_INVAL;
}
info->num_params = num_tlv;
for (i = 0; i < num_tlv; i++) {
WMI_MAC_ADDR_TO_CHAR_ARRAY(&lnk_switch_param->ml_bssid,
info->link_switch_param[i].mld_addr.bytes);
info->link_switch_param[i].active_link_bitmap =
lnk_switch_param->cur_active_ieee_bitmap;
info->link_switch_param[i].prev_link_bitmap =
lnk_switch_param->prev_active_ieee_bitmap;
info->link_switch_param[i].fw_timestamp =
lnk_switch_param->host_ref_fw_timestamp_ms;
info->link_switch_param[i].reason_code =
lnk_switch_param->reason_code;
wmi_debug("i:%d active_link_bmap:0x%x prev_bmap:0x%x reason_code:%d MLD addr: "QDF_MAC_ADDR_FMT,
i, info->link_switch_param[i].active_link_bitmap,
info->link_switch_param[i].prev_link_bitmap,
info->link_switch_param[i].reason_code,
QDF_MAC_ADDR_REF(info->link_switch_param[i].mld_addr.bytes));
lnk_switch_param++;
}
return QDF_STATUS_SUCCESS;
}
#endif
#ifdef WLAN_FEATURE_11BE
size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req)
{
@ -2592,5 +2658,7 @@ void wmi_11be_attach_tlv(wmi_unified_t wmi_handle)
extract_mlo_link_switch_request_event_tlv;
ops->send_mlo_link_switch_req_cnf_cmd =
send_link_switch_request_cnf_cmd_tlv;
ops->extract_mlo_link_state_switch_evt =
extract_mlo_link_state_switch_event_tlv;
#endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE */
}

View File

@ -21728,6 +21728,8 @@ static void populate_tlv_events_id_mlo(WMI_EVT_ID *event_ids)
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
event_ids[wmi_mlo_link_switch_request_eventid] =
WMI_MLO_LINK_SWITCH_REQUEST_EVENTID;
event_ids[wmi_mlo_link_state_switch_eventid] =
WMI_MLO_LINK_STATE_SWITCH_EVENTID;
#endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE */
}
#else /* WLAN_FEATURE_11BE_MLO */