Browse Source

qcacld-3.0: Obsolete setMCBCFilter ioctls, remove clearMCBCFilter

The features exposed by the setMCBCFilter ioctl are exposed via newer,
standard APIs. Strip out setMCBCFilter, and replace it with instructions
for moving to the new APIs. Relatedly, clearMCBCFilter is not needed,
so remove it completely.

Change-Id: I091ca239240ea1b35afe755cfa791b83bcd91409
CRs-Fixed: 2000747
Dustin Brown 8 years ago
parent
commit
860566f5c1
2 changed files with 14 additions and 248 deletions
  1. 0 13
      core/hdd/inc/wlan_hdd_power.h
  2. 14 235
      core/hdd/src/wlan_hdd_wext.c

+ 0 - 13
core/hdd/inc/wlan_hdd_power.h

@@ -39,7 +39,6 @@
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 
 #define HDD_MAX_CMP_PER_PACKET_FILTER	5
-#define HDD_MC_FILTER_MAX_MC_ADDRS	16
 
 /**
  * enum pkt_filter_protocol_layer - packet filter protocol layer
@@ -127,18 +126,6 @@ struct pkt_filter_cfg {
 
 #endif
 
-/**
- * struct pkt_filter_mc_addr_list - dynamic mc/bc filter config from user space
- * @mcbc_filter_setting: The type of filter being configured
- * @mc_addr_cnt: The number of mc addresses to configure
- * @mc_addrs: The mc mac addresses to configure
- */
-struct pkt_filter_mc_addr_list {
-	uint8_t mcbc_filter_setting;
-	uint8_t mc_addr_cnt;
-	uint8_t mc_addrs[HDD_MC_FILTER_MAX_MC_ADDRS][QDF_MAC_ADDR_SIZE];
-};
-
 /**
  * enum suspend_resume_state - Suspend resume state
  * @HDD_WLAN_EARLY_SUSPEND: Early suspend state.

+ 14 - 235
core/hdd/src/wlan_hdd_wext.c

@@ -974,7 +974,7 @@ static const hdd_freq_chan_map_t freq_chan_map[] = {
 #define WLAN_SET_BAND_CONFIG  (SIOCIWFIRSTPRIV + 25)
 
 #define WLAN_PRIV_SET_MCBC_FILTER   (SIOCIWFIRSTPRIV + 26)
-#define WLAN_PRIV_CLEAR_MCBC_FILTER (SIOCIWFIRSTPRIV + 27)
+/* (SIOCIWFIRSTPRIV + 27) is currently unused */
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_TWO_INT_GET_NONE   (SIOCIWFIRSTPRIV + 28)
@@ -9295,165 +9295,6 @@ static int iw_set_fties(struct net_device *dev,
 	return ret;
 }
 
