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

qcacmn: Dont add the wmi header size while allocating the wmi buff

Currently whenever the wmi message is allocated the wmi header
length is also added to check with against the max size supported
by the firmware, there is no need to add the extra wmi header size
as the max length shared by firmware has the wmi header size
included.

Below is the breakdown:

Max CE2 transfer size is 2048 bytes
HTC header is 8 bytes
WMI header is 4 bytes

Max payload can be (MAX CE2 Transfer size - (HTC header+ WMI header)
                   (2048 - (8 +4)) =  2036

During the htc handshake this max wmi length is recevied by the host as
2040 bytes which is including the  wmi header so host adding the extra
4 bytes is redundant and can be removed.
HTC buffer->actual_length = 2036 + WMI(4) = 2040 bytes

Change-Id: Ib958a938506c5c96347dec5304ca30aa8690d459
CRs-Fixed: 3130493
Arun Kumar Khandavalli 3 жил өмнө
parent
commit
d4239b89f6
1 өөрчлөгдсөн 7 нэмэгдсэн , 4 устгасан
  1. 7 4
      wmi/src/wmi_unified.c

+ 7 - 4
wmi/src/wmi_unified.c

@@ -1677,7 +1677,10 @@ wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint32_t len,
 {
 	wmi_buf_t wmi_buf;
 
-	if (roundup(len + sizeof(WMI_CMD_HDR), 4) > wmi_handle->max_msg_len) {
+	if (roundup(len, 4) > wmi_handle->max_msg_len) {
+		wmi_err("Invalid length %u (via %s:%u) max size: %u",
+			len, func_name, line_num,
+			wmi_handle->max_msg_len);
 		QDF_ASSERT(0);
 		return NULL;
 	}
@@ -1718,9 +1721,9 @@ wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len,
 {
 	wmi_buf_t wmi_buf;
 
-	if (roundup(len + sizeof(WMI_CMD_HDR), 4) > wmi_handle->max_msg_len) {
-		QDF_DEBUG_PANIC("Invalid length %u (via %s:%u)",
-				len, func, line);
+	if (roundup(len, 4) > wmi_handle->max_msg_len) {
+		QDF_DEBUG_PANIC("Invalid length %u (via %s:%u) max size: %u",
+				len, func, line, wmi_handle->max_msg_len);
 		return NULL;
 	}