diff mbox series

[wpan-next] net: mac802154: Fix symbol durations

Message ID 20220428164140.251965-1-miquel.raynal@bootlin.com (mailing list archive)
State Accepted
Headers show
Series [wpan-next] net: mac802154: Fix symbol durations | expand

Commit Message

Miquel Raynal April 28, 2022, 4:41 p.m. UTC
There are two major issues in the logic calculating the symbol durations
based on the page/channel:
- The page number is used in place of the channel value.
- The BIT() macro is missing because we want to check the channel
  value against a bitmask.

Fix these two errors and apologize loudly for this mistake.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/mac802154/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Alexander Aring April 28, 2022, 6:32 p.m. UTC | #1
Hi,

On Thu, Apr 28, 2022 at 12:41 PM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> There are two major issues in the logic calculating the symbol durations
> based on the page/channel:
> - The page number is used in place of the channel value.
> - The BIT() macro is missing because we want to check the channel
>   value against a bitmask.
>
> Fix these two errors and apologize loudly for this mistake.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Acked-by: Alexander Aring <aahringo@redhat.com>

- Alex
Stefan Schmidt April 30, 2022, 6:37 p.m. UTC | #2
Hello.

On 28.04.22 18:41, Miquel Raynal wrote:
> There are two major issues in the logic calculating the symbol durations
> based on the page/channel:
> - The page number is used in place of the channel value.
> - The BIT() macro is missing because we want to check the channel
>    value against a bitmask.
> 
> Fix these two errors and apologize loudly for this mistake.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>


This patch has been applied to the wpan-next tree and will be
part of the next pull request to net-next. Thanks!

regards
Stefan Schmidt
diff mbox series

Patch

diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 5546ef86e231..bd7bdb1219dd 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -119,26 +119,26 @@  void ieee802154_configure_durations(struct wpan_phy *phy)
 
 	switch (phy->current_page) {
 	case 0:
-		if (BIT(phy->current_page) & 0x1)
+		if (BIT(phy->current_channel) & 0x1)
 			/* 868 MHz BPSK 802.15.4-2003: 20 ksym/s */
 			duration = 50 * NSEC_PER_USEC;
-		else if (phy->current_page & 0x7FE)
+		else if (BIT(phy->current_channel) & 0x7FE)
 			/* 915 MHz BPSK	802.15.4-2003: 40 ksym/s */
 			duration = 25 * NSEC_PER_USEC;
-		else if (phy->current_page & 0x7FFF800)
+		else if (BIT(phy->current_channel) & 0x7FFF800)
 			/* 2400 MHz O-QPSK 802.15.4-2006: 62.5 ksym/s */
 			duration = 16 * NSEC_PER_USEC;
 		break;
 	case 2:
-		if (BIT(phy->current_page) & 0x1)
+		if (BIT(phy->current_channel) & 0x1)
 			/* 868 MHz O-QPSK 802.15.4-2006: 25 ksym/s */
 			duration = 40 * NSEC_PER_USEC;
-		else if (phy->current_page & 0x7FE)
+		else if (BIT(phy->current_channel) & 0x7FE)
 			/* 915 MHz O-QPSK 802.15.4-2006: 62.5 ksym/s */
 			duration = 16 * NSEC_PER_USEC;
 		break;
 	case 3:
-		if (BIT(phy->current_page) & 0x3FFF)
+		if (BIT(phy->current_channel) & 0x3FFF)
 			/* 2.4 GHz CSS 802.15.4a-2007: 1/6 Msym/s */
 			duration = 6 * NSEC_PER_USEC;
 		break;