[PATCH] libertas: specific mesh scan for mshX interface
authorLuis Carlos Cobo <luisca@cozybit.com>
Thu, 2 Aug 2007 14:51:27 +0000 (10:51 -0400)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:49:40 +0000 (16:49 -0700)
With this patch, scanning with mshX interface will only return mesh networks. To
differentiate them, a specific mesh IE in beacons/probe responses is used. This
IE has been introduced in firmware release 5.110.14. Note:

Even though there can be at most a single mesh per channel, this scan might
return several networks in the same channel.

If all nodes in a mesh network are associated to an AP, they won't produce
beacons/probe responses, thus the network will not be listed. This will be fixed
in future firmware releases.

Scan on ethX interface is not filtered, so it will list both mesh and non-mesh
networks.

Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/defs.h
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/scan.h

index de0756ee15ad6be477ea59466a9abad327781469..a5d70c19768bc65522628aff67557062a1cf2a30 100644 (file)
@@ -156,6 +156,8 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
 #define MRVDRV_MAX_BEACON_INTERVAL             1000
 #define MRVDRV_BEACON_INTERVAL                 100
 
+#define MARVELL_MESH_IE_LENGTH         9
+
 /** INT status Bit Definition*/
 #define his_cmddnldrdy                 0x01
 #define his_cardevent                  0x02
index 2d6bc7811b2716b0f4ed88da2dde2c27a7309b47..a98feedf001c967fa6adfcf1656b4b239e9573d0 100644 (file)
@@ -1099,6 +1099,12 @@ static int libertas_process_bss(struct bss_descriptor * bss,
                                memcpy(bss->wpa_ie, elem, bss->wpa_ie_len);
                                lbs_dbg_hex("process_bss: WPA IE", bss->wpa_ie,
                                            elem->len);
+                       } else if (elem->len >= MARVELL_MESH_IE_LENGTH &&
+                           elem->data[0] == 0x00 &&
+                           elem->data[1] == 0x50 &&
+                           elem->data[2] == 0x43 &&
+                           elem->data[3] == 0x04) {
+                               bss->mesh = 1;
                        }
                        break;
 
@@ -1611,6 +1617,10 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
                        break;
                }
 
+               /* For mesh device, list only mesh networks */
+               if (dev == priv->mesh_dev && !iter_bss->mesh)
+                       continue;
+
                /* Prune old an old scan result */
                stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE;
                if (time_after(jiffies, stale_time)) {
index 2a095733f19437aebecc1152afbf183ba9dcbd59..23c539c226342960f9ec5f489dbf6c243697a401 100644 (file)
@@ -170,6 +170,8 @@ struct bss_descriptor {
        u8 rsn_ie[MAX_WPA_IE_LEN];
        size_t rsn_ie_len;
 
+       u8 mesh;
+
        struct list_head list;
 };