From 5b0152f4f7e75c7f92a3d252a052ecc4feaf7214 Mon Sep 17 00:00:00 2001 From: Semjon Kerner Date: Thu, 30 Aug 2018 11:54:50 +0200 Subject: [PATCH] drivers/netdev_ieee802154: drop NETOPT_MAX_PKT_SIZE --- cpu/cc2538/radio/cc2538_rf_netdev.c | 9 --------- cpu/native/include/socket_zep.h | 3 --- cpu/native/socket_zep/socket_zep.c | 17 ++--------------- drivers/at86rf2xx/at86rf2xx_netdev.c | 7 ------- drivers/cc2420/cc2420_netdev.c | 7 ------- drivers/kw2xrf/kw2xrf_netdev.c | 10 ---------- drivers/mrf24j40/mrf24j40_netdev.c | 12 ------------ 7 files changed, 2 insertions(+), 63 deletions(-) diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index 387abb9fb3..e63e610d9e 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -31,8 +31,6 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define _MAX_MHR_OVERHEAD (25) - /* Reference pointer for the IRQ handler */ static netdev_t *_dev; @@ -88,13 +86,6 @@ static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) case NETOPT_IS_WIRED: return -ENOTSUP; - case NETOPT_MAX_PACKET_SIZE: - if (max_len < sizeof(int16_t)) { - return -EOVERFLOW; - } - *((uint16_t *)value) = CC2538_RF_MAX_DATA_LEN - _MAX_MHR_OVERHEAD; - return sizeof(uint16_t); - case NETOPT_PROMISCUOUSMODE: if (cc2538_get_monitor()) { *((netopt_enable_t *)value) = NETOPT_ENABLE; diff --git a/cpu/native/include/socket_zep.h b/cpu/native/include/socket_zep.h index bcb945cac8..01bbad616c 100644 --- a/cpu/native/include/socket_zep.h +++ b/cpu/native/include/socket_zep.h @@ -31,9 +31,6 @@ extern "C" { #endif -/* 127 - 25 as in at86rf2xx */ -#define SOCKET_ZEP_FRAME_PAYLOAD_LEN (102) /**< maximum possible payload size */ - /** * @brief ZEP device state */ diff --git a/cpu/native/socket_zep/socket_zep.c b/cpu/native/socket_zep/socket_zep.c index f62b98cdba..cb40fba8af 100644 --- a/cpu/native/socket_zep/socket_zep.c +++ b/cpu/native/socket_zep/socket_zep.c @@ -304,21 +304,8 @@ static int _init(netdev_t *netdev) static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) { - socket_zep_t *dev = (socket_zep_t *)netdev; - uint16_t *v = value; - - assert((dev != NULL)); - switch (opt) { - case NETOPT_MAX_PACKET_SIZE: - assert(value != NULL); - if (max_len != sizeof(uint16_t)) { - return -EOVERFLOW; - } - *v = SOCKET_ZEP_FRAME_PAYLOAD_LEN; - return sizeof(uint16_t); - default: - return netdev_ieee802154_get(&dev->netdev, opt, value, max_len); - } + assert(netdev != NULL); + return netdev_ieee802154_get((netdev_ieee802154_t *)netdev, opt, value, max_len); } static int _set(netdev_t *netdev, netopt_t opt, const void *value, diff --git a/drivers/at86rf2xx/at86rf2xx_netdev.c b/drivers/at86rf2xx/at86rf2xx_netdev.c index 2533806b19..2623524b78 100644 --- a/drivers/at86rf2xx/at86rf2xx_netdev.c +++ b/drivers/at86rf2xx/at86rf2xx_netdev.c @@ -42,8 +42,6 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define _MAX_MHR_OVERHEAD (25) - static int _send(netdev_t *netdev, const iolist_t *iolist); static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); static int _init(netdev_t *netdev); @@ -284,11 +282,6 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) ((uint8_t *)val)[0] = at86rf2xx_get_page(dev); return sizeof(uint16_t); - case NETOPT_MAX_PACKET_SIZE: - assert(max_len >= sizeof(int16_t)); - *((uint16_t *)val) = AT86RF2XX_MAX_PKT_LENGTH - _MAX_MHR_OVERHEAD; - return sizeof(uint16_t); - case NETOPT_STATE: assert(max_len >= sizeof(netopt_state_t)); *((netopt_state_t *)val) = _get_state(dev); diff --git a/drivers/cc2420/cc2420_netdev.c b/drivers/cc2420/cc2420_netdev.c index 20f741e723..58cbe50e6a 100644 --- a/drivers/cc2420/cc2420_netdev.c +++ b/drivers/cc2420/cc2420_netdev.c @@ -38,8 +38,6 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define _MAX_MHR_OVERHEAD (25) - static int _send(netdev_t *netdev, const iolist_t *iolist); static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); static int _init(netdev_t *netdev); @@ -188,11 +186,6 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) cc2420_get_addr_long(dev, val); return 8; - case NETOPT_MAX_PACKET_SIZE: - assert(max_len >= sizeof(int16_t)); - *((uint16_t *)val) = CC2420_PKT_MAXLEN - _MAX_MHR_OVERHEAD; - return sizeof(int16_t); - case NETOPT_NID: assert(max_len >= sizeof(uint16_t)); return w_u16(val, cc2420_get_pan(dev)); diff --git a/drivers/kw2xrf/kw2xrf_netdev.c b/drivers/kw2xrf/kw2xrf_netdev.c index 2fc899f4fd..532e200851 100644 --- a/drivers/kw2xrf/kw2xrf_netdev.c +++ b/drivers/kw2xrf/kw2xrf_netdev.c @@ -42,8 +42,6 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define _MAX_MHR_OVERHEAD (25) - #define _MACACKWAITDURATION (864 / 16) /* 864us * 62500Hz */ #define KW2XRF_THREAD_FLAG_ISR (1 << 8) @@ -260,14 +258,6 @@ int _get(netdev_t *netdev, netopt_t opt, void *value, size_t len) } switch (opt) { - case NETOPT_MAX_PACKET_SIZE: - if (len < sizeof(int16_t)) { - return -EOVERFLOW; - } - - *((uint16_t *)value) = KW2XRF_MAX_PKT_LENGTH - _MAX_MHR_OVERHEAD; - return sizeof(uint16_t); - case NETOPT_STATE: if (len < sizeof(netopt_state_t)) { return -EOVERFLOW; diff --git a/drivers/mrf24j40/mrf24j40_netdev.c b/drivers/mrf24j40/mrf24j40_netdev.c index 41c35395ef..099bc3789b 100644 --- a/drivers/mrf24j40/mrf24j40_netdev.c +++ b/drivers/mrf24j40/mrf24j40_netdev.c @@ -37,8 +37,6 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define _MAX_MHR_OVERHEAD (25) - static void _irq_handler(void *arg) { netdev_t *dev = (netdev_t *) arg; @@ -187,16 +185,6 @@ static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) } break; - case NETOPT_MAX_PACKET_SIZE: - if (max_len < sizeof(int16_t)) { - res = -EOVERFLOW; - } - else { - *((uint16_t *)val) = IEEE802154_FRAME_LEN_MAX - _MAX_MHR_OVERHEAD; - res = sizeof(uint16_t); - } - break; - case NETOPT_STATE: if (max_len < sizeof(netopt_state_t)) { res = -EOVERFLOW;