diff options
| author | David Woodhouse <dwmw2@infradead.org> | 2007-12-11 19:56:28 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:06:56 -0500 |
| commit | 823eaa2cc261e3723772aa4aaa4d76c5815b117f (patch) | |
| tree | 678d61c898704a66408df65206759f0e5e59472a /drivers/net | |
| parent | f5956bf1e4575175135d636db1b7f3ab950e0dc3 (diff) | |
libertas: allow setting channel on mshX device
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
| -rw-r--r-- | drivers/net/wireless/libertas/wext.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 0a060726cf32..262d4cc58046 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
| @@ -959,6 +959,57 @@ out: | |||
| 959 | return ret; | 959 | return ret; |
| 960 | } | 960 | } |
| 961 | 961 | ||
| 962 | static int lbs_mesh_set_freq(struct net_device *dev, | ||
| 963 | struct iw_request_info *info, | ||
| 964 | struct iw_freq *fwrq, char *extra) | ||
| 965 | { | ||
| 966 | struct lbs_private *priv = dev->priv; | ||
| 967 | struct chan_freq_power *cfp; | ||
| 968 | int ret = -EINVAL; | ||
| 969 | |||
| 970 | lbs_deb_enter(LBS_DEB_WEXT); | ||
| 971 | |||
| 972 | /* If setting by frequency, convert to a channel */ | ||
| 973 | if (fwrq->e == 1) { | ||
| 974 | long f = fwrq->m / 100000; | ||
| 975 | |||
| 976 | cfp = find_cfp_by_band_and_freq(priv, 0, f); | ||
| 977 | if (!cfp) { | ||
| 978 | lbs_deb_wext("invalid freq %ld\n", f); | ||
| 979 | goto out; | ||
| 980 | } | ||
| 981 | |||
| 982 | fwrq->e = 0; | ||
| 983 | fwrq->m = (int) cfp->channel; | ||
| 984 | } | ||
| 985 | |||
| 986 | /* Setting by channel number */ | ||
| 987 | if (fwrq->m > 1000 || fwrq->e > 0) { | ||
| 988 | goto out; | ||
| 989 | } | ||
| 990 | |||
| 991 | cfp = lbs_find_cfp_by_band_and_channel(priv, 0, fwrq->m); | ||
| 992 | if (!cfp) { | ||
| 993 | goto out; | ||
| 994 | } | ||
| 995 | |||
| 996 | if (fwrq->m != priv->curbssparams.channel) { | ||
| 997 | lbs_deb_wext("mesh channel change forces eth disconnect\n"); | ||
| 998 | if (priv->mode == IW_MODE_INFRA) | ||
| 999 | lbs_send_deauthentication(priv); | ||
| 1000 | else if (priv->mode == IW_MODE_ADHOC) | ||
| 1001 | lbs_stop_adhoc_network(priv); | ||
| 1002 | } | ||
| 1003 | priv->curbssparams.channel = fwrq->m; | ||
| 1004 | lbs_mesh_config(priv, 0); | ||
| 1005 | lbs_mesh_config(priv, 1); | ||
| 1006 | ret = 0; | ||
| 1007 | |||
| 1008 | out: | ||
| 1009 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | ||
| 1010 | return ret; | ||
| 1011 | } | ||
| 1012 | |||
| 962 | static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, | 1013 | static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, |
| 963 | struct iw_param *vwrq, char *extra) | 1014 | struct iw_param *vwrq, char *extra) |
| 964 | { | 1015 | { |
| @@ -2097,7 +2148,7 @@ static const iw_handler mesh_wlan_handler[] = { | |||
| 2097 | (iw_handler) lbs_get_name, /* SIOCGIWNAME */ | 2148 | (iw_handler) lbs_get_name, /* SIOCGIWNAME */ |
| 2098 | (iw_handler) NULL, /* SIOCSIWNWID */ | 2149 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 2099 | (iw_handler) NULL, /* SIOCGIWNWID */ | 2150 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 2100 | (iw_handler) lbs_set_freq, /* SIOCSIWFREQ */ | 2151 | (iw_handler) lbs_mesh_set_freq, /* SIOCSIWFREQ */ |
| 2101 | (iw_handler) lbs_get_freq, /* SIOCGIWFREQ */ | 2152 | (iw_handler) lbs_get_freq, /* SIOCGIWFREQ */ |
| 2102 | (iw_handler) NULL, /* SIOCSIWMODE */ | 2153 | (iw_handler) NULL, /* SIOCSIWMODE */ |
| 2103 | (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */ | 2154 | (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */ |
