[WCNCR00170597] perf: fix isolation detection flow in coex command

[Description]
Fix isolation detection flow, and this fix command
should be used by coex related sub-commands
(Command ID : CMD_ID_COEX_CTRL (0x7C)).

Remove redundant command argument and if you want to
use isolation detection method, you should enter
the command like: iwpriv wlan0 driver "coex_ctrl 1 0 6".
(The argument is : [Subcmd id] [WF Path] [WF Channel])

Change-Id: Ie6ede14aab9da7b55bab2d5b838658cf4e5c88e9
Signed-off-by: Jared.Huang <jared.huang@mediatek.com>
CR-Id: WCNCR00170597
Feature: perf
Reviewed-on: http://gerrit.mediatek.inc:8080/1309968
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: TH3 Huang <th3.huang@mediatek.com>
Reviewed-by: Rick Wen <rick.wen@mediatek.com>
Reviewed-by: Ted Huang <ted.huang@mediatek.com>
Build: srv_neptune_adm <srv_neptune_adm@mediatek.com>
Test: srv_neptune_adm <srv_neptune_adm@mediatek.com>
diff --git a/include/nic_cmd_event.h b/include/nic_cmd_event.h
index 2f6e819..66c7f7f 100644
--- a/include/nic_cmd_event.h
+++ b/include/nic_cmd_event.h
@@ -1298,8 +1298,8 @@
 	UINT_32 u4Data;
 } CMD_ACCESS_REG, *P_CMD_ACCESS_REG;
 
-#define COEX_CTRL_BUF_LEN 500
-#define COEX_INFO_LEN 125
+#define COEX_CTRL_BUF_LEN 460
+#define COEX_INFO_LEN 115
 
 /* CMD_COEX_CTRL & EVENT_COEX_CTRL */
 /************************************************/
diff --git a/include/wlan_oid.h b/include/wlan_oid.h
index 56f2c3c..3fe8431 100644
--- a/include/wlan_oid.h
+++ b/include/wlan_oid.h
@@ -593,8 +593,8 @@
 	UINT_32 u4McrData;
 } PARAM_CUSTOM_MCR_RW_STRUCT_T, *P_PARAM_CUSTOM_MCR_RW_STRUCT_T;
 
-#define COEX_CTRL_BUF_LEN 500
-#define COEX_INFO_LEN 125
+#define COEX_CTRL_BUF_LEN 460
+#define COEX_INFO_LEN 115
 
 /* CMD_COEX_CTRL & EVENT_COEX_CTRL */
 /************************************************/
diff --git a/os/linux/gl_wext_priv.c b/os/linux/gl_wext_priv.c
index 0b03ecf..0e8eed0 100644
--- a/os/linux/gl_wext_priv.c
+++ b/os/linux/gl_wext_priv.c
@@ -3736,7 +3736,7 @@
 		{
 			struct CMD_COEX_ISO_DETECT *prCmdCoexIsoDetect;
 
-			i4SubArgNum = 4;
+			i4SubArgNum = 3;
 			/* Safely dereference "argv[3]".*/
 			if (i4Argc < i4SubArgNum)
 				break;
@@ -3750,8 +3750,9 @@
 
 			/* Set Return i4BytesWritten Value */
 			u4Offset = snprintf(pcCommand, i4TotalLen, "%d",
-				prCmdCoexIsoDetect->u4Isolation);
-			DBGLOG(REQ, INFO, "Isolation: %d\n", prCmdCoexIsoDetect->u4Isolation);
+				(prCmdCoexIsoDetect->u4Isolation/2));
+			DBGLOG(REQ, INFO, "Isolation: %d\n",
+				(prCmdCoexIsoDetect->u4Isolation/2));
 			break;
 		}
 		case ENUM_COEX_CTRL_GET_INFO:
@@ -3760,22 +3761,19 @@
 			UINT_8 ucCoexTblSize = sizeof(coex_ref_table) / sizeof(struct COEX_REF_TABLE);
 			UINT_8 ucCoexInfoNum, ucIdx = 0, ucTblIdx;
 			UINT_16 u2CoexInfoId, u2CoexInfoLen;
+			PUINT_32 pu4CoexInfo;
 
-			i4SubArgNum = 2;
-			/* Safely dereference "argv[1]".*/
-			if (i4Argc < i4SubArgNum)
-				break;
 			u4Ret = priv_driver_get_coex_info(prGlueInfo, &rCmdCoexCtrl, apcArgv);
 			if (u4Ret)
 				return -1;
 
 			prCmdCoexGetInfo = (struct CMD_COEX_GET_INFO *) rCmdCoexCtrl.aucBuffer;
 
-			ucCoexInfoNum = (prCmdCoexGetInfo->u4CoexInfo[0] & 0xff);
+			pu4CoexInfo = &prCmdCoexGetInfo->u4CoexInfo[0];
+			ucCoexInfoNum = *pu4CoexInfo++ & 0xff;
 			while (ucIdx < ucCoexInfoNum) {
-
-				u2CoexInfoId = (prCmdCoexGetInfo->u4CoexInfo[(ucIdx + 1) * 2] >> 16) & 0xffff;
-				u2CoexInfoLen = prCmdCoexGetInfo->u4CoexInfo[(ucIdx + 1) * 2] & 0xffff;
+				u2CoexInfoId = (*pu4CoexInfo >> 16) & 0xffff;
+				u2CoexInfoLen = *pu4CoexInfo++ & 0xffff;
 
 				/* Find Coex Info Cmd Id from priv_driver_coex_info_table[] */
 				for (ucTblIdx = 0; ucTblIdx < ucCoexTblSize; ucTblIdx++) {
@@ -3797,28 +3795,28 @@
 				{
 					u4Offset += snprintf(pcCommand + u4Offset,
 					i4TotalLen - u4Offset, "0x%02x",
-					prCmdCoexGetInfo->u4CoexInfo[(ucIdx + 1) * 2 + 1]);
+					*pu4CoexInfo++);
 					break;
 				}
 				case 0x0002:
 				{
 					u4Offset += snprintf(pcCommand + u4Offset,
 					i4TotalLen - u4Offset, "0x%04x",
-					prCmdCoexGetInfo->u4CoexInfo[(ucIdx + 1) * 2 + 1]);
+					*pu4CoexInfo++);
 					break;
 				}
 				case 0x0003:
 				{
 					u4Offset += snprintf(pcCommand + u4Offset,
 					i4TotalLen - u4Offset, "0x%06x",
-					prCmdCoexGetInfo->u4CoexInfo[(ucIdx + 1) * 2 + 1]);
+					*pu4CoexInfo++);
 					break;
 				}
 				case 0x0004:
 				{
 					u4Offset += snprintf(pcCommand + u4Offset,
 					i4TotalLen - u4Offset, "0x%08x",
-					prCmdCoexGetInfo->u4CoexInfo[(ucIdx + 1) * 2 + 1]);
+					*pu4CoexInfo++);
 					break;
 				}
 				default: