Bläddra i källkod

qcacld-3.0: Consolidate SIOCGIWRTS and SIOCGIWFRAG ioctls

Currently for both SIOCGIWRTS and SIOCGIWFRAG there are two separate
but identical handlers, one for STA-like interfaces and one for
SAP-like interfaces. For each ioctl consolidate the code into a single
handler. This is a prerequisite for further ioctl cleanup.

Change-Id: I4d4f288198bed2124ec96cf3ca1929e89705d4de
CRs-Fixed: 2004191
Jeff Johnson 8 år sedan
förälder
incheckning
5b907621fa
3 ändrade filer med 58 tillägg och 209 borttagningar
  1. 8 4
      core/hdd/inc/wlan_hdd_wext.h
  2. 2 105
      core/hdd/src/wlan_hdd_hostapd.c
  3. 48 100
      core/hdd/src/wlan_hdd_wext.c

+ 8 - 4
core/hdd/inc/wlan_hdd_wext.h

@@ -304,10 +304,6 @@ typedef struct ccp_freq_chan_map_s {
 extern int hdd_unregister_wext(struct net_device *dev);
 extern int hdd_register_wext(struct net_device *dev);
 extern int hdd_wlan_get_freq(uint32_t chan, uint32_t *freq);
-extern int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter,
-				      union iwreq_data *wrqu);
-extern int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter,
-				       union iwreq_data *wrqu);
 extern void hdd_wlan_get_version(hdd_context_t *hdd_ctx,
 				 union iwreq_data *wrqu, char *extra);
 