-#ifdef WLAN_FEATURE_PACKET_FILTERING
-static int iw_set_mc_filter_list(hdd_adapter_t *adapter,
-				 struct pkt_filter_mc_addr_list *req)
-{
-	int exit_code;
-	QDF_STATUS status;
-	tHalHandle hal;
-	tSirRcvFltMcAddrList *mc_addr_list;
-	int i;
-
-	ENTER();
-
-	mc_addr_list = qdf_mem_malloc(sizeof(*mc_addr_list));
-	if (!mc_addr_list) {
-		hdd_err("Out of memory");
-		exit_code = -ENOMEM;
-		goto exit_with_code;
-	}
-
-	mc_addr_list->action = HDD_SET_MCBC_FILTERS_TO_FW;
-	mc_addr_list->ulMulticastAddrCnt =
-		min(req->mc_addr_cnt, (uint8_t)HDD_MC_FILTER_MAX_MC_ADDRS);
-
-	hdd_info("Configuring %u MC addrs (originally %u)",
-		 mc_addr_list->ulMulticastAddrCnt, req->mc_addr_cnt);
-
-	for (i = 0; i < mc_addr_list->ulMulticastAddrCnt; i++) {
-		memcpy(&mc_addr_list->multicastAddr[i], req->mc_addrs[i],
-		       QDF_MAC_ADDR_SIZE);
-
-		hdd_info("MC addr %d: " MAC_ADDRESS_STR,
-			 i, MAC_ADDR_ARRAY(req->mc_addrs[i]));
-	}
-
-	hal = WLAN_HDD_GET_HAL_CTX(adapter);
-	status = sme_8023_multicast_list(hal, adapter->sessionId, mc_addr_list);
-	qdf_mem_free(mc_addr_list);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		hdd_err("Failed to configure MC address list");
-		exit_code = -EINVAL;
-		goto exit_with_code;
-	}
-
-	exit_code = 0;
-
-exit_with_code:
-	EXIT();
-	return exit_code;
-}
-
-static int iw_clear_mc_filter_list(hdd_adapter_t *adapter)
-{
-	int exit_code;
-	QDF_STATUS status;
-	tHalHandle hal;
-	tSirRcvFltMcAddrList *mc_addr_list;
-
-	ENTER();
-
-	mc_addr_list = qdf_mem_malloc(sizeof(*mc_addr_list));
-	if (!mc_addr_list) {
-		hdd_err("Out of memory");
-		exit_code = -ENOMEM;
-		goto exit_with_code;
-	}
-
-	mc_addr_list->action = HDD_DELETE_MCBC_FILTERS_FROM_FW;
-
-	hal = WLAN_HDD_GET_HAL_CTX(adapter);
-	status = sme_8023_multicast_list(hal, adapter->sessionId, mc_addr_list);
-	qdf_mem_free(mc_addr_list);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		hdd_err("Failed to clear MC address list");
-		exit_code = -EINVAL;
-		goto exit_with_code;
-	}
-
-	exit_code = 0;
-
-exit_with_code:
-	EXIT();
-	return exit_code;
-}
-#else
-static inline int iw_set_mc_filter_list(hdd_adapter_t *adapter,
-					struct pkt_filter_mc_addr_list *req)
-{
-	return 0;
-}
-
-static inline int iw_clear_mc_filter_list(hdd_adapter_t *adapter)
-{
-	return 0;
-}
-#endif /* WLAN_FEATURE_PACKET_FILTERING */
-
-static int iw_configure_mcbc_filter(hdd_adapter_t *adapter,
-				    struct pkt_filter_mc_addr_list *req)
-{
-	hdd_context_t *hdd_ctx;
-
-	ENTER();
-
-	hdd_info("Configuring mc/bc filter; setting:%u",
-		 req->mcbc_filter_setting);
-
-	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	hdd_conf_hostoffload(adapter, true);
-
-	EXIT();
-	return 0;
-}
-
-/**
- * __iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
- * @dev: device upon which the ioctl was received
- * @info: ioctl request information
- * @wrqu: ioctl request data
- * @extra: ioctl extra data
- *
- * Return: 0 on success, non-zero on error
- */
-static int __iw_set_dynamic_mcbc_filter(struct net_device *dev,
-					struct iw_request_info *info,
-					union iwreq_data *wrqu,
-					char *extra)
-{
-	int exit_code;
-	hdd_adapter_t *adapter;
-	struct pkt_filter_mc_addr_list *req;
-
-	ENTER();
-
-	req = (struct pkt_filter_mc_addr_list *)extra;
-	if (req->mcbc_filter_setting > HDD_MULTICAST_FILTER_LIST_CLEAR) {
-		hdd_err("Invalid filter setting: %u", req->mcbc_filter_setting);
-		exit_code = -EINVAL;
-		goto exit_with_code;
-	}
-
-	adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-
-	if (req->mcbc_filter_setting == HDD_MULTICAST_FILTER_LIST) {
-		exit_code = iw_set_mc_filter_list(adapter, req);
-		goto exit_with_code;
-	}
-
-	if (req->mcbc_filter_setting == HDD_MULTICAST_FILTER_LIST_CLEAR) {
-		exit_code = iw_clear_mc_filter_list(adapter);
-		goto exit_with_code;
-	}
-
-	exit_code = iw_configure_mcbc_filter(adapter, req);
-
-exit_with_code:
-	EXIT();
-	return exit_code;
-}
-
 /**
  * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
  * @dev: device upon which the ioctl was received
@@ -9461,6 +9302,9 @@ exit_with_code:
  * @wrqu: ioctl request data
  * @extra: ioctl extra data
  *
+ * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
+ * time being to provide guidance in migrating to standard APIs.
+ *
  * Return: 0 on success, non-zero on error
  */
 static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
