mac80211_hwsim: fix beacon delta calculation
authorBenjamin Beichler <[email protected]>
Fri, 11 Nov 2016 16:37:56 +0000 (17:37 +0100)
committerJohannes Berg <[email protected]>
Tue, 15 Nov 2016 13:39:56 +0000 (14:39 +0100)
Due to the cast from uint32_t to int64_t, a wrong next beacon timing is
calculated and effectively the beacon timer stops working. This is
especially bad for 802.11s mesh networks, because discovery breaks
without beacons.

Signed-off-by: Benjamin Beichler <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
drivers/net/wireless/mac80211_hwsim.c

index 431f13b4faf690c885fbd459b257de5d103406a8..d3bad577937622c868257892cf1658c561c3b947 100644 (file)
@@ -826,7 +826,7 @@ static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
                data->bcn_delta = do_div(delta, bcn_int);
        } else {
                data->tsf_offset -= delta;
-               data->bcn_delta = -do_div(delta, bcn_int);
+               data->bcn_delta = -(s64)do_div(delta, bcn_int);
        }
 }