Переглянути джерело

qcacld-3.0: Fix DHCP_SERVER_OFFLOAD featurization

When the DHCP_SERVER_OFFLOAD feature is enabled the driver does not
build, so address the build issues.

Change-Id: I42103afd91c4bed2d04f22bdb6159e286ff12fa0
CRs-Fixed: 2399937
Jeff Johnson 6 роки тому
батько
коміт
e77641ea77

+ 1 - 0
Kbuild

@@ -1917,6 +1917,7 @@ cppflags-$(CONFIG_AGEIE_ON_SCAN_RESULTS) += -DWLAN_ENABLE_AGEIE_ON_SCAN_RESULTS
 cppflags-$(CONFIG_SOFTAP_CHANNEL_RANGE) += -DSOFTAP_CHANNEL_RANGE
 cppflags-$(CONFIG_FEATURE_WLAN_SCAN_PNO) += -DFEATURE_WLAN_SCAN_PNO
 cppflags-$(CONFIG_WLAN_FEATURE_PACKET_FILTERING) += -DWLAN_FEATURE_PACKET_FILTERING
+cppflags-$(CONFIG_DHCP_SERVER_OFFLOAD) += -DDHCP_SERVER_OFFLOAD
 cppflags-$(CONFIG_WLAN_NS_OFFLOAD) += -DWLAN_NS_OFFLOAD
 cppflags-$(CONFIG_FEATURE_WLAN_RA_FILTERING) += -DFEATURE_WLAN_RA_FILTERING
 cppflags-$(CONFIG_FEATURE_WLAN_LPHB) += -DFEATURE_WLAN_LPHB

+ 0 - 55
core/hdd/src/wlan_hdd_cfg80211.c

@@ -13377,61 +13377,6 @@ QDF_STATUS wlan_hdd_validate_operation_channel(struct hdd_adapter *adapter,
 
 }
 
-#ifdef DHCP_SERVER_OFFLOAD
-static void wlan_hdd_set_dhcp_server_offload(struct hdd_adapter *adapter)
-{
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	tpSirDhcpSrvOffloadInfo pDhcpSrvInfo;
-	uint8_t numEntries = 0;
-	uint8_t srv_ip[IPADDR_NUM_ENTRIES];
-	uint8_t num;
-	uint32_t temp;
-	uint32_t dhcp_max_num_clients;
-	mac_handle_t mac_handle;
-	QDF_STATUS status;
-
-	pDhcpSrvInfo = qdf_mem_malloc(sizeof(*pDhcpSrvInfo));
-	if (!pDhcpSrvInfo)
-		return;
-	pDhcpSrvInfo->vdev_id = adapter->vdev_id;
-	pDhcpSrvInfo->dhcpSrvOffloadEnabled = true;
-
-	status = ucfg_fwol_get_dhcp_max_num_clients(hdd_ctx->psoc,
-						    &dhcp_max_num_clients);
-	if (QDF_IS_STATUS_ERROR(status))
-		return;
-
-	pDhcpSrvInfo->dhcpClientNum = dhcp_max_num_clients;
-	hdd_string_to_u8_array(hdd_ctx->config->dhcpServerIP,
-			       srv_ip, &numEntries, IPADDR_NUM_ENTRIES);
-	if (numEntries != IPADDR_NUM_ENTRIES) {
-		hdd_err("Incorrect IP address (%s) assigned for DHCP server!", hdd_ctx->config->dhcpServerIP);
-		goto end;
-	}
-	if ((srv_ip[0] >= 224) && (srv_ip[0] <= 239)) {
-		hdd_err("Invalid IP address (%s)! It could NOT be multicast IP address!", hdd_ctx->config->dhcpServerIP);
-		goto end;
-	}
-	if (srv_ip[IPADDR_NUM_ENTRIES - 1] >= 100) {
-		hdd_err("Invalid IP address (%s)! The last field must be less than 100!", hdd_ctx->config->dhcpServerIP);
-		goto end;
-	}
-	for (num = 0; num < numEntries; num++) {
-		temp = srv_ip[num];
-		pDhcpSrvInfo->dhcpSrvIP |= (temp << (8 * num));
-	}
-	mac_handle = hdd_ctx->mac_handle;
-	if (QDF_STATUS_SUCCESS !=
-	    sme_set_dhcp_srv_offload(mac_handle, pDhcpSrvInfo)) {
-		hdd_err("sme_setDHCPSrvOffload fail!");
-		goto end;
-	}
-	hdd_debug("enable DHCP Server offload successfully!");
-end:
-	qdf_mem_free(pDhcpSrvInfo);
-}
-#endif /* DHCP_SERVER_OFFLOAD */
-
 static int __wlan_hdd_cfg80211_change_bss(struct wiphy *wiphy,
 					  struct net_device *dev,
 					  struct bss_parameters *params)

+ 64 - 8
core/hdd/src/wlan_hdd_hostapd.c

@@ -86,6 +86,7 @@
 #include "cfg_ucfg_api.h"
 #include "wlan_crypto_global_api.h"
 #include "wlan_action_oui_ucfg_api.h"
+#include "wlan_fwol_ucfg_api.h"
 #include "nan_ucfg_api.h"
 #include <wlan_reg_services_api.h>
 
@@ -4708,16 +4709,71 @@ int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx,
 }
 #endif
 
