mrf24j40: Fix netdev recv implementation#9562
Merged
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom Jul 13, 2018
Merged
Conversation
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
Member
PeterKietzmann
left a comment
There was a problem hiding this comment.
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 |
Member
There was a problem hiding this comment.
Why don't you need to flush the rx buffer anymore?
mrf24j40_reg_write_short(dev, MRF24J40_REG_RXFLUSH, MRF24J40_RXFLUSH_RXFLUSH);
Member
Author
There was a problem hiding this comment.
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.
PeterKietzmann
approved these changes
Jul 13, 2018
Member
Author
|
Thanks for the review and testing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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