net: wireless: bcmdhd: Fix filtering setting in case of P2P
authorDmitry Shmidt <dimitrysh@google.com>
Thu, 10 May 2012 20:20:40 +0000 (13:20 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Thu, 10 May 2012 20:36:51 +0000 (13:36 -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 5cace1f91a5c07c8207b74c0e0b800d4aa7f336d..0470b33d22c2fbdbae999a12ca582a3ccdca6f98 100644 (file)
@@ -449,6 +449,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 183891df160a85725ced0630c0af5d4d23021560..bc1be94802b4a63292f4eacb07d14a8d571cb2f0 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 32e4eb8fb69ba0e9fd197a6c7d94d20dbea65688..c5f2e86c8b7a49f610275f531f1437c856733648 100644 (file)
@@ -512,7 +512,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++) {
@@ -3057,7 +3058,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
@@ -4400,9 +4400,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
@@ -4410,15 +4409,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)