hostapd: Add Power Constraint element
Add Power Constraint information element to Beacon and Probe Response frames when hostapd is configured on 5 GHz band and Country information element is also added. According to IEEE Std 802.11-2012 a STA shall determine a local maximum transmit power for the current channel based on information derived from Country and Power Constraint elements. In order to add Power Constraint element ieee80211d option need to be enabled and new local_pwr_constraint config option need to be set to unsigned value in units of decibels. For now this value is statically configured but the future goal is to implement dynamic TPC algorithm to control local power constraint. Signed-hostap: Srinivasan <srinivasanb@posedge.com> Signed-hostap: Chaitanya T K <chaitanyatk@posedge.com> Signed-hostap: Marek Puzyniak <marek.puzyniak@tieto.com>
This commit is contained in:
parent
891330fda9
commit
e0392f825d
5 changed files with 66 additions and 0 deletions
|
@ -102,6 +102,36 @@ static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid)
|
|||
}
|
||||
|
||||
|
||||
static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
|
||||
{
|
||||
u8 *pos = eid;
|
||||
|
||||
if (hapd->iconf->local_pwr_constraint == -1 ||
|
||||
hapd->iface->current_mode == NULL ||
|
||||
hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
|
||||
return eid;
|
||||
|
||||
/*
|
||||
* A STA that is not an AP shall use a transmit power less than or
|
||||
* equal to the local maximum transmit power level for the channel.
|
||||
* The local maximum transmit power can be calculated from the formula:
|
||||
* local max TX pwr = max TX pwr - local pwr constraint
|
||||
* Where max TX pwr is maximum transmit power level specified for
|
||||
* channel in Country element and local pwr constraint is specified
|
||||
* for channel in this Power Constraint element.
|
||||
*/
|
||||
|
||||
/* Element ID */
|
||||
*pos++ = WLAN_EID_PWR_CONSTRAINT;
|
||||
/* Length */
|
||||
*pos++ = 1;
|
||||
/* Local Power Constraint */
|
||||
*pos++ = hapd->iconf->local_pwr_constraint;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
static u8 * hostapd_eid_country_add(u8 *pos, u8 *end, int chan_spacing,
|
||||
struct hostapd_channel_data *start,
|
||||
struct hostapd_channel_data *prev)
|
||||
|
@ -315,6 +345,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
|
|||
|
||||
pos = hostapd_eid_country(hapd, pos, epos - pos);
|
||||
|
||||
/* Power Constraint element */
|
||||
pos = hostapd_eid_pwr_constraint(hapd, pos);
|
||||
|
||||
/* ERP Information element */
|
||||
pos = hostapd_eid_erp_info(hapd, pos);
|
||||
|
||||
|
@ -721,6 +754,9 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
|
|||
tailpos = hostapd_eid_country(hapd, tailpos,
|
||||
tail + BEACON_TAIL_BUF_SIZE - tailpos);
|
||||
|
||||
/* Power Constraint element */
|
||||
tailpos = hostapd_eid_pwr_constraint(hapd, tailpos);
|
||||
|
||||
/* ERP Information element */
|
||||
tailpos = hostapd_eid_erp_info(hapd, tailpos);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue