Переглянути джерело

qcacld-3.0: Unit test command for XPAN WHC feature

Add interface command to test WHC feature.

Change-Id: I084fdc4da9966d371c0f7f1e3da624bca9e9d9ca
CRs-Fixed: 3576080
Ananya Gupta 1 рік тому
батько
коміт
dc882e4dd9

+ 2 - 0
core/hdd/src/wlan_hdd_sysfs.c

@@ -821,11 +821,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
 	hdd_sysfs_11be_rate_create(adapter);
 	hdd_sysfs_bmiss_create(adapter);
 	hdd_sysfs_dp_tx_delay_stats_create(adapter);
+	hdd_sysfs_direct_link_ut_cmd_create(adapter);
 }
 
 static void
 hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
 {
+	hdd_sysfs_direct_link_ut_destroy(adapter);
 	hdd_sysfs_dp_tx_delay_stats_destroy(adapter);
 	hdd_sysfs_bmiss_destroy(adapter);
 	hdd_sysfs_11be_rate_destroy(adapter);

+ 26 - 2
core/hdd/src/wlan_hdd_sysfs_direct_link_ut_cmd.c

@@ -22,7 +22,7 @@
 #include <wlan_hdd_sysfs.h>
 #include "wlan_hdd_sysfs_direct_link_ut_cmd.h"
 
-#define MAX_SYSFS_DIRECT_LNK_UT_USER_COMMAND_LENGTH 64
+#define MAX_SYSFS_DIRECT_LNK_UT_USER_COMMAND_LENGTH 512
 
 static ssize_t __hdd_sysfs_direct_link_ut_cmd_store(struct net_device *net_dev,
 						    char const *buf,
@@ -101,7 +101,31 @@ static ssize_t __hdd_sysfs_direct_link_ut_cmd_store(struct net_device *net_dev,
 		return -EINVAL;
 	qdf_mac_parse(token, &cmd_info.dest_mac);
 
-	qdf_copy_macaddr(&cmd_info.src_mac, &adapter->mac_addr);
+	if (cmd_info.cmd == WFDS_START_WHC) {
+		token = strsep(&sptr, " ");
+		if (!token)
+			return -EINVAL;
+		qdf_mac_parse(token, &cmd_info.src_mac);
+
+		token = strsep(&sptr, " ");
+		if (!token)
+			return -EINVAL;
+		qdf_ipv4_parse(token, &cmd_info.dest_ip);
+
+		token = strsep(&sptr, " ");
+		if (!token)
+			return -EINVAL;
+		qdf_ipv4_parse(token, &cmd_info.src_ip);
+
+		token = strsep(&sptr, " ");
+		if (!token)
+			return -EINVAL;
+		if (kstrtou16(token, 0, &cmd_info.dest_port))
+			return -EINVAL;
+	} else if (cmd_info.cmd == WFDS_START_TRAFFIC) {
+		qdf_copy_macaddr(&cmd_info.src_mac, &adapter->mac_addr);
+	}
+
 send_request:
 	status = os_if_qmi_wfds_send_ut_cmd_req_msg(&cmd_info);
 	if (QDF_IS_STATUS_ERROR(status))

+ 14 - 2
os_if/qmi/inc/os_if_qmi.h

@@ -43,11 +43,17 @@
  * @WFDS_STOP_TRAFFIC: Stop WFDS traffic
  * @WFDS_START_TRAFFIC: Start WFDS Traffic
  * @WFDS_GET_STATS: Get WFDS traffic stats
+ * @WFDS_START_WHC: Start WHC traffic
+ * @WFDS_START_TSF: Start TSF handshake
+ * @WFDS_CMD_MISC: Miscellaneous test
  */
 enum os_if_qmi_wfds_ut_cmd_type {
 	WFDS_STOP_TRAFFIC,
 	WFDS_START_TRAFFIC,
-	WFDS_GET_STATS
+	WFDS_GET_STATS,
+	WFDS_START_WHC,
+	WFDS_START_TSF,
+	WFDS_CMD_MISC,
 };
 
 /**
@@ -60,6 +66,9 @@ enum os_if_qmi_wfds_ut_cmd_type {
  * @ether_type: ether_type of packet
  * @dest_mac: Destination MAC address
  * @src_mac: Source MAC address
+ * @dest_ip: Destination IPv4 address
+ * @src_ip: Source IPv4 address
+ * @dest_port: Destination port
  */
 struct os_if_qmi_wfds_ut_cmd_info {
 	enum os_if_qmi_wfds_ut_cmd_type cmd;
@@ -68,8 +77,11 @@ struct os_if_qmi_wfds_ut_cmd_info {
 	uint32_t num_pkts;
 	uint32_t buf_size;
 	uint16_t ether_type;
-	struct qdf_mac_addr src_mac;
 	struct qdf_mac_addr dest_mac;
+	struct qdf_mac_addr src_mac;
+	struct qdf_ipv4_addr dest_ip;
+	struct qdf_ipv4_addr src_ip;
+	uint16_t dest_port;
 };
 
 #ifdef QMI_COMPONENT_ENABLE

+ 17 - 1
os_if/qmi/inc/os_if_qmi_wifi_driver_service_v01.h

@@ -297,6 +297,9 @@ extern struct qmi_elem_info wfds_misc_ind_msg_v01_ei[];
  * @WFDS_UT_CMD_STOP_V01: Stop WFDS traffic
  * @WFDS_UT_CMD_START_V01: Start WFDS Traffic
  * @WFDS_UT_CMD_STATS_V01: Get WFDS traffic stats
+ * @WFDS_UT_CMD_START_WHC_V01: Start WHC Traffic
+ * @WFDS_UT_CMD_START_TSF_SYNC_V01: Start TSF handshake
+ * @WFDS_UT_CMD_MISC_V01: Miscellaneous test
  * @WIFI_DRV_QMI_UT_CMD_MAX_VAL_V01: event enum max value
  */
 enum wifi_drv_qmi_ut_cmd_v01 {
@@ -304,6 +307,9 @@ enum wifi_drv_qmi_ut_cmd_v01 {
 	WFDS_UT_CMD_STOP_V01 = 0,
 	WFDS_UT_CMD_START_V01 = 1,
 	WFDS_UT_CMD_STATS_V01 = 2,
+	WFDS_UT_CMD_START_WHC_V01 = 3,
+	WFDS_UT_CMD_START_TSF_SYNC_V01 = 4,
+	WFDS_UT_CMD_MISC_V01 = 5,
 	WIFI_DRV_QMI_UT_CMD_MAX_VAL_V01 = INT_MAX,
 };
 
@@ -317,6 +323,11 @@ enum wifi_drv_qmi_ut_cmd_v01 {
  * @ether_type: ether_type of packet
  * @src_mac: Source MAC address
  * @dest_mac: Destination MAC address
+ * @ip_ver: IP address version
+ * @src_ip_addr: source IP address
+ * @dest_ip_addr: Destination IP address
+ * @dest_port: Destination port
+ * @misc: Misc input data
  */
 struct wfds_ut_cmd_req_msg_v01 {
 	enum wifi_drv_qmi_ut_cmd_v01 cmd;
@@ -327,9 +338,14 @@ struct wfds_ut_cmd_req_msg_v01 {
 	u16 ether_type;
 	u8 src_mac[6];
 	u8 dest_mac[6];
+	u8 ip_ver;
+	u8 src_ip_addr[16];
+	u8 dest_ip_addr[16];
+	u16 dest_port;
+	u8 misc[256];
 };
 
-#define WFDS_UT_CMD_REQ_MSG_V01_MAX_MSG_LEN 58
+#define WFDS_UT_CMD_REQ_MSG_V01_MAX_MSG_LEN 364
 extern struct qmi_elem_info wfds_ut_cmd_req_msg_v01_ei[];
 
 #endif

+ 10 - 1
os_if/qmi/src/os_if_qmi_wfds.c

@@ -495,7 +495,7 @@ os_if_qmi_wfds_send_ut_cmd_req_msg(struct os_if_qmi_wfds_ut_cmd_info *cmd_info)
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	req->cmd = cmd_info->cmd;
+	req->cmd = (enum wifi_drv_qmi_ut_cmd_v01)cmd_info->cmd;
 	req->duration = cmd_info->duration;
 	req->flush_period = cmd_info->flush_period;
 	req->num_pkts = cmd_info->num_pkts;
@@ -506,6 +506,15 @@ os_if_qmi_wfds_send_ut_cmd_req_msg(struct os_if_qmi_wfds_ut_cmd_info *cmd_info)
 		req->dest_mac[i] = cmd_info->dest_mac.bytes[i];
 	}
 
+	if (cmd_info->cmd == WFDS_START_WHC) {
+		for (i = 0; i < QDF_IPV4_ADDR_SIZE; i++) {
+			req->src_ip_addr[i] = cmd_info->src_ip.bytes[i];
+			req->dest_ip_addr[i] = cmd_info->dest_ip.bytes[i];
+		}
+
+		req->dest_port = cmd_info->dest_port;
+	}
+
 	osif_debug("cmd: %u for duration: %u s, flush period: %u ms",
 		  req->cmd, req->duration, req->flush_period);
 

+ 50 - 0
os_if/qmi/src/os_if_qmi_wifi_driver_service_v01.c

@@ -574,4 +574,54 @@ struct qmi_elem_info wfds_ut_cmd_req_msg_v01_ei[] = {
 		.array_type       = NO_ARRAY,
 		.tlv_type       = QMI_COMMON_TLV_TYPE,
 	},
+	{
+		.data_type      = QMI_UNSIGNED_1_BYTE,
+		.elem_len       = 1,
+		.elem_size      = sizeof(u8),
+		.array_type       = NO_ARRAY,
+		.tlv_type       = 0x09,
+		.offset         = offsetof(struct
+					   wfds_ut_cmd_req_msg_v01,
+					   ip_ver),
+	},
+	{
+		.data_type      = QMI_UNSIGNED_1_BYTE,
+		.elem_len       = 16,
+		.elem_size      = sizeof(u8),
+		.array_type       = STATIC_ARRAY,
+		.tlv_type       = 0x0A,
+		.offset         = offsetof(struct
+					   wfds_ut_cmd_req_msg_v01,
+					   src_ip_addr),
+	},
+	{
+		.data_type      = QMI_UNSIGNED_1_BYTE,
+		.elem_len       = 16,
+		.elem_size      = sizeof(u8),
+		.array_type       = STATIC_ARRAY,
+		.tlv_type       = 0x0B,
+		.offset         = offsetof(struct
+					   wfds_ut_cmd_req_msg_v01,
+					   dest_ip_addr),
+	},
+	{
+		.data_type      = QMI_UNSIGNED_2_BYTE,
+		.elem_len       = 1,
+		.elem_size      = sizeof(u16),
+		.array_type       = NO_ARRAY,
+		.tlv_type       = 0x0C,
+		.offset         = offsetof(struct
+					   wfds_ut_cmd_req_msg_v01,
+					   dest_port),
+	},
+	{
+		.data_type      = QMI_UNSIGNED_1_BYTE,
+		.elem_len       = 256,
+		.elem_size      = sizeof(u8),
+		.array_type       = STATIC_ARRAY,
+		.tlv_type       = 0x0D,
+		.offset         = offsetof(struct
+					   wfds_ut_cmd_req_msg_v01,
+					   misc),
+	},
 };