Эх сурвалжийг харах

qcacmn: Add support to offload FILS Discovery to FW

Construct the FILS Discovery frame template and send
template to FW.

Change-Id: I1052b9b8240ea9461e19bb70887b49aabffc4e05
Rhythm Patwa 5 жил өмнө
parent
commit
c5068e341f

+ 13 - 0
umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mgr_tgt_if_tx_defs.h

@@ -175,6 +175,19 @@ struct beacon_params {
 	bool is_high_latency;
 };
 
+/* struct fils_discovery_tmpl_params - FILS Discovery template cmd parameter
+ * @vdev_id: vdev ID
+ * @tmpl_len: FILS Discovery template length
+ * @tmpl_aligned: FILS Discovery template alignment
+ * @frm: FILS Discovery template parameter
+ */
+struct fils_discovery_tmpl_params {
+	uint8_t vdev_id;
+	uint32_t tmpl_len;
+	uint32_t tmpl_len_aligned;
+	uint8_t *frm;
+};
+
 /**
  * struct mlme_channel_param - Channel parameters with all
  *			info required by target.

+ 11 - 0
wmi/inc/wmi_unified_api.h

@@ -853,6 +853,17 @@ wmi_unified_pdev_param_send(wmi_unified_t wmi_handle,
 			    struct pdev_params *param,
 			    uint8_t mac_id);
 
+/**
+ * wmi_unified_fd_tmpl_send_cmd() - WMI FILS Discovery send function
+ * @wmi_handle: handle to WMI.
+ * @param: pointer to hold FILS Discovery send cmd parameter
+ *
+ * @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_unified_fd_tmpl_send_cmd(wmi_unified_t wmi_handle,
+			     struct fils_discovery_tmpl_params *param);
+
 /**
  * wmi_unified_beacon_tmpl_send_cmd() - WMI beacon send function
  * @wmi_handle: handle to WMI.

+ 3 - 0
wmi/inc/wmi_unified_priv.h

@@ -398,6 +398,9 @@ QDF_STATUS (*send_packet_log_enable_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_packet_log_disable_cmd)(wmi_unified_t wmi_handle,
 	uint8_t mac_id);
 
+QDF_STATUS (*send_fd_tmpl_cmd)(wmi_unified_t wmi_handle,
+				struct fils_discovery_tmpl_params *param);
+
 QDF_STATUS (*send_beacon_send_cmd)(wmi_unified_t wmi_handle,
 				struct beacon_params *param);
 

+ 11 - 0
wmi/src/wmi_unified_api.c

@@ -464,6 +464,17 @@ QDF_STATUS wmi_unified_packet_log_disable_send(wmi_unified_t wmi_handle,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS
+wmi_unified_fd_tmpl_send_cmd(wmi_unified_t wmi_handle,
+			     struct fils_discovery_tmpl_params *param)
+{
+	if (wmi_handle->ops->send_fd_tmpl_cmd)
+		return wmi_handle->ops->send_fd_tmpl_cmd(wmi_handle,
+				  param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS
 wmi_unified_beacon_tmpl_send_cmd(wmi_unified_t wmi_handle,
 				 struct beacon_tmpl_params *param)

+ 49 - 0
wmi/src/wmi_unified_tlv.c

@@ -2251,6 +2251,54 @@ static void send_time_stamp_sync_cmd_tlv(wmi_unified_t wmi_handle)
 
 }
 
+/**
+ *  send_fd_tmpl_cmd_tlv() - WMI FILS Discovery send function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold FILS Discovery send cmd parameter
+ *
+ *  Return: 0  on success and -ve on failure.
+ */
+static QDF_STATUS send_fd_tmpl_cmd_tlv(wmi_unified_t wmi_handle,
+				struct fils_discovery_tmpl_params *param)
+{
+	int32_t ret;
+	wmi_fd_tmpl_cmd_fixed_param *cmd;
+	wmi_buf_t wmi_buf;
+	uint8_t *buf_ptr;
+	uint32_t wmi_buf_len;
+
+	wmi_buf_len = sizeof(wmi_fd_tmpl_cmd_fixed_param) +
+		      WMI_TLV_HDR_SIZE + param->tmpl_len_aligned;
+	wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len);
+	if (!wmi_buf)
+		return QDF_STATUS_E_NOMEM;
+
+	buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf);
+	cmd = (wmi_fd_tmpl_cmd_fixed_param *) buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_fd_tmpl_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(wmi_fd_tmpl_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	cmd->buf_len = param->tmpl_len;
+	buf_ptr += sizeof(wmi_fd_tmpl_cmd_fixed_param);
+
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned);
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len);
+
+	wmi_mtrace(WMI_FD_TMPL_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+				wmi_buf, wmi_buf_len, WMI_FD_TMPL_CMDID);
+
+	if (ret) {
+		WMI_LOGE("%s: Failed to send fd tmpl: %d", __func__, ret);
+		wmi_buf_free(wmi_buf);
+		return ret;
+	}
+
+	return 0;
+}
+
 /**
  *  send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function
  *  @param wmi_handle      : handle to WMI.
@@ -12074,6 +12122,7 @@ struct wmi_ops tlv_ops =  {
 	.send_time_stamp_sync_cmd = send_time_stamp_sync_cmd_tlv,
 	.send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv,
 	.send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv,
+	.send_fd_tmpl_cmd = send_fd_tmpl_cmd_tlv,
 	.send_peer_assoc_cmd = send_peer_assoc_cmd_tlv,
 	.send_scan_start_cmd = send_scan_start_cmd_tlv,
 	.send_scan_stop_cmd = send_scan_stop_cmd_tlv,