diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2012-06-07 00:12:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-06-11 14:59:44 -0400 |
commit | 658f37b736ce335edcdf1425228e8652ec6adf24 (patch) | |
tree | fe00c1c14e60c8f7dbfffe7c4c702e932d865dec /drivers/net/wireless/mwifiex/scan.c | |
parent | 3249ba7376caa93af387d8e6b5e41b290934f88c (diff) |
mwifiex: scan less channels per scan command to improve Tx traffic
Currently 4 channels are scanned per scan command. if scan request
is issued by user during Tx traffic, radio will be out of channel
for "4 * per_chan_scan_time" for each scan command and will not be
able to receive Rx packets. This adds delay in data traffic. We can
minimize it by reducing number of channels scanned per scan command
in this scenario.
We can not always scan 1 channel per scan command due to limitation
of number of command buffers. So we add code to decide number of
channels scanned per scan command in associated state.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index ea2f1bdef8a2..efaf26ccd6ba 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -28,7 +28,10 @@ | |||
28 | /* The maximum number of channels the firmware can scan per command */ | 28 | /* The maximum number of channels the firmware can scan per command */ |
29 | #define MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN 14 | 29 | #define MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN 14 |
30 | 30 | ||
31 | #define MWIFIEX_CHANNELS_PER_SCAN_CMD 4 | 31 | #define MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD 4 |
32 | #define MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD 15 | ||
33 | #define MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD 27 | ||
34 | #define MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD 35 | ||
32 | 35 | ||
33 | /* Memory needed to store a max sized Channel List TLV for a firmware scan */ | 36 | /* Memory needed to store a max sized Channel List TLV for a firmware scan */ |
34 | #define CHAN_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_header) \ | 37 | #define CHAN_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_header) \ |
@@ -471,7 +474,7 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv, | |||
471 | * This routine is used for any scan that is not provided with a | 474 | * This routine is used for any scan that is not provided with a |
472 | * specific channel list to scan. | 475 | * specific channel list to scan. |
473 | */ | 476 | */ |
474 | static void | 477 | static int |
475 | mwifiex_scan_create_channel_list(struct mwifiex_private *priv, | 478 | mwifiex_scan_create_channel_list(struct mwifiex_private *priv, |
476 | const struct mwifiex_user_scan_cfg | 479 | const struct mwifiex_user_scan_cfg |
477 | *user_scan_in, | 480 | *user_scan_in, |
@@ -528,6 +531,7 @@ mwifiex_scan_create_channel_list(struct mwifiex_private *priv, | |||
528 | } | 531 | } |
529 | 532 | ||
530 | } | 533 | } |
534 | return chan_idx; | ||
531 | } | 535 | } |
532 | 536 | ||
533 | /* | 537 | /* |
@@ -727,6 +731,7 @@ mwifiex_config_scan(struct mwifiex_private *priv, | |||
727 | u32 num_probes; | 731 | u32 num_probes; |
728 | u32 ssid_len; | 732 | u32 ssid_len; |
729 | u32 chan_idx; | 733 | u32 chan_idx; |
734 | u32 chan_num; | ||
730 | u32 scan_type; | 735 | u32 scan_type; |
731 | u16 scan_dur; | 736 | u16 scan_dur; |
732 | u8 channel; | 737 | u8 channel; |
@@ -850,7 +855,7 @@ mwifiex_config_scan(struct mwifiex_private *priv, | |||
850 | if (*filtered_scan) | 855 | if (*filtered_scan) |
851 | *max_chan_per_scan = MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN; | 856 | *max_chan_per_scan = MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN; |
852 | else | 857 | else |
853 | *max_chan_per_scan = MWIFIEX_CHANNELS_PER_SCAN_CMD; | 858 | *max_chan_per_scan = MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD; |
854 | 859 | ||
855 | /* If the input config or adapter has the number of Probes set, | 860 | /* If the input config or adapter has the number of Probes set, |
856 | add tlv */ | 861 | add tlv */ |
@@ -962,13 +967,28 @@ mwifiex_config_scan(struct mwifiex_private *priv, | |||
962 | dev_dbg(adapter->dev, | 967 | dev_dbg(adapter->dev, |
963 | "info: Scan: Scanning current channel only\n"); | 968 | "info: Scan: Scanning current channel only\n"); |
964 | } | 969 | } |
965 | 970 | chan_num = chan_idx; | |
966 | } else { | 971 | } else { |
967 | dev_dbg(adapter->dev, | 972 | dev_dbg(adapter->dev, |
968 | "info: Scan: Creating full region channel list\n"); | 973 | "info: Scan: Creating full region channel list\n"); |
969 | mwifiex_scan_create_channel_list(priv, user_scan_in, | 974 | chan_num = mwifiex_scan_create_channel_list(priv, user_scan_in, |
970 | scan_chan_list, | 975 | scan_chan_list, |
971 | *filtered_scan); | 976 | *filtered_scan); |
977 | } | ||
978 | |||
979 | /* | ||
980 | * In associated state we will reduce the number of channels scanned per | ||
981 | * scan command to avoid any traffic delay/loss. This number is decided | ||
982 | * based on total number of channels to be scanned due to constraints | ||
983 | * of command buffers. | ||
984 | */ | ||
985 | if (priv->media_connected) { | ||
986 | if (chan_num < MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD) | ||
987 | *max_chan_per_scan = 1; | ||
988 | else if (chan_num < MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD) | ||
989 | *max_chan_per_scan = 2; | ||
990 | else if (chan_num < MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD) | ||
991 | *max_chan_per_scan = 3; | ||
972 | } | 992 | } |
973 | } | 993 | } |
974 | 994 | ||