+#ifdef DHCP_SERVER_OFFLOAD
+static void wlan_hdd_set_dhcp_server_offload(struct hdd_adapter *adapter)
+{
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	tpSirDhcpSrvOffloadInfo pDhcpSrvInfo;
+	uint8_t numEntries = 0;
+	uint8_t srv_ip[IPADDR_NUM_ENTRIES];
+	uint8_t num;
+	uint32_t temp;
+	uint32_t dhcp_max_num_clients;
+	mac_handle_t mac_handle;
+	QDF_STATUS status;
+
+	pDhcpSrvInfo = qdf_mem_malloc(sizeof(*pDhcpSrvInfo));
+	if (!pDhcpSrvInfo)
+		return;
+	pDhcpSrvInfo->vdev_id = adapter->vdev_id;
+	pDhcpSrvInfo->dhcpSrvOffloadEnabled = true;
+
+	status = ucfg_fwol_get_dhcp_max_num_clients(hdd_ctx->psoc,
+						    &dhcp_max_num_clients);
+	if (QDF_IS_STATUS_ERROR(status))
+		return;
+
+	pDhcpSrvInfo->dhcpClientNum = dhcp_max_num_clients;
+	hdd_string_to_u8_array(hdd_ctx->config->dhcpServerIP,
+			       srv_ip, &numEntries, IPADDR_NUM_ENTRIES);
+	if (numEntries != IPADDR_NUM_ENTRIES) {
+		hdd_err("Incorrect IP address (%s) assigned for DHCP server!", hdd_ctx->config->dhcpServerIP);
+		goto end;
+	}
+	if ((srv_ip[0] >= 224) && (srv_ip[0] <= 239)) {
+		hdd_err("Invalid IP address (%s)! It could NOT be multicast IP address!", hdd_ctx->config->dhcpServerIP);
+		goto end;
+	}
+	if (srv_ip[IPADDR_NUM_ENTRIES - 1] >= 100) {
+		hdd_err("Invalid IP address (%s)! The last field must be less than 100!", hdd_ctx->config->dhcpServerIP);
+		goto end;
+	}
+	for (num = 0; num < numEntries; num++) {
+		temp = srv_ip[num];
+		pDhcpSrvInfo->dhcpSrvIP |= (temp << (8 * num));
+	}
+	mac_handle = hdd_ctx->mac_handle;
+	if (QDF_STATUS_SUCCESS !=
+	    sme_set_dhcp_srv_offload(mac_handle, pDhcpSrvInfo)) {
+		hdd_err("sme_setDHCPSrvOffload fail!");
+		goto end;
+	}
+	hdd_debug("enable DHCP Server offload successfully!");
+end:
+	qdf_mem_free(pDhcpSrvInfo);
+}
+
 /**
- * wlan_hdd_is_dhcp_enabled: Enable DHCP offload
+ * wlan_hdd_dhcp_offload_enable: Enable DHCP offload
  * @hdd_ctx: HDD context handler
  * @adapter: Adapter pointer
  *
+ * Enables the DHCP Offload feature in firmware if it has been configured.
+ *
  * Return: None
  */
-#ifdef DHCP_SERVER_OFFLOAD
-static void wlan_hdd_is_dhcp_enabled(struct hdd_context *hdd_ctx,
-				     struct hdd_adapter *adapter)
+static void wlan_hdd_dhcp_offload_enable(struct hdd_context *hdd_ctx,
+					 struct hdd_adapter *adapter)
 {
 	bool enable_dhcp_server_offload;
 	QDF_STATUS status;
@@ -4732,11 +4788,11 @@ static void wlan_hdd_is_dhcp_enabled(struct hdd_context *hdd_ctx,
 		wlan_hdd_set_dhcp_server_offload(adapter);
 }
 #else
-static void wlan_hdd_is_dhcp_enabled(struct hdd_context *hdd_ctx,
-				     struct hdd_adapter *adapter)
+static void wlan_hdd_dhcp_offload_enable(struct hdd_context *hdd_ctx,
+					 struct hdd_adapter *adapter)
 {
 }
-#endif
+#endif /* DHCP_SERVER_OFFLOAD */
 
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
 /**
@@ -5553,7 +5609,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 					    true);
 	}
 
-	wlan_hdd_is_dhcp_enabled(hdd_ctx, adapter);
+	wlan_hdd_dhcp_offload_enable(hdd_ctx, adapter);
 	ucfg_p2p_status_start_bss(adapter->vdev);
 
 	/* Check and restart SAP if it is on unsafe channel */

+ 3 - 3
core/wma/inc/wma_internal.h

@@ -1231,9 +1231,9 @@ static inline QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin)
 QDF_STATUS wma_set_wisa_params(tp_wma_handle wma, struct sir_wisa_params *wisa);
 
 #ifdef DHCP_SERVER_OFFLOAD
-int wma_process_dhcpserver_offload(tp_wma_handle wma_handle,
-				   tSirDhcpSrvOffloadInfo *
-				   pDhcpSrvOffloadInfo);
+QDF_STATUS wma_process_dhcpserver_offload(tp_wma_handle wma_handle,
+					  tSirDhcpSrvOffloadInfo *
+					  pDhcpSrvOffloadInfo);
 #endif
 
 #ifdef WLAN_FEATURE_GPIO_LED_FLASHING

+ 1 - 1
core/wma/src/wma_features.c

@@ -3868,7 +3868,7 @@ QDF_STATUS wma_process_dhcpserver_offload(tp_wma_handle wma_handle,
 
 	if (!wma_handle) {
 		WMA_LOGE("%s: wma handle is NULL", __func__);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	params.vdev_id = pDhcpSrvOffloadInfo->vdev_id;

+ 1 - 2
core/wma/src/wma_main.c

@@ -8698,8 +8698,7 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
 
 #ifdef DHCP_SERVER_OFFLOAD
 	case WMA_SET_DHCP_SERVER_OFFLOAD_CMD:
-		wma_process_dhcpserver_offload(wma_handle,
-			(tSirDhcpSrvOffloadInfo *) msg->bodyptr);
+		wma_process_dhcpserver_offload(wma_handle, msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
 		break;
 #endif /* DHCP_SERVER_OFFLOAD */