qcacmn: Add bss color collision detection support

Add support for bss color collision detection.

Change-Id: Ia3d64917518c2aa5fc4a10bb7f3f8db2d47bc5d7
CRs-Fixed: 2185238
This commit is contained in:
Arif Hussain
2018-01-22 01:19:36 -08:00
committed by snandini
parent ddf7f8840a
commit 6e6217bcd2
5 changed files with 315 additions and 4 deletions

View File

@@ -2091,6 +2091,51 @@ QDF_STATUS wmi_unified_extract_obss_detection_info(void *wmi_hdl,
uint8_t *data,
struct wmi_obss_detect_info
*info);
/**
* wmi_unified_send_bss_color_change_enable_cmd() - WMI function to send bss
* color change enable to FW.
* @wmi_hdl: wmi handle
* @vdev_id: vdev ID
* @enable: enable or disable color change handeling within firmware
*
* Send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID parameters to fw,
* thereby firmware updates bss color when AP announces bss color change.
*
* Return: QDF_STATUS
*/
QDF_STATUS wmi_unified_send_bss_color_change_enable_cmd(void *wmi_hdl,
uint32_t vdev_id,
bool enable);
/**
* wmi_unified_send_obss_color_collision_cfg_cmd() - WMI function to send bss
* color collision detection configuration to FW.
* @wmi_hdl: wmi handle
* @cfg: obss color collision detection configuration
*
* Send WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID parameters to fw.
*
* Return: QDF_STATUS
*/
QDF_STATUS wmi_unified_send_obss_color_collision_cfg_cmd(void *wmi_hdl,
struct wmi_obss_color_collision_cfg_param *cfg);
/**
* wmi_unified_extract_obss_color_collision_info() - WMI function to extract
* obss color collision info from FW.
* @wmi_hdl: wmi handle
* @data: event data from firmware
* @info: Pointer to hold bss color collision info
*
* This function is used to extract bss collision info from firmware.
*
* Return: QDF_STATUS
*/
QDF_STATUS wmi_unified_extract_obss_color_collision_info(void *wmi_hdl,
uint8_t *data, struct wmi_obss_color_collision_info *info);
#ifdef WLAN_SUPPORT_GREEN_AP
QDF_STATUS wmi_extract_green_ap_egap_status_info(

View File

@@ -5559,6 +5559,7 @@ typedef enum {
wmi_report_stats_event_id,
wmi_dma_buf_release_event_id,
wmi_sap_obss_detection_report_event_id,
wmi_obss_color_collision_report_event_id,
wmi_host_swfda_event_id,
wmi_sar_get_limits_event_id,
@@ -8276,7 +8277,7 @@ struct wmi_obss_detection_cfg_param {
};
/**
* enum sap_obss_detection_reason - obss detection event reasons
* enum wmi_obss_detection_reason - obss detection event reasons
* @OBSS_OFFLOAD_DETECTION_DISABLED: OBSS detection disabled
* @OBSS_OFFLOAD_DETECTION_PRESENT: OBSS present detection
* @OBSS_OFFLOAD_DETECTION_ABSENT: OBSS absent detection
@@ -8291,7 +8292,7 @@ enum wmi_obss_detection_reason {
/**
* struct wmi_obss_detect_info - OBSS detection info from firmware
* @vdev_id: IDof the vdev to which this info belongs.
* @vdev_id: ID of the vdev to which this info belongs.
* @reason: Indicate if present or Absent detection,
* also if not supported offload for this vdev.
* @matched_detection_masks: Detection bit map.
@@ -8356,4 +8357,55 @@ struct wmi_invoke_neighbor_report_params {
struct mac_ssid ssid;
};
/**
* enum wmi_obss_color_collision_evt_type - bss color collision event type
* @OBSS_COLOR_COLLISION_DETECTION_DISABLE: OBSS color detection disabled
* @OBSS_COLOR_COLLISION_DETECTION: OBSS color collision detection
* @OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY: OBSS free slot detection with
* within expiry period
* @OBSS_COLOR_FREE_SLOT_AVAILABLE: OBSS free slot detection
*
* Defines different types of type for obss color collision event type.
*/
enum wmi_obss_color_collision_evt_type {
OBSS_COLOR_COLLISION_DETECTION_DISABLE = 0,
OBSS_COLOR_COLLISION_DETECTION = 1,
OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY = 2,
OBSS_COLOR_FREE_SLOT_AVAILABLE = 3,
};
/**
* struct wmi_obss_color_collision_cfg_param - obss color collision cfg
* @vdev_id: vdev id
* @flags: proposed for future use cases, currently not used.
* @evt_type: bss color collision event.
* @current_bss_color: current bss color.
* @detection_period_ms: scan interval for both AP and STA mode.
* @scan_period_ms: scan period for passive scan to detect collision.
* @free_slot_expiry_time_ms: FW to notify host at timer expiry after
* which Host will disable the bss color.
*/
struct wmi_obss_color_collision_cfg_param {
uint32_t vdev_id;
uint32_t flags;
enum wmi_obss_color_collision_evt_type evt_type;
uint32_t current_bss_color;
uint32_t detection_period_ms;
uint32_t scan_period_ms;
uint32_t free_slot_expiry_time_ms;
};
/**
* struct wmi_obss_color_collision_info - bss color detection info from firmware
* @vdev_id: ID of the vdev to which this info belongs.
* @evt_type: bss color collision event.
* @obss_color_bitmap_bit0to31: Bit set indicating BSS color present.
* @obss_color_bitmap_bit32to63: Bit set indicating BSS color present.
*/
struct wmi_obss_color_collision_info {
uint32_t vdev_id;
enum wmi_obss_color_collision_evt_type evt_type;
uint32_t obss_color_bitmap_bit0to31;
uint32_t obss_color_bitmap_bit32to63;
};
#endif /* _WMI_UNIFIED_PARAM_H_ */

View File

@@ -1553,6 +1553,13 @@ int (*wmi_check_and_pad_event)(void *os_handle, void *param_struc_ptr,
int (*wmi_check_command_params)(void *os_handle, void *param_struc_ptr,
A_UINT32 param_buf_len,
A_UINT32 wmi_cmd_event_id);
QDF_STATUS (*send_bss_color_change_enable_cmd)(wmi_unified_t wmi_handle,
uint32_t vdev_id,
bool enable);
QDF_STATUS (*send_obss_color_collision_cfg_cmd)(wmi_unified_t wmi_handle,
struct wmi_obss_color_collision_cfg_param *cfg);
QDF_STATUS (*extract_obss_color_collision_info)(uint8_t *evt_buf,
struct wmi_obss_color_collision_info *info);
};
/* Forward declartion for psoc*/

View File

@@ -7372,3 +7372,40 @@ QDF_STATUS wmi_extract_green_ap_egap_status_info(
return QDF_STATUS_E_FAILURE;
}
#endif
QDF_STATUS wmi_unified_send_bss_color_change_enable_cmd(void *wmi_hdl,
uint32_t vdev_id,
bool enable)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_bss_color_change_enable_cmd)
return wmi_handle->ops->send_bss_color_change_enable_cmd(
wmi_handle, vdev_id, enable);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_send_obss_color_collision_cfg_cmd(void *wmi_hdl,
struct wmi_obss_color_collision_cfg_param *cfg)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_obss_color_collision_cfg_cmd)
return wmi_handle->ops->send_obss_color_collision_cfg_cmd(
wmi_handle, cfg);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_extract_obss_color_collision_info(void *wmi_hdl,
uint8_t *data, struct wmi_obss_color_collision_info *info)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->extract_obss_color_collision_info)
return wmi_handle->ops->extract_obss_color_collision_info(data,
info);
return QDF_STATUS_E_FAILURE;
}