@@ -9468,72 +9312,16 @@ static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
 				      union iwreq_data *wrqu,
 				      char *extra)
 {
-	int ret;
-
-	cds_ssr_protect(__func__);
-	ret = __iw_set_dynamic_mcbc_filter(dev, info, wrqu, extra);
-	cds_ssr_unprotect(__func__);
-
-	return ret;
-}
-
-/**
- * __iw_clear_dynamic_mcbc_filter() - Clear Dynamic MCBC Filter ioctl handler
- * @dev: device upon which the ioctl was received
- * @info: ioctl request information
- * @wrqu: ioctl request data
- * @extra: ioctl extra data
- *
- * Return: 0 on success, non-zero on error
- */
-static int __iw_clear_dynamic_mcbc_filter(struct net_device *dev,
-					  struct iw_request_info *info,
-					  union iwreq_data *wrqu,
-					  char *extra)
-{
-	int exit_code;
-	hdd_adapter_t *adapter;
+	hdd_err("\n"
+		"setMCBCFilter is obsolete. Use the following instead:\n"
+		"Configure multicast filtering via the ‘ip’ command.\n"
+		"\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
+		"\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
+		"Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
+		"\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
+		"\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
 
-	ENTER();
-
-	if (!capable(CAP_NET_ADMIN)) {
-		hdd_err("Net Admin permissions required");
-		exit_code = -EPERM;
-		goto exit_with_code;
-	}
-
-	/* clear basically means: reset to ini filter settings */
-	adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	hdd_conf_hostoffload(adapter, true);
-
-	exit_code = 0;
-
-exit_with_code:
-	EXIT();
-	return exit_code;
-}
-
-/**
- * iw_clear_dynamic_mcbc_filter() - Clear Dynamic MCBC Filter ioctl handler
- * @dev: device upon which the ioctl was received
- * @info: ioctl request information
- * @wrqu: ioctl request data
- * @extra: ioctl extra data
- *
- * Return: 0 on success, non-zero on error
- */
-static int iw_clear_dynamic_mcbc_filter(struct net_device *dev,
-					struct iw_request_info *info,
-					union iwreq_data *wrqu,
-					char *extra)
-{
-	int ret;
-
-	cds_ssr_protect(__func__);
-	ret = __iw_clear_dynamic_mcbc_filter(dev, info, wrqu, extra);
-	cds_ssr_unprotect(__func__);
-
-	return ret;
+	return -EINVAL;
 }
 
 /**
@@ -10822,8 +10610,6 @@ static const iw_handler we_private[] = {
 	[WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
 	[WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
 		iw_set_dynamic_mcbc_filter,
-	[WLAN_PRIV_CLEAR_MCBC_FILTER - SIOCIWFIRSTPRIV] =
-		iw_clear_dynamic_mcbc_filter,
 	[WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
 	[WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
 		iw_set_two_ints_getnone,
@@ -11882,16 +11668,9 @@ static const struct iw_priv_args we_private_args[] = {
 	,
 	{
 		WLAN_PRIV_SET_MCBC_FILTER,
-		IW_PRIV_TYPE_BYTE | sizeof(struct pkt_filter_mc_addr_list),
-		0,
-		"setMCBCFilter"
-	}
-	,
-	{
-		WLAN_PRIV_CLEAR_MCBC_FILTER,
 		0,
 		0,
-		"clearMCBCFilter"
+		"setMCBCFilter"
 	}
 	,