Message ID | 1484485518-2005-1-git-send-email-Chaitanya.Tata@imgtec.com |
---|---|
State | Changes Requested |
Delegated to: | John Crispin |
Headers | show |
On Sun, Jan 15, 2017 at 6:35 PM, Chaitanya Tata <chaitanya.mgit@gmail.com> wrote: > > Before enabling the DFS channels looks for support of DFS > in interface combinations, NO_IR and DFS flags. > > Currently BW level checks are not supported. > > Tested-by: Tushar Jobanputra <Tushar.Jobanputra@imgtec.com> > Signed-off-by: Chaitanya Tata <Chaitanya.Tata@imgtec.com> > --- > Fix signed tag. > --- > iwinfo_nl80211.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 59 insertions(+), 6 deletions(-) > > diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c > index 63b70d5..d8d2670 100644 > --- a/iwinfo_nl80211.c > +++ b/iwinfo_nl80211.c > @@ -2404,20 +2404,71 @@ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len) > return -1; > } > > +char *channel_width_name(enum nl80211_chan_width width) > +{ > + switch (width) { > + case NL80211_CHAN_WIDTH_20_NOHT: > + return "20 MHz (no HT)"; > + case NL80211_CHAN_WIDTH_20: > + return "20 MHz"; > + case NL80211_CHAN_WIDTH_40: > + return "40 MHz"; > + case NL80211_CHAN_WIDTH_80: > + return "80 MHz"; > + case NL80211_CHAN_WIDTH_80P80: > + return "80+80 MHz"; > + case NL80211_CHAN_WIDTH_160: > + return "160 MHz"; > + default: > + return "unknown"; > + } > +} > + I just realized that i am not using this function, it was left over from debug prints. > > nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) > { > + struct nlattr *is_ir,*is_dfs; Technically this should be is_no_ir? Will await further comments and then submit a V2.
On Mon, Jan 16, 2017 at 1:10 AM, Krishna Chaitanya <chaitanya.mgit@gmail.com> wrote: > > On Sun, Jan 15, 2017 at 6:35 PM, Chaitanya Tata > <chaitanya.mgit@gmail.com> wrote: > > > > Before enabling the DFS channels looks for support of DFS > > in interface combinations, NO_IR and DFS flags. > > > > Currently BW level checks are not supported. > > > > Tested-by: Tushar Jobanputra <Tushar.Jobanputra@imgtec.com> > > Signed-off-by: Chaitanya Tata <Chaitanya.Tata@imgtec.com> > > --- > > Fix signed tag. > > --- > > iwinfo_nl80211.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++------ > > 1 file changed, 59 insertions(+), 6 deletions(-) > > > > diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c > > index 63b70d5..d8d2670 100644 > > --- a/iwinfo_nl80211.c > > +++ b/iwinfo_nl80211.c > > @@ -2404,20 +2404,71 @@ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len) > > return -1; > > } > > > > +char *channel_width_name(enum nl80211_chan_width width) > > +{ > > + switch (width) { > > + case NL80211_CHAN_WIDTH_20_NOHT: > > + return "20 MHz (no HT)"; > > + case NL80211_CHAN_WIDTH_20: > > + return "20 MHz"; > > + case NL80211_CHAN_WIDTH_40: > > + return "40 MHz"; > > + case NL80211_CHAN_WIDTH_80: > > + return "80 MHz"; > > + case NL80211_CHAN_WIDTH_80P80: > > + return "80+80 MHz"; > > + case NL80211_CHAN_WIDTH_160: > > + return "160 MHz"; > > + default: > > + return "unknown"; > > + } > > +} > > + > > I just realized that i am not using this function, it was left over > from debug prints. > > > > > nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) > > { > > + struct nlattr *is_ir,*is_dfs; > Technically this should be is_no_ir? > > Will await further comments and then submit a V2. the patch says "changed requested" but no review comments received, should I submit v2? https://patchwork.ozlabs.org/project/openwrt/list/?series=&submitter=23866&state=*&q=&archive=&delegate=
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 63b70d5..d8d2670 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -2404,20 +2404,71 @@ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len) return -1; } +char *channel_width_name(enum nl80211_chan_width width) +{ + switch (width) { + case NL80211_CHAN_WIDTH_20_NOHT: + return "20 MHz (no HT)"; + case NL80211_CHAN_WIDTH_20: + return "20 MHz"; + case NL80211_CHAN_WIDTH_40: + return "40 MHz"; + case NL80211_CHAN_WIDTH_80: + return "80 MHz"; + case NL80211_CHAN_WIDTH_80P80: + return "80+80 MHz"; + case NL80211_CHAN_WIDTH_160: + return "160 MHz"; + default: + return "unknown"; + } +} + static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg) { - int bands_remain, freqs_remain; + int if_comb_remain, bands_remain, freqs_remain,comb_limits_remain; struct nl80211_array_buf *arr = arg; struct iwinfo_freqlist_entry *e = arr->buf; struct nlattr **attr = nl80211_parse(msg); + struct nlattr *combs[MAX_NL80211_IFACE_COMB + 1]; struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1]; struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1]; - struct nlattr *band, *freq; + struct nlattr *comb, *band, *freq,*comb_limit; + struct nlattr *comb_limits[MAX_NL80211_IFACE_COMB + 1]; + bool dfs_support = 0; + unsigned int widths = 0; + + nla_for_each_nested(comb, attr[NL80211_ATTR_INTERFACE_COMBINATIONS], bands_remain) + { + + nla_parse(combs, MAX_NL80211_IFACE_COMB, + nla_data(comb), nla_len(comb), NULL); + + nla_for_each_nested(comb_limit, combs[NL80211_IFACE_COMB_LIMITS], comb_limits_remain) + { + nla_parse(comb_limits, MAX_NL80211_IFACE_LIMIT, + nla_data(comb_limit), nla_len(comb_limit), NULL); + + if (!comb_limits[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) + continue; + + widths = nla_get_u32(comb_limits[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]); + /* Curently there is no 1-1 mappng between + * freq and cbw, so we cannot check dfs support + * for different cbw. + */ + if (widths) + dfs_support = true; + + } + + } nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain) { + struct nlattr *is_ir,*is_dfs; nla_parse(bands, NL80211_BAND_ATTR_MAX, nla_data(band), nla_len(band), NULL); @@ -2433,16 +2484,18 @@ static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg) e->mhz = nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]); e->channel = nl80211_freq2channel(e->mhz); - e->restricted = ( - freqs[NL80211_FREQUENCY_ATTR_NO_IR] && - !freqs[NL80211_FREQUENCY_ATTR_RADAR] - ) ? 1 : 0; + is_ir = freqs[NL80211_FREQUENCY_ATTR_NO_IR] ; + is_dfs = freqs[NL80211_FREQUENCY_ATTR_RADAR]; + + e->restricted = is_ir || (is_dfs && !dfs_support); e++; arr->count++; } } + + return NL_SKIP; }