Commit 9a9c4fbc authored by Rajkumar Manoharan's avatar Rajkumar Manoharan Committed by John W. Linville

ath9k: Summarize hw state per channel context

Group and set hw state (opmode, primary_sta, beacon conf) per
channel context instead of whole list of vifs. This would allow
each channel context to run in different mode (STA/AP).
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ca900ac9
...@@ -328,6 +328,9 @@ struct ath_chanctx { ...@@ -328,6 +328,9 @@ struct ath_chanctx {
struct list_head vifs; struct list_head vifs;
struct list_head acq[IEEE80211_NUM_ACS]; struct list_head acq[IEEE80211_NUM_ACS];
/* do not dereference, use for comparison only */
struct ieee80211_vif *primary_sta;
struct ath_beacon_config beacon; struct ath_beacon_config beacon;
struct ath9k_hw_cal_data caldata; struct ath9k_hw_cal_data caldata;
struct timespec tsf_ts; struct timespec tsf_ts;
...@@ -438,7 +441,6 @@ struct ath_vif { ...@@ -438,7 +441,6 @@ struct ath_vif {
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
struct ath_node mcast_node; struct ath_node mcast_node;
int av_bslot; int av_bslot;
bool primary_sta_vif;
__le64 tsf_adjust; /* TSF adjustment for staggered beacons */ __le64 tsf_adjust; /* TSF adjustment for staggered beacons */
struct ath_buf *av_bcbuf; struct ath_buf *av_bcbuf;
struct ath_chanctx *chanctx; struct ath_chanctx *chanctx;
...@@ -451,17 +453,22 @@ struct ath9k_vif_iter_data { ...@@ -451,17 +453,22 @@ struct ath9k_vif_iter_data {
u8 hw_macaddr[ETH_ALEN]; /* address of the first vif */ u8 hw_macaddr[ETH_ALEN]; /* address of the first vif */
u8 mask[ETH_ALEN]; /* bssid mask */ u8 mask[ETH_ALEN]; /* bssid mask */
bool has_hw_macaddr; bool has_hw_macaddr;
u8 slottime;
bool beacons;
int naps; /* number of AP vifs */ int naps; /* number of AP vifs */
int nmeshes; /* number of mesh vifs */ int nmeshes; /* number of mesh vifs */
int nstations; /* number of station vifs */ int nstations; /* number of station vifs */
int nwds; /* number of WDS vifs */ int nwds; /* number of WDS vifs */
int nadhocs; /* number of adhoc vifs */ int nadhocs; /* number of adhoc vifs */
struct ieee80211_vif *primary_sta;
}; };
void ath9k_calculate_iter_data(struct ieee80211_hw *hw, void ath9k_calculate_iter_data(struct ath_softc *sc,
struct ieee80211_vif *vif, struct ath_chanctx *ctx,
struct ath9k_vif_iter_data *iter_data); struct ath9k_vif_iter_data *iter_data);
void ath9k_calculate_summary_state(struct ath_softc *sc,
struct ath_chanctx *ctx);
/*******************/ /*******************/
/* Beacon Handling */ /* Beacon Handling */
......
...@@ -277,8 +277,8 @@ static int ath9k_beacon_choose_slot(struct ath_softc *sc) ...@@ -277,8 +277,8 @@ static int ath9k_beacon_choose_slot(struct ath_softc *sc)
static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif) static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
u32 tsfadjust; u32 tsfadjust;
if (avp->av_bslot == 0) if (avp->av_bslot == 0)
...@@ -500,7 +500,6 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc, ...@@ -500,7 +500,6 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_vif *avp = (void *)vif->drv_priv;
if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
if ((vif->type != NL80211_IFTYPE_AP) || if ((vif->type != NL80211_IFTYPE_AP) ||
...@@ -514,7 +513,7 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc, ...@@ -514,7 +513,7 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc,
if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
if ((vif->type == NL80211_IFTYPE_STATION) && if ((vif->type == NL80211_IFTYPE_STATION) &&
test_bit(ATH_OP_BEACONS, &common->op_flags) && test_bit(ATH_OP_BEACONS, &common->op_flags) &&
!avp->primary_sta_vif) { vif != sc->cur_chan->primary_sta) {
ath_dbg(common, CONFIG, ath_dbg(common, CONFIG,
"Beacon already configured for a station interface\n"); "Beacon already configured for a station interface\n");
return false; return false;
...@@ -525,10 +524,11 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc, ...@@ -525,10 +524,11 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc,
} }
static void ath9k_cache_beacon_config(struct ath_softc *sc, static void ath9k_cache_beacon_config(struct ath_softc *sc,
struct ath_chanctx *ctx,
struct ieee80211_bss_conf *bss_conf) struct ieee80211_bss_conf *bss_conf)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; struct ath_beacon_config *cur_conf = &ctx->beacon;
ath_dbg(common, BEACON, ath_dbg(common, BEACON,
"Caching beacon data for BSS: %pM\n", bss_conf->bssid); "Caching beacon data for BSS: %pM\n", bss_conf->bssid);
...@@ -564,20 +564,29 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, ...@@ -564,20 +564,29 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
u32 changed) u32 changed)
{ {
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_vif *avp = (void *)vif->drv_priv;
struct ath_chanctx *ctx = avp->chanctx;
struct ath_beacon_config *cur_conf;
unsigned long flags; unsigned long flags;
bool skip_beacon = false; bool skip_beacon = false;
if (!ctx)
return;
cur_conf = &avp->chanctx->beacon;
if (vif->type == NL80211_IFTYPE_AP) if (vif->type == NL80211_IFTYPE_AP)
ath9k_set_tsfadjust(sc, vif); ath9k_set_tsfadjust(sc, vif);
if (!ath9k_allow_beacon_config(sc, vif)) if (!ath9k_allow_beacon_config(sc, vif))
return; return;
if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { if (vif->type == NL80211_IFTYPE_STATION) {
ath9k_cache_beacon_config(sc, bss_conf); ath9k_cache_beacon_config(sc, ctx, bss_conf);
if (ctx != sc->cur_chan)
return;
ath9k_set_beacon(sc); ath9k_set_beacon(sc);
set_bit(ATH_OP_BEACONS, &common->op_flags); set_bit(ATH_OP_BEACONS, &common->op_flags);
return; return;
...@@ -593,10 +602,13 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, ...@@ -593,10 +602,13 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
cur_conf->enable_beacon = false; cur_conf->enable_beacon = false;
} else if (bss_conf->enable_beacon) { } else if (bss_conf->enable_beacon) {
cur_conf->enable_beacon = true; cur_conf->enable_beacon = true;
ath9k_cache_beacon_config(sc, bss_conf); ath9k_cache_beacon_config(sc, ctx, bss_conf);
} }
} }
if (ctx != sc->cur_chan)
return;
/* /*
* Configure the HW beacon registers only when we have a valid * Configure the HW beacon registers only when we have a valid
* beacon interval. * beacon interval.
......
...@@ -750,13 +750,13 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf, ...@@ -750,13 +750,13 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
{ {
struct ath_softc *sc = file->private_data; struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ieee80211_hw *hw = sc->hw;
struct ath9k_vif_iter_data iter_data; struct ath9k_vif_iter_data iter_data;
struct ath_chanctx *ctx;
char buf[512]; char buf[512];
unsigned int len = 0; unsigned int len = 0;
ssize_t retval = 0; ssize_t retval = 0;
unsigned int reg; unsigned int reg;
u32 rxfilter; u32 rxfilter, i;
len += scnprintf(buf + len, sizeof(buf) - len, len += scnprintf(buf + len, sizeof(buf) - len,
"BSSID: %pM\n", common->curbssid); "BSSID: %pM\n", common->curbssid);
...@@ -826,14 +826,20 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf, ...@@ -826,14 +826,20 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
len += scnprintf(buf + len, sizeof(buf) - len, "\n"); len += scnprintf(buf + len, sizeof(buf) - len, "\n");
ath9k_calculate_iter_data(hw, NULL, &iter_data); i = 0;
ath_for_each_chanctx(sc, ctx) {
len += scnprintf(buf + len, sizeof(buf) - len, if (!ctx->assigned || list_empty(&ctx->vifs))
"VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i" continue;
" ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n", ath9k_calculate_iter_data(sc, ctx, &iter_data);
iter_data.naps, iter_data.nstations, iter_data.nmeshes,
iter_data.nwds, iter_data.nadhocs, len += scnprintf(buf + len, sizeof(buf) - len,
sc->nvifs, sc->nbcnvifs); "VIF-COUNTS: CTX %i AP: %i STA: %i MESH: %i WDS: %i",
i++, iter_data.naps, iter_data.nstations,
iter_data.nmeshes, iter_data.nwds);
len += scnprintf(buf + len, sizeof(buf) - len,
" ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n",
iter_data.nadhocs, sc->nvifs, sc->nbcnvifs);
}
if (len > sizeof(buf)) if (len > sizeof(buf))
len = sizeof(buf); len = sizeof(buf);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment