Browse Source

qcacmn: Expose full hardware filter capabilities via WMI

The WMI API exposes the broadcast hardware filter. Modify the WMI API
to expose all of the supported modes of the hardware filter.

Change-Id: I185b149f4d1ad38692d8ff5810acd52bf84565b2
CRs-Fixed: 2040419
Dustin Brown 8 years ago
parent
commit
3c777ef4d2

+ 0 - 75
pmo/core/inc/wlan_pmo_hw_bcast_fltr.h

@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2017 The Linux Foundation. All rights reserved.
-*
-* Permission to use, copy, modify, and/or distribute this software for
-* any purpose with or without fee is hereby granted, provided that the
-* above copyright notice and this permission notice appear in all
-* copies.
-*
-* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-*/
-/**
- * DOC: Declare arp offload feature API's
- */
-
-#ifndef _WLAN_PMO_NON_ARP_HW_BCAST_FILTER_H_
-#define _WLAN_PMO_NON_ARP_HW_BCAST_FILTER_H_
-
-#include "wlan_pmo_non_arp_hwbcast_public_struct.h"
-
-/**
- * pmo_core_do_enable_non_arp_bcast_filter() - API to enable
- * hw broadcast filter
- * @vdev: objmgr vdev
- *
- *  API to enable hw broadcast filter in fwr from vdev priv ctx
- *
- * Return: QDF_STATUS_SUCCESS in case of success else return error
- */
-QDF_STATUS pmo_core_do_enable_non_arp_bcast_filter(
-			struct wlan_objmgr_vdev *vdev, uint8_t vdev_id);
-
-/**
- * pmo_core_do_disable_non_arp_bcast_filter() - API to enable
- * hw broadcast filter
- * @vdev: objmgr vdev
- *
- *  API to enable hw broadcast filter in fwr from vdev priv ctx
- *
- * Return: QDF_STATUS_SUCCESS in case of success else return error
- */
-QDF_STATUS pmo_core_do_disable_non_arp_bcast_filter(
-			struct wlan_objmgr_vdev *vdev, uint8_t vdev_id);
-
-/**
- * pmo_core_enable_non_arp_bcast_filter_in_fwr() - API to enable
- * hw broadcast filter
- * @vdev: objmgr vdev
- *
- *  API to enable hw broadcast filter in fwr from vdev priv ctx
- *
- * Return: QDF_STATUS_SUCCESS in case of success else return error
- */
-QDF_STATUS pmo_core_enable_non_arp_bcast_filter_in_fwr(
-				struct wlan_objmgr_vdev *vdev);
-
-/**
- * pmo_core_disable_non_arp_bcast_filter_in_fwr() - API to disable
- * hw broadcast filter
- * @vdev: objmgr vdev
- *
- *  API to disable hw broadcast filter in fwr from vdev priv ctx
- *
- * Return: QQDF_STATUS_SUCCESS in case of success else return error
- */
-QDF_STATUS pmo_core_disable_non_arp_bcast_filter_in_fwr(
-				struct wlan_objmgr_vdev *vdev);
-
-#endif /* end  of _WLAN_PMO_NON_ARP_HW_BCAST_FILTER_H_*/

+ 46 - 0
pmo/core/inc/wlan_pmo_hw_filter.h

@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: Declare hardware filter offload feature APIs
+ */
+
+#ifndef _WLAN_PMO_HW_FILTER_H_
+#define _WLAN_PMO_HW_FILTER_H_
+
+#include "qdf_status.h"
+#include "wlan_objmgr_vdev_obj.h"
+#include "wlan_pmo_hw_filter_public_struct.h"
+
+/**
+ * pmo_core_enable_hw_filter_in_fwr() - enable previously configured hw filter
+ * @vdev: objmgr vdev to configure
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS pmo_core_enable_hw_filter_in_fwr(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * pmo_core_disable_hw_filter_in_fwr() - disable previously configured hw filter
+ * @vdev: objmgr vdev to configure
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS pmo_core_disable_hw_filter_in_fwr(struct wlan_objmgr_vdev *vdev);
+
+#endif /* _WLAN_PMO_HW_FILTER_H_*/

+ 0 - 143
pmo/core/src/wlan_pmo_hw_bcast_fltr.c

@@ -1,143 +0,0 @@
-/*
-* Copyright (c) 2017 The Linux Foundation. All rights reserved.
-*
-* Permission to use, copy, modify, and/or distribute this software for
-* any purpose with or without fee is hereby granted, provided that the
-* above copyright notice and this permission notice appear in all
-* copies.
-*
-* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-*/
-/**
- * DOC: Implements arp offload feature API's
- */
-
-#include "wlan_pmo_hw_bcast_fltr.h"
-#include "wlan_pmo_tgt_api.h"
-#include "wlan_pmo_main.h"
-#include "wlan_pmo_obj_mgmt_public_struct.h"
-
-static QDF_STATUS pmo_core_non_arp_bcast_filter_sanity(
-			struct wlan_objmgr_vdev *vdev)
-{
-	struct pmo_vdev_priv_obj *vdev_ctx;
-
-	if (!vdev) {
-		pmo_err("vdev is NULL");
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	vdev_ctx = pmo_vdev_get_priv(vdev);
-	if (!vdev_ctx->pmo_psoc_ctx->psoc_cfg.hw_bcast_filter) {
-		pmo_err("user disabled hw broadcast filter using ini");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (!pmo_core_is_vdev_connected(vdev))
-		return QDF_STATUS_E_INVAL;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-QDF_STATUS pmo_core_do_enable_non_arp_bcast_filter(
-		struct wlan_objmgr_vdev *vdev, uint8_t vdev_id)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	PMO_ENTER();
-
-	status = pmo_tgt_enable_non_arp_bcast_filter_req(vdev, vdev_id);
-
-	PMO_EXIT();
-
-	return status;
-}
-
-QDF_STATUS pmo_core_do_disable_non_arp_bcast_filter(
-			struct wlan_objmgr_vdev *vdev, uint8_t vdev_id)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	PMO_ENTER();
-
-	status = pmo_tgt_enable_non_arp_bcast_filter_req(vdev, vdev_id);
-
-	PMO_EXIT();
-
-	return status;
-}
-
-QDF_STATUS pmo_core_enable_non_arp_bcast_filter_in_fwr(
-				struct wlan_objmgr_vdev *vdev)
-{
-	QDF_STATUS status;
-	uint8_t vdev_id;
-
-	PMO_ENTER();
-	if (!vdev) {
-		pmo_err("vdev is NULL");
-		status = QDF_STATUS_E_NULL_VALUE;
-		goto out;
-	}
-
-	status = pmo_vdev_get_ref(vdev);
-	if (status != QDF_STATUS_SUCCESS)
-		goto out;
-
-	status = pmo_core_non_arp_bcast_filter_sanity(vdev);
-	if (status != QDF_STATUS_SUCCESS)
-		goto def_ref;
-
-	vdev_id = pmo_vdev_get_id(vdev);
-	pmo_info("Enable non arp hw bcast filter in fwr vdev id: %d vdev: %p",
-		vdev_id, vdev);
-
-	status = pmo_core_do_enable_non_arp_bcast_filter(vdev, vdev_id);
-def_ref:
-	pmo_vdev_put_ref(vdev);
-out:
-	PMO_EXIT();
-
-	return status;
-}
-
-QDF_STATUS pmo_core_disable_non_arp_bcast_filter_in_fwr(
-				struct wlan_objmgr_vdev *vdev)
-{
-	QDF_STATUS status;
-	uint8_t vdev_id;
-
-	PMO_ENTER();
-	if (!vdev) {
-		pmo_err("vdev is NULL");
-		status = QDF_STATUS_E_NULL_VALUE;
-		goto out;
-	}
-
-	status = pmo_vdev_get_ref(vdev);
-	if (status != QDF_STATUS_SUCCESS)
-		goto out;
-
-	status = pmo_core_non_arp_bcast_filter_sanity(vdev);
-	if (status != QDF_STATUS_SUCCESS)
-		goto def_ref;
-
-	vdev_id = pmo_vdev_get_id(vdev);
-	pmo_info("Disable non arp hw bcast filter in fwr vdev id: %d vdev: %p",
-		vdev_id, vdev);
-
-	status = pmo_core_do_disable_non_arp_bcast_filter(vdev, vdev_id);
-def_ref:
-	pmo_vdev_put_ref(vdev);
-out:
-	PMO_EXIT();
-
-	return status;
-}

+ 96 - 0
pmo/core/src/wlan_pmo_hw_filter.c

@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: Implements arp offload feature API's
+ */
+
+#include "qdf_lock.h"
+#include "wlan_pmo_hw_filter.h"
+#include "wlan_pmo_tgt_api.h"
+#include "wlan_pmo_main.h"
+#include "wlan_pmo_obj_mgmt_public_struct.h"
+
+static QDF_STATUS pmo_core_conf_hw_filter(struct wlan_objmgr_vdev *vdev,
+					  enum pmo_hw_filter_mode mode)
+{
+	QDF_STATUS status;
+	struct pmo_hw_filter_params req = { .mode = mode, };
+
+	PMO_ENTER();
+
+	if (!pmo_core_is_vdev_connected(vdev)) {
+		status = QDF_STATUS_E_NOSUPPORT;
+		goto exit_with_status;
+	}
+
+	req.vdev_id = pmo_vdev_get_id(vdev);
+	status = pmo_tgt_conf_hw_filter(pmo_vdev_get_psoc(vdev), &req);
+
+exit_with_status:
+	PMO_EXIT();
+
+	return status;
+}
+
+QDF_STATUS pmo_core_enable_hw_filter_in_fwr(struct wlan_objmgr_vdev *vdev)
+{
+	QDF_STATUS status;
+	struct pmo_psoc_priv_obj *psoc_priv;
+	enum pmo_hw_filter_mode mode;
+
+	PMO_ENTER();
+
+	status = pmo_vdev_get_ref(vdev);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto exit_with_status;
+
+	psoc_priv = pmo_vdev_get_psoc_priv(vdev);
+	qdf_spin_lock_bh(&psoc_priv->lock);
+	mode = psoc_priv->psoc_cfg.hw_filter_mode;
+	qdf_spin_unlock_bh(&psoc_priv->lock);
+
+	status = pmo_core_conf_hw_filter(vdev, mode);
+
+	pmo_vdev_put_ref(vdev);
+
+exit_with_status:
+	PMO_EXIT();
+
+	return status;
+}
+
+QDF_STATUS pmo_core_disable_hw_filter_in_fwr(struct wlan_objmgr_vdev *vdev)
+{
+	QDF_STATUS status;
+
+	PMO_ENTER();
+
+	status = pmo_vdev_get_ref(vdev);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto exit_with_status;
+
+	status = pmo_core_conf_hw_filter(vdev, PMO_HW_FILTER_DISABLED);
+
+	pmo_vdev_put_ref(vdev);
+
+exit_with_status:
+	PMO_EXIT();
+
+	return status;
+}

+ 3 - 10
pmo/core/src/wlan_pmo_main.c

@@ -63,23 +63,16 @@ struct wlan_pmo_ctx *pmo_get_context(void)
 	return gp_pmo_ctx;
 }
 
-bool pmo_is_vdev_in_beaconning_mode(
-		enum tQDF_ADAPTER_MODE vdev_opmode)
+bool pmo_is_vdev_in_beaconning_mode(enum tQDF_ADAPTER_MODE vdev_opmode)
 {
-	bool val;
-
 	switch (vdev_opmode) {
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
 	case QDF_IBSS_MODE:
-		val = true;
-		break;
+		return true;
 	default:
-		val = false;
-		break;
+		return false;
 	}
-
-	return val;
 }
 
 QDF_STATUS pmo_get_vdev_bss_peer_mac_addr(struct wlan_objmgr_vdev *vdev,

+ 2 - 2
pmo/dispatcher/inc/wlan_pmo_common_public_struct.h

@@ -243,7 +243,7 @@ enum pmo_offload_trigger {
  * @ptrn_match_enable_all_vdev: true when pattern match is enable for all vdev
  * @bpf_enable: true if psoc supports bpf else false
  * @arp_offload_enable: true if arp offload is supported for psoc else false
- * @hw_bcast_filter: true if supports hw bcast filter in ine else flase
+ * @hw_filter_mode: which mode the hardware filter should use during DTIM
  * @ns_offload_enable_static: true if psoc supports ns offload in ini else false
  * @ns_offload_enable_dynamic: to enable / disable the ns offload using
  *    ioctl or vendor command.
@@ -269,7 +269,7 @@ struct pmo_psoc_cfg {
 	bool ptrn_match_enable_all_vdev;
 	bool bpf_enable;
 	bool arp_offload_enable;
-	bool hw_bcast_filter;
+	enum pmo_hw_filter_mode hw_filter_mode;
 	bool ns_offload_enable_static;
 	bool ns_offload_enable_dynamic;
 	bool ssdp;

+ 54 - 0
pmo/dispatcher/inc/wlan_pmo_hw_filter_public_struct.h

@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: This file shall contain all public parameter (struct/macro/enum)
+ * definitions to support hardware filtering configuration. No APIs, or
+ * implememtations of APIs, shall be contained within.
+ */
+
+#ifndef _WLAN_PMO_HW_FILTER_PUBLIC_STRUCT_H
+#define _WLAN_PMO_HW_FILTER_PUBLIC_STRUCT_H
+
+/**
+ * pmo_hw_filter_mode - bitmap for enabled hardware filters
+ * @HW_FILTER_DISABLED: hardware filter is completely disabled
+ * @HW_FILTER_NON_ARP_BC: drop all broadcast frames, except ARP
+ * @HW_FILTER_NON_ICMPV6_MC: drop all multicast frames, except ICMPv6
+ *
+ * The hardware filter is only effective in DTIM mode. Use this configuration
+ * to blanket drop broadcast/multicast packets at the hardware level, without
+ * waking up the firmware.
+ */
+enum pmo_hw_filter_mode {
+	PMO_HW_FILTER_DISABLED = 0,
+	PMO_HW_FILTER_NON_ARP_BC = 1,
+	PMO_HW_FILTER_NON_ICMPV6_MC = 2,
+};
+
+/**
+ * struct pmo_hw_filter_params - hardware filter configuration parameters
+ * @vdev_id: Id of the virtual device to configure
+ * @mode: the hardware filter mode to configure
+ */
+struct pmo_hw_filter_params {
+	uint8_t vdev_id;
+	enum pmo_hw_filter_mode mode;
+};
+
+#endif /* _WLAN_PMO_HW_FILTER_PUBLIC_STRUCT_H */

+ 0 - 52
pmo/dispatcher/inc/wlan_pmo_non_arp_hwbcast_public_struct.h

@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2017 The Linux Foundation. All rights reserved.
-*
-* Permission to use, copy, modify, and/or distribute this software for
-* any purpose with or without fee is hereby granted, provided that the
-* above copyright notice and this permission notice appear in all
-* copies.
-*
-* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-*/
- /**
-  * DOC: Declare various struct, macros which shall be used in
-  * pmo arp offload feature.
-  *
-  * Note: This file shall not contain public API's prototype/declarations.
-  *
-  */
-
-#ifndef _WLAN_PMO_NON_ARP_HW_BCAST_FILTER_PUBLIC_STRUCT_H_
-#define _WLAN_PMO_NON_ARP_HW_BCAST_FILTER_PUBLIC_STRUCT_H_
-
-#include "wlan_pmo_common_public_struct.h"
-
-/**
- * struct pmo_bcast_filter_req - pmo arp request
- * @psoc: objmgr psoc
- * @vdev_id: vdev id on which arp offload needed
- */
-struct pmo_bcast_filter_req {
-	struct wlan_objmgr_psoc *psoc;
-	uint8_t vdev_id;
-};
-
-/**
- * struct pmo_bcast_filter_params - For enable/disable pmo HW Broadcast Filter
- * @enable: value to enable disable feature
- * @bss_id: bss_id for get session.
- */
-struct pmo_bcast_filter_params {
-	bool enable;
-	struct qdf_mac_addr bssid;
-};
-
-#endif /* end  of _WLAN_PMO_NON_ARP_HW_BCAST_FILTER_PUBLIC_STRUCT_H_ */
-

+ 6 - 18
pmo/dispatcher/inc/wlan_pmo_tgt_api.h

@@ -27,26 +27,14 @@
 #define GET_PMO_TX_OPS_FROM_PSOC(psoc) (psoc->soc_cb.tx_ops.pmo_tx_ops)
 
 /**
- * pmo_tgt_enable_non_arp_bcast_filter_req() - Enable non arp
- * hw bcast filter to target
- * @vdev: objmgr vdev
- * @vdev_id: vdev id
+ * pmo_tgt_conf_hw_filter() - configure hardware filter mode in firmware
+ * @psoc: the psoc to use to communicate with firmware
+ * @req: the configuration request
  *
- * Return: QDF status
- */
-QDF_STATUS pmo_tgt_enable_non_arp_bcast_filter_req(
-		struct wlan_objmgr_vdev *vdev, uint8_t vdev_id);
-
-/**
- * pmo_tgt_disable_non_arp_bcast_filter_req() - Disable non arp
- * hw bcast filter to target
- * @vdev: objmgr vdev
- * @vdev_id: vdev id
- *
- * Return: QDF status
+ * Return: QDF_STATUS
  */
-QDF_STATUS pmo_tgt_disable_non_arp_bcast_filter_req(
-		struct wlan_objmgr_vdev *vdev, uint8_t vdev_id);
+QDF_STATUS pmo_tgt_conf_hw_filter(struct wlan_objmgr_psoc *psoc,
+				  struct pmo_hw_filter_params *req);
 
 /**
  * pmo_tgt_set_pkt_filter() - Set packet filter

+ 17 - 16
pmo/dispatcher/inc/wlan_pmo_ucfg_api.h

@@ -30,6 +30,7 @@
 #include "wlan_pmo_common_public_struct.h"
 #include "wlan_pmo_obj_mgmt_api.h"
 #include "wlan_pmo_pkt_filter_public_struct.h"
+#include "wlan_pmo_hw_filter.h"
 
 /**
  * pmo_ucfg_is_ap_mode_supports_arp_ns() - Check ap mode support arp&ns offload
@@ -183,28 +184,28 @@ QDF_STATUS pmo_ucfg_disable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 		enum pmo_offload_trigger trigger);
 
 /**
- * pmo_ucfg_enable_non_arp_bcast_filter_in_fwr(): API to enable
- * hw broadcast filter in fwr
- * @vdev: objmgr vdev param
- *
- *  API to enable hw broadcast filter from pmo vdev priv ctx
+ * pmo_ucfg_enable_hw_filter_in_fwr() - enable previously configured hw filter
+ * @vdev: objmgr vdev to configure
  *
- * Return QDF_STATUS -in case of success else return error
+ * Return: QDF_STATUS
  */
-QDF_STATUS pmo_ucfg_enable_non_arp_bcast_filter_in_fwr(
-		struct wlan_objmgr_vdev *vdev);
+static inline QDF_STATUS
+pmo_ucfg_enable_hw_filter_in_fwr(struct wlan_objmgr_vdev *vdev)
+{
+	return pmo_core_enable_hw_filter_in_fwr(vdev);
+}
 
 /**
- * pmo_ucfg_disable_non_arp_bcast_filter_in_fwr(): API to disable
- * hw broadcast filter in fwr
- * @vdev: objmgr vdev param
- *
- *  API to disable hw broadcast filter from pmo vdev priv ctx
+ * pmo_ucfg_disable_hw_filter_in_fwr() - disable previously configured hw filter
+ * @vdev: objmgr vdev to configure
  *
- * Return QDF_STATUS -in case of success else return error
+ * Return: QDF_STATUS
  */
-QDF_STATUS pmo_ucfg_disable_non_arp_bcast_filter_in_fwr(
-		struct wlan_objmgr_vdev *vdev);
+static inline QDF_STATUS
+pmo_ucfg_disable_hw_filter_in_fwr(struct wlan_objmgr_vdev *vdev)
+{
+	return pmo_core_disable_hw_filter_in_fwr(vdev);
+}
 
 /**
  * pmo_ucfg_max_mc_addr_supported() -  to get max support mc address

+ 52 - 0
pmo/dispatcher/src/wlan_pmo_tgt_hw_filter.c

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: Implements public API for pmo to interact with target/WMI
+ */
+
+#include "wlan_pmo_tgt_api.h"
+#include "wlan_pmo_hw_filter_public_struct.h"
+#include "wlan_pmo_obj_mgmt_public_struct.h"
+
+QDF_STATUS pmo_tgt_conf_hw_filter(struct wlan_objmgr_psoc *psoc,
+				  struct pmo_hw_filter_params *req)
+{
+	QDF_STATUS status;
+	struct wlan_lmac_if_pmo_tx_ops ops;
+
+	PMO_ENTER();
+
+	pmo_debug("Configure hw filter; vdev_id:%u, mode:%d",
+		  req->vdev_id, req->mode);
+
+	ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
+	if (!ops.send_conf_hw_filter_req) {
+		pmo_err("send_conf_hw_filter_req is null");
+		status = QDF_STATUS_E_NULL_VALUE;
+		goto exit_with_status;
+	}
+
+	status = ops.send_conf_hw_filter_req(psoc, req);
+
+exit_with_status:
+	PMO_EXIT();
+
+	return status;
+}
+

+ 0 - 142
pmo/dispatcher/src/wlan_pmo_tgt_non_arp_bcast_fltr.c

@@ -1,142 +0,0 @@
-/*
-* Copyright (c) 2017 The Linux Foundation. All rights reserved.
-*
-* Permission to use, copy, modify, and/or distribute this software for
-* any purpose with or without fee is hereby granted, provided that the
-* above copyright notice and this permission notice appear in all
-* copies.
-*
-* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-*/
-/**
- * DOC: Implements public API for pmo to interact with target/WMI
- */
-
-#include "wlan_pmo_tgt_api.h"
-#include "wlan_pmo_non_arp_hwbcast_public_struct.h"
-#include "wlan_pmo_obj_mgmt_public_struct.h"
-
-QDF_STATUS pmo_tgt_enable_non_arp_bcast_filter_req(
-		struct wlan_objmgr_vdev *vdev,
-		uint8_t vdev_id)
-{
-	struct pmo_bcast_filter_params *bcast_req = NULL;
-	struct pmo_vdev_priv_obj *vdev_ctx;
-	struct wlan_objmgr_psoc *psoc;
-	QDF_STATUS status;
-	struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
-	struct qdf_mac_addr peer_bssid;
-
-	PMO_ENTER();
-
-	vdev_ctx = pmo_vdev_get_priv(vdev);
-
-	psoc = pmo_vdev_get_psoc(vdev);
-
-	bcast_req = qdf_mem_malloc(sizeof(*bcast_req));
-	if (!bcast_req) {
-		pmo_err("unable to allocate arp_offload_req");
-		status = QDF_STATUS_E_NOMEM;
-		goto out;
-	}
-
-	status = pmo_get_vdev_bss_peer_mac_addr(vdev,
-			&peer_bssid);
-	if (status != QDF_STATUS_SUCCESS)
-		goto out;
-
-	qdf_mem_copy(&bcast_req->bssid.bytes, &peer_bssid.bytes,
-			QDF_MAC_ADDR_SIZE);
-	pmo_info("vdev self mac addr: %pM bss peer mac addr: %pM",
-		wlan_vdev_mlme_get_macaddr(vdev),
-		peer_bssid.bytes);
-
-	bcast_req->enable = true;
-
-	pmo_debug("Non ARP Broadcast filter vdev_id: %d enable: %d",
-		vdev_id,
-		bcast_req->enable);
-
-	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
-	if (!pmo_tx_ops.send_non_arp_bcast_filter_req) {
-		pmo_err("send_non_arp_bcast_filter_req is null");
-		status = QDF_STATUS_E_NULL_VALUE;
-		goto out;
-	}
-
-	status = pmo_tx_ops.send_non_arp_bcast_filter_req(
-			vdev, bcast_req);
-
-out:
-	if (bcast_req)
-		qdf_mem_free(bcast_req);
-	PMO_EXIT();
-
-	return status;
-}
-
-QDF_STATUS pmo_tgt_disable_non_arp_bcast_filter_req(
-		struct wlan_objmgr_vdev *vdev,
-		uint8_t vdev_id)
-{
-	struct pmo_bcast_filter_params *bcast_req = NULL;
-	struct pmo_vdev_priv_obj *vdev_ctx;
-	struct wlan_objmgr_psoc *psoc;
-	QDF_STATUS status;
-	struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
-	struct qdf_mac_addr peer_bssid;
-
-	PMO_ENTER();
-
-	vdev_ctx = pmo_vdev_get_priv(vdev);
-
-	psoc = pmo_vdev_get_psoc(vdev);
-
-	bcast_req = qdf_mem_malloc(sizeof(*bcast_req));
-	if (!bcast_req) {
-		pmo_err("unable to allocate arp_offload_req");
-		status = QDF_STATUS_E_NOMEM;
-		goto out;
-	}
-
-	status = pmo_get_vdev_bss_peer_mac_addr(vdev,
-			&peer_bssid);
-	if (status != QDF_STATUS_SUCCESS)
-		goto out;
-
-	qdf_mem_copy(&bcast_req->bssid.bytes, &peer_bssid.bytes,
-			QDF_MAC_ADDR_SIZE);
-	pmo_info("vdev self mac addr: %pM bss peer mac addr: %pM",
-		wlan_vdev_mlme_get_macaddr(vdev),
-		peer_bssid.bytes);
-
-	bcast_req->enable = false;
-
-	pmo_debug("Non ARP Broadcast filter vdev_id: %d enable: %d",
-		vdev_id,
-		bcast_req->enable);
-
-	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
-	if (!pmo_tx_ops.send_non_arp_bcast_filter_req) {
-		pmo_err("send_non_arp_bcast_filter_req is null");
-		status = QDF_STATUS_E_NULL_VALUE;
-		goto out;
-	}
-
-	status = pmo_tx_ops.send_non_arp_bcast_filter_req(
-			vdev, bcast_req);
-
-out:
-	if (bcast_req)
-		qdf_mem_free(bcast_req);
-	PMO_EXIT();
-
-	return status;
-}

+ 0 - 13
pmo/dispatcher/src/wlan_pmo_ucfg_api.c

@@ -21,7 +21,6 @@
 
 #include "wlan_pmo_ucfg_api.h"
 #include "wlan_pmo_arp.h"
-#include "wlan_pmo_hw_bcast_fltr.h"
 #include "wlan_pmo_ns.h"
 #include "wlan_pmo_gtk.h"
 #include "wlan_pmo_wow.h"
@@ -93,18 +92,6 @@ QDF_STATUS pmo_ucfg_disable_arp_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 	return pmo_core_disable_arp_offload_in_fwr(vdev, trigger);
 }
 
-QDF_STATUS pmo_ucfg_enable_non_arp_bcast_filter_in_fwr(
-		struct wlan_objmgr_vdev *vdev)
-{
-	return pmo_core_enable_non_arp_bcast_filter_in_fwr(vdev);
-}
-
-QDF_STATUS pmo_ucfg_disable_non_arp_bcast_filter_in_fwr(
-		struct wlan_objmgr_vdev *vdev)
-{
-	return pmo_core_disable_non_arp_bcast_filter_in_fwr(vdev);
-}
-
 QDF_STATUS pmo_ucfg_cache_ns_offload_req(struct pmo_ns_req *ns_req)
 {
 	return pmo_core_cache_ns_offload_req(ns_req);

+ 6 - 9
target_if/pmo/inc/target_if_pmo.h

@@ -125,17 +125,14 @@ QDF_STATUS target_if_pmo_send_action_frame_patterns(
 		struct pmo_action_wakeup_set_params *ip_cmd);
 
 /**
- * target_if_pmo_send_non_arp_bcast_filter_req() -  Enable/Disable Broadcast
- * @vdev: objmgr vdev
- * @bcast_req: enable/disable hw bcast filter
- *
- * This functions enable/disable non arp hw bcast filter.
+ * target_if_pmo_conf_hw_filter() - configure hardware filter in DTIM mode
+ * @psoc: the psoc containing the vdev to configure
+ * @req: the request parameters
  *
- * Return: QDF_STATUS_SUCCESS for success or error code
+ * Return: QDF_STATUS
  */
-QDF_STATUS target_if_pmo_send_non_arp_bcast_filter_req(
-		struct wlan_objmgr_vdev *vdev,
-		struct pmo_bcast_filter_params *bcast_req);
+QDF_STATUS target_if_pmo_conf_hw_filter(struct wlan_objmgr_psoc *psoc,
+					struct pmo_hw_filter_params *req);
 
 /**
  * target_if_pmo_send_pkt_filter_req() - enable packet filter

+ 9 - 22
target_if/pmo/src/target_if_pmo_non_arp_bcast_fltr.c → target_if/pmo/src/target_if_pmo_hw_filter.c

@@ -25,37 +25,24 @@
 #include "target_if.h"
 #include "target_if_pmo.h"
 #include "wmi_unified_api.h"
-#include "wlan_pmo_non_arp_hwbcast_public_struct.h"
+#include "wlan_pmo_hw_filter_public_struct.h"
 
-QDF_STATUS target_if_pmo_send_non_arp_bcast_filter_req(
-		struct wlan_objmgr_vdev *vdev,
-		struct pmo_bcast_filter_params *bcast_req)
+QDF_STATUS target_if_pmo_conf_hw_filter(struct wlan_objmgr_psoc *psoc,
+					struct pmo_hw_filter_params *req)
 {
-	uint8_t vdev_id;
-	struct wlan_objmgr_psoc *psoc;
 	QDF_STATUS status;
 
-	if (!vdev) {
-		target_if_err("vdev ptr passed is NULL");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	wlan_vdev_obj_lock(vdev);
-	psoc = wlan_vdev_get_psoc(vdev);
-	vdev_id = wlan_vdev_get_id(vdev);
-	wlan_vdev_obj_unlock(vdev);
 	if (!psoc) {
-		target_if_err("psoc handle is NULL");
+		target_if_err("psoc is NULL");
 		return QDF_STATUS_E_INVAL;
 	}
 
-	status = wmi_unified_configure_broadcast_filter_cmd(
-			GET_WMI_HDL_FROM_PSOC(psoc),
-			vdev_id,
-			bcast_req->enable);
+	status = wmi_unified_conf_hw_filter_cmd(
+		GET_WMI_HDL_FROM_PSOC(psoc),
+		req);
 
-	if (status != QDF_STATUS_SUCCESS)
-		target_if_err("Failed to enable HW Broadcast filter");
+	if (QDF_IS_STATUS_ERROR(status))
+		target_if_err("Failed to configure HW Filter");
 
 	return status;
 }

+ 2 - 2
target_if/pmo/src/target_if_pmo_main.c

@@ -36,8 +36,8 @@ void target_if_pmo_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 	pmo_tx_ops = &tx_ops->pmo_tx_ops;
 	pmo_tx_ops->send_arp_offload_req =
 		target_if_pmo_send_arp_offload_req;
-	pmo_tx_ops->send_non_arp_bcast_filter_req =
-		target_if_pmo_send_non_arp_bcast_filter_req;
+	pmo_tx_ops->send_conf_hw_filter_req =
+		target_if_pmo_conf_hw_filter;
 	pmo_tx_ops->send_ns_offload_req =
 		target_if_pmo_send_ns_offload_req;
 	pmo_tx_ops->send_enable_wow_wakeup_event_req =

+ 8 - 4
umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h

@@ -15,13 +15,17 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.
  */
- /**
-  * DOC: Define the pdev data structure of UMAC
-  * Public APIs to perform operations on Global objects
-  */
+
+/**
+ * DOC: Define the pdev data structure of UMAC
+ * Public APIs to perform operations on Global objects
+ */
+
 #ifndef _WLAN_OBJMGR_PDEV_OBJ_H_
 #define _WLAN_OBJMGR_PDEV_OBJ_H_
+
 #include <wlan_objmgr_cmn.h>
+#include "wlan_objmgr_psoc_obj.h"
 
 /* STATUS: scanning */
 #define WLAN_PDEV_F_SCAN                    0x00000001

+ 15 - 3
umac/cmn_services/obj_mgr/inc/wlan_objmgr_vdev_obj.h

@@ -15,11 +15,23 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.
  */
- /**
-  * DOC: Define the vdev data structure of UMAC
-  */
+
+/**
+ * DOC: Define the vdev data structure of UMAC
+ */
+
 #ifndef _WLAN_OBJMGR_VDEV_OBJ_H_
 #define _WLAN_OBJMGR_VDEV_OBJ_H_
+
+#include "qdf_atomic.h"
+#include "qdf_list.h"
+#include "qdf_lock.h"
+#include "qdf_types.h"
+#include "wlan_cmn.h"
+#include "wlan_objmgr_cmn.h"
+#include "wlan_objmgr_pdev_obj.h"
+#include "wlan_objmgr_psoc_obj.h"
+
 	/* CONF: privacy enabled */
 #define WLAN_VDEV_F_PRIVACY              0x00000001
 	/* CONF: 11g w/o 11b sta's */

+ 34 - 29
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -45,6 +45,11 @@
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
 #include "wlan_crypto_global_def.h"
 #endif
+
+#ifdef WLAN_PMO_ENABLE
+#include "wlan_pmo_hw_filter_public_struct.h"
+#endif
+
 /* Number of dev type: Direct attach and Offload */
 #define MAX_DEV_TYPE 2
 
@@ -180,13 +185,13 @@ struct pmo_rcv_pkt_fltr_clear_param;
  * @psoc_send_target_resume_req: fp to send target resume request
  */
 struct wlan_lmac_if_pmo_tx_ops {
-	QDF_STATUS(*send_arp_offload_req)(struct wlan_objmgr_vdev *vdev,
+	QDF_STATUS (*send_arp_offload_req)(struct wlan_objmgr_vdev *vdev,
 			struct pmo_arp_offload_params *arp_offload_req,
 			struct pmo_ns_offload_params *ns_offload_req);
-	QDF_STATUS(*send_non_arp_bcast_filter_req)(
-			struct wlan_objmgr_vdev *vdev,
-			struct pmo_bcast_filter_params *bcast_req);
-	QDF_STATUS(*send_ns_offload_req)(struct wlan_objmgr_vdev *vdev,
+	QDF_STATUS (*send_conf_hw_filter_req)(
+			struct wlan_objmgr_psoc *psoc,
+			struct pmo_hw_filter_params *req);
+	QDF_STATUS (*send_ns_offload_req)(struct wlan_objmgr_vdev *vdev,
 			struct pmo_arp_offload_params *arp_offload_req,
 			struct pmo_ns_offload_params *ns_offload_req);
 	QDF_STATUS(*send_set_pkt_filter)(struct wlan_objmgr_vdev *vdev,
@@ -194,72 +199,72 @@ struct wlan_lmac_if_pmo_tx_ops {
 	QDF_STATUS(*send_clear_pkt_filter)(struct wlan_objmgr_vdev *vdev,
 			struct pmo_rcv_pkt_fltr_clear_param
 						*pmo_clr_pkt_fltr_param);
-	QDF_STATUS(*send_enable_wow_wakeup_event_req)(
+	QDF_STATUS (*send_enable_wow_wakeup_event_req)(
 			struct wlan_objmgr_vdev *vdev,
 			uint32_t bitmap);
-	QDF_STATUS(*send_disable_wow_wakeup_event_req)(
+	QDF_STATUS (*send_disable_wow_wakeup_event_req)(
 			struct wlan_objmgr_vdev *vdev,
 			uint32_t bitmap);
-	QDF_STATUS(*send_add_wow_pattern)(
+	QDF_STATUS (*send_add_wow_pattern)(
 			struct wlan_objmgr_vdev *vdev,
 			uint8_t ptrn_id, const uint8_t *ptrn, uint8_t ptrn_len,
 			uint8_t ptrn_offset, const uint8_t *mask,
 			uint8_t mask_len, bool user);
-	QDF_STATUS(*send_enhance_mc_offload_req)(
+	QDF_STATUS (*send_enhance_mc_offload_req)(
 			struct wlan_objmgr_vdev *vdev, bool enable);
-	QDF_STATUS(*send_set_mc_filter_req)(
+	QDF_STATUS (*send_set_mc_filter_req)(
 			struct wlan_objmgr_vdev *vdev,
 			struct qdf_mac_addr multicast_addr);
-	QDF_STATUS(*send_clear_mc_filter_req)(
+	QDF_STATUS (*send_clear_mc_filter_req)(
 			struct wlan_objmgr_vdev *vdev,
 			struct qdf_mac_addr multicast_addr);
-	QDF_STATUS(*send_ra_filter_req)(
+	QDF_STATUS (*send_ra_filter_req)(
 			struct wlan_objmgr_vdev *vdev,
 			uint8_t default_pattern, uint16_t rate_limit_interval);
-	QDF_STATUS(*send_gtk_offload_req)(
+	QDF_STATUS (*send_gtk_offload_req)(
 			struct wlan_objmgr_vdev *vdev,
 			struct pmo_gtk_req *gtk_offload_req);
-	QDF_STATUS(*send_get_gtk_rsp_cmd)(struct wlan_objmgr_vdev *vdev);
-	QDF_STATUS(*send_action_frame_pattern_req)(
+	QDF_STATUS (*send_get_gtk_rsp_cmd)(struct wlan_objmgr_vdev *vdev);
+	QDF_STATUS (*send_action_frame_pattern_req)(
 			struct wlan_objmgr_vdev *vdev,
 			struct pmo_action_wakeup_set_params *ip_cmd);
-	QDF_STATUS(*send_lphb_enable)(
+	QDF_STATUS (*send_lphb_enable)(
 			struct wlan_objmgr_psoc *psoc,
 			struct pmo_lphb_enable_req *ts_lphb_enable);
-	QDF_STATUS(*send_lphb_tcp_params)(
+	QDF_STATUS (*send_lphb_tcp_params)(
 			struct wlan_objmgr_psoc *psoc,
 			struct pmo_lphb_tcp_params *ts_lphb_tcp_param);
-	QDF_STATUS(*send_lphb_tcp_filter_req)(
+	QDF_STATUS (*send_lphb_tcp_filter_req)(
 			struct wlan_objmgr_psoc *psoc,
 			struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter);
-	QDF_STATUS(*send_lphb_upd_params)(
+	QDF_STATUS (*send_lphb_upd_params)(
 			struct wlan_objmgr_psoc *psoc,
 			struct pmo_lphb_udp_params *ts_lphb_udp_param);
-	QDF_STATUS(*send_lphb_udp_filter_req)(
+	QDF_STATUS (*send_lphb_udp_filter_req)(
 			struct wlan_objmgr_psoc *psoc,
 			struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter);
-	QDF_STATUS(*send_vdev_param_update_req)(
+	QDF_STATUS (*send_vdev_param_update_req)(
 			struct wlan_objmgr_vdev *vdev,
 			uint32_t param_id, uint32_t param_value);
-	QDF_STATUS(*send_vdev_sta_ps_param_req)(
+	QDF_STATUS (*send_vdev_sta_ps_param_req)(
 			struct wlan_objmgr_vdev *vdev,
 			uint32_t ps_mode, uint32_t value);
-	void(*psoc_update_wow_bus_suspend)(
+	void (*psoc_update_wow_bus_suspend)(
 			struct wlan_objmgr_psoc *psoc, uint8_t value);
-	int(*psoc_get_host_credits)(
+	int (*psoc_get_host_credits)(
 			struct wlan_objmgr_psoc *psoc);
-	int(*psoc_get_pending_cmnds)(
+	int (*psoc_get_pending_cmnds)(
 			struct wlan_objmgr_psoc *psoc);
-	void(*update_target_suspend_flag)(
+	void (*update_target_suspend_flag)(
 		struct wlan_objmgr_psoc *psoc, uint8_t value);
-	QDF_STATUS(*psoc_send_wow_enable_req)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*psoc_send_wow_enable_req)(struct wlan_objmgr_psoc *psoc,
 		struct pmo_wow_cmd_params *param);
-	QDF_STATUS(*psoc_send_supend_req)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*psoc_send_supend_req)(struct wlan_objmgr_psoc *psoc,
 		struct pmo_suspend_params *param);
 	void (*psoc_set_runtime_pm_in_progress)(struct wlan_objmgr_psoc *psoc,
 						bool value);
 	bool (*psoc_get_runtime_pm_in_progress)(struct wlan_objmgr_psoc *psoc);
-	QDF_STATUS(*psoc_send_host_wakeup_ind)(struct wlan_objmgr_psoc *psoc);
+	QDF_STATUS (*psoc_send_host_wakeup_ind)(struct wlan_objmgr_psoc *psoc);
 	QDF_STATUS (*psoc_send_target_resume_req)(
 			struct wlan_objmgr_psoc *psoc);
 

+ 6 - 9
wmi/inc/wmi_unified_pmo_api.h

@@ -166,17 +166,14 @@ QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(void *wmi_hdl,
 			   uint8_t vdev_id);
 
 /**
- * wmi_unified_configure_broadcast_filter_cmd() - Enable/Disable Broadcast
- * filter
- * when target goes to wow suspend/resume mode
- * @wmi_hdl: wmi handle
- * @vdev_id: device identifier
- * @bc_filter: enable/disable Broadcast filter
+ * wmi_unified_conf_hw_filter_cmd() - Configure hardware filter in DTIM mode
+ * @opaque_wmi: wmi handle
+ * @req: request parameters to configure to firmware
  *
- * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ * Return: QDF_STATUS
  */
-QDF_STATUS wmi_unified_configure_broadcast_filter_cmd(void *wmi_hdl,
-			   uint8_t vdev_id, bool bc_filter);
+QDF_STATUS wmi_unified_conf_hw_filter_cmd(void *opaque_wmi,
+					  struct pmo_hw_filter_params *req);
 
 /**
  * wmi_unified_lphb_config_hbenable_cmd() - enable command of LPHB configuration

+ 2 - 2
wmi/inc/wmi_unified_priv.h

@@ -504,8 +504,8 @@ QDF_STATUS (*send_enable_arp_ns_offload_cmd)(wmi_unified_t wmi_handle,
 			   struct pmo_ns_offload_params *ns_offload_req,
 			   uint8_t vdev_id);
 
-QDF_STATUS (*send_enable_broadcast_filter_cmd)(wmi_unified_t wmi_handle,
-			   uint8_t vdev_id, bool enable);
+QDF_STATUS (*send_conf_hw_filter_cmd)(wmi_unified_t wmi,
+				      struct pmo_hw_filter_params *req);
 
 QDF_STATUS (*send_enable_enhance_multicast_offload_cmd)(
 		wmi_unified_t wmi_handle,

+ 7 - 7
wmi/src/wmi_unified_pmo_api.c

@@ -23,6 +23,7 @@
 #include "ol_defines.h"
 #include "wmi_unified_priv.h"
 #include "wmi_unified_pmo_api.h"
+#include "wlan_pmo_hw_filter_public_struct.h"
 
 QDF_STATUS wmi_unified_add_wow_wakeup_event_cmd(void *wmi_hdl,
 					uint32_t vdev_id,
@@ -195,16 +196,15 @@ QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
-QDF_STATUS wmi_unified_configure_broadcast_filter_cmd(void *wmi_hdl,
-			   uint8_t vdev_id, bool bc_filter)
+QDF_STATUS wmi_unified_conf_hw_filter_cmd(void *opaque_wmi,
+					  struct pmo_hw_filter_params *req)
 {
-	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+	struct wmi_unified *wmi = opaque_wmi;
 
-	if (wmi_handle->ops->send_enable_broadcast_filter_cmd)
-		return wmi_handle->ops->send_enable_broadcast_filter_cmd(
-				wmi_handle, vdev_id, bc_filter);
+	if (!wmi->ops->send_conf_hw_filter_cmd)
+		return QDF_STATUS_E_NOSUPPORT;
 
-	return QDF_STATUS_E_FAILURE;
+	return wmi->ops->send_conf_hw_filter_cmd(wmi, req);
 }
 
 #ifdef FEATURE_WLAN_LPHB

+ 29 - 31
wmi/src/wmi_unified_tlv.c

@@ -33,6 +33,9 @@
 #ifdef CONVERGED_P2P_ENABLE
 #include "wlan_p2p_public_struct.h"
 #endif
+#ifdef WLAN_PMO_ENABLE
+#include "wlan_pmo_hw_filter_public_struct.h"
+#endif
 #include <wlan_utility.h>
 
 /* copy_vdev_create_pdev_id() - copy pdev from host params to target command
@@ -13475,47 +13478,43 @@ QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle,
 }
 #endif /* FEATURE_WLAN_LPHB */
 
-static QDF_STATUS send_enable_broadcast_filter_cmd_tlv(wmi_unified_t wmi_handle,
-			   uint8_t vdev_id, bool enable)
+static QDF_STATUS send_conf_hw_filter_cmd_tlv(wmi_unified_t wmi,
+					      struct pmo_hw_filter_params *req)
 {
-	int32_t res;
+	QDF_STATUS status;
 	wmi_hw_data_filter_cmd_fixed_param *cmd;
-	A_UINT8 *buf_ptr;
-	wmi_buf_t buf;
-	int32_t len;
+	wmi_buf_t wmi_buf;
 
-	/*
-	 * TLV place holder size for array of ARP tuples
-	 */
-	len = sizeof(wmi_hw_data_filter_cmd_fixed_param);
+	if (!req) {
+		WMI_LOGE("req is null");
+		return QDF_STATUS_E_INVAL;
+	}
 
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+	wmi_buf = wmi_buf_alloc(wmi, sizeof(*cmd));
+	if (!wmi_buf) {
+		WMI_LOGE(FL("Out of memory"));
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	buf_ptr = (A_UINT8 *) wmi_buf_data(buf);
-	cmd = (wmi_hw_data_filter_cmd_fixed_param *) buf_ptr;
+	cmd = (wmi_hw_data_filter_cmd_fixed_param *)wmi_buf_data(wmi_buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_hw_data_filter_cmd_fixed_param));
-	cmd->vdev_id = vdev_id;
-	cmd->enable = enable;
-	cmd->hw_filter_bitmap = WMI_HW_DATA_FILTER_DROP_NON_ARP_BC;
+		  WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param,
+		  WMITLV_GET_STRUCT_TLVLEN(wmi_hw_data_filter_cmd_fixed_param));
+	cmd->vdev_id = req->vdev_id;
+	cmd->enable = req->mode != PMO_HW_FILTER_DISABLED;
+	cmd->hw_filter_bitmap = req->mode;
 
-	WMI_LOGD("HW Broadcast Filter vdev_id: %d", cmd->vdev_id);
+	WMI_LOGD("configure hw filter (vdev_id: %d, mode: %d)",
+		 req->vdev_id, req->mode);
 
-	res = wmi_unified_cmd_send(wmi_handle, buf, len,
-				     WMI_HW_DATA_FILTER_CMDID);
-	if (res) {
-		WMI_LOGE("Failed to enable ARP NDP/NSffload");
-		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
+	status = wmi_unified_cmd_send(wmi, wmi_buf, sizeof(*cmd),
+				      WMI_HW_DATA_FILTER_CMDID);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMI_LOGE("Failed to configure hw filter");
+		wmi_buf_free(wmi_buf);
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -17701,8 +17700,7 @@ struct wmi_ops tlv_ops =  {
 	.send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv,
 	.send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv,
 	.send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv,
-	.send_enable_broadcast_filter_cmd =
-		 send_enable_broadcast_filter_cmd_tlv,
+	.send_conf_hw_filter_cmd = send_conf_hw_filter_cmd_tlv,
 	.send_gtk_offload_cmd = send_gtk_offload_cmd_tlv,
 	.send_process_gtk_offload_getinfo_cmd =
 		send_process_gtk_offload_getinfo_cmd_tlv,