Skip to content

mrf24j40: Fix netdev recv implementation#9562

Merged
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
bergzand:pr/mrf24j40/netdev_recv_fix
Jul 13, 2018
Merged

mrf24j40: Fix netdev recv implementation#9562
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
bergzand:pr/mrf24j40/netdev_recv_fix

Conversation

@bergzand
Copy link
Copy Markdown
Member

The mrf24j40 driver should return the frame length when both buf is NULL
and len is zero and drop the packet when len is nonzero and buf is NULL.
This PR fixes that behaviour

Issues/PRs references

None

The mrf24j40 driver should return the frame length when both buf is NULL
and len is zero and drop the packet when len is nonzero and buf is NULL.
This commit fixes that behaviour
@bergzand bergzand added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking Area: drivers Area: Device drivers labels Jul 12, 2018
@bergzand bergzand requested a review from PeterKietzmann July 12, 2018 13:58
Copy link
Copy Markdown
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested heavy pinging between a samr21-xpro and a nucleo-l476rg equipped with the mrf24j40 (pinging from the samr21-xpro). Doesn't break anything.

master:

ping6 1000 fe80::7517:732e:332:124e 1000 0
...
--- fe80::7517:732e:332:124e ping statistics ---
1000 packets transmitted, 995 received, 1% packet loss, time 155.06593401 s
rtt min/avg/max = 133.119/142.733/159.732 ms

With this PR:

ping6 1000 fe80::7517:732e:332:124e 1000 0
...
--- fe80::7517:732e:332:124e ping statistics ---
1000 packets transmitted, 998 received, 1% packet loss, time 152.06724640 s
rtt min/avg/max = 127.792/142.620/153.133 ms

/* Turn on reception of packets off the air */
mrf24j40_reg_write_short(dev, MRF24J40_REG_BBREG1, 0x00);
return pkt_len;
/* Return -ENOBUFS if a too small buffer is supplied. Return packet size
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you need to flush the rx buffer anymore?
mrf24j40_reg_write_short(dev, MRF24J40_REG_RXFLUSH, MRF24J40_RXFLUSH_RXFLUSH);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page 109 of the mrf24j40 datasheet describes the ways to reset the RX FIFO pointer. writing the RXFLUSH bit is one way, but it is also reset by reading the first byte of the received frame. As we always read the first bytes of the frame this extra flush is not necessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@PeterKietzmann PeterKietzmann added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 13, 2018
@PeterKietzmann PeterKietzmann merged commit 7816d35 into RIOT-OS:master Jul 13, 2018
@bergzand
Copy link
Copy Markdown
Member Author

Thanks for the review and testing!

@bergzand bergzand deleted the pr/mrf24j40/netdev_recv_fix branch July 13, 2018 08:52
@cladmi cladmi added this to the Release 2018.10 milestone Aug 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants