qcacld-3.0: Featurize WLAN_FEATURE_PACKET_FILTERING

Featurize WLAN_FEATURE_PACKET_FILTERING to compile out
in mission mode.

Change-Id: I373e65b9286dd6a6e870dce873d19bf3b3455adb
CRs-Fixed: 2241323
diff --git a/Kbuild b/Kbuild
index bb36be8..721b5a5 100644
--- a/Kbuild
+++ b/Kbuild
@@ -51,7 +51,6 @@
 		$(HDD_SRC_DIR)/wlan_hdd_object_manager.o \
 		$(HDD_SRC_DIR)/wlan_hdd_oemdata.o \
 		$(HDD_SRC_DIR)/wlan_hdd_p2p.o \
-		$(HDD_SRC_DIR)/wlan_hdd_packet_filter.o \
 		$(HDD_SRC_DIR)/wlan_hdd_power.o \
 		$(HDD_SRC_DIR)/wlan_hdd_regulatory.o \
 		$(HDD_SRC_DIR)/wlan_hdd_request_manager.o \
@@ -150,6 +149,10 @@
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_nud_tracking.o
 endif
 
+ifeq ($(CONFIG_WLAN_FEATURE_PACKET_FILTERING), y)
+HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_packet_filter.o
+endif
+
 ########### HOST DIAG LOG ###########
 HOST_DIAG_LOG_DIR :=	$(WLAN_COMMON_ROOT)/utils/host_diag_log
 
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index d7736e0..03f9a7d 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -13369,6 +13369,7 @@
 #define CFG_MBO_CAND_RSSI_BTC_THRESHOLD_MIN     (-120)
 #define CFG_MBO_CAND_RSSI_BTC_THRESHOLD_MAX     (0)
 
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 /*
  * <ini>
  * g_enable_packet_filter_bitmap - Enable Packet filters before going into
@@ -13406,7 +13407,7 @@
 #define CFG_ENABLE_PACKET_FILTERS_DEFAULT  (0)
 #define CFG_ENABLE_PACKET_FILTERS_MIN      (0)
 #define CFG_ENABLE_PACKET_FILTERS_MAX      (63)
-
+#endif /* WLAN_FEATURE_PACKET_FILTERING */
 
 /*
  * <ini>
@@ -15047,7 +15048,9 @@
 	int8_t mbo_current_rssi_thres;
 	int8_t mbo_current_rssi_mcc_thres;
 	int8_t mbo_candidate_rssi_btc_thres;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 	uint8_t packet_filters_bitmap;
+#endif
 	uint8_t enable_phy_reg_retention;
 	uint8_t dfs_beacon_tx_enhanced;
 	uint16_t reduced_beacon_interval;
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index 5d54ce3..625d183 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -1880,7 +1880,9 @@
 	uint8_t bt_vo_active:1;
 	enum band_info curr_band;
 	bool imps_enabled;
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 	int user_configured_pkt_filter_rules;
+#endif
 	bool is_fils_roaming_supported;
 	QDF_STATUS (*receive_offload_cb)(struct hdd_adapter *,
 					 struct sk_buff *);
diff --git a/core/hdd/inc/wlan_hdd_packet_filter_api.h b/core/hdd/inc/wlan_hdd_packet_filter_api.h
index af0f102..77e5dfa 100644
--- a/core/hdd/inc/wlan_hdd_packet_filter_api.h
+++ b/core/hdd/inc/wlan_hdd_packet_filter_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 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
@@ -27,6 +27,9 @@
 /* Include files */
 #include "wlan_hdd_assoc.h"
 #include "wlan_hdd_power.h"
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+
 /**
  * hdd_enable_default_pkt_filters() - Enable default packet filters based
  * on, filters bit map provided in INI, when target goes to suspend mode
@@ -56,4 +59,20 @@
 int wlan_hdd_set_filter(struct hdd_context *hdd_ctx,
 			struct pkt_filter_cfg *request,
 			uint8_t sessionId);
+
+#else /* WLAN_FEATURE_PACKET_FILTERING */
+
+static inline int
+hdd_enable_default_pkt_filters(struct hdd_adapter *adapter)
+{
+	return 0;
+}
+
+static inline int
+hdd_disable_default_pkt_filters(struct hdd_adapter *adapter)
+{
+	return 0;
+}
+
+#endif /* WLAN_FEATURE_PACKET_FILTERING */
 #endif
diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h
index bce0e0a..4d5ce11 100644
--- a/core/hdd/inc/wlan_hdd_power.h
+++ b/core/hdd/inc/wlan_hdd_power.h
@@ -27,12 +27,9 @@
 
 #include "wlan_hdd_main.h"
 
-#ifdef WLAN_FEATURE_PACKET_FILTERING
-
-#define HDD_MAX_CMP_PER_PACKET_FILTER	5
-
 #define HDD_WAKELOCK_TIMEOUT_CONNECT 1000
 #define HDD_WAKELOCK_TIMEOUT_RESUME 1000
