Re: [PATCH v2 14/22] mac80211: encode listen interval for S1G

Johannes Berg
2020-09-18T10:51:51Z

On Mon, 2020-08-31 at 13:55 -0700, Thomas Pedersen wrote:

> +static const int listen_int_usf[] = { 1, 10, 1000, 10000 };

That should probably be in some C file?

OTOH ... maybe it's small enough to duplicate everywhere? could make it
u16 at least :)

> +__le16 ieee80211_encode_usf(int listen_interval)
> +{
> + u16 ui, usf = 0;
> +
> + /* find greatest USF */
> + while (usf < IEEE80211_MAX_USF) {
> + if (listen_interval % listen_int_usf[usf + 1])
> + break;
> + usf += 1;
> + }
> + ui = listen_interval / listen_int_usf[usf];

But you really only need it here in one place anyway.

johannes