[tools] fix segfault when using the maxlen argument (#4359)
[openwrt.git] / package / acx-mac80211 / patches / 002-rate_definitions.patch
1 --- a/common.c
2 +++ b/common.c
3 @@ -1452,60 +1452,66 @@ void acx_free_modes(acx_device_t * adev)
4 // adev->modes = NULL;
5 }
6
7 -/*
8 -#define RATETAB_ENT(_rate, _rateid, _flags) \
9 - { \
10 - .rate = (_rate), \
11 - .val = (_rateid), \
12 - .val2 = (_rateid), \
13 - .flags = (_flags), \
14 - }
15 -*/
16 -
17 static struct ieee80211_rate acx_rates[] = {
18 { .bitrate = 10, .hw_value = 0, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
19 { .bitrate = 20, .hw_value = 1, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
20 { .bitrate = 55, .hw_value = 2, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
21 { .bitrate = 110, .hw_value = 3, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
22 - { .bitrate = 60, .hw_value = 4, },
23 - { .bitrate = 90, .hw_value = 5, },
24 - { .bitrate = 120, .hw_value = 6, },
25 - { .bitrate = 180, .hw_value = 7, },
26 - { .bitrate = 240, .hw_value = 8, },
27 - { .bitrate = 360, .hw_value = 9, },
28 - { .bitrate = 480, .hw_value = 10, },
29 - { .bitrate = 540, .hw_value = 11, },
30 + { .bitrate = 60, .hw_value = 4, .flags = 0 },
31 + { .bitrate = 90, .hw_value = 5, .flags = 0 },
32 + { .bitrate = 120, .hw_value = 6, .flags = 0 },
33 + { .bitrate = 180, .hw_value = 7, .flags = 0 },
34 + { .bitrate = 240, .hw_value = 8, .flags = 0 },
35 + { .bitrate = 360, .hw_value = 9, .flags = 0 },
36 + { .bitrate = 480, .hw_value = 10, .flags = 0 },
37 + { .bitrate = 540, .hw_value = 11, .flags = 0 },
38 };
39
40 +#define CHAN4G(_channel, _freq, _flags) { \
41 + .band = IEEE80211_BAND_2GHZ, \
42 + .center_freq = (_freq), \
43 + .hw_value = (_channel), \
44 + .flags = (_flags), \
45 + .max_antenna_gain = 0, \
46 + .max_power = 30, \
47 +}
48 static struct ieee80211_channel channels[] = {
49 - { .center_freq = 2412, .hw_value = 1, },
50 - { .center_freq = 2417, .hw_value = 2, },
51 - { .center_freq = 2422, .hw_value = 3, },
52 - { .center_freq = 2427, .hw_value = 4, },
53 - { .center_freq = 2432, .hw_value = 5, },
54 - { .center_freq = 2437, .hw_value = 6, },
55 - { .center_freq = 2442, .hw_value = 7, },
56 - { .center_freq = 2447, .hw_value = 8, },
57 - { .center_freq = 2452, .hw_value = 9, },
58 - { .center_freq = 2457, .hw_value = 10, },
59 - { .center_freq = 2462, .hw_value = 11, },
60 - { .center_freq = 2467, .hw_value = 12, },
61 - { .center_freq = 2472, .hw_value = 13, },
62 - { .center_freq = 2484, .hw_value = 14, },
63 + CHAN4G(1, 2412, 0),
64 + CHAN4G(2, 2417, 0),
65 + CHAN4G(3, 2422, 0),
66 + CHAN4G(4, 2427, 0),
67 + CHAN4G(5, 2432, 0),
68 + CHAN4G(6, 2437, 0),
69 + CHAN4G(7, 2442, 0),
70 + CHAN4G(8, 2447, 0),
71 + CHAN4G(9, 2452, 0),
72 + CHAN4G(10, 2457, 0),
73 + CHAN4G(11, 2462, 0),
74 + CHAN4G(12, 2467, 0),
75 + CHAN4G(13, 2472, 0),
76 + CHAN4G(14, 2484, 0),
77 };
78 +#undef CHAN4G
79 +
80 +#define acx_b_ratetable (acx_rates + 0)
81 +#define acx_b_ratetable_size 4
82 +#define acx_g_ratetable (acx_rates + 0)
83 +#define acx_g_ratetable_size 12
84
85 static struct ieee80211_supported_band g_band_2GHz = {
86 + .band = IEEE80211_BAND_2GHZ,
87 .channels = channels,
88 .n_channels = ARRAY_SIZE(channels),
89 - .bitrates = acx_rates,
90 - .n_bitrates = 12,
91 + .bitrates = acx_b_ratetable,
92 + .n_bitrates = acx_g_ratetable_size,
93 };
94
95 static struct ieee80211_supported_band b_band_2GHz = {
96 + .band = IEEE80211_BAND_2GHZ,
97 .channels = channels,
98 .n_channels = ARRAY_SIZE(channels),
99 - .bitrates = acx_rates,
100 - .n_bitrates = 4,
101 + .bitrates = acx_g_ratetable,
102 + .n_bitrates = acx_b_ratetable_size,
103 };
104
105 int acx_setup_modes(acx_device_t * adev)
This page took 0.041292 seconds and 5 git commands to generate.