Browse Source

qcacmn: Refine the STA keepalive interface

The unified WMI struct used to support the STA keepalive feature has a
few flaws:
- It is poorly named. Struct sta_params is a very generic name for a
  struct that has a very specific purpose.
- It is poorly designed. It utilizes pointers to the IPv4 and MAC
  addresses rather than support having those addresses within the
  struct itself. This prevents the struct from completely representing
  the payload, which is required if we want to utilize this struct in
  the converged UMAC.

To resolve these issues rename and redesign the struct.

This is co-dependent with I20cf9f54a7ec920a90575ffd73c51708414d46a0
("qcacld-3.0: Use the redesigned STA keepalive interface").

Change-Id: I2a401fa6934f05555cb3c30088af62cfbc9a3c59
CRs-Fixed: 2404895
Jeff Johnson 6 years ago
parent
commit
be9a952aa2

+ 1 - 1
wmi/inc/wmi_unified_priv.h

@@ -887,7 +887,7 @@ QDF_STATUS (*send_vdev_set_gtx_cfg_cmd)(wmi_unified_t wmi_handle,
 				  struct wmi_gtx_config *gtx_info);
 
 QDF_STATUS (*send_set_sta_keep_alive_cmd)(wmi_unified_t wmi_handle,
-				struct sta_params *params);
+					  struct sta_keep_alive_params *params);
 
 QDF_STATUS (*send_set_sta_sa_query_param_cmd)(wmi_unified_t wmi_handle,
 					uint8_t vdev_id, uint32_t max_retries,

+ 4 - 3
wmi/inc/wmi_unified_sta_api.h

@@ -47,15 +47,16 @@ QDF_STATUS wmi_unified_set_sta_sa_query_param_cmd(void *wmi_hdl,
 
 /**
  * wmi_unified_set_sta_keep_alive_cmd() - set sta keep alive parameters
- * @wmi_hdl: wmi handle
+ * @wmi_handle: wmi handle
  * @params: sta keep alive parameter
  *
  * This function sets keep alive related parameters in fw.
  *
  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
  */
-QDF_STATUS wmi_unified_set_sta_keep_alive_cmd(void *wmi_hdl,
-					      struct sta_params *params);
+QDF_STATUS
+wmi_unified_set_sta_keep_alive_cmd(wmi_unified_t wmi_handle,
+				   struct sta_keep_alive_params *params);
 
 /**
  * wmi_unified_vdev_set_gtx_cfg_cmd() - set GTX params

+ 5 - 5
wmi/inc/wmi_unified_sta_param.h

@@ -24,7 +24,7 @@
 #define _WMI_UNIFIED_STA_PARAM_H_
 
 /**
- * struct sta_params - sta keep alive parameters
+ * struct sta_keep_alive_params - sta keep alive parameters
  * @vdev_id: vdev id
  * @method: keep alive method
  * @timeperiod: time to keep alive
@@ -32,13 +32,13 @@
  * @destv4addr: destination ipv4 address
  * @destmac: destination mac address
  */
-struct sta_params {
+struct sta_keep_alive_params {
 	uint8_t vdev_id;
 	uint32_t method;
 	uint32_t timeperiod;
-	uint8_t *hostv4addr;
-	uint8_t *destv4addr;
-	uint8_t *destmac;
+	uint8_t hostv4addr[QDF_IPV4_ADDR_SIZE];
+	uint8_t destv4addr[QDF_IPV4_ADDR_SIZE];
+	uint8_t destmac[QDF_MAC_ADDR_SIZE];
 };
 
 /**

+ 3 - 4
wmi/src/wmi_unified_sta_api.c

@@ -37,11 +37,10 @@ QDF_STATUS wmi_unified_set_sta_sa_query_param_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
-QDF_STATUS wmi_unified_set_sta_keep_alive_cmd(void *wmi_hdl,
-					      struct sta_params *params)
+QDF_STATUS
+wmi_unified_set_sta_keep_alive_cmd(wmi_unified_t wmi_handle,
+				   struct sta_keep_alive_params *params)
 {
-	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
-
 	if (wmi_handle->ops->send_set_sta_keep_alive_cmd)
 		return wmi_handle->ops->send_set_sta_keep_alive_cmd(wmi_handle,
 								    params);

+ 9 - 17
wmi/src/wmi_unified_sta_tlv.c

@@ -85,8 +85,9 @@ static QDF_STATUS send_set_sta_sa_query_param_cmd_tlv(wmi_unified_t wmi_handle,
  *
  * Return: CDF status
  */
-static QDF_STATUS send_set_sta_keep_alive_cmd_tlv(wmi_unified_t wmi_handle,
-						  struct sta_params *params)
+static QDF_STATUS
+send_set_sta_keep_alive_cmd_tlv(wmi_unified_t wmi_handle,
+				struct sta_keep_alive_params *params)
 {
 	wmi_buf_t buf;
 	WMI_STA_KEEPALIVE_CMD_fixed_param *cmd;
@@ -112,8 +113,8 @@ static QDF_STATUS send_set_sta_keep_alive_cmd_tlv(wmi_unified_t wmi_handle,
 	cmd->interval = params->timeperiod;
 	cmd->enable = (params->timeperiod) ? 1 : 0;
 	cmd->vdev_id = params->vdev_id;
-	WMI_LOGD("Keep Alive: vdev_id:%d interval:%u method:%d", params->vdev_id,
-		 params->timeperiod, params->method);
+	WMI_LOGD("Keep Alive: vdev_id:%d interval:%u method:%d",
+		 params->vdev_id, params->timeperiod, params->method);
 	arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd));
 	WMITLV_SET_HDR(&arp_rsp->tlv_header,
 		       WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE,
@@ -122,22 +123,13 @@ static QDF_STATUS send_set_sta_keep_alive_cmd_tlv(wmi_unified_t wmi_handle,
 	if ((params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) ||
 	    (params->method ==
 	     WMI_STA_KEEPALIVE_METHOD_GRATUITOUS_ARP_REQUEST)) {
-		if ((NULL == params->hostv4addr) ||
-			(NULL == params->destv4addr) ||
-			(NULL == params->destmac)) {
-			WMI_LOGE("%s: received null pointer, hostv4addr:%pK "
-				 "destv4addr:%pK destmac:%pK ", __func__,
-				 params->hostv4addr, params->destv4addr,
-				 params->destmac);
-			wmi_buf_free(buf);
-			return QDF_STATUS_E_FAILURE;
-		}
 		cmd->method = params->method;
 		qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr,
-			     WMI_IPV4_ADDR_LEN);
+			     QDF_IPV4_ADDR_SIZE);
 		qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr,
-			     WMI_IPV4_ADDR_LEN);
-		WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr);
+			     QDF_IPV4_ADDR_SIZE);
+		WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac,
+					   &arp_rsp->dest_mac_addr);
 	} else {
 		cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME;
 	}