diff --git a/src/agent_map.c b/src/agent_map.c index 8931fc824f4fb8b2b2859fb19b9908b858d6f2c9..e379dc1e6b354d93b5ea84baad362f2df166128a 100644 --- a/src/agent_map.c +++ b/src/agent_map.c @@ -3615,8 +3615,16 @@ int get_op_class_sec(int op_class) { switch (op_class) { case 83: + case 116: + case 119: + case 122: + case 126: return 1; case 84: + case 117: + case 120: + case 123: + case 127: return -1; default: break; @@ -3795,6 +3803,8 @@ int agent_channel_switch(struct agent *a, uint8_t *radio_id, int channel, int op } /* Check current mode/standard */ + if (strstr(ap->standard, "be")) + param.eht = true; if (strstr(ap->standard, "ax")) param.he = true; if (strstr(ap->standard, "ac")) @@ -3802,9 +3812,9 @@ int agent_channel_switch(struct agent *a, uint8_t *radio_id, int channel, int op if (strstr(ap->standard, "n")) param.ht = true; - trace("|%s %d| channel %d bandwidth %d ht/vht/he: %d/%d/%d\n", - __func__, __LINE__, channel, param.bandwidth, - param.ht, param.vht, param.he); + trace("|%s %d| channel %d bandwidth %d sec %d ht/vht/he/eht: %d/%d/%d/%d\n", + __func__, __LINE__, channel, param.bandwidth, param.sec_chan_offset, + param.ht, param.vht, param.he, param.eht); return wifi_chan_switch(ap->ifname, ¶m); } @@ -3867,11 +3877,6 @@ int agent_process_channel_pref_tlv(void *agent, struct tlv_channel_pref *p, struct agent *a = (struct agent *) agent; struct wifi_radio_element *re; struct wifi_radio_opclass opclass = {}; -#ifdef LOCAL_ACS_SERVICE - uint8_t bws[] = {80, 20}; -#else - uint8_t bws[] = {80, 40, 20}; -#endif uint8_t target_opclass=0; uint8_t target_channel=0; uint8_t radio_id[6] = {0}; @@ -4000,14 +4005,9 @@ int agent_process_channel_pref_tlv(void *agent, struct tlv_channel_pref *p, #endif /* Switch to best channel */ - for (i = 0; i < ARRAY_SIZE(bws); i++) { - ret = wifi_opclass_get_higest_preference(&opclass, bws[i], - &target_opclass, - &target_channel); - - if (!ret) - break; - } + ret = wifi_opclass_get_higest_preference(&opclass, 0, + &target_opclass, + &target_channel); trace("[%s]: higest pref opclass %u chan %u ret %d\n", re->name, target_opclass, target_channel, ret); diff --git a/src/wifi_opclass.c b/src/wifi_opclass.c index ee370eb3f66a956a68dba9489522c0cf3b54fede..bd04f9cf1969b677d283b16c9289339c04594343 100644 --- a/src/wifi_opclass.c +++ b/src/wifi_opclass.c @@ -198,7 +198,7 @@ static const struct wifi_radio_opclass e4 = { { .channel = 153, .ctrl_channels = {153}}, { .channel = 157, .ctrl_channels = {157}}, { .channel = 161, .ctrl_channels = {161}}, - { .channel = 164, .ctrl_channels = {164}}, + { .channel = 165, .ctrl_channels = {165}}, { .channel = 169, .ctrl_channels = {169}}, { .channel = 173, .ctrl_channels = {173}}, { .channel = 177, .ctrl_channels = {177}}, @@ -744,7 +744,11 @@ _wifi_opclass_get_higest_preference(struct wifi_radio_opclass *opclass, chan = &entry->channel[j]; pref = (chan->preference & CHANNEL_PREF_MASK) >> 4; - if (pref > preference) { + if (!pref) + continue; + + if (pref > preference || + (pref == preference && entry->bandwidth > *bandwidth)) { preference = pref; *opclass_id = entry->id; *bandwidth = entry->bandwidth; diff --git a/src/wifi_ubus.c b/src/wifi_ubus.c index 7248f59974bad0c7124d87b211cedc5b412c475b..5d8958367f03e32160f33ee5a58afd5e2baf2383 100644 --- a/src/wifi_ubus.c +++ b/src/wifi_ubus.c @@ -1457,6 +1457,7 @@ int wifi_ubus_chan_switch(struct ubus_context *ubus_ctx, const char *ifname, blobmsg_add_u8(&bb, "ht", param->ht); blobmsg_add_u8(&bb, "vht", param->vht); blobmsg_add_u8(&bb, "he", param->he); + blobmsg_add_u8(&bb, "eht", param->eht); ret = ubus_invoke(ubus_ctx, id, "chan_switch", bb.head, NULL, NULL, 2 * 1000);