qcacld-3.0: Interfacing files for LFR Subnet Detection support

Add interfacing files and configuration options to enable
LFR subnet detection feature support.

Change-Id: I46756dfb2dd8071fd2bb762038414709e6212c1c
CRs-fixed: 876335
diff --git a/Kbuild b/Kbuild
index 23c6036..8e02563 100644
--- a/Kbuild
+++ b/Kbuild
@@ -130,6 +130,9 @@
 			CONFIG_WLAN_LRO := n
 		endif
 	endif
+
+	# Flag to enable LFR Subnet Detection
+	CONFIG_LFR_SUBNET_DETECTION := y
 endif
 
 ifneq ($(CONFIG_MOBILE_ROUTER), y)
@@ -338,6 +341,10 @@
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_memdump.o
 endif
 
+ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y)
+HDD_OBJS +=	$(HDD_SRC_DIR)/wlan_hdd_subnet_detect.o
+endif
+
 ########### HOST DIAG LOG ###########
 HOST_DIAG_LOG_DIR :=	core/utils/host_diag_log
 
@@ -1317,6 +1324,10 @@
 CDEFINES += -DFEATURE_STATICALLY_ADD_11P_CHANNELS
 endif
 
+ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y)
+CDEFINES += -DFEATURE_LFR_SUBNET_DETECTION
+endif
+
 KBUILD_CPPFLAGS += $(CDEFINES)
 
 # Currently, for versions of gcc which support it, the kernel Makefile
diff --git a/Kconfig b/Kconfig
index 9cf8e1d..940ae4d 100644
--- a/Kconfig
+++ b/Kconfig
@@ -107,4 +107,8 @@
 	bool "Enable RX wake lock feature"
 	default n
 
+config FEATURE_LFR_SUBNET_DETECTION
+	bool "Enable LFR Subnet Change Detection"
+	default n
+
 endif # QCA_CLD_WLAN
diff --git a/core/cdf/inc/cdf_types.h b/core/cdf/inc/cdf_types.h
index 2715141..5c987af 100644
--- a/core/cdf/inc/cdf_types.h
+++ b/core/cdf/inc/cdf_types.h
@@ -353,6 +353,7 @@
 #define CDF_MAC_ADDR_ZERO_INITIALIZER { { 0, 0, 0, 0, 0, 0 } }
 
 #define CDF_IPV4_ADDR_SIZE (4)
+#define CDF_IPV6_ADDR_SIZE (16)
 
 /**
  * struct cdf_tso_frag_t - fragments of a single TCP segment
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 3d04d1f..a627a09 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -5395,6 +5395,33 @@
 	PS_QPOWER_DEEPSLEEP = 4,
 	PS_DUTY_CYCLING_QPOWER = 5
 };
+#ifdef FEATURE_LFR_SUBNET_DETECTION
+/**
+ * struct gateway_param_update_req - gateway parameter update request
+ * @request_id: request id
+ * @session_id: session id
+ * @max_retries: Max ARP/NS retry attempts
+ * @timeout: Retry interval
+ * @ipv4_addr_type: on ipv4 network
+ * @ipv6_addr_type: on ipv6 network
+ * @gw_mac_addr: gateway mac addr
+ * @ipv4_addr: ipv4 addr
+ * @ipv6_addr: ipv6 addr
+ */
+struct gateway_param_update_req {
+	uint32_t     request_id;
+	uint32_t     session_id;
+	uint32_t     max_retries;
+	uint32_t     timeout;
+	uint32_t     ipv4_addr_type;
+	uint32_t     ipv6_addr_type;
+	struct cdf_mac_addr  gw_mac_addr;
+	uint8_t      ipv4_addr[CDF_IPV4_ADDR_SIZE];
+	uint8_t      ipv6_addr[CDF_IPV6_ADDR_SIZE];
+};
+#else
+struct gateway_param_update_req;
+#endif /* FEATURE_LFR_SUBNET_DETECTION */
 
 /**
  * struct sir_sme_ext_change_chan_req - channel change request
diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h
index c5b6d7c..22aabae 100644
--- a/core/mac/src/include/sir_params.h
+++ b/core/mac/src/include/sir_params.h
@@ -579,7 +579,7 @@
 #define SIR_HAL_EXIT_PS_REQ                  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 236)
 #define SIR_HAL_ENABLE_UAPSD_REQ             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 237)
 #define SIR_HAL_DISABLE_UAPSD_REQ            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 238)
-
+#define SIR_HAL_GATEWAY_PARAM_UPDATE_REQ    (SIR_HAL_ITC_MSG_TYPES_BEGIN + 239)
 #define SIR_HAL_SET_EPNO_LIST_REQ          (SIR_HAL_ITC_MSG_TYPES_BEGIN + 313)
 #define SIR_HAL_SET_PASSPOINT_LIST_REQ     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 316)
 #define SIR_HAL_RESET_PASSPOINT_LIST_REQ   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 317)
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 91f6526..93e307f 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1075,4 +1075,9 @@
 }
 #endif
 
+#ifdef FEATURE_LFR_SUBNET_DETECTION
+CDF_STATUS sme_gateway_param_update(tHalHandle hHal,
+				struct gateway_param_update_req *request);
+#endif
+
 #endif /* #if !defined( __SME_API_H ) */
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 9a3cea4..95a1ad5 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -2008,6 +2008,17 @@
 void wma_set_dfs_region(tp_wma_handle wma, uint8_t dfs_region);
 uint32_t wma_get_vht_ch_width(void);
 
+#ifdef FEATURE_LFR_SUBNET_DETECTION
+CDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
+					struct gateway_param_update_req *req);
+#else
+static inline CDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
+					struct gateway_param_update_req *req)
+{
+	return CDF_STATUS_SUCCESS;
+}
+#endif /* FEATURE_LFR_SUBNET_DETECTION */
+
 #if defined(FEATURE_LRO)
 CDF_STATUS wma_lro_config_cmd(tp_wma_handle wma_handle,
 	 struct wma_lro_config_cmd_t *wma_lro_cmd);
diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h
index 5c5c974..6676a08 100644
--- a/core/wma/inc/wma_types.h
+++ b/core/wma/inc/wma_types.h
@@ -447,6 +447,7 @@
 #define WMA_SET_IE_INFO                       SIR_HAL_SET_IE_INFO
 
 #define WMA_LRO_CONFIG_CMD                    SIR_HAL_LRO_CONFIG_CMD
+#define WMA_GW_PARAM_UPDATE_REQ              SIR_HAL_GATEWAY_PARAM_UPDATE_REQ
 
 /* Bit 6 will be used to control BD rate for Management frames */
 #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40