[PATCH] libertas: split wext for eth and msh
authorLuis Carlos Cobo Rus <luisca@cozybit.com>
Sat, 26 May 2007 03:08:34 +0000 (23:08 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jun 2007 18:28:44 +0000 (14:28 -0400)
Separate wireless handlers of mshX and ethX. ethX remains as before.

For mshX, it has been disabled set/get essid, wap and set mode. Get mode always
returns "Repeater" and by now we use the Nickname to show if the mesh is active
("Mesh") or not (empty). The rest remains as before.

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

index 5dde49b..61cf95b 100644 (file)
@@ -925,7 +925,7 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
        SET_NETDEV_DEV(priv->mesh_dev, dev);
 
 #ifdef WIRELESS_EXT
-       mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
+       mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
 #endif
 #define NETIF_F_DYNALLOC 16
 
index 2edc10c..e91de10 100644 (file)
@@ -372,6 +372,30 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
        return 0;
 }
 
+static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
+                        struct iw_point *dwrq, char *extra)
+{
+       wlan_private *priv = dev->priv;
+       wlan_adapter *adapter = priv->adapter;
+
+       lbs_deb_enter(LBS_DEB_WEXT);
+
+       /* Use nickname to indicate that mesh is on */
+
+       if (adapter->connect_status == libertas_connected) {
+               strncpy(extra, "Mesh", 12);
+               extra[12] = '\0';
+               dwrq->length = strlen(extra) + 1;
+       }
+
+       else {
+               extra[0] = '\0';
+               dwrq->length = 1 ;
+       }
+
+       lbs_deb_leave(LBS_DEB_WEXT);
+       return 0;
+}
 static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
                        struct iw_param *vwrq, char *extra)
 {
@@ -492,6 +516,18 @@ static int wlan_get_mode(struct net_device *dev,
        return 0;
 }
 
+static int mesh_wlan_get_mode(struct net_device *dev,
+                             struct iw_request_info *info, u32 * uwrq,
+                             char *extra)
+{
+       lbs_deb_enter(LBS_DEB_WEXT);
+
+       *uwrq = IW_MODE_REPEAT ;
+
+       lbs_deb_leave(LBS_DEB_WEXT);
+       return 0;
+}
+
 static int wlan_get_txpow(struct net_device *dev,
                          struct iw_request_info *info,
                          struct iw_param *vwrq, char *extra)
@@ -2342,6 +2378,63 @@ static const iw_handler wlan_handler[] = {
        (iw_handler) NULL,              /* SIOCSIWPMKSA */
 };
 
+static const iw_handler mesh_wlan_handler[] = {
+       (iw_handler) NULL,      /* SIOCSIWCOMMIT */
+       (iw_handler) wlan_get_name,     /* SIOCGIWNAME */
+       (iw_handler) NULL,      /* SIOCSIWNWID */
+       (iw_handler) NULL,      /* SIOCGIWNWID */
+       (iw_handler) wlan_set_freq,     /* SIOCSIWFREQ */
+       (iw_handler) wlan_get_freq,     /* SIOCGIWFREQ */
+       (iw_handler) NULL,              /* SIOCSIWMODE */
+       (iw_handler) mesh_wlan_get_mode,        /* SIOCGIWMODE */
+       (iw_handler) NULL,      /* SIOCSIWSENS */
+       (iw_handler) NULL,      /* SIOCGIWSENS */
+       (iw_handler) NULL,      /* SIOCSIWRANGE */
+       (iw_handler) wlan_get_range,    /* SIOCGIWRANGE */
+       (iw_handler) NULL,      /* SIOCSIWPRIV */
+       (iw_handler) NULL,      /* SIOCGIWPRIV */
+       (iw_handler) NULL,      /* SIOCSIWSTATS */
+       (iw_handler) NULL,      /* SIOCGIWSTATS */
+       iw_handler_set_spy,     /* SIOCSIWSPY */
+       iw_handler_get_spy,     /* SIOCGIWSPY */
+       iw_handler_set_thrspy,  /* SIOCSIWTHRSPY */
+       iw_handler_get_thrspy,  /* SIOCGIWTHRSPY */
+       (iw_handler) NULL,      /* SIOCSIWAP */
+       (iw_handler) NULL,      /* SIOCGIWAP */
+       (iw_handler) NULL,      /* SIOCSIWMLME */
+       (iw_handler) NULL,      /* SIOCGIWAPLIST - deprecated */
+       (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */
+       (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */
+       (iw_handler) NULL,              /* SIOCSIWESSID */
+       (iw_handler) NULL,              /* SIOCGIWESSID */
+       (iw_handler) NULL,              /* SIOCSIWNICKN */
+       (iw_handler) mesh_get_nick,     /* SIOCGIWNICKN */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) wlan_set_rate,     /* SIOCSIWRATE */
+       (iw_handler) wlan_get_rate,     /* SIOCGIWRATE */
+       (iw_handler) wlan_set_rts,      /* SIOCSIWRTS */
+       (iw_handler) wlan_get_rts,      /* SIOCGIWRTS */
+       (iw_handler) wlan_set_frag,     /* SIOCSIWFRAG */
+       (iw_handler) wlan_get_frag,     /* SIOCGIWFRAG */
+       (iw_handler) wlan_set_txpow,    /* SIOCSIWTXPOW */
+       (iw_handler) wlan_get_txpow,    /* SIOCGIWTXPOW */
+       (iw_handler) wlan_set_retry,    /* SIOCSIWRETRY */
+       (iw_handler) wlan_get_retry,    /* SIOCGIWRETRY */
+       (iw_handler) wlan_set_encode,   /* SIOCSIWENCODE */
+       (iw_handler) wlan_get_encode,   /* SIOCGIWENCODE */
+       (iw_handler) wlan_set_power,    /* SIOCSIWPOWER */
+       (iw_handler) wlan_get_power,    /* SIOCGIWPOWER */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) wlan_set_genie,    /* SIOCSIWGENIE */
+       (iw_handler) wlan_get_genie,    /* SIOCGIWGENIE */
+       (iw_handler) wlan_set_auth,     /* SIOCSIWAUTH */
+       (iw_handler) wlan_get_auth,     /* SIOCGIWAUTH */
+       (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */
+       (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */
+       (iw_handler) NULL,              /* SIOCSIWPMKSA */
+};
 struct iw_handler_def libertas_handler_def = {
        .num_standard   = sizeof(wlan_handler) / sizeof(iw_handler),
        .num_private    = sizeof(wlan_private_handler) / sizeof(iw_handler),
@@ -2352,3 +2445,14 @@ struct iw_handler_def libertas_handler_def = {
        .private_args   = (struct iw_priv_args *)wlan_private_args,
        .get_wireless_stats = wlan_get_wireless_stats,
 };
+
+struct iw_handler_def mesh_handler_def = {
+       .num_standard   = sizeof(mesh_wlan_handler) / sizeof(iw_handler),
+       .num_private    = sizeof(wlan_private_handler) / sizeof(iw_handler),
+       .num_private_args = sizeof(wlan_private_args) /
+               sizeof(struct iw_priv_args),
+       .standard       = (iw_handler *) mesh_wlan_handler,
+       .private        = (iw_handler *) wlan_private_handler,
+       .private_args   = (struct iw_priv_args *)wlan_private_args,
+       .get_wireless_stats = wlan_get_wireless_stats,
+};
index fb7e828..d555056 100644 (file)
@@ -58,6 +58,7 @@ struct wlan_ioctl_regrdwr {
 };
 
 extern struct iw_handler_def libertas_handler_def;
+extern struct iw_handler_def mesh_handler_def;
 int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
 int wlan_radio_ioctl(wlan_private * priv, u8 option);