]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Get maximum TX power for each allowed channel from mac80211
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 25 Nov 2008 09:11:50 +0000 (11:11 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 25 Nov 2008 09:11:50 +0000 (11:11 +0200)
hostapd/driver_nl80211.c
hostapd/hw_features.c
hostapd/hw_features.h

index 6a9ecaf245560dad21b6ca9126a0bcc2319ebf61..bcbbcd79b9562b5bfcb3f94590a72e4b51bc629f 100644 (file)
@@ -1316,6 +1316,9 @@ static int phy_info_handler(struct nl_msg *msg, void *arg)
                [NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
                [NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
                [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
+#ifdef NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+               [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
+#endif /* NL80211_FREQUENCY_ATTR_MAX_TX_POWER */
        };
 
        struct nlattr *tb_rate[NL80211_BITRATE_ATTR_MAX + 1];
@@ -1405,6 +1408,14 @@ static int phy_info_handler(struct nl_msg *msg, void *arg)
                        if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR])
                                mode->channels[idx].flag |=
                                        HOSTAPD_CHAN_RADAR;
+
+#ifdef NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+                       if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] &&
+                           !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
+                               mode->channels[idx].max_tx_power =
+                                       nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]) / 100;
+#endif /* NL80211_FREQUENCY_ATTR_MAX_TX_POWER */
+
                        idx++;
                }
 
index 9909723f3d050c07b015516f14271377b3bb60bd..6cf043765f640b30037d96dbb56b6209b6ab849e 100644 (file)
@@ -84,10 +84,11 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
                        if (feature->channels[j].flag & HOSTAPD_CHAN_DISABLED)
                                continue;
                        wpa_printf(MSG_MSGDUMP, "Allowed channel: mode=%d "
-                                  "chan=%d freq=%d MHz",
+                                  "chan=%d freq=%d MHz max_tx_power=%d dBm",
                                   feature->mode,
                                   feature->channels[j].chan,
-                                  feature->channels[j].freq);
+                                  feature->channels[j].freq,
+                                  feature->channels[j].max_tx_power);
                }
        }
 
index 7faeed5006288c66920148c0aa2ef46af73fd27f..b35396854ac76a04908238d15cf5602fdbe58879 100644 (file)
@@ -25,6 +25,7 @@ struct hostapd_channel_data {
        short chan; /* channel number (IEEE 802.11) */
        short freq; /* frequency in MHz */
        int flag; /* flag for hostapd use (HOSTAPD_CHAN_*) */
+       u8 max_tx_power; /* maximum transmit power in dBm */
 };
 
 #define HOSTAPD_RATE_ERP 0x00000001