[RFC] hostapd: allow configuring driver to VHT

Mahesh Palivela maheshp
Wed Nov 21 23:00:01 PST 2012


On 11/21/2012 02:31 PM, Johannes Berg wrote:
> On Wed, 2012-11-21 at 14:13 +0530, Mahesh Palivela wrote:
>
>>> +	if (data.vht_enabled) switch (vht_oper_chwidth) {
>>> +	case 0:
>>> +		if (center_segment1)
>>> +			return -1;
>>> +		if (5000 + center_segment0 * 5 != data.center_freq1)
>>> +			return -1;
>>> +		break;
>>
>> instead of case 0, 1 etc, can you define names? can we have name for 5000?
>
> Yeah, I guess I should do that.
>

Thanks.

>>> +	case 1:
>>> +		data.bandwidth = 80;
>>> +		if (vht_oper_chwidth == 1 && center_segment1)
>>> +			return -1;
>>> +		if (vht_oper_chwidth == 3 && !center_segment1)
>>> +			return -1;
>>> +		if (!sec_channel_offset)
>>> +			return -1;
>>> +		/* primary 40 part must match the HT configuration */
>>> +		tmp = (30 + freq - 5000 - center_segment0 * 5)/20;
>>> +		tmp /= 2;
>>> +		if (data.center_freq1 != 5000 +
>>> +					 center_segment0 * 5 - 20 + 40 * tmp)
>>> +			return -1;
>>> +		data.center_freq1 = 5000 + center_segment0 * 5;
>>> +		break;
>>> +	case 2:
>>> +		data.bandwidth = 160;
>>> +		if (center_segment1)
>>> +			return -1;
>>> +		if (!sec_channel_offset)
>>> +			return -1;
>>> +		/* primary 40 part must match the HT configuration */
>>> +		tmp = (70 + freq - 5000 - center_segment0 * 5)/20;
>>> +		tmp /= 2;
>>> +		if (data.center_freq1 != 5000 +
>>> +					 center_segment0 * 5 - 60 + 40 * tmp)
>>> +			return -1;
>>
>> Sorry, I couldn't understand your arithmetic. Can you explain with example?
>
> Oh, well, it's a little tricky, I had to draw a diagram:
>
> Imagine each - is 5 MHz, so this is a 160 MHz channel, split into the 20
> MHz subchannels:
>
> |----|----|----|----|----|----|----|----|
>
> Now each one of these could be the primary 20 MHz channel, which has the
> center freq "freq" (in the code.)
>
> center_segment0 points to the middle of the whole thing, so
> 	freq - (center_segment0 *5+5000)
> will be -70, -50, -30, -10, 10, 30, 50, 70
>
> Adding 70 will lead to 0, 20, 40, ..., 140
> Divide by 20 will give us 0,...,7
> Divide by 2 will give 0 ... 3, mapping 0,1->0, 2,3->1 etc.
>
> data.center_freq1 is the center of the primary 40 MHz channel (as
> calculated by the HT information, not VHT)
>
> Now VHT must match this and given the 0..3 index we can calculate what
> on the VHT side is the primary 40 MHz channel's center frequency --
> which is the 160 MHz channel's center freq, minus 60, plus 40 * the
> index.
>
> Yeah, it's tricky ... This is vaguely based on pages 193-195 in the VHT
> draft (formulas 22-1 through 22-7 and table 22-7)
>

Thanks for the detailed write up. It will be good to have this write up 
in code at least briefly.



More information about the Hostap mailing list