On 2020-09-18 03:51, Johannes Berg wrote:
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.
OK better to keep it private to that file then.
--
thomas