LinuxKPI: 802.11: factor out rate logic for mandatory channels
I was looking at rate work for another problem and found more flags in ath9k (which we will likely never need). The documentation then revealed the "mandatory" flags as well and with discussions about cfg80211 going on I decided to use the momentum and split our "supp_rates" setup between lkpi_lsta_alloc() and wiphy_register(). There should be no functional change. While there also initialize max_rc_amsdu_len. Sponsored by: The FreeBSD Foundation MFC after: 3 days
This commit is contained in:
@@ -108,7 +108,18 @@ struct ieee80211_mmie_16 {
|
|||||||
#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100
|
#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100
|
||||||
|
|
||||||
enum ieee80211_rate_flags {
|
enum ieee80211_rate_flags {
|
||||||
IEEE80211_RATE_SHORT_PREAMBLE = BIT(0),
|
IEEE80211_RATE_SHORT_PREAMBLE = BIT(0), /* 2.4Ghz, CCK */
|
||||||
|
IEEE80211_RATE_SUPPORTS_5MHZ = BIT(1),
|
||||||
|
IEEE80211_RATE_SUPPORTS_10MHZ = BIT(2),
|
||||||
|
IEEE80211_RATE_ERP_G = BIT(3),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* According to documentation these are flags initialized internally.
|
||||||
|
* See lkpi_wiphy_band_annotate().
|
||||||
|
*/
|
||||||
|
IEEE80211_RATE_MANDATORY_A = BIT(4),
|
||||||
|
IEEE80211_RATE_MANDATORY_G = BIT(5),
|
||||||
|
IEEE80211_RATE_MANDATORY_B = BIT(6),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ieee80211_rate_control_changed_flags {
|
enum ieee80211_rate_control_changed_flags {
|
||||||
|
|||||||
@@ -1230,6 +1230,7 @@ struct cfg80211_ops {
|
|||||||
|
|
||||||
struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
|
struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
|
||||||
void linuxkpi_wiphy_free(struct wiphy *wiphy);
|
void linuxkpi_wiphy_free(struct wiphy *wiphy);
|
||||||
|
int linuxkpi_80211_wiphy_register(struct wiphy *);
|
||||||
|
|
||||||
void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *);
|
void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *);
|
||||||
void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *);
|
void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *);
|
||||||
@@ -1749,8 +1750,7 @@ wiphy_net(struct wiphy *wiphy)
|
|||||||
static __inline int
|
static __inline int
|
||||||
wiphy_register(struct wiphy *wiphy)
|
wiphy_register(struct wiphy *wiphy)
|
||||||
{
|
{
|
||||||
TODO();
|
return (linuxkpi_80211_wiphy_register(wiphy));
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
|
|||||||
@@ -896,41 +896,34 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN],
|
|||||||
/* Deflink information. */
|
/* Deflink information. */
|
||||||
for (band = 0; band < NUM_NL80211_BANDS; band++) {
|
for (band = 0; band < NUM_NL80211_BANDS; band++) {
|
||||||
struct ieee80211_supported_band *supband;
|
struct ieee80211_supported_band *supband;
|
||||||
|
uint32_t rate_mandatory;;
|
||||||
|
|
||||||
supband = hw->wiphy->bands[band];
|
supband = hw->wiphy->bands[band];
|
||||||
if (supband == NULL)
|
if (supband == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
switch (band) {
|
||||||
|
case NL80211_BAND_2GHZ:
|
||||||
|
/* We have to assume 11g support here. */
|
||||||
|
rate_mandatory = IEEE80211_RATE_MANDATORY_G |
|
||||||
|
IEEE80211_RATE_MANDATORY_B;
|
||||||
|
break;
|
||||||
|
case NL80211_BAND_5GHZ:
|
||||||
|
rate_mandatory = IEEE80211_RATE_MANDATORY_A;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < supband->n_bitrates; i++) {
|
for (i = 0; i < supband->n_bitrates; i++) {
|
||||||
switch (band) {
|
if ((supband->bitrates[i].flags & rate_mandatory) != 0)
|
||||||
case NL80211_BAND_2GHZ:
|
sta->deflink.supp_rates[band] |= BIT(i);
|
||||||
switch (supband->bitrates[i].bitrate) {
|
|
||||||
case 240: /* 11g only */
|
|
||||||
case 120: /* 11g only */
|
|
||||||
case 110:
|
|
||||||
case 60: /* 11g only */
|
|
||||||
case 55:
|
|
||||||
case 20:
|
|
||||||
case 10:
|
|
||||||
sta->deflink.supp_rates[band] |= BIT(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NL80211_BAND_5GHZ:
|
|
||||||
switch (supband->bitrates[i].bitrate) {
|
|
||||||
case 240:
|
|
||||||
case 120:
|
|
||||||
case 60:
|
|
||||||
sta->deflink.supp_rates[band] |= BIT(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sta->deflink.smps_mode = IEEE80211_SMPS_OFF;
|
sta->deflink.smps_mode = IEEE80211_SMPS_OFF;
|
||||||
sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20;
|
sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20;
|
||||||
|
sta->deflink.agg.max_rc_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_BA;
|
||||||
sta->deflink.rx_nss = 1;
|
sta->deflink.rx_nss = 1;
|
||||||
sta->deflink.sta = sta;
|
sta->deflink.sta = sta;
|
||||||
|
|
||||||
@@ -8028,6 +8021,75 @@ linuxkpi_wiphy_free(struct wiphy *wiphy)
|
|||||||
kfree(lwiphy);
|
kfree(lwiphy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
lkpi_wiphy_band_annotate(struct wiphy *wiphy)
|
||||||
|
{
|
||||||
|
int band;
|
||||||
|
|
||||||
|
for (band = 0; band < NUM_NL80211_BANDS; band++) {
|
||||||
|
struct ieee80211_supported_band *supband;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
supband = wiphy->bands[band];
|
||||||
|
if (supband == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (band) {
|
||||||
|
case NL80211_BAND_2GHZ:
|
||||||
|
case NL80211_BAND_5GHZ:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
IMPROVE("band %d(%s) not yet supported",
|
||||||
|
band, lkpi_nl80211_band_name(band));
|
||||||
|
/* For bands added here, also check lkpi_lsta_alloc(). */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < supband->n_bitrates; i++) {
|
||||||
|
switch (band) {
|
||||||
|
case NL80211_BAND_2GHZ:
|
||||||
|
switch (supband->bitrates[i].bitrate) {
|
||||||
|
case 110:
|
||||||
|
case 55:
|
||||||
|
case 20:
|
||||||
|
case 10:
|
||||||
|
supband->bitrates[i].flags |=
|
||||||
|
IEEE80211_RATE_MANDATORY_B;
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
/* 11g only */
|
||||||
|
case 240:
|
||||||
|
case 120:
|
||||||
|
case 60:
|
||||||
|
supband->bitrates[i].flags |=
|
||||||
|
IEEE80211_RATE_MANDATORY_G;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NL80211_BAND_5GHZ:
|
||||||
|
switch (supband->bitrates[i].bitrate) {
|
||||||
|
case 240:
|
||||||
|
case 120:
|
||||||
|
case 60:
|
||||||
|
supband->bitrates[i].flags |=
|
||||||
|
IEEE80211_RATE_MANDATORY_A;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
linuxkpi_80211_wiphy_register(struct wiphy *wiphy)
|
||||||
|
{
|
||||||
|
TODO("Lots of checks and initialization");
|
||||||
|
|
||||||
|
lkpi_wiphy_band_annotate(wiphy);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
lkpi_cfg80211_calculate_bitrate_ht(struct rate_info *rate)
|
lkpi_cfg80211_calculate_bitrate_ht(struct rate_info *rate)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user