31b1ac0d38b8ae078a29947b75a90feee198c88f
[openwrt/staging/blocktrron.git] /
1 From 6522dcbbcf71abcb80cce84b93b4a9a5cfcd4fca Mon Sep 17 00:00:00 2001
2 From: Markus Theil <markus.theil@tu-ilmenau.de>
3 Date: Tue, 30 Jun 2020 13:53:22 +0200
4 Subject: [PATCH 06/19] hw_features: better debug messages for some error cases
5
6 Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
7 ---
8 src/common/hw_features_common.c | 29 ++++++++++++++++++++++-------
9 1 file changed, 22 insertions(+), 7 deletions(-)
10
11 --- a/src/common/hw_features_common.c
12 +++ b/src/common/hw_features_common.c
13 @@ -540,13 +540,18 @@ int hostapd_set_freq_params(struct hosta
14 if (center_segment1 ||
15 (center_segment0 != 0 &&
16 5000 + center_segment0 * 5 != data->center_freq1 &&
17 - 2407 + center_segment0 * 5 != data->center_freq1))
18 + 2407 + center_segment0 * 5 != data->center_freq1)) {
19 + wpa_printf(MSG_ERROR, "20/40 MHz: center segment 0 (=%i) and center freq 1 (=%i) not in sync",
20 + center_segment0, data->center_freq1);
21 return -1;
22 + }
23 break;
24 case CHANWIDTH_80P80MHZ:
25 if (center_segment1 == center_segment0 + 4 ||
26 - center_segment1 == center_segment0 - 4)
27 + center_segment1 == center_segment0 - 4) {
28 + wpa_printf(MSG_ERROR, "80+80 MHz: center segment 1 only 20 MHz apart");
29 return -1;
30 + }
31 data->center_freq2 = 5000 + center_segment1 * 5;
32 /* fall through */
33 case CHANWIDTH_80MHZ:
34 @@ -555,8 +560,10 @@ int hostapd_set_freq_params(struct hosta
35 center_segment1) ||
36 (oper_chwidth == CHANWIDTH_80P80MHZ &&
37 !center_segment1) ||
38 - !sec_channel_offset)
39 + !sec_channel_offset) {
40 + wpa_printf(MSG_ERROR, "80/80+80 MHz: center segment 1 wrong or no second channel offset");
41 return -1;
42 + }
43 if (!center_segment0) {
44 if (channel <= 48)
45 center_segment0 = 42;
46 @@ -582,16 +589,22 @@ int hostapd_set_freq_params(struct hosta
47 center_segment0 == channel - 2 ||
48 center_segment0 == channel - 6)
49 data->center_freq1 = 5000 + center_segment0 * 5;
50 - else
51 + else {
52 + wpa_printf(MSG_ERROR, "Wrong coupling between HT and VHT/HE channel setting");
53 return -1;
54 + }
55 }
56 break;
57 case CHANWIDTH_160MHZ:
58 data->bandwidth = 160;
59 - if (center_segment1)
60 + if (center_segment1) {
61 + wpa_printf(MSG_ERROR, "160 MHz: center segment 1 should not be set");
62 return -1;
63 - if (!sec_channel_offset)
64 + }
65 + if (!sec_channel_offset) {
66 + wpa_printf(MSG_ERROR, "160 MHz: second channel offset not set");
67 return -1;
68 + }
69 /*
70 * Note: HT/VHT config and params are coupled. Check if
71 * HT40 channel band is in VHT160 channel band configuration.
72 @@ -605,8 +618,10 @@ int hostapd_set_freq_params(struct hosta
73 center_segment0 == channel - 10 ||
74 center_segment0 == channel - 14)
75 data->center_freq1 = 5000 + center_segment0 * 5;
76 - else
77 + else {
78 + wpa_printf(MSG_ERROR, "160 MHz: HT40 channel band is not in 160 MHz band");
79 return -1;
80 + }
81 break;
82 }
83