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/cmd.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/cmd.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 67 |
1 files changed, 48 insertions, 19 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index e8d0144eb8bb..cf261d3487fd 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -676,26 +676,60 @@ static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd, | |||
676 | return 0; | 676 | return 0; |
677 | } | 677 | } |
678 | 678 | ||
679 | static int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, | 679 | static __le16 lbs_rate_to_fw_bitmap(int rate, int lower_rates_ok) |
680 | struct cmd_ds_command *cmd, | ||
681 | u16 cmd_action) | ||
682 | { | 680 | { |
683 | struct cmd_ds_802_11_rate_adapt_rateset | 681 | /* Bit Rate |
684 | *rateadapt = &cmd->params.rateset; | 682 | * 15:13 Reserved |
683 | * 12 54 Mbps | ||
684 | * 11 48 Mbps | ||
685 | * 10 36 Mbps | ||
686 | * 9 24 Mbps | ||
687 | * 8 18 Mbps | ||
688 | * 7 12 Mbps | ||
689 | * 6 9 Mbps | ||
690 | * 5 6 Mbps | ||
691 | * 4 Reserved | ||
692 | * 3 11 Mbps | ||
693 | * 2 5.5 Mbps | ||
694 | * 1 2 Mbps | ||
695 | * 0 1 Mbps | ||
696 | **/ | ||
697 | |||
698 | uint16_t ratemask; | ||
699 | int i = lbs_data_rate_to_fw_index(rate); | ||
700 | if (lower_rates_ok) | ||
701 | ratemask = (0x1fef >> (12 - i)); | ||
702 | else | ||
703 | ratemask = (1 << i); | ||
704 | return cpu_to_le16(ratemask); | ||
705 | } | ||
706 | |||
707 | int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, | ||
708 | uint16_t cmd_action) | ||
709 | { | ||
710 | struct cmd_ds_802_11_rate_adapt_rateset cmd; | ||
711 | int ret; | ||
685 | 712 | ||
686 | lbs_deb_enter(LBS_DEB_CMD); | 713 | lbs_deb_enter(LBS_DEB_CMD); |
687 | cmd->size = | ||
688 | cpu_to_le16(sizeof(struct cmd_ds_802_11_rate_adapt_rateset) | ||
689 | + S_DS_GEN); | ||
690 | cmd->command = cpu_to_le16(CMD_802_11_RATE_ADAPT_RATESET); | ||
691 | 714 | ||
692 | rateadapt->action = cpu_to_le16(cmd_action); | 715 | if (!priv->cur_rate && !priv->enablehwauto) |
693 | rateadapt->enablehwauto = cpu_to_le16(priv->enablehwauto); | 716 | return -EINVAL; |
694 | rateadapt->bitmap = cpu_to_le16(priv->ratebitmap); | ||
695 | 717 | ||
696 | lbs_deb_leave(LBS_DEB_CMD); | 718 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
697 | return 0; | 719 | |
720 | cmd.action = cpu_to_le16(cmd_action); | ||
721 | cmd.enablehwauto = cpu_to_le16(priv->enablehwauto); | ||
722 | cmd.bitmap = lbs_rate_to_fw_bitmap(priv->cur_rate, priv->enablehwauto); | ||
723 | ret = lbs_cmd_with_response(priv, CMD_802_11_RATE_ADAPT_RATESET, &cmd); | ||
724 | if (!ret && cmd_action == CMD_ACT_GET) { | ||
725 | priv->ratebitmap = le16_to_cpu(cmd.bitmap); | ||
726 | priv->enablehwauto = le16_to_cpu(cmd.enablehwauto); | ||
727 | } | ||
728 | |||
729 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
730 | return ret; | ||
698 | } | 731 | } |
732 | EXPORT_SYMBOL_GPL(lbs_cmd_802_11_rate_adapt_rateset); | ||
699 | 733 | ||
700 | /** | 734 | /** |
701 | * @brief Set the data rate | 735 | * @brief Set the data rate |
@@ -1378,11 +1412,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1378 | cmd_action, pdata_buf); | 1412 | cmd_action, pdata_buf); |
1379 | break; | 1413 | break; |
1380 | 1414 | ||
1381 | case CMD_802_11_RATE_ADAPT_RATESET: | ||
1382 | ret = lbs_cmd_802_11_rate_adapt_rateset(priv, | ||
1383 | cmdptr, cmd_action); | ||
1384 | break; | ||
1385 | |||
1386 | case CMD_802_11_MONITOR_MODE: | 1415 | case CMD_802_11_MONITOR_MODE: |
1387 | ret = lbs_cmd_802_11_monitor_mode(cmdptr, | 1416 | ret = lbs_cmd_802_11_monitor_mode(cmdptr, |
1388 | cmd_action, pdata_buf); | 1417 | cmd_action, pdata_buf); |