From 63a87fb6399ab1467dfa9f4cf821989fb4f17b00 Mon Sep 17 00:00:00 2001 From: Aaron Sowry Date: Tue, 12 Apr 2016 11:04:02 +1200 Subject: [PATCH] Implement NETOPT_ACK_REQ configuration option. Allows setting the acknowledgement request bit of 802.15.14 headers via netdev. --- drivers/netdev2_ieee802154/netdev2_ieee802154.c | 4 ++-- sys/include/net/netopt.h | 2 ++ sys/net/crosslayer/netopt/netopt.c | 1 + sys/net/link_layer/ieee802154/ieee802154.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/netdev2_ieee802154/netdev2_ieee802154.c b/drivers/netdev2_ieee802154/netdev2_ieee802154.c index c409e8fa139d..26ec0a14e335 100644 --- a/drivers/netdev2_ieee802154/netdev2_ieee802154.c +++ b/drivers/netdev2_ieee802154/netdev2_ieee802154.c @@ -84,7 +84,7 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, *((uint16_t *)value) = (uint16_t)dev->chan; res = sizeof(dev->chan); break; - case NETOPT_AUTOACK: + case NETOPT_ACK_REQ: assert(max_len == sizeof(netopt_enable_t)); if (dev->flags & NETDEV2_IEEE802154_ACK_REQ) { *((netopt_enable_t *)value) = NETOPT_ENABLE; @@ -183,7 +183,7 @@ int netdev2_ieee802154_set(netdev2_ieee802154_t *dev, netopt_t opt, void *value, dev->pan = *((uint16_t *)value); res = sizeof(dev->pan); break; - case NETOPT_AUTOACK: + case NETOPT_ACK_REQ: if ((*(bool *)value)) { dev->flags |= NETDEV2_IEEE802154_ACK_REQ; } diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 778d1d8ff0e3..9bf1bad0a8e8 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -90,6 +90,8 @@ typedef enum { * the current state */ NETOPT_AUTOACK, /**< en/disable link layer auto ACKs or read * the current state */ + NETOPT_ACK_REQ, /**< en/disable acknowledgement requests or + * read the current state */ NETOPT_RETRANS, /**< get/set the maximum number of * retransmissions. */ NETOPT_PROTO, /**< get/set the protocol for the layer diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index c470a247c319..83ec4d26efaf 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -37,6 +37,7 @@ static const char *_netopt_strmap[] = { [NETOPT_PRELOADING] = "NETOPT_PRELOADING", [NETOPT_PROMISCUOUSMODE] = "NETOPT_PROMISCUOUSMODE", [NETOPT_AUTOACK] = "NETOPT_AUTOACK", + [NETOPT_ACK_REQ] = "NETOPT_ACK_REQ", [NETOPT_RETRANS] = "NETOPT_RETRANS", [NETOPT_PROTO] = "NETOPT_PROTO", [NETOPT_STATE] = "NETOPT_STATE", diff --git a/sys/net/link_layer/ieee802154/ieee802154.c b/sys/net/link_layer/ieee802154/ieee802154.c index 043c20d0352d..489d8f6a80e4 100644 --- a/sys/net/link_layer/ieee802154/ieee802154.c +++ b/sys/net/link_layer/ieee802154/ieee802154.c @@ -53,7 +53,7 @@ size_t ieee802154_set_frame_hdr(uint8_t *buf, const uint8_t *src, size_t src_len /* fill in destination address */ if (bcast) { - /* no AUTOACK for broadcast */ + /* no ACK_REQ for broadcast */ buf[0] &= ~IEEE802154_FCF_ACK_REQ; buf[1] &= ~IEEE802154_FCF_DST_ADDR_MASK; buf[1] |= IEEE802154_FCF_DST_ADDR_SHORT;