View File

@@ -21519,8 +21519,6 @@ static QDF_STATUS send_obss_detection_cfg_cmd_tlv(wmi_unified_t wmi_handle,
cmd->ht_legacy_detect_mode = obss_cfg_param->obss_ht_legacy_detect_mode;
cmd->ht_mixed_detect_mode = obss_cfg_param->obss_ht_mixed_detect_mode;
cmd->ht_20mhz_detect_mode = obss_cfg_param->obss_ht_20mhz_detect_mode;
WMI_LOGD("Sending WMI_SAP_OBSS_DETECTION_CFG_CMDID vdev_id:%d",
cmd->vdev_id);
if (wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_SAP_OBSS_DETECTION_CFG_CMDID)) {
@@ -21755,6 +21753,170 @@ static QDF_STATUS extract_green_ap_egap_status_info_tlv(
}
#endif
/*
* send_bss_color_change_enable_cmd_tlv() - Send command to enable or disable of
* updating bss color change within firmware when AP announces bss color change.
* @wmi_handle: wmi handle
* @vdev_id: vdev ID
* @enable: enable bss color change within firmware
*
* Send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID parameters to fw.
*
* Return: QDF_STATUS
*/
static QDF_STATUS send_bss_color_change_enable_cmd_tlv(wmi_unified_t wmi_handle,
uint32_t vdev_id,
bool enable)
{
wmi_buf_t buf;
wmi_bss_color_change_enable_fixed_param *cmd;
uint8_t len = sizeof(wmi_bss_color_change_enable_fixed_param);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s: Failed to allocate wmi buffer", __func__);
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_bss_color_change_enable_fixed_param *)wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_bss_color_change_enable_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_bss_color_change_enable_fixed_param));
cmd->vdev_id = vdev_id;
cmd->enable = enable;
if (wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_BSS_COLOR_CHANGE_ENABLE_CMDID)) {
WMI_LOGE("Failed to send WMI_BSS_COLOR_CHANGE_ENABLE_CMDID");
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* send_obss_color_collision_cfg_cmd_tlv() - send bss color detection
* configurations to firmware.
* @wmi_handle: wmi handle
* @cfg_param: obss detection configurations
*
* Send WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID parameters to fw.
*
* Return: QDF_STATUS
*/
static QDF_STATUS send_obss_color_collision_cfg_cmd_tlv(
wmi_unified_t wmi_handle,
struct wmi_obss_color_collision_cfg_param *cfg_param)
{
wmi_buf_t buf;
wmi_obss_color_collision_det_config_fixed_param *cmd;
uint8_t len = sizeof(wmi_obss_color_collision_det_config_fixed_param);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s: Failed to allocate wmi buffer", __func__);
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_obss_color_collision_det_config_fixed_param *)wmi_buf_data(
buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_obss_color_collision_det_config_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_obss_color_collision_det_config_fixed_param));
cmd->vdev_id = cfg_param->vdev_id;
cmd->flags = cfg_param->flags;
cmd->current_bss_color = cfg_param->current_bss_color;
cmd->detection_period_ms = cfg_param->detection_period_ms;
cmd->scan_period_ms = cfg_param->scan_period_ms;
cmd->free_slot_expiry_time_ms = cfg_param->free_slot_expiry_time_ms;
switch (cfg_param->evt_type) {
case OBSS_COLOR_COLLISION_DETECTION_DISABLE:
cmd->evt_type = WMI_BSS_COLOR_COLLISION_DISABLE;
break;
case OBSS_COLOR_COLLISION_DETECTION:
cmd->evt_type = WMI_BSS_COLOR_COLLISION_DETECTION;
break;
case OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY:
cmd->evt_type = WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY;
break;
case OBSS_COLOR_FREE_SLOT_AVAILABLE:
cmd->evt_type = WMI_BSS_COLOR_FREE_SLOT_AVAILABLE;
break;
default:
WMI_LOGE("%s: invalid event type: %d",
__func__, cfg_param->evt_type);
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
if (wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID)) {
WMI_LOGE("%s: Sending OBSS color det cmd failed, vdev_id: %d",
__func__, cfg_param->vdev_id);
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* extract_obss_color_collision_info_tlv() - Extract bss color collision info
* received from firmware.
* @evt_buf: pointer to event buffer
* @info: Pointer to hold bss collision info
*
* Return: QDF_STATUS
*/
static QDF_STATUS extract_obss_color_collision_info_tlv(uint8_t *evt_buf,
struct wmi_obss_color_collision_info *info)
{
WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID_param_tlvs *param_buf;
wmi_obss_color_collision_evt_fixed_param *fix_param;
if (!info) {
WMI_LOGE("%s: Invalid obss color buffer", __func__);
return QDF_STATUS_E_INVAL;
}
param_buf = (WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID_param_tlvs *)
evt_buf;
if (!param_buf) {
WMI_LOGE("%s: Invalid evt_buf", __func__);
return QDF_STATUS_E_INVAL;
}
fix_param = param_buf->fixed_param;
info->vdev_id = fix_param->vdev_id;
info->obss_color_bitmap_bit0to31 = fix_param->bss_color_bitmap_bit0to31;
info->obss_color_bitmap_bit32to63 =
fix_param->bss_color_bitmap_bit32to63;
switch (fix_param->evt_type) {
case WMI_BSS_COLOR_COLLISION_DISABLE:
info->evt_type = OBSS_COLOR_COLLISION_DETECTION_DISABLE;
break;
case WMI_BSS_COLOR_COLLISION_DETECTION:
info->evt_type = OBSS_COLOR_COLLISION_DETECTION;
break;
case WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY:
info->evt_type = OBSS_COLOR_FREE_SLOT_TIMER_EXPIRY;
break;
case WMI_BSS_COLOR_FREE_SLOT_AVAILABLE:
info->evt_type = OBSS_COLOR_FREE_SLOT_AVAILABLE;
break;
default:
WMI_LOGE("%s: invalid event type: %d, vdev_id: %d",
__func__, fix_param->evt_type, fix_param->vdev_id);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
struct wmi_ops tlv_ops = {
.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
@@ -22221,6 +22383,12 @@ struct wmi_ops tlv_ops = {
.wmi_free_allocated_event = wmitlv_free_allocated_event_tlvs,
.wmi_check_and_pad_event = wmitlv_check_and_pad_event_tlvs,
.wmi_check_command_params = wmitlv_check_command_tlv_params,
.send_bss_color_change_enable_cmd =
send_bss_color_change_enable_cmd_tlv,
.send_obss_color_collision_cfg_cmd =
send_obss_color_collision_cfg_cmd_tlv,
.extract_obss_color_collision_info =
extract_obss_color_collision_info_tlv,
};
/**
@@ -22503,6 +22671,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
WMI_SAP_OBSS_DETECTION_REPORT_EVENTID;
event_ids[wmi_host_swfda_event_id] = WMI_HOST_SWFDA_EVENTID;
event_ids[wmi_sar_get_limits_event_id] = WMI_SAR_GET_LIMITS_EVENTID;
event_ids[wmi_obss_color_collision_report_event_id] =
WMI_OBSS_COLOR_COLLISION_DETECTION_EVENTID;
}
/**