--- a/common.c +++ b/common.c @@ -1452,60 +1452,66 @@ void acx_free_modes(acx_device_t * adev) // adev->modes = NULL; } -/* -#define RATETAB_ENT(_rate, _rateid, _flags) \ - { \ - .rate = (_rate), \ - .val = (_rateid), \ - .val2 = (_rateid), \ - .flags = (_flags), \ - } -*/ - static struct ieee80211_rate acx_rates[] = { { .bitrate = 10, .hw_value = 0, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, { .bitrate = 20, .hw_value = 1, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, { .bitrate = 55, .hw_value = 2, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, { .bitrate = 110, .hw_value = 3, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, .hw_value = 4, }, - { .bitrate = 90, .hw_value = 5, }, - { .bitrate = 120, .hw_value = 6, }, - { .bitrate = 180, .hw_value = 7, }, - { .bitrate = 240, .hw_value = 8, }, - { .bitrate = 360, .hw_value = 9, }, - { .bitrate = 480, .hw_value = 10, }, - { .bitrate = 540, .hw_value = 11, }, + { .bitrate = 60, .hw_value = 4, .flags = 0 }, + { .bitrate = 90, .hw_value = 5, .flags = 0 }, + { .bitrate = 120, .hw_value = 6, .flags = 0 }, + { .bitrate = 180, .hw_value = 7, .flags = 0 }, + { .bitrate = 240, .hw_value = 8, .flags = 0 }, + { .bitrate = 360, .hw_value = 9, .flags = 0 }, + { .bitrate = 480, .hw_value = 10, .flags = 0 }, + { .bitrate = 540, .hw_value = 11, .flags = 0 }, }; +#define CHAN4G(_channel, _freq, _flags) { \ + .band = IEEE80211_BAND_2GHZ, \ + .center_freq = (_freq), \ + .hw_value = (_channel), \ + .flags = (_flags), \ + .max_antenna_gain = 0, \ + .max_power = 30, \ +} static struct ieee80211_channel channels[] = { - { .center_freq = 2412, .hw_value = 1, }, - { .center_freq = 2417, .hw_value = 2, }, - { .center_freq = 2422, .hw_value = 3, }, - { .center_freq = 2427, .hw_value = 4, }, - { .center_freq = 2432, .hw_value = 5, }, - { .center_freq = 2437, .hw_value = 6, }, - { .center_freq = 2442, .hw_value = 7, }, - { .center_freq = 2447, .hw_value = 8, }, - { .center_freq = 2452, .hw_value = 9, }, - { .center_freq = 2457, .hw_value = 10, }, - { .center_freq = 2462, .hw_value = 11, }, - { .center_freq = 2467, .hw_value = 12, }, - { .center_freq = 2472, .hw_value = 13, }, - { .center_freq = 2484, .hw_value = 14, }, + CHAN4G(1, 2412, 0), + CHAN4G(2, 2417, 0), + CHAN4G(3, 2422, 0), + CHAN4G(4, 2427, 0), + CHAN4G(5, 2432, 0), + CHAN4G(6, 2437, 0), + CHAN4G(7, 2442, 0), + CHAN4G(8, 2447, 0), + CHAN4G(9, 2452, 0), + CHAN4G(10, 2457, 0), + CHAN4G(11, 2462, 0), + CHAN4G(12, 2467, 0), + CHAN4G(13, 2472, 0), + CHAN4G(14, 2484, 0), }; +#undef CHAN4G + +#define acx_b_ratetable (acx_rates + 0) +#define acx_b_ratetable_size 4 +#define acx_g_ratetable (acx_rates + 0) +#define acx_g_ratetable_size 12 static struct ieee80211_supported_band g_band_2GHz = { + .band = IEEE80211_BAND_2GHZ, .channels = channels, .n_channels = ARRAY_SIZE(channels), - .bitrates = acx_rates, - .n_bitrates = 12, + .bitrates = acx_b_ratetable, + .n_bitrates = acx_g_ratetable_size, }; static struct ieee80211_supported_band b_band_2GHz = { + .band = IEEE80211_BAND_2GHZ, .channels = channels, .n_channels = ARRAY_SIZE(channels), - .bitrates = acx_rates, - .n_bitrates = 4, + .bitrates = acx_g_ratetable, + .n_bitrates = acx_b_ratetable_size, }; int acx_setup_modes(acx_device_t * adev)