qcacmn: Add support for TWT ack event

In case if TWT command (i.e setup, terminate, pause, resume,
nudge) comes from userspace and if the firmware is in below mode
1. scan in progress
2. roam in progress
3. CSA is in progress or
4. Any other error
then the command needs to be rejected in userspace context.

Synchronize the TWT command so that whenever command goes from
driver to firmware, then driver will receive ack event first
followed by respective event (i.e add dialog, delete dialog,
pause, resume, nudge) with below condition
1. If driver receives the ack event as successful then driver
   waits for this ack event, respective event with status of the
   TWT action frame over the air is expected.
2. If driver receives the ack event as failure then it will
   rejects the TWT command in userspace context.

Change-Id: Ie885d98ecf2dad98d34676d889fd70e4c84f0a05
CRs-Fixed: 2987904
This commit is contained in:
Jyoti Kumari
2021-06-21 21:25:47 +05:30
committed by Madan Koyyalamudi
parent 04f9725d81
commit fc3c62d771
7 changed files with 135 additions and 1 deletions

View File

@@ -1049,6 +1049,75 @@ static QDF_STATUS extract_twt_cap_service_ready_ext2_tlv(
return QDF_STATUS_SUCCESS;
}
static enum WMI_HOST_TWT_CMD_FOR_ACK_EVENT
wmi_get_converted_twt_command_for_ack_event(WMI_CMD_ID tgt_cmd)
{
switch (tgt_cmd) {
case WMI_TWT_ADD_DIALOG_CMDID:
return WMI_HOST_TWT_ADD_DIALOG_CMDID;
case WMI_TWT_DEL_DIALOG_CMDID:
return WMI_HOST_TWT_DEL_DIALOG_CMDID;
case WMI_TWT_PAUSE_DIALOG_CMDID:
return WMI_HOST_TWT_PAUSE_DIALOG_CMDID;
case WMI_TWT_RESUME_DIALOG_CMDID:
return WMI_HOST_TWT_RESUME_DIALOG_CMDID;
case WMI_TWT_NUDGE_DIALOG_CMDID:
return WMI_HOST_TWT_NUDGE_DIALOG_CMDID;
default:
return WMI_HOST_TWT_UNKNOWN_CMDID;
}
}
static QDF_STATUS
extract_twt_ack_comp_event_tlv(wmi_unified_t wmi_handle,
uint8_t *evt_buf,
struct wmi_twt_ack_complete_event_param *var)
{
WMI_TWT_ACK_EVENTID_param_tlvs *param_buf;
wmi_twt_ack_event_fixed_param *ack_event;
param_buf = (WMI_TWT_ACK_EVENTID_param_tlvs *)evt_buf;
if (!param_buf) {
wmi_err("evt_buf is NULL");
return QDF_STATUS_E_INVAL;
}
ack_event = param_buf->fixed_param;
var->vdev_id = ack_event->vdev_id;
WMI_MAC_ADDR_TO_CHAR_ARRAY(&ack_event->peer_macaddr,
var->peer_macaddr.bytes);
var->dialog_id = ack_event->dialog_id;
var->twt_cmd_ack = wmi_get_converted_twt_command_for_ack_event(
ack_event->twt_cmd);
switch (ack_event->twt_cmd) {
case WMI_TWT_ADD_DIALOG_CMDID:
var->status = wmi_get_converted_twt_add_dialog_status(
ack_event->status);
break;
case WMI_TWT_DEL_DIALOG_CMDID:
var->status = wmi_get_converted_twt_del_dialog_status(
ack_event->status);
break;
case WMI_TWT_PAUSE_DIALOG_CMDID:
var->status = wmi_twt_pause_status_to_host_twt_status(
ack_event->status);
break;
case WMI_TWT_RESUME_DIALOG_CMDID:
var->status = wmi_get_converted_twt_resume_dialog_status(
ack_event->status);
break;
case WMI_TWT_NUDGE_DIALOG_CMDID:
var->status = wmi_twt_nudge_status_to_host_twt_status(
ack_event->status);
break;
default:
break;
}
return QDF_STATUS_SUCCESS;
}
void wmi_twt_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
@@ -1083,6 +1152,6 @@ void wmi_twt_attach_tlv(wmi_unified_t wmi_handle)
extract_twt_notify_event_tlv;
ops->extract_twt_cap_service_ready_ext2 =
extract_twt_cap_service_ready_ext2_tlv,
ops->extract_twt_ack_comp_event = extract_twt_ack_comp_event_tlv;
wmi_twt_attach_bcast_twt_tlv(ops);
}