瀏覽代碼

qcacmn: Fix GTK offload req params

Currently the host sends the fixed gtk offload params
and the FILS TLV params, even when the FILS feature is disabled
in the host, which force firmware to pick the KEK from the
FILS TLV structure rather than from the fixed param structure,
which further leads to GTK re-keying feature fail.

Fix is to send only the fixed params in case when host doesnt
supports FILS.

Change-Id: I53a77257e716bf290a6f4bd62927020f073e2df6
CRs-Fixed: 2275938
gaurank kathpalia 6 年之前
父節點
當前提交
ef354f7899
共有 1 個文件被更改,包括 34 次插入21 次删除
  1. 34 21
      wmi/src/wmi_unified_tlv.c

+ 34 - 21
wmi/src/wmi_unified_tlv.c

@@ -14270,6 +14270,33 @@ send_cmd:
 	return QDF_STATUS_SUCCESS;
 }
 
+static void
+fill_fils_tlv_params(WMI_GTK_OFFLOAD_CMD_fixed_param *cmd,
+			  uint8_t vdev_id,
+			  struct pmo_gtk_req *params)
+{
+	uint8_t *buf_ptr;
+	wmi_gtk_offload_fils_tlv_param *ext_param;
+
+	buf_ptr = (uint8_t *) cmd + sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(*ext_param));
+	buf_ptr += WMI_TLV_HDR_SIZE;
+
+	ext_param = (wmi_gtk_offload_fils_tlv_param *)buf_ptr;
+	WMITLV_SET_HDR(&ext_param->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_gtk_offload_extended_tlv_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_gtk_offload_fils_tlv_param));
+	ext_param->vdev_id = vdev_id;
+	ext_param->flags = cmd->flags;
+	ext_param->kek_len = params->kek_len;
+	qdf_mem_copy(ext_param->KEK, params->kek, params->kek_len);
+	qdf_mem_copy(ext_param->KCK, params->kck,
+		     WMI_GTK_OFFLOAD_KCK_BYTES);
+	qdf_mem_copy(ext_param->replay_counter, &params->replay_counter,
+		     GTK_REPLAY_COUNTER_BYTES);
+}
 
 /**
  * send_gtk_offload_cmd_tlv() - send GTK offload command to fw
@@ -14288,13 +14315,15 @@ QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id,
 	int len;
 	wmi_buf_t buf;
 	WMI_GTK_OFFLOAD_CMD_fixed_param *cmd;
-	wmi_gtk_offload_fils_tlv_param *ext_param;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	uint8_t *buf_ptr;
 
 	WMI_LOGD("%s Enter", __func__);
 
-	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*ext_param);
+	len = sizeof(*cmd);
+
+	if (params->is_fils_connection)
+		len += WMI_TLV_HDR_SIZE +
+		       sizeof(wmi_gtk_offload_fils_tlv_param);
 
 	/* alloc wmi buffer */
 	buf = wmi_buf_alloc(wmi_handle, len);
@@ -14305,7 +14334,6 @@ QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id,
 	}
 
 	cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf);
-	buf_ptr = (uint8_t *)cmd;
 	WMITLV_SET_HDR(&cmd->tlv_header,
 		       WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param,
 		       WMITLV_GET_STRUCT_TLVLEN
@@ -14325,23 +14353,8 @@ QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id,
 	} else {
 		cmd->flags = gtk_offload_opcode;
 	}
-
-	buf_ptr += sizeof(*cmd);
-	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(*ext_param));
-	buf_ptr += WMI_TLV_HDR_SIZE;
-
-	ext_param = (wmi_gtk_offload_fils_tlv_param *)buf_ptr;
-	WMITLV_SET_HDR(&ext_param->tlv_header,
-			WMITLV_TAG_STRUC_wmi_gtk_offload_extended_tlv_param,
-			WMITLV_GET_STRUCT_TLVLEN(
-				wmi_gtk_offload_fils_tlv_param));
-	ext_param->vdev_id = vdev_id;
-	ext_param->flags = cmd->flags;
-	ext_param->kek_len = params->kek_len;
-	qdf_mem_copy(ext_param->KEK, params->kek, params->kek_len);
-	qdf_mem_copy(ext_param->KCK, params->kck, WMI_GTK_OFFLOAD_KCK_BYTES);
-	qdf_mem_copy(ext_param->replay_counter, &params->replay_counter,
-			GTK_REPLAY_COUNTER_BYTES);
+	if (params->is_fils_connection)
+		fill_fils_tlv_params(cmd, vdev_id, params);
 
 	WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x kek len %d", vdev_id, cmd->flags, params->kek_len);
 	/* send the wmi command */