@@ -316,6 +312,14 @@ extern void hdd_wlan_get_stats(hdd_adapter_t *pAdapter, uint16_t *length,
 extern void hdd_wlan_list_fw_profile(uint16_t *length,
 			       char *buffer, uint16_t buf_len);
 
+int iw_get_rts_threshold(struct net_device *dev,
+			 struct iw_request_info *info,
+			 union iwreq_data *wrqu, char *extra);
+
+int iw_get_frag_threshold(struct net_device *dev,
+			  struct iw_request_info *info,
+			  union iwreq_data *wrqu, char *extra);
+
 extern int iw_set_essid(struct net_device *dev,
 			struct iw_request_info *info,
 			union iwreq_data *wrqu, char *extra);

+ 2 - 105
core/hdd/src/wlan_hdd_hostapd.c

@@ -4555,109 +4555,6 @@ static int iw_set_ap_mlme(struct net_device *dev,
 	return ret;
 }
 
-/**
- * __iw_get_ap_rts_threshold() - get ap rts threshold
- * @dev - Pointer to the net device.
- * @info - Pointer to the iw_request_info.
- * @wrqu - Pointer to the iwreq_data.
- * @extra - Pointer to the data.
- *
- * Return: 0 for success, non zero for failure.
- */
-static int __iw_get_ap_rts_threshold(struct net_device *dev,
-				   struct iw_request_info *info,
-				   union iwreq_data *wrqu, char *extra) {
-
-	hdd_adapter_t *pHostapdAdapter = netdev_priv(dev);
-	int ret;
-	hdd_context_t *hdd_ctx;
-
-	ENTER_DEV(dev);
-
-	hdd_ctx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-	ret = wlan_hdd_validate_context(hdd_ctx);
-	if (0 != ret)
-		return ret;
-	ret = hdd_wlan_get_rts_threshold(pHostapdAdapter, wrqu);
-
-	return ret;
-}
-
-/**
- * iw_get_ap_rts_threshold() - Wrapper function to protect
- *			__iw_get_ap_rts_threshold from the SSR.
- * @dev - Pointer to the net device.
- * @info - Pointer to the iw_request_info.
- * @wrqu - Pointer to the iwreq_data.
- * @extra - Pointer to the data.
- *
- * Return: 0 for success, non zero for failure.
- */
-static int iw_get_ap_rts_threshold(struct net_device *dev,
-				   struct iw_request_info *info,
-				   union iwreq_data *wrqu, char *extra)
-{
-	int ret;
-
-	cds_ssr_protect(__func__);
-	ret = __iw_get_ap_rts_threshold(dev, info, wrqu, extra);
-	cds_ssr_unprotect(__func__);
-
-	return ret;
-}
-
-/**
- * __iw_get_ap_frag_threshold() - get ap fragmentation threshold
- * @dev - Pointer to the net device.
- * @info - Pointer to the iw_request_info.
- * @wrqu - Pointer to the iwreq_data.
- * @extra - Pointer to the data.
- *
- * Return: 0 for success, non zero for failure.
- */
-static int __iw_get_ap_frag_threshold(struct net_device *dev,
-				    struct iw_request_info *info,
-				    union iwreq_data *wrqu, char *extra) {
-
-	hdd_adapter_t *pHostapdAdapter = netdev_priv(dev);
-	hdd_context_t *hdd_ctx;
-	int ret = 0;
-
-	ENTER_DEV(dev);
-
-	hdd_ctx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-	ret = wlan_hdd_validate_context(hdd_ctx);
-	if (0 != ret)
-		return ret;
-
-	ret = hdd_wlan_get_frag_threshold(pHostapdAdapter, wrqu);
-
-	return ret;
-}
-
-/**
- * iw_get_ap_frag_threshold() - Wrapper function to protect
- *			__iw_get_ap_frag_threshold from the SSR.
- * @dev - Pointer to the net device.
- * @info - Pointer to the iw_request_info.
- * @wrqu - Pointer to the iwreq_data.
- * @extra - Pointer to the data.
- *
- * Return: 0 for success, non zero for failure.
- */
-static int iw_get_ap_frag_threshold(struct net_device *dev,
-				    struct iw_request_info *info,
-				    union iwreq_data *wrqu, char *extra)
-{
-	int ret;
-
-	cds_ssr_protect(__func__);
-	ret = __iw_get_ap_frag_threshold(dev, info, wrqu, extra);
-	cds_ssr_unprotect(__func__);
-
-	return ret;
-}
-
 /**
  * __iw_get_ap_freq() - get ap frequency
  * @dev - Pointer to the net device.
@@ -5206,9 +5103,9 @@ static const iw_handler hostapd_handler[] = {
 	(iw_handler) NULL,      /* SIOCSIWRATE */
 	(iw_handler) NULL,      /* SIOCGIWRATE */
 	(iw_handler) NULL,      /* SIOCSIWRTS */
-	(iw_handler) iw_get_ap_rts_threshold,           /* SIOCGIWRTS */
+	(iw_handler) iw_get_rts_threshold,           /* SIOCGIWRTS */
 	(iw_handler) NULL,      /* SIOCSIWFRAG */
-	(iw_handler) iw_get_ap_frag_threshold,          /* SIOCGIWFRAG */
+	(iw_handler) iw_get_frag_threshold,          /* SIOCGIWFRAG */
 	(iw_handler) NULL,      /* SIOCSIWTXPOW */
 	(iw_handler) NULL,      /* SIOCGIWTXPOW */
 	(iw_handler) NULL,      /* SIOCSIWRETRY */

+ 48 - 100
core/hdd/src/wlan_hdd_wext.c

@@ -1532,92 +1532,6 @@ static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(hdd_adapter_t *pAdapter)
 	return status;
 }
 
-/**
- * hdd_wlan_get_rts_threshold() - Get RTS threshold
- * @pAdapter: adapter upon which the request was received
- * @wrqu: pointer to the ioctl request
- *
- * This function retrieves the current RTS threshold value and stores
- * it in the ioctl request structure
- *
- * Return: 0 if valid data was returned, non-zero on error
- */
-int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
-{
-	tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-	uint32_t threshold = 0;
-	hdd_context_t *hdd_ctx;
-	int ret = 0;
-
-	ENTER();
-
-	if (NULL == pAdapter) {
-		hdd_err("Adapter is NULL");
-		return -EINVAL;
-	}
-
-	hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
-	ret = wlan_hdd_validate_context(hdd_ctx);
-	if (0 != ret)
-		return ret;
-
-	if (QDF_STATUS_SUCCESS !=
-	    sme_cfg_get_int(hHal, WNI_CFG_RTS_THRESHOLD, &threshold)) {
-		hdd_warn("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD");
-		return -EIO;
-	}
-	wrqu->rts.value = threshold;
-
-	hdd_notice("Rts-Threshold=%d!!", wrqu->rts.value);
-
-	EXIT();
-
-	return 0;
-}
-
-/**
- * hdd_wlan_get_frag_threshold() - Get fragmentation threshold
- * @pAdapter: adapter upon which the request was received
- * @wrqu: pointer to the ioctl request
- *
- * This function retrieves the current fragmentation threshold value
- * and stores it in the ioctl request structure
- *
- * Return: 0 if valid data was returned, non-zero on error
- */
-int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter,
-				union iwreq_data *wrqu)
-{
-	tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-	uint32_t threshold = 0, status = 0;
-	hdd_context_t *hdd_ctx;
-
-	ENTER();
-
-	if (NULL == pAdapter) {
-		hdd_err("Adapter is NULL");
-		return -EINVAL;
-	}
-
-	hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
-	status = wlan_hdd_validate_context(hdd_ctx);
-	if (0 != status)
-		return status;
-
-	if (sme_cfg_get_int(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold)
-	    != QDF_STATUS_SUCCESS) {
-		hdd_warn("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD");
-		return -EIO;
-	}
-	wrqu->frag.value = threshold;
-
-	hdd_notice("Frag-Threshold=%d!!", wrqu->frag.value);
-
-	EXIT();
-
-	return 0;
-}
-
 /**
  * hdd_wlan_get_freq() - Convert channel to frequency
  * @channel: channel to be converted
@@ -3686,14 +3600,31 @@ static int __iw_get_rts_threshold(struct net_device *dev,
 				  struct iw_request_info *info,
 				  union iwreq_data *wrqu, char *extra)
 {
-	hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	uint32_t status = 0;
+	hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
+	uint32_t threshold = 0;
+	hdd_context_t *hdd_ctx;
+	int ret;
 
 	ENTER_DEV(dev);
 
-	status = hdd_wlan_get_rts_threshold(pAdapter, wrqu);
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	ret = wlan_hdd_validate_context(hdd_ctx);
+	if (0 != ret)
+		return ret;
 
-	return status;
+	if (QDF_STATUS_SUCCESS !=
+	    sme_cfg_get_int(hal, WNI_CFG_RTS_THRESHOLD, &threshold)) {
+		hdd_warn("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD");
+		return -EIO;
+	}
+	wrqu->rts.value = threshold;
+
+	hdd_notice("Rts-Threshold=%d!!", wrqu->rts.value);
+
+	EXIT();
+
+	return 0;
 }
 
 /**
@@ -3746,9 +3677,9 @@ static int __iw_set_rts_threshold(struct net_device *dev,
  *
  * Return: 0 on success, error number otherwise
  */
-static int iw_get_rts_threshold(struct net_device *dev,
-				struct iw_request_info *info,
-				union iwreq_data *wrqu, char *extra)
+int iw_get_rts_threshold(struct net_device *dev,
+			 struct iw_request_info *info,
+			 union iwreq_data *wrqu, char *extra)
 {
 	int ret;
 
@@ -3794,14 +3725,31 @@ static int __iw_get_frag_threshold(struct net_device *dev,
 				   struct iw_request_info *info,
 				   union iwreq_data *wrqu, char *extra)
 {
-	hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	uint32_t status = 0;
+	hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
+	uint32_t threshold = 0;
+	hdd_context_t *hdd_ctx;
+	int ret;
 
 	ENTER_DEV(dev);
 
-	status = hdd_wlan_get_frag_threshold(pAdapter, wrqu);
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	ret = wlan_hdd_validate_context(hdd_ctx);
+	if (0 != ret)
+		return ret;
 
-	return status;
+	if (sme_cfg_get_int(hal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold)
+	    != QDF_STATUS_SUCCESS) {
+		hdd_warn("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD");
+		return -EIO;
+	}
+	wrqu->frag.value = threshold;
+
+	hdd_notice("Frag-Threshold=%d!!", wrqu->frag.value);
+
+	EXIT();
+
+	return 0;
 }
 
 /**
@@ -3813,9 +3761,9 @@ static int __iw_get_frag_threshold(struct net_device *dev,
  *
  * Return: 0 on success, error number otherwise
  */
-static int iw_get_frag_threshold(struct net_device *dev,
-				 struct iw_request_info *info,
-				 union iwreq_data *wrqu, char *extra)
+int iw_get_frag_threshold(struct net_device *dev,
+			  struct iw_request_info *info,
+			  union iwreq_data *wrqu, char *extra)
 {
 	int ret;