diff options
| author | Dmitry Antipov <dmantipov@yandex.ru> | 2024-05-08 14:40:10 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-07-11 12:47:10 +0200 |
| commit | a0d1afe8a9650f38b82f9762d4c94a323b221908 (patch) | |
| tree | 60264b8809a49c21677fe52a87852b84e4fbec96 /net | |
| parent | 325d8659b8fdbee76a56645cc70a39f10667b0df (diff) | |
| download | linux-a0d1afe8a9650f38b82f9762d4c94a323b221908.tar.gz linux-a0d1afe8a9650f38b82f9762d4c94a323b221908.tar.bz2 linux-a0d1afe8a9650f38b82f9762d4c94a323b221908.zip | |
mac802154: fix time calculation in ieee802154_configure_durations()
[ Upstream commit 07aa33988ad92fef79056f5ec30b9a0e4364b616 ]
Since 'symbol_duration' of 'struct wpan_phy' is in nanoseconds but
'lifs_period' and 'sifs_period' are both in microseconds, fix time
calculation in 'ieee802154_configure_durations()' and use convenient
'NSEC_PER_USEC' in 'ieee802154_setup_wpan_phy_pib()' as well.
Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 781830c800dd ("net: mac802154: Set durations automatically")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Message-ID: <20240508114010.219527-1-dmantipov@yandex.ru>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/mac802154/main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/mac802154/main.c b/net/mac802154/main.c index bd7bdb1219dd..356e86c3c9b1 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c @@ -152,8 +152,10 @@ void ieee802154_configure_durations(struct wpan_phy *phy) } phy->symbol_duration = duration; - phy->lifs_period = (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_SEC; - phy->sifs_period = (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_SEC; + phy->lifs_period = + (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; + phy->sifs_period = + (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; } EXPORT_SYMBOL(ieee802154_configure_durations); @@ -175,10 +177,10 @@ static void ieee802154_setup_wpan_phy_pib(struct wpan_phy *wpan_phy) * Should be done when all drivers sets this value. */ - wpan_phy->lifs_period = - (IEEE802154_LIFS_PERIOD * wpan_phy->symbol_duration) / 1000; - wpan_phy->sifs_period = - (IEEE802154_SIFS_PERIOD * wpan_phy->symbol_duration) / 1000; + wpan_phy->lifs_period = (IEEE802154_LIFS_PERIOD * + wpan_phy->symbol_duration) / NSEC_PER_USEC; + wpan_phy->sifs_period = (IEEE802154_SIFS_PERIOD * + wpan_phy->symbol_duration) / NSEC_PER_USEC; } int ieee802154_register_hw(struct ieee802154_hw *hw) |