+
 /*
  * HDD_WAKELOCK_CONNECT_COMPLETE = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT (3000) +
  *                      WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF (1000) +
@@ -40,6 +37,10 @@
  */
 #define HDD_WAKELOCK_CONNECT_COMPLETE 6000
 
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+
+#define HDD_MAX_CMP_PER_PACKET_FILTER	5
+
 /**
  * enum pkt_filter_protocol_layer - packet filter protocol layer
  * @HDD_FILTER_PROTO_TYPE_INVALID: Invalid initial value
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index f85c169..7fa92b9 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -5125,12 +5125,14 @@
 		CFG_IS_FILS_ENABLED_MIN,
 		CFG_IS_FILS_ENABLED_MAX),
 
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 	REG_VARIABLE(CFG_ENABLE_PACKET_FILTERS_NAME, WLAN_PARAM_Integer,
 		struct hdd_config, packet_filters_bitmap,
 		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
 		CFG_ENABLE_PACKET_FILTERS_DEFAULT,
 		CFG_ENABLE_PACKET_FILTERS_MIN,
 		CFG_ENABLE_PACKET_FILTERS_MAX),
+#endif /* WLAN_FEATURE_PACKET_FILTERING */
 
 	REG_VARIABLE(CFG_DFS_BEACON_TX_ENHANCED, WLAN_PARAM_Integer,
 		struct hdd_config, dfs_beacon_tx_enhanced,
diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c
index c6cb07b..1ee3e85 100644
--- a/core/hdd/src/wlan_hdd_ioctl.c
+++ b/core/hdd/src/wlan_hdd_ioctl.c
@@ -6227,6 +6227,7 @@
 	return ret;
 }
 
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 /**
  * hdd_set_rx_filter() - set RX filter
  * @adapter: Pointer to adapter
@@ -6407,6 +6408,7 @@
 {
 	return hdd_driver_rxfilter_command_handler(command, adapter, true);
 }
+#endif /* WLAN_FEATURE_PACKET_FILTERING */
 
 /**
  * hdd_parse_setantennamode_command() - HDD Parse SETANTENNAMODE
@@ -6997,8 +6999,10 @@
 #endif
 	{"RSSI",                      drv_cmd_get_rssi, false},
 	{"LINKSPEED",                 drv_cmd_get_linkspeed, false},
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 	{"RXFILTER-REMOVE",           drv_cmd_rx_filter_remove, true},
 	{"RXFILTER-ADD",              drv_cmd_rx_filter_add, true},
+#endif
 	{"SET_FCC_CHANNEL",           drv_cmd_set_fcc_channel, true},
 	{"CHANNEL_SWITCH",            drv_cmd_set_channel_switch, true},
 	{"SETANTENNAMODE",            drv_cmd_set_antenna_mode, true},
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 7cab41e..b9429c5 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -2917,8 +2917,6 @@
 	uint32_t reason;
 } tSirRoamOffloadScanRsp, *tpSirRoamOffloadScanRsp;
 
-
-#ifdef WLAN_FEATURE_PACKET_FILTERING
 /*---------------------------------------------------------------------------
    Packet Filtering Parameters
    ---------------------------------------------------------------------------*/
@@ -2928,6 +2926,7 @@
 #define    SIR_MAX_NUM_FILTERS               20
 #define    SIR_MAX_NUM_TESTS_PER_FILTER      10
 
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 /* */
 /* Filter Packet Match Count Parameters */
 /* */
@@ -2955,6 +2954,7 @@
 	struct qdf_mac_addr self_macaddr;
 	struct qdf_mac_addr bssid;
 } tSirRcvFltPktClearParam, *tpSirRcvFltPktClearParam;
+#endif /* WLAN_FEATURE_PACKET_FILTERING */
 
 /* */
 /* Multicast Address List Parameters */
@@ -2966,7 +2966,6 @@
 	struct qdf_mac_addr bssid;
 	uint8_t action;
 } tSirRcvFltMcAddrList, *tpSirRcvFltMcAddrList;
-#endif /* WLAN_FEATURE_PACKET_FILTERING */
 
 /* */
 /* Generic version information */
diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h
index 38c41e5..ef47766 100644
--- a/core/mac/src/include/sir_params.h
+++ b/core/mac/src/include/sir_params.h
@@ -365,9 +365,10 @@
 
 /* (SIR_HAL_ITC_MSG_TYPES_BEGIN + 122) is unused */
 
-#ifdef WLAN_FEATURE_PACKET_FILTERING
 #define SIR_HAL_8023_MULTICAST_LIST_REQ \
 					   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 123)
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 #define SIR_HAL_RECEIVE_FILTER_SET_FILTER_REQ \
 					   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 124)
 #define SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ \
diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h
index 2a2f4bc..fbc82ba 100644
--- a/core/wma/inc/wma_types.h
+++ b/core/wma/inc/wma_types.h
@@ -257,8 +257,9 @@
 #define WMA_ROAM_OFFLOAD_SYNCH_FAIL SIR_HAL_ROAM_OFFLOAD_SYNCH_FAIL
 #endif
 
-#ifdef WLAN_FEATURE_PACKET_FILTERING
 #define WMA_8023_MULTICAST_LIST_REQ                     SIR_HAL_8023_MULTICAST_LIST_REQ
+
+#ifdef WLAN_FEATURE_PACKET_FILTERING
 #define WMA_RECEIVE_FILTER_SET_FILTER_REQ               SIR_HAL_RECEIVE_FILTER_SET_FILTER_REQ
 #define WMA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ    SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ
 #define WMA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP    SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP