From e81b6191aa98c725ec5afea326f34760eaa2024d Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Wed, 26 Dec 2018 20:40:25 +0100
Subject: [PATCH] netdev_driver_t::recv: Clarified small buf case

Clarified in the documentation how netdev_driver_t::recv() should behave in case
the size of the buffer in parameter buf (indicated by parameter len) is to small
to fit the received frame.
---
 drivers/include/net/netdev.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/include/net/netdev.h b/drivers/include/net/netdev.h
index c0824d4ed5..8824a4422a 100644
--- a/drivers/include/net/netdev.h
+++ b/drivers/include/net/netdev.h
@@ -323,6 +323,13 @@ typedef struct netdev_driver {
      * If @p buf == NULL and @p len > 0, drops the packet and returns the packet
      * size.
      *
+     * If called with @p buf != NULL and @p len is smaller than the received
+     * packet:
+     *  - The received packet is dropped
+     *  - The content in @p buf becomes invalid. (The driver may use the memory
+     *    to implement the dropping - or may not change it.)
+     *  - `-ENOBUFS` is returned
+     *
      * @param[in]   dev     network device descriptor. Must not be NULL.
      * @param[out]  buf     buffer to write into or NULL to return the packet
      *                      size.
-- 
GitLab