[riot-notifications] [RIOT-OS/RIOT] drivers/w5100: Fixed netdev_driver_t::recv() API (#10412)

Marian Buschsieweke notifications at github.com
Tue Jan 22 13:09:27 CET 2019


maribu commented on this pull request.



>  
-            /* if RX buffer now empty, clear RECV interrupt flag */
-            if ((num - psize) == 0) {
-                wreg(dev, S0_IR, IR_RECV);
-            }
+        /* if frame received OR drop requested, remove frame from RX buffer */
+        if ((in_buf != NULL) || (len > 0)) {

OK, it should have checked for `max_len > 0`, as `len` is computed within this function and always `>0`, unless an empty frame was received.

Also, checking for `max_len > 0` should be sufficient. The cases we have are:

| Case     | `buf`     | `max_len` | Call `drop()`? |
|----------|-----------|-----------|----------------|
| get size | `NULL`    | `0`       | No             |
| recvieve | `!= NULL` | `> 0`     | Yes            |
| drop     | `NULL`    | `> 0`     | Yes            |

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10412#discussion_r249753678
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190122/c8a5702c/attachment.html>


More information about the notifications mailing list