P2P: Apply unsafe frequency rules to available channels
This adds a QCA vendor specific nl80211 event to allow the driver to indicate a list of frequency ranges that should be avoided due to interference or possible known co-existance constraints. Such frequencies are marked as not allowed for P2P use to force groups to be formed on different channels. If a P2P GO is operating on a channel that the driver recommended not to use, a notification about this is sent on the control interface and upper layer code may decide to tear down the group and optionally restart it on another channel. As a TODO item, this could also be changed to use CSA to avoid removing the group. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
1682c62360
commit
253f2e3795
9 changed files with 148 additions and 1 deletions
|
@ -2717,10 +2717,60 @@ static void nl80211_spurious_frame(struct i802_bss *bss, struct nlattr **tb,
|
|||
}
|
||||
|
||||
|
||||
static void qca_nl80211_avoid_freq(struct wpa_driver_nl80211_data *drv,
|
||||
const u8 *data, size_t len)
|
||||
{
|
||||
u32 i, count;
|
||||
union wpa_event_data event;
|
||||
struct wpa_freq_range *range = NULL;
|
||||
const struct qca_avoid_freq_list *freq_range;
|
||||
|
||||
freq_range = (const struct qca_avoid_freq_list *) data;
|
||||
if (len < sizeof(freq_range->count))
|
||||
return;
|
||||
|
||||
count = freq_range->count;
|
||||
if (len < sizeof(freq_range->count) +
|
||||
count * sizeof(struct qca_avoid_freq_range)) {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Ignored too short avoid frequency list (len=%u)",
|
||||
(unsigned int) len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
range = os_calloc(count, sizeof(struct wpa_freq_range));
|
||||
if (range == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
os_memset(&event, 0, sizeof(event));
|
||||
for (i = 0; i < count; i++) {
|
||||
unsigned int idx = event.freq_range.num;
|
||||
range[idx].min = freq_range->range[i].start_freq;
|
||||
range[idx].max = freq_range->range[i].end_freq;
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Avoid frequency range: %u-%u",
|
||||
range[idx].min, range[idx].max);
|
||||
if (range[idx].min > range[idx].max) {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Ignore invalid frequency range");
|
||||
continue;
|
||||
}
|
||||
event.freq_range.num++;
|
||||
}
|
||||
event.freq_range.range = range;
|
||||
|
||||
wpa_supplicant_event(drv->ctx, EVENT_AVOID_FREQUENCIES, &event);
|
||||
|
||||
os_free(range);
|
||||
}
|
||||
|
||||
|
||||
static void nl80211_vendor_event_qca(struct wpa_driver_nl80211_data *drv,
|
||||
u32 subcmd, u8 *data, size_t len)
|
||||
{
|
||||
switch (subcmd) {
|
||||
case QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY:
|
||||
qca_nl80211_avoid_freq(drv, data, len);
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"nl80211: Ignore unsupported QCA vendor event %u",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue