[PATCH 2/2] wifi: mac80211: ageout BSS color bitmap
Johannes Berg
johannes at sipsolutions.net
Mon Jun 5 04:33:09 PDT 2023
On Mon, 2023-04-03 at 14:04 -0700, Yi-Chia Hsieh wrote:
> +/* ageout time for OBSS BSS color */
> +#define IEEE80211_BSS_COLOR_AGEOUT_TIME 10
I don't think that should be in this file, it's implementation defined.
Also it might be nicer to just define it in jiffies, i.e. (10 * HZ),
directly.
> +++ b/include/net/mac80211.h
> @@ -750,6 +750,7 @@ struct ieee80211_bss_conf {
> bool color_change_active;
> u8 color_change_color;
> u64 used_color_bitmap;
> + unsigned long color_last_seen[IEEE80211_BSS_COLOR_MAX + 1];
This is really big (512 bytes) and per link - might make sense to only
allocate when needed.
> +void ieee80211_color_aging_work(struct work_struct *work)
> +{
> + struct ieee80211_sub_if_data *sdata =
> + container_of(work, struct ieee80211_sub_if_data,
> + deflink.color_aging_work.work);
> + struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
> + int i;
> +
> + sdata_lock(sdata);
> +
> + if (!ieee80211_sdata_running(sdata))
> + goto unlock;
> +
> + for (i = 1; i < IEEE80211_BSS_COLOR_MAX + 1; i++) {
> + /* ageout if not seen for a period */
> + if ((bss_conf->used_color_bitmap & BIT_ULL(i)) &&
> + time_before(bss_conf->color_last_seen[i],
> + jiffies - IEEE80211_BSS_COLOR_AGEOUT_TIME * HZ)) {
> + bss_conf->used_color_bitmap &= ~BIT_ULL(i);
> + }
> + }
> +
> + ieee80211_queue_delayed_work(&sdata->local->hw,
> + &sdata->deflink.color_aging_work, HZ);
What? No ... you really can't do this. Just schedule the work properly
at the right time, don't leave it running forever every 1 second!!
> @@ -1430,6 +1431,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
>
> set_bit(SDATA_STATE_RUNNING, &sdata->state);
>
> + if (sdata->vif.type == NL80211_IFTYPE_AP)
> + ieee80211_queue_delayed_work(&sdata->local->hw,
> + &sdata->deflink.color_aging_work,
> + HZ);
Again, no.
johannes
More information about the Linux-mediatek
mailing list