[PATCH] hostapd: Add cell_density data rates option

David Bauer mail at david-bauer.net
Sun Oct 25 15:29:44 EDT 2020


Hi Nick,

see my inline comment

On 10/19/20 1:56 AM, Nick Lowe wrote:
>  .../network/services/hostapd/files/hostapd.sh | 70 +++++++++++++++----
>  1 file changed, 57 insertions(+), 13 deletions(-)
> 
> diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
> index b33e8e1edc..2bf67601c5 100644
> --- a/package/network/services/hostapd/files/hostapd.sh
> +++ b/package/network/services/hostapd/files/hostapd.sh
> @@ -98,6 +98,7 @@ hostapd_common_add_device_config() {
>  	config_add_int local_pwr_constraint
>  	config_add_string require_mode
>  	config_add_boolean legacy_rates
> +	config_add_int cell_density
>  
>  	config_add_string acs_chan_bias
>  	config_add_array hostapd_options
> @@ -113,7 +114,7 @@ hostapd_prepare_device_config() {
>  	local base_cfg=
>  
>  	json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
> -		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode
> +		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density
>  
>  	hostapd_set_log_options base_cfg
>  
> @@ -122,8 +123,7 @@ hostapd_prepare_device_config() {
>  	set_default doth 1
>  	set_default legacy_rates 1
>  	set_default airtime_mode 0
> -
> -	[ "$hwmode" = "b" ] && legacy_rates=1
> +	set_default cell_density 0
>  
>  	[ -n "$country" ] && {
>  		append base_cfg "country_code=$country" "$N"
> @@ -144,16 +144,60 @@ hostapd_prepare_device_config() {
>  	json_get_values rate_list supported_rates
>  
>  	[ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N"
> -	[ "$legacy_rates" -eq 0 ] && set_default require_mode g
> -
> -	[ "$hwmode" = "g" ] && {
> -		[ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
> -		[ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000"
> -	}
> -
> -	case "$require_mode" in
> -		n) append base_cfg "require_ht=1" "$N";;
> -		ac) append base_cfg "require_vht=1" "$N";;
> +	if [ "$hwmode" = "g" ] || [ "$hwmode" = "a" ]; then
> +		[ -n "$require_mode" ] && legacy_rates=0
> +		case "$require_mode" in
> +			n) append base_cfg "require_ht=1" "$N";;
> +			ac) append base_cfg "require_vht=1" "$N";;
> +		esac
> +	fi
> +	case "$hwmode" in
> +		b)
> +			if [ "$cell_density" -eq 1 ]; then
> +				set_default rate_list "5500 11000"
> +				set_default basic_rate_list "5500 11000"
> +			elif [ "$cell_density" -ge 2 ]; then
> +				set_default rate_list "11000"
> +				set_default basic_rate_list "11000"
> +			fi
> +		;;
> +		g)
> +			if [ "$cell_density" -eq 0 ] && [ "$legacy_rates" -eq 0 ]; then
> +				set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
> +				set_default basic_rate_list "6000 12000 24000"
> +			elif [ "$cell_density" -eq 1 ]; then
> +				if [ "$legacy_rates" -eq 0 ]; then
> +					set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
> +					set_default basic_rate_list "6000 12000 24000"
> +				else
> +					set_default rate_list "5500 6000 9000 11000 12000 18000 24000 36000 48000 54000"
> +					set_default basic_rate_list "5500 11000"
> +				fi
> +			elif [ "$cell_density" -eq 2 ] || [ "$legacy_rates" -ne 0 ]; then

This branch will be taken if cell_density is set to 0 and legacy_rates is set to 1. This looks wrong to me,
as the condition below will never evaluate to true.

Best wishes
David

> +				if [ "$legacy_rates" -eq 0 ]; then
> +					set_default rate_list "12000 18000 24000 36000 48000 54000"
> +					set_default basic_rate_list "12000 24000"
> +				else
> +					set_default rate_list "11000 12000 18000 24000 36000 48000 54000"
> +					set_default basic_rate_list "11000"
> +				fi
> +			elif [ "$cell_density" -ge 3 ]; then
> +				set_default rate_list "24000 36000 48000 54000"
> +				set_default basic_rate_list "24000"
> +			fi
> +		;;
> +		a)
> +			if [ "$cell_density" -eq 1 ]; then
> +				set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000"
> +				set_default basic_rate_list "6000 12000 24000"
> +			elif [ "$cell_density" -eq 2 ]; then
> +				set_default rate_list "12000 18000 24000 36000 48000 54000"
> +				set_default basic_rate_list "12000 24000"
> +			elif [ "$cell_density" -ge 3 ]; then
> +				set_default rate_list "24000 36000 48000 54000"
> +				set_default basic_rate_list "24000"
> +			fi
> +		;;
>  	esac
>  
>  	for r in $rate_list; do
> 



More information about the openwrt-devel mailing list