net: wireless: bcmdhd: Fix filtering setting in case of P2P
Dmitry Shmidt [Thu, 10 May 2012 20:20:40 +0000 (13:20 -0700)]
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

drivers/net/wireless/bcmdhd/dhd.h
drivers/net/wireless/bcmdhd/dhd_cfg80211.c
drivers/net/wireless/bcmdhd/dhd_linux.c

index 3911f33..5ff5c21 100644 (file)
@@ -450,6 +450,7 @@ extern int dhd_dev_get_pno_status(struct net_device *dev);
 #define DHD_MULTICAST4_FILTER_NUM      2
 #define DHD_MULTICAST6_FILTER_NUM      3
 #define DHD_MDNS_FILTER_NUM            4
+extern int dhd_os_set_packet_filter(dhd_pub_t *dhdp, int val);
 extern int net_os_set_packet_filter(struct net_device *dev, int val);
 extern int net_os_rxfilter_add_remove(struct net_device *dev, int val, int num);
 
index 183891d..bc1be94 100644 (file)
@@ -84,6 +84,8 @@ s32 dhd_cfg80211_set_p2p_info(struct wl_priv *wl, int val)
        dhd_arp_offload_enable(dhd, false);
 #endif /* ARP_OFFLOAD_SUPPORT */
 
+       dhd_os_set_packet_filter(dhd, 0);
+
        /* Setup timeout if Beacons are lost and roam is off to report link down */
        bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, sizeof(iovbuf));
        dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
@@ -107,6 +109,8 @@ s32 dhd_cfg80211_clean_p2p_info(struct wl_priv *wl)
        dhd_arp_offload_enable(dhd, true);
 #endif /* ARP_OFFLOAD_SUPPORT */
 
+       dhd_os_set_packet_filter(dhd, 1);
+
        /* Setup timeout if Beacons are lost and roam is off to report link down */
        bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, sizeof(iovbuf));
        dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
index 3792e2c..a042955 100644 (file)
@@ -513,7 +513,8 @@ static void dhd_set_packet_filter(int value, dhd_pub_t *dhd)
        DHD_TRACE(("%s: %d\n", __FUNCTION__, value));
        /* 1 - Enable packet filter, only allow unicast packet to send up */
        /* 0 - Disable packet filter */
-       if (dhd_pkt_filter_enable) {
+       if (dhd_pkt_filter_enable && (!value ||
+           (dhd_check_ap_wfd_mode_set(dhd) == FALSE))) {
                int i;
 
                for (i = 0; i < dhd->pktfilter_count; i++) {
@@ -3059,7 +3060,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
                        DHD_ERROR(("%s APSTA for WFD failed ret= %d\n", __FUNCTION__, ret));
                } else {
                        dhd->op_mode |= WFD_MASK;
-                       dhd_pkt_filter_enable = FALSE;
                }
        }
 #endif
@@ -4402,9 +4402,8 @@ int net_os_rxfilter_add_remove(struct net_device *dev, int add_remove, int num)
        return ret;
 }
 
-int net_os_set_packet_filter(struct net_device *dev, int val)
+int dhd_os_set_packet_filter(dhd_pub_t *dhdp, int val)
 {
-       dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
        int ret = 0;
 
        /* Packet filtering is set only if we still in early-suspend and
@@ -4412,15 +4411,22 @@ int net_os_set_packet_filter(struct net_device *dev, int val)
         * We can always turn it OFF in case of early-suspend, but we turn it
         * back ON only if suspend_disable_flag was not set
        */
-       if (dhd && dhd->pub.up) {
-               if (dhd->pub.in_suspend) {
-                       if (!val || (val && !dhd->pub.suspend_disable_flag))
-                               dhd_set_packet_filter(val, &dhd->pub);
+       if (dhdp && dhdp->up) {
+               if (dhdp->in_suspend) {
+                       if (!val || (val && !dhdp->suspend_disable_flag))
+                               dhd_set_packet_filter(val, dhdp);
                }
        }
        return ret;
+
 }
 
+int net_os_set_packet_filter(struct net_device *dev, int val)
+{
+       dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+
+       return dhd_os_set_packet_filter(&dhd->pub, val);
+}
 
 void
 dhd_dev_init_ioctl(struct net_device *dev)