diff options
author | Javier Cardona <javier@cozybit.com> | 2008-05-24 05:59:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-03 15:00:17 -0400 |
commit | 85319f933a703a92652a8f23339f1ec1694cd594 (patch) | |
tree | dbf8cfc55fa2dd3c5b72379ba98c920bbf027b11 /drivers/net/wireless/libertas/wext.c | |
parent | 553381c430f0e65e87ed1b5cee841a04c8a47b58 (diff) |
libertas: rate adaptation configuration via iwconfig.
Implemented rate adaptation support via 'iwconfig rate' API. It is now
possible to specify a bit-rate value and append 'auto'. That will configure
rate adaptation to use all bit-rates equal or lower than than selected value.
Made lbs_cmd_802_11_rate_adapt_rateset a direct command.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index d4b19f11b785..8b3ed77860b3 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -1021,29 +1021,38 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1021 | 1021 | ||
1022 | lbs_deb_enter(LBS_DEB_WEXT); | 1022 | lbs_deb_enter(LBS_DEB_WEXT); |
1023 | lbs_deb_wext("vwrq->value %d\n", vwrq->value); | 1023 | lbs_deb_wext("vwrq->value %d\n", vwrq->value); |
1024 | lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed); | ||
1025 | |||
1026 | if (vwrq->fixed && vwrq->value == -1) | ||
1027 | goto out; | ||
1024 | 1028 | ||
1025 | /* Auto rate? */ | 1029 | /* Auto rate? */ |
1026 | if (vwrq->value == -1) { | 1030 | priv->enablehwauto = !vwrq->fixed; |
1027 | priv->auto_rate = 1; | 1031 | |
1032 | if (vwrq->value == -1) | ||
1028 | priv->cur_rate = 0; | 1033 | priv->cur_rate = 0; |
1029 | } else { | 1034 | else { |
1030 | if (vwrq->value % 100000) | 1035 | if (vwrq->value % 100000) |
1031 | goto out; | 1036 | goto out; |
1032 | 1037 | ||
1038 | new_rate = vwrq->value / 500000; | ||
1039 | priv->cur_rate = new_rate; | ||
1040 | /* the rest is only needed for lbs_set_data_rate() */ | ||
1033 | memset(rates, 0, sizeof(rates)); | 1041 | memset(rates, 0, sizeof(rates)); |
1034 | copy_active_data_rates(priv, rates); | 1042 | copy_active_data_rates(priv, rates); |
1035 | new_rate = vwrq->value / 500000; | ||
1036 | if (!memchr(rates, new_rate, sizeof(rates))) { | 1043 | if (!memchr(rates, new_rate, sizeof(rates))) { |
1037 | lbs_pr_alert("fixed data rate 0x%X out of range\n", | 1044 | lbs_pr_alert("fixed data rate 0x%X out of range\n", |
1038 | new_rate); | 1045 | new_rate); |
1039 | goto out; | 1046 | goto out; |
1040 | } | 1047 | } |
1041 | |||
1042 | priv->cur_rate = new_rate; | ||
1043 | priv->auto_rate = 0; | ||
1044 | } | 1048 | } |
1045 | 1049 | ||
1046 | ret = lbs_set_data_rate(priv, new_rate); | 1050 | /* Try the newer command first (Firmware Spec 5.1 and above) */ |
1051 | ret = lbs_cmd_802_11_rate_adapt_rateset(priv, CMD_ACT_SET); | ||
1052 | |||
1053 | /* Fallback to older version */ | ||
1054 | if (ret) | ||
1055 | ret = lbs_set_data_rate(priv, new_rate); | ||
1047 | 1056 | ||
1048 | out: | 1057 | out: |
1049 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 1058 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
@@ -1060,7 +1069,7 @@ static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, | |||
1060 | if (priv->connect_status == LBS_CONNECTED) { | 1069 | if (priv->connect_status == LBS_CONNECTED) { |
1061 | vwrq->value = priv->cur_rate * 500000; | 1070 | vwrq->value = priv->cur_rate * 500000; |
1062 | 1071 | ||
1063 | if (priv->auto_rate) | 1072 | if (priv->enablehwauto) |
1064 | vwrq->fixed = 0; | 1073 | vwrq->fixed = 0; |
1065 | else | 1074 | else |
1066 | vwrq->fixed = 1; | 1075 | vwrq->fixed = 1; |