[PATCH 1/4] nl80211: add supported BW parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dmitry Lebed <dlebed@xxxxxxxxxxxxx>

Add NL80211_FREQUENCY_ATTR_NO_* channel attributes parsing.
Needed for correct checking if channel is available in
particular BW.

Signed-off-by: Dmitry Lebed <dlebed@xxxxxxxxxxxxx>
---
 src/ap/dfs.c                      |  1 -
 src/drivers/driver.h              | 20 ++++++++++++++++++++
 src/drivers/driver_nl80211_capa.c | 20 ++++++++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index f1476eee0..8c56cbb96 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -172,7 +172,6 @@ static int is_in_chanlist(struct hostapd_iface *iface,
        return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan);
 }

-
 /*
  * The function assumes HT40+ operation.
  * Make sure to adjust the following variables after calling this:
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 92a58b2f2..37a31d3bc 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -58,6 +58,20 @@
 #define HOSTAPD_CHAN_VHT_130_30 0x04000000
 #define HOSTAPD_CHAN_VHT_150_10 0x08000000

+/* Allowed BW mask */
+enum hostapd_chan_width_attr {
+       HOSTAPD_CHAN_WIDTH_10   = BIT(0),
+       HOSTAPD_CHAN_WIDTH_20   = BIT(1),
+       HOSTAPD_CHAN_WIDTH_40P  = BIT(2),
+       HOSTAPD_CHAN_WIDTH_40M  = BIT(3),
+       HOSTAPD_CHAN_WIDTH_80   = BIT(4),
+       HOSTAPD_CHAN_WIDTH_160  = BIT(5),
+
+       /* all new elements goes before this line */
+       __HOSTAPD_CHAN_WIDTH_AFTER_LAST,
+       HOSTAPD_CHAN_WIDTH_ALL = __HOSTAPD_CHAN_WIDTH_AFTER_LAST - 2
+};
+
 /* Filter gratuitous ARP */
 #define WPA_DATA_FRAME_FILTER_FLAG_ARP BIT(0)
 /* Filter unsolicited Neighbor Advertisement */
@@ -110,6 +124,12 @@ struct hostapd_channel_data {
         */
        int flag;

+       /**
+        * allowed_bw - allowed channel width bitmask
+        * see enum hostapd_chan_width_attr
+        */
+       u32 allowed_bw;
+
        /**
         * max_tx_power - Regulatory transmit power limit in dBm
         */
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index e5bc7693b..ea6139c87 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1286,6 +1286,7 @@ static void phy_info_freq(struct hostapd_hw_modes *mode,
        u8 channel;
        chan->freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
        chan->flag = 0;
+       chan->allowed_bw = HOSTAPD_CHAN_WIDTH_ALL;
        chan->dfs_cac_ms = 0;
        if (ieee80211_freq_to_chan(chan->freq, &channel) != NUM_HOSTAPD_MODES)
                chan->chan = channel;
@@ -1301,6 +1302,19 @@ static void phy_info_freq(struct hostapd_hw_modes *mode,
        if (tb_freq[NL80211_FREQUENCY_ATTR_GO_CONCURRENT])
                chan->flag |= HOSTAPD_CHAN_GO_CONCURRENT;

+       if (tb_freq[NL80211_FREQUENCY_ATTR_NO_10MHZ])
+               chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_10;
+       if (tb_freq[NL80211_FREQUENCY_ATTR_NO_20MHZ])
+               chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_20;
+       if (tb_freq[NL80211_FREQUENCY_ATTR_NO_HT40_PLUS])
+               chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_40P;
+       if (tb_freq[NL80211_FREQUENCY_ATTR_NO_HT40_MINUS])
+               chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_40M;
+       if (tb_freq[NL80211_FREQUENCY_ATTR_NO_80MHZ])
+               chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_80;
+       if (tb_freq[NL80211_FREQUENCY_ATTR_NO_160MHZ])
+               chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_160;
+
        if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]) {
                enum nl80211_dfs_state state =
                        nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]);
@@ -1335,6 +1349,12 @@ static int phy_info_freqs(struct phy_info_arg *phy_info,
                [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
                [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
                [NL80211_FREQUENCY_ATTR_DFS_STATE] = { .type = NLA_U32 },
+               [NL80211_FREQUENCY_ATTR_NO_10MHZ] = { .type = NLA_FLAG },
+               [NL80211_FREQUENCY_ATTR_NO_20MHZ] = { .type = NLA_FLAG },
+               [NL80211_FREQUENCY_ATTR_NO_HT40_PLUS] = { .type = NLA_FLAG },
+               [NL80211_FREQUENCY_ATTR_NO_HT40_MINUS] = { .type = NLA_FLAG },
+               [NL80211_FREQUENCY_ATTR_NO_80MHZ] = { .type = NLA_FLAG },
+               [NL80211_FREQUENCY_ATTR_NO_160MHZ] = { .type = NLA_FLAG },
        };
        int new_channels = 0;
        struct hostapd_channel_data *channel;
--
2.16.1



This email, including its contents and any attachment(s), may contain confidential information of Quantenna Communications, Inc. and is solely for the intended recipient(s). If you may have received this in error, please contact the sender and permanently delete this email, its contents and any attachment(s).

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux