Browse Source

qcacmn: Configure and clear packet filter

Add PMO changes to configure and clear default packet filters
over suspend and resume

Change-Id: I1f3fab170d2669865da8ba09673df6ec8e755b31
CRs-Fixed: 2034458
Ravi Kumar Bokka 8 years ago
parent
commit
91b6182286

+ 0 - 7
wmi/inc/wmi_unified_api.h

@@ -746,13 +746,6 @@ QDF_STATUS wmi_unified_aggr_qos_cmd(void *wmi_hdl,
 QDF_STATUS wmi_unified_add_ts_cmd(void *wmi_hdl,
 		 struct add_ts_param *msg);
 
-QDF_STATUS wmi_unified_enable_disable_packet_filter_cmd(void *wmi_hdl,
-					uint8_t vdev_id, bool enable);
-
-QDF_STATUS wmi_unified_config_packet_filter_cmd(void *wmi_hdl,
-		uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param,
-		uint8_t filter_id, bool enable);
-
 QDF_STATUS wmi_unified_process_add_periodic_tx_ptrn_cmd(void *wmi_hdl,
 						struct periodic_tx_pattern  *
 						pAddPeriodicTxPtrnParams,

+ 26 - 0
wmi/inc/wmi_unified_pmo_api.h

@@ -28,6 +28,7 @@
 #include "wlan_pmo_ns_public_struct.h"
 #include "wlan_pmo_gtk_public_struct.h"
 #include "wlan_pmo_wow_public_struct.h"
+#include "wlan_pmo_pkt_filter_public_struct.h"
 
 /**
  * wmi_unified_add_wow_wakeup_event_cmd() -  Configures wow wakeup events.
@@ -227,4 +228,29 @@ QDF_STATUS wmi_unified_lphb_config_udp_params_cmd(void *wmi_hdl,
 QDF_STATUS wmi_unified_lphb_config_udp_pkt_filter_cmd(void *wmi_hdl,
 		wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req);
 
+/**
+ * wmi_unified_enable_disable_packet_filter_cmd() - enable/disable packet filter
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ * @enable: Flag to enable/disable packet filter
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_enable_disable_packet_filter_cmd(void *wmi_hdl,
+		uint8_t vdev_id, bool enable);
+
+/**
+ * wmi_unified_config_packet_filter_cmd() - configure packet filter in target
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ * @rcv_filter_param: Packet filter parameters
+ * @filter_id: Filter id
+ * @enable: Flag to add/delete packet filter configuration
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_config_packet_filter_cmd(void *wmi_hdl,
+		uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
+		uint8_t filter_id, bool enable);
+
 #endif /* _WMI_UNIFIED_PMO_API_H_ */

+ 7 - 7
wmi/inc/wmi_unified_priv.h

@@ -550,6 +550,13 @@ QDF_STATUS (*send_lphb_config_udp_params_cmd)(wmi_unified_t wmi_handle,
 
 QDF_STATUS (*send_lphb_config_udp_pkt_filter_cmd)(wmi_unified_t wmi_handle,
 					wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req);
+
+QDF_STATUS (*send_enable_disable_packet_filter_cmd)(wmi_unified_t wmi_handle,
+					uint8_t vdev_id, bool enable);
+
+QDF_STATUS (*send_config_packet_filter_cmd)(wmi_unified_t wmi_handle,
+		uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
+		uint8_t filter_id, bool enable);
 #endif /* end of WLAN_PMO_ENABLE */
 #ifdef CONFIG_MCL
 QDF_STATUS (*send_process_dhcp_ind_cmd)(wmi_unified_t wmi_handle,
@@ -608,13 +615,6 @@ QDF_STATUS (*send_aggr_qos_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_add_ts_cmd)(wmi_unified_t wmi_handle,
 		 struct add_ts_param *msg);
 
-QDF_STATUS (*send_enable_disable_packet_filter_cmd)(wmi_unified_t wmi_handle,
-					uint8_t vdev_id, bool enable);
-
-QDF_STATUS (*send_config_packet_filter_cmd)(wmi_unified_t wmi_handle,
-		uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param,
-		uint8_t filter_id, bool enable);
-
 QDF_STATUS (*send_process_add_periodic_tx_ptrn_cmd)(wmi_unified_t wmi_handle,
 						struct periodic_tx_pattern  *
 						pAddPeriodicTxPtrnParams,

+ 0 - 44
wmi/src/wmi_unified_api.c

@@ -2429,50 +2429,6 @@ QDF_STATUS wmi_unified_add_ts_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
-/**
- * wmi_unified_enable_disable_packet_filter_cmd() - enable/disable packet filter in target
- * @wmi_handle: wmi handle
- * @vdev_id: vdev id
- * @enable: Flag to enable/disable packet filter
- *
- * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
- */
-QDF_STATUS wmi_unified_enable_disable_packet_filter_cmd(void *wmi_hdl,
-					uint8_t vdev_id, bool enable)
-{
-	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
-
-	if (wmi_handle->ops->send_enable_disable_packet_filter_cmd)
-		return wmi_handle->ops->send_enable_disable_packet_filter_cmd(
-				wmi_handle, vdev_id, enable);
-
-	return QDF_STATUS_E_FAILURE;
-}
-
-/**
- * wmi_unified_config_packet_filter_cmd() - configure packet filter in target
- * @wmi_handle: wmi handle
- * @vdev_id: vdev id
- * @rcv_filter_param: Packet filter parameters
- * @filter_id: Filter id
- * @enable: Flag to add/delete packet filter configuration
- *
- * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
- */
-QDF_STATUS wmi_unified_config_packet_filter_cmd(void *wmi_hdl,
-		uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param,
-		uint8_t filter_id, bool enable)
-{
-	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
-
-	if (wmi_handle->ops->send_config_packet_filter_cmd)
-		return wmi_handle->ops->send_config_packet_filter_cmd(wmi_handle,
-			    vdev_id, rcv_filter_param,
-				filter_id, enable);
-
-	return QDF_STATUS_E_FAILURE;
-}
-
 /**
  * wmi_unified_process_add_periodic_tx_ptrn_cmd - add periodic tx ptrn
  * @wmi_handle: wmi handle

+ 25 - 0
wmi/src/wmi_unified_pmo_api.c

@@ -155,6 +155,31 @@ QDF_STATUS wmi_unified_send_gtk_offload_cmd(void *wmi_hdl, uint8_t vdev_id,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_unified_enable_disable_packet_filter_cmd(void *wmi_hdl,
+		uint8_t vdev_id, bool enable)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_enable_disable_packet_filter_cmd)
+		return wmi_handle->ops->send_enable_disable_packet_filter_cmd(
+		wmi_handle, vdev_id, enable);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wmi_unified_config_packet_filter_cmd(void *wmi_hdl,
+		uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
+		uint8_t filter_id, bool enable)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_config_packet_filter_cmd)
+		return wmi_handle->ops->send_config_packet_filter_cmd(
+		wmi_handle, vdev_id, rcv_filter_param, filter_id, enable);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(void *wmi_hdl,
 			   struct pmo_arp_offload_params *arp_offload_req,
 			   struct pmo_ns_offload_params *ns_offload_req,

+ 132 - 133
wmi/src/wmi_unified_tlv.c

@@ -8379,136 +8379,6 @@ static QDF_STATUS send_add_ts_cmd_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter in target
- * @wmi_handle: wmi handle
- * @vdev_id: vdev id
- * @enable: Flag to enable/disable packet filter
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv(wmi_unified_t wmi_handle,
-					uint8_t vdev_id, bool enable)
-{
-	int32_t len;
-	int ret = 0;
-	wmi_buf_t buf;
-	WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd;
-
-	len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param);
-
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMI_LOGE("%s: Failed allocate wmi buffer", __func__);
-		return QDF_STATUS_E_NOMEM;
-	}
-
-	cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param,
-		WMITLV_GET_STRUCT_TLVLEN(
-		WMI_PACKET_FILTER_ENABLE_CMD_fixed_param));
-
-	cmd->vdev_id = vdev_id;
-	if (enable)
-		cmd->enable = PACKET_FILTER_SET_ENABLE;
-	else
-		cmd->enable = PACKET_FILTER_SET_DISABLE;
-
-	WMI_LOGE("%s: Packet filter enable %d for vdev_id %d",
-		__func__, cmd->enable, vdev_id);
-
-	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
-			 WMI_PACKET_FILTER_ENABLE_CMDID);
-	if (ret) {
-		WMI_LOGE("Failed to send packet filter wmi cmd to fw");
-		wmi_buf_free(buf);
-	}
-
-	return ret;
-}
-
-/**
- * send_config_packet_filter_cmd_tlv() - configure packet filter in target
- * @wmi_handle: wmi handle
- * @vdev_id: vdev id
- * @rcv_filter_param: Packet filter parameters
- * @filter_id: Filter id
- * @enable: Flag to add/delete packet filter configuration
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle,
-		uint8_t vdev_id, struct rcv_pkt_filter_config *rcv_filter_param,
-		uint8_t filter_id, bool enable)
-{
-	int len, i;
-	int err = 0;
-	wmi_buf_t buf;
-	WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd;
-
-
-	/* allocate the memory */
-	len = sizeof(*cmd);
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMI_LOGE("Failed to allocate buffer to send set_param cmd");
-		return QDF_STATUS_E_NOMEM;
-	}
-
-	cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param,
-		WMITLV_GET_STRUCT_TLVLEN
-			       (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param));
-
-	cmd->vdev_id = vdev_id;
-	cmd->filter_id = filter_id;
-	if (enable)
-		cmd->filter_action = PACKET_FILTER_SET_ACTIVE;
-	else
-		cmd->filter_action = PACKET_FILTER_SET_INACTIVE;
-
-	if (enable) {
-		cmd->num_params = QDF_MIN(
-			WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER,
-			rcv_filter_param->numFieldParams);
-		cmd->filter_type = rcv_filter_param->filterType;
-		cmd->coalesce_time = rcv_filter_param->coalesceTime;
-
-		for (i = 0; i < cmd->num_params; i++) {
-			cmd->paramsData[i].proto_type =
-				rcv_filter_param->paramsData[i].protocolLayer;
-			cmd->paramsData[i].cmp_type =
-				rcv_filter_param->paramsData[i].cmpFlag;
-			cmd->paramsData[i].data_length =
-				rcv_filter_param->paramsData[i].dataLength;
-			cmd->paramsData[i].data_offset =
-				rcv_filter_param->paramsData[i].dataOffset;
-			memcpy(&cmd->paramsData[i].compareData,
-				rcv_filter_param->paramsData[i].compareData,
-				sizeof(cmd->paramsData[i].compareData));
-			memcpy(&cmd->paramsData[i].dataMask,
-				rcv_filter_param->paramsData[i].dataMask,
-				sizeof(cmd->paramsData[i].dataMask));
-		}
-	}
-
-	WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d",
-		cmd->filter_action, cmd->filter_id, cmd->num_params);
-	/* send the command along with data */
-	err = wmi_unified_cmd_send(wmi_handle, buf, len,
-				WMI_PACKET_FILTER_CONFIG_CMDID);
-	if (err) {
-		WMI_LOGE("Failed to send pkt_filter cmd");
-		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-
-	return 0;
-}
-
 /**
  * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn
  * @wmi_handle: wmi handle
@@ -13647,6 +13517,135 @@ static QDF_STATUS send_enable_broadcast_filter_cmd_tlv(wmi_unified_t wmi_handle,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ * @enable: Flag to enable/disable packet filter
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv(
+		wmi_unified_t wmi_handle, uint8_t vdev_id, bool enable)
+{
+	int32_t len;
+	int ret = 0;
+	wmi_buf_t buf;
+	WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd;
+
+	len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: Failed allocate wmi buffer", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+		WMI_PACKET_FILTER_ENABLE_CMD_fixed_param));
+
+	cmd->vdev_id = vdev_id;
+	if (enable)
+		cmd->enable = PACKET_FILTER_SET_ENABLE;
+	else
+		cmd->enable = PACKET_FILTER_SET_DISABLE;
+
+	WMI_LOGE("%s: Packet filter enable %d for vdev_id %d",
+		__func__, cmd->enable, vdev_id);
+
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+			 WMI_PACKET_FILTER_ENABLE_CMDID);
+	if (ret) {
+		WMI_LOGE("Failed to send packet filter wmi cmd to fw");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_config_packet_filter_cmd_tlv() - configure packet filter in target
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ * @rcv_filter_param: Packet filter parameters
+ * @filter_id: Filter id
+ * @enable: Flag to add/delete packet filter configuration
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle,
+		uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
+		uint8_t filter_id, bool enable)
+{
+	int len, i;
+	int err = 0;
+	wmi_buf_t buf;
+	WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd;
+
+
+	/* allocate the memory */
+	len = sizeof(*cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("Failed to allocate buffer to send set_param cmd");
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN
+			       (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param));
+
+	cmd->vdev_id = vdev_id;
+	cmd->filter_id = filter_id;
+	if (enable)
+		cmd->filter_action = PACKET_FILTER_SET_ACTIVE;
+	else
+		cmd->filter_action = PACKET_FILTER_SET_INACTIVE;
+
+	if (enable) {
+		cmd->num_params = QDF_MIN(
+			WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER,
+			rcv_filter_param->num_params);
+		cmd->filter_type = rcv_filter_param->filter_type;
+		cmd->coalesce_time = rcv_filter_param->coalesce_time;
+
+		for (i = 0; i < cmd->num_params; i++) {
+			cmd->paramsData[i].proto_type =
+				rcv_filter_param->params_data[i].protocol_layer;
+			cmd->paramsData[i].cmp_type =
+				rcv_filter_param->params_data[i].compare_flag;
+			cmd->paramsData[i].data_length =
+				rcv_filter_param->params_data[i].data_length;
+			cmd->paramsData[i].data_offset =
+				rcv_filter_param->params_data[i].data_offset;
+			memcpy(&cmd->paramsData[i].compareData,
+				rcv_filter_param->params_data[i].compare_data,
+				sizeof(cmd->paramsData[i].compareData));
+			memcpy(&cmd->paramsData[i].dataMask,
+				rcv_filter_param->params_data[i].data_mask,
+				sizeof(cmd->paramsData[i].dataMask));
+		}
+	}
+
+	WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d",
+		cmd->filter_action, cmd->filter_id, cmd->num_params);
+	/* send the command along with data */
+	err = wmi_unified_cmd_send(wmi_handle, buf, len,
+				WMI_PACKET_FILTER_CONFIG_CMDID);
+	if (err) {
+		WMI_LOGE("Failed to send pkt_filter cmd");
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
 #endif /* End of WLAN_PMO_ENABLE */
 
 /**
@@ -17721,6 +17720,9 @@ struct wmi_ops tlv_ops =  {
 	.send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv,
 	.send_lphb_config_udp_pkt_filter_cmd =
 		send_lphb_config_udp_pkt_filter_cmd_tlv,
+	.send_enable_disable_packet_filter_cmd =
+		send_enable_disable_packet_filter_cmd_tlv,
+	.send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv,
 #endif /* End of WLAN_PMO_ENABLE */
 #ifdef CONFIG_MCL
 	.send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv,
@@ -17746,9 +17748,6 @@ struct wmi_ops tlv_ops =  {
 	.send_del_ts_cmd = send_del_ts_cmd_tlv,
 	.send_aggr_qos_cmd = send_aggr_qos_cmd_tlv,
 	.send_add_ts_cmd = send_add_ts_cmd_tlv,
-	.send_enable_disable_packet_filter_cmd =
-		send_enable_disable_packet_filter_cmd_tlv,
-	.send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv,
 	.send_process_add_periodic_tx_ptrn_cmd =
 		send_process_add_periodic_tx_ptrn_cmd_tlv,
 	.send_process_del_periodic_tx_ptrn_cmd =