wlan: Multicast Address Filter cleanup
Instead of calling wlan_hdd_set_filter, using sme_8023MulticastList to
configure MC Address Filter list and not use up the filter IDs.
Change-Id: I45088586b5699a293abd27b3807b04d329b3601b
CRs-fixed: 506890
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index 0fa5fe7..20bba5b 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -2451,28 +2451,22 @@
case eCSR_ROAM_LOSTLINK:
case eCSR_ROAM_DISASSOCIATED:
{
- hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
"****eCSR_ROAM_DISASSOCIATED****");
halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
/* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
- if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) {
+ if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE)
+ {
+
hdd_conf_mcastbcast_filter((WLAN_HDD_GET_CTX(pAdapter)), FALSE);
(WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
}
#ifdef WLAN_FEATURE_PACKET_FILTERING
- if (pHddCtx->cfg_ini->isMcAddrListFilter)
- {
- /*Multicast addr filtering is enabled*/
- if (pAdapter->mc_addr_list.isFilterApplied)
- {
- /*Filter applied during suspend mode*/
- /*Clear it here*/
- wlan_hdd_set_mc_addr_list(pAdapter, FALSE);
- }
- }
+ /* Call to clear any MC Addr List filter applied after
+ * successful connection.
+ */
+ wlan_hdd_set_mc_addr_list(pAdapter, FALSE);
#endif
-
}
break;
case eCSR_ROAM_IBSS_LEAVE:
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index d875926..c5f26c6 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -865,19 +865,11 @@
wlanSuspendParam->configuredMcstBcstFilterSetting = pHddCtx->configuredMcastBcastFilter;
#ifdef WLAN_FEATURE_PACKET_FILTERING
- if (pHddCtx->cfg_ini->isMcAddrListFilter)
- {
- /*Multicast addr list filter is enabled during suspend*/
- if (((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) ||
- (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))
- && pAdapter->mc_addr_list.mc_cnt
- && (eConnectionState_Associated ==
- (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
- {
- /*set the filter*/
- wlan_hdd_set_mc_addr_list(pAdapter, TRUE);
- }
- }
+ /* During suspend, configure MC Addr list filter to the firmware
+ * function takes care of checking necessary conditions before
+ * configuring.
+ */
+ wlan_hdd_set_mc_addr_list(pAdapter, TRUE);
#endif
}
@@ -922,17 +914,11 @@
}
-#ifdef WLAN_FEATURE_PACKET_FILTERING
- if (pHddCtx->cfg_ini->isMcAddrListFilter)
- {
- /*Multicast addr filtering is enabled*/
- if (pAdapter->mc_addr_list.isFilterApplied)
- {
- /*Filter applied during suspend mode*/
- /*Clear it here*/
- wlan_hdd_set_mc_addr_list(pAdapter, FALSE);
- }
- }
+#ifdef WLAN_FEATURE_PACKET_FILTERING
+ /* Filer was applied during suspend inditication
+ * clear it when we resume.
+ */
+ wlan_hdd_set_mc_addr_list(pAdapter, FALSE);
#endif
}
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 1f16a33..fe64d15 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -5739,43 +5739,87 @@
void wlan_hdd_set_mc_addr_list(hdd_adapter_t *pAdapter, v_U8_t set)
{
- v_U8_t filterAction;
- tPacketFilterCfg request;
v_U8_t i;
- hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ tpSirRcvFltMcAddrList pMulticastAddrs = NULL;
+ tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+ hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
- filterAction = set ? HDD_RCV_FILTER_SET : HDD_RCV_FILTER_CLEAR;
-
- /*set mulitcast addr list*/
- for (i = 0; i < pAdapter->mc_addr_list.mc_cnt; i++)
+ if (NULL == hHal)
{
- memset(&request, 0, sizeof (tPacketFilterCfg));
- request.filterAction = filterAction;
- request.filterId = i;
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("HAL Handle is NULL"));
+ return;
+ }
+ if (NULL == pHddCtx)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD CTX is NULL"));
+ return;
+ }
+
+ /* Check if INI is enabled or not, other wise just return
+ */
+ if (pHddCtx->cfg_ini->isMcAddrListFilter)
+ {
+ pMulticastAddrs = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
+ if (NULL == pMulticastAddrs)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("Could not allocate Memory"));
+ return;
+ }
+
if (set)
{
- request.numParams = 1;
- request.paramsData[0].protocolLayer = HDD_FILTER_PROTO_TYPE_MAC;
- request.paramsData[0].cmpFlag = HDD_FILTER_CMP_TYPE_EQUAL;
- request.paramsData[0].dataOffset = WLAN_HDD_80211_FRM_DA_OFFSET;
- request.paramsData[0].dataLength = ETH_ALEN;
- memcpy(&(request.paramsData[0].compareData[0]),
- &(pAdapter->mc_addr_list.addr[i][0]), ETH_ALEN);
- /*set mulitcast filters*/
- hddLog(VOS_TRACE_LEVEL_INFO,
- "%s: %s multicast filter: addr ="
- MAC_ADDRESS_STR,
- __func__, set ? "setting" : "clearing",
- MAC_ADDR_ARRAY(request.paramsData[0].compareData));
+ /* Following pre-conditions should be satisfied before wei
+ * configure the MC address list.
+ */
+ if (((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) ||
+ (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))
+ && pAdapter->mc_addr_list.mc_cnt
+ && (eConnectionState_Associated ==
+ (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
+ {
+ pMulticastAddrs->ulMulticastAddrCnt =
+ pAdapter->mc_addr_list.mc_cnt;
+ for (i = 0; i < pAdapter->mc_addr_list.mc_cnt; i++)
+ {
+ memcpy(&(pMulticastAddrs->multicastAddr[i][0]),
+ &(pAdapter->mc_addr_list.addr[i][0]),
+ sizeof(pAdapter->mc_addr_list.addr[i]));
+ hddLog(VOS_TRACE_LEVEL_INFO,
+ "%s: %s multicast filter: addr ="
+ MAC_ADDRESS_STR,
+ __func__, set ? "setting" : "clearing",
+ MAC_ADDR_ARRAY(pMulticastAddrs->multicastAddr[i]));
+ }
+ /* Set multicast filter */
+ sme_8023MulticastList(hHal, pAdapter->sessionId,
+ pMulticastAddrs);
+ }
}
- wlan_hdd_set_filter(pHddCtx, &request, pAdapter->sessionId);
+ else
+ {
+ /* Need to clear only if it was previously configured
+ */
+ if (pAdapter->mc_addr_list.isFilterApplied)
+ {
+ pMulticastAddrs->ulMulticastAddrCnt = 0;
+ sme_8023MulticastList(hHal, pAdapter->sessionId,
+ pMulticastAddrs);
+ }
+
+ }
+ pAdapter->mc_addr_list.isFilterApplied = set ? TRUE : FALSE;
}
- pAdapter->mc_addr_list.isFilterApplied = set ? TRUE : FALSE;
+ else
+ {
+ hddLog(VOS_TRACE_LEVEL_INFO,
+ FL("isMcAddrListFilter is not enabled in INI"));
+ }
+ return;
}
static int iw_set_packet_filter_params(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);
tpPacketFilterCfg pRequest = (tpPacketFilterCfg)wrqu->data.pointer;