diff --git a/wmi/inc/wmi_unified_11be_api.h b/wmi/inc/wmi_unified_11be_api.h index 7821cd4191..aaf8e31f2c 100644 --- a/wmi/inc/wmi_unified_11be_api.h +++ b/wmi/inc/wmi_unified_11be_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -126,10 +126,12 @@ QDF_STATUS wmi_extract_mgmt_rx_mlo_link_removal_info( * wmi_send_mlo_peer_tid_to_link_map_cmd() - send TID-to-link mapping command * @wmi: WMI handle for this pdev * @params: Pointer to TID-to-link mapping params + * @t2lm_info: T2LM info presence flag */ QDF_STATUS wmi_send_mlo_peer_tid_to_link_map_cmd( wmi_unified_t wmi, - struct wmi_host_tid_to_link_map_params *params); + struct wmi_host_tid_to_link_map_params *params, + bool t2lm_info); /** * wmi_send_mlo_vdev_tid_to_link_map_cmd() - send TID-to-link mapping command diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 2fce6321ac..9e6ea1d2c3 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -1111,11 +1111,21 @@ typedef struct { * is present. * @preffered_link_order: Preferred links in order. * @timeout: timeout values for all the access categories. + * @tlt_characterization_params: Bitmask to select Tx-Link Tuple from ordered + * list. + * Bit 0-15 : Each bit maps to the corresponding Link ID + * Bit 16-31: Reserved + * @link_control_flags: Link control flags. + * Bit 0: TLT enable/disable + * Bit 1: Preferred Link enable/disable + * Bit 2-31: Reserved */ struct wlan_host_preferred_links { uint8_t num_pref_links; uint8_t preffered_link_order[MAX_PREFERRED_LINKS]; uint32_t timeout[WMI_HOST_WLAN_MAX_AC]; + uint32_t tlt_characterization_params; + uint32_t link_control_flags; }; #endif diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 0f579887a4..4b0a1e3a43 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -3151,7 +3151,8 @@ QDF_STATUS #ifdef WLAN_FEATURE_11BE QDF_STATUS (*send_mlo_peer_tid_to_link_map)( wmi_unified_t wmi_handle, - struct wmi_host_tid_to_link_map_params *params); + struct wmi_host_tid_to_link_map_params *params, + bool t2lm_info); QDF_STATUS (*send_mlo_vdev_tid_to_link_map)( wmi_unified_t wmi_handle, diff --git a/wmi/src/wmi_unified_11be_api.c b/wmi/src/wmi_unified_11be_api.c index efd566bf8e..e11c918579 100644 --- a/wmi/src/wmi_unified_11be_api.c +++ b/wmi/src/wmi_unified_11be_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -62,10 +62,11 @@ wmi_send_mlo_link_set_active_cmd(wmi_unified_t wmi, #ifdef WLAN_FEATURE_11BE QDF_STATUS wmi_send_mlo_peer_tid_to_link_map_cmd( wmi_unified_t wmi, - struct wmi_host_tid_to_link_map_params *params) + struct wmi_host_tid_to_link_map_params *params, + bool t2lm_info) { if (wmi->ops->send_mlo_peer_tid_to_link_map) - return wmi->ops->send_mlo_peer_tid_to_link_map(wmi, params); + return wmi->ops->send_mlo_peer_tid_to_link_map(wmi, params, t2lm_info); return QDF_STATUS_E_FAILURE; } diff --git a/wmi/src/wmi_unified_11be_tlv.c b/wmi/src/wmi_unified_11be_tlv.c index 91f3b6fa0c..43293fef13 100644 --- a/wmi/src/wmi_unified_11be_tlv.c +++ b/wmi/src/wmi_unified_11be_tlv.c @@ -914,60 +914,98 @@ uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr, #ifdef WMI_AP_SUPPORT static uint32_t find_buf_len_pref_link( - struct wmi_host_tid_to_link_map_params *params) + struct wmi_host_tid_to_link_map_params *params, + bool t2lm_info) { uint32_t buf_len = 0; - buf_len = sizeof(wmi_peer_tid_to_link_map_fixed_param) + - WMI_TLV_HDR_SIZE + (params->num_dir * T2LM_MAX_NUM_TIDS * - sizeof(wmi_tid_to_link_map)) + - WMI_TLV_HDR_SIZE + sizeof(wmi_peer_preferred_link_map); + buf_len = sizeof(wmi_peer_tid_to_link_map_fixed_param); + + /* Update the length for T2LM info TLV */ + if (t2lm_info) { + buf_len += (WMI_TLV_HDR_SIZE + + (params->num_dir * T2LM_MAX_NUM_TIDS * + sizeof(wmi_tid_to_link_map))); + } else { + buf_len += WMI_TLV_HDR_SIZE; + } + + /* Update the length for Preferred Link TLV. + * The Link Preference TLV is planned to be deprecated, + * so the TLV is going to be exlcuded by default + */ + buf_len += WMI_TLV_HDR_SIZE; + + /* Update the length for Link control TLV */ + if (params->preferred_links.num_pref_links) { + buf_len += (WMI_TLV_HDR_SIZE + + sizeof(wmi_mlo_peer_link_control_param)); + } else { + buf_len += WMI_TLV_HDR_SIZE; + } + return buf_len; } -static uint8_t *populate_preferred_link_tlv( +static uint8_t *populate_link_control_tlv( uint8_t *buf_ptr, struct wmi_host_tid_to_link_map_params *params) { - wmi_peer_preferred_link_map *pref_links; + wmi_mlo_peer_link_control_param *link_control; uint8_t pref_link = 0; uint8_t latency = 0; uint8_t links = 0; - WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, - sizeof(wmi_peer_preferred_link_map)); - buf_ptr += sizeof(uint32_t); + /* The Link Preference TLV is planned to be deprecated, + * so the TLV is going to be exlcuded by default. + */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); + buf_ptr = buf_ptr + WMI_TLV_HDR_SIZE; - pref_links = (wmi_peer_preferred_link_map *)buf_ptr; + if (params->preferred_links.num_pref_links) { + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + sizeof(wmi_mlo_peer_link_control_param)); + buf_ptr += sizeof(uint32_t); - WMITLV_SET_HDR(&pref_links->tlv_header, - WMITLV_TAG_STRUC_wmi_peer_preferred_link_map, - WMITLV_GET_STRUCT_TLVLEN(wmi_peer_preferred_link_map)); + link_control = (wmi_mlo_peer_link_control_param *)buf_ptr; - pref_links->num_preferred_links = - params->preferred_links.num_pref_links; - links = params->preferred_links.num_pref_links; + WMITLV_SET_HDR(&link_control->tlv_header, + WMITLV_TAG_STRUC_wmi_mlo_peer_link_control_param, + WMITLV_GET_STRUCT_TLVLEN(wmi_mlo_peer_link_control_param)); - for (pref_link = 0; pref_link < links; pref_link++) { - pref_links->preferred_link_order[pref_link] = - params->preferred_links.preffered_link_order[pref_link]; - wmi_debug("Add preference link TLV: preffered_link_order: %d", - pref_links->preferred_link_order[pref_link]); + link_control->num_links = params->preferred_links.num_pref_links; + links = params->preferred_links.num_pref_links; + + for (pref_link = 0; pref_link < links; pref_link++) { + link_control->link_priority_order[pref_link] = + params->preferred_links.preffered_link_order[pref_link]; + wmi_debug("Add preference link TLV: preffered_link_order: %d", + link_control->link_priority_order[pref_link]); + } + + link_control->flags = + params->preferred_links.link_control_flags; + link_control->tx_link_tuple_bitmap = + params->preferred_links.tlt_characterization_params; + + for (latency = 0; latency < WLAN_MAX_AC; latency++) { + link_control->max_timeout_ms[latency] = + params->preferred_links.timeout[latency]; + wmi_debug("Add preference link TLV: expected_timeout_ms: %d", + link_control->max_timeout_ms[latency]); + } + buf_ptr += sizeof(wmi_mlo_peer_link_control_param); + } else { + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); + buf_ptr = buf_ptr + WMI_TLV_HDR_SIZE; } - for (latency = 0; latency < WLAN_MAX_AC; latency++) { - pref_links->expected_max_latency_ms[latency] = - params->preferred_links.timeout[latency]; - wmi_debug("Add preference link TLV: expected_timeout_ms: %d", - pref_links->expected_max_latency_ms[latency]); - } - - buf_ptr += sizeof(wmi_peer_preferred_link_map); return buf_ptr; } #else static uint32_t find_buf_len_pref_link( - struct wmi_host_tid_to_link_map_params *params) + struct wmi_host_tid_to_link_map_params *params, + bool t2lm_info) { uint32_t buf_len = 0; @@ -977,7 +1015,7 @@ static uint32_t find_buf_len_pref_link( return buf_len; } -static uint8_t *populate_preferred_link_tlv( +static uint8_t *populate_link_control_tlv( uint8_t *buf_ptr, struct wmi_host_tid_to_link_map_params *params) { @@ -987,7 +1025,8 @@ static uint8_t *populate_preferred_link_tlv( static QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv( wmi_unified_t wmi_handle, - struct wmi_host_tid_to_link_map_params *params) + struct wmi_host_tid_to_link_map_params *params, + bool t2lm_info) { wmi_peer_tid_to_link_map_fixed_param *cmd; wmi_tid_to_link_map *t2lm; @@ -998,7 +1037,7 @@ static QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv( uint8_t dir = 0; uint8_t tid_num = 0; - buf_len = find_buf_len_pref_link(params); + buf_len = find_buf_len_pref_link(params, t2lm_info); buf = wmi_buf_alloc(wmi_handle, buf_len); if (!buf) { wmi_err("wmi buf alloc failed for mlo_peer_mac: " @@ -1022,53 +1061,58 @@ static QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv( buf_ptr += sizeof(wmi_peer_tid_to_link_map_fixed_param); - WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + if (t2lm_info) { + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, (params->num_dir * T2LM_MAX_NUM_TIDS * sizeof(wmi_tid_to_link_map))); - buf_ptr += sizeof(uint32_t); + buf_ptr += sizeof(uint32_t); - for (dir = 0; dir < params->num_dir; dir++) { - wmi_debug("Add T2LM TLV for peer: " QDF_MAC_ADDR_FMT " direction:%d", + for (dir = 0; dir < params->num_dir; dir++) { + wmi_debug("Add T2LM TLV for peer: " QDF_MAC_ADDR_FMT " direction:%d", QDF_MAC_ADDR_REF(params->peer_macaddr), params->t2lm_info[dir].direction); - for (tid_num = 0; tid_num < T2LM_MAX_NUM_TIDS; tid_num++) { - t2lm = (wmi_tid_to_link_map *)buf_ptr; + for (tid_num = 0; tid_num < T2LM_MAX_NUM_TIDS; tid_num++) { + t2lm = (wmi_tid_to_link_map *)buf_ptr; - WMITLV_SET_HDR(&t2lm->tlv_header, + WMITLV_SET_HDR(&t2lm->tlv_header, WMITLV_TAG_STRUC_wmi_tid_to_link_map, WMITLV_GET_STRUCT_TLVLEN( wmi_tid_to_link_map)); - /* Populate TID number */ - WMI_TID_TO_LINK_MAP_TID_NUM_SET( + /* Populate TID number */ + WMI_TID_TO_LINK_MAP_TID_NUM_SET( t2lm->tid_to_link_map_info, tid_num); - /* Populate the direction */ - WMI_TID_TO_LINK_MAP_DIR_SET( + /* Populate the direction */ + WMI_TID_TO_LINK_MAP_DIR_SET( t2lm->tid_to_link_map_info, params->t2lm_info[dir].direction); - /* Populate the default link mapping value */ - WMI_TID_TO_LINK_MAP_DEFAULT_MAPPING_SET( + /* Populate the default link mapping value */ + WMI_TID_TO_LINK_MAP_DEFAULT_MAPPING_SET( t2lm->tid_to_link_map_info, params->t2lm_info[dir].default_link_mapping); - /* Populate the T2LM provisioned links for the - * corresponding TID number. - */ - WMI_TID_TO_LINK_MAP_LINK_MASK_SET( + /* Populate the T2LM provisioned links for the + * corresponding TID number. + */ + WMI_TID_TO_LINK_MAP_LINK_MASK_SET( t2lm->tid_to_link_map_info, params->t2lm_info[dir].t2lm_provisioned_links[tid_num]); - buf_ptr += sizeof(wmi_tid_to_link_map); + buf_ptr += sizeof(wmi_tid_to_link_map); - wmi_debug("Add T2LM TLV: tid_to_link_map_info:%x", + wmi_debug("Add T2LM TLV: tid_to_link_map_info:%x", t2lm->tid_to_link_map_info); + } } + } else { + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); + buf_ptr = buf_ptr + WMI_TLV_HDR_SIZE; } - buf_ptr = populate_preferred_link_tlv(buf_ptr, params); + buf_ptr = populate_link_control_tlv(buf_ptr, params); wmi_mtrace(WMI_MLO_PEER_TID_TO_LINK_MAP_CMDID, cmd->pdev_id, 0); ret = wmi_unified_cmd_send(wmi_handle, buf, buf_len, WMI_MLO_PEER_TID_TO_LINK_MAP_CMDID);