From 02395e593d76c02d52a6c9e5a133583e3d993e92 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Tue, 10 Apr 2018 23:59:50 +0200 Subject: [PATCH 1/2] sys: netopt: add checksum option --- sys/include/net/netopt.h | 7 +++++++ sys/net/crosslayer/netopt/netopt.c | 1 + sys/shell/commands/sc_gnrc_netif.c | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 15744b27ca..132bc20fc2 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -539,6 +539,13 @@ typedef enum { */ NETOPT_BLE_CTX, + /** + * @brief (@ref netopt_enable_t) enable hardware checksumming + * + * If enabled, enable hardware checksumming of incoming frames. + */ + NETOPT_CHECKSUM, + /* add more options if needed */ /** diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index e9ba46d5a4..4f1355a1e0 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -90,6 +90,7 @@ static const char *_netopt_strmap[] = { [NETOPT_TX_RETRIES_NEEDED] = "NETOPT_TX_RETRIES_NEEDED", [NETOPT_6LO_IPHC] = "NETOPT_6LO_IPHC", [NETOPT_BLE_CTX] = "NETOPT_BLE_CTX", + [NETOPT_CHECKSUM] = "NETOPT_CHECKSUM", [NETOPT_NUMOF] = "NETOPT_NUMOF", }; diff --git a/sys/shell/commands/sc_gnrc_netif.c b/sys/shell/commands/sc_gnrc_netif.c index 403fbadb8f..46b48411ee 100644 --- a/sys/shell/commands/sc_gnrc_netif.c +++ b/sys/shell/commands/sc_gnrc_netif.c @@ -71,7 +71,8 @@ static const struct { { "rtr_adv", NETOPT_IPV6_SND_RTR_ADV }, { "iq_invert", NETOPT_IQ_INVERT }, { "rx_single", NETOPT_SINGLE_RECEIVE }, - { "chan_hop", NETOPT_CHANNEL_HOP } + { "chan_hop", NETOPT_CHANNEL_HOP }, + { "checksum", NETOPT_CHECKSUM }, }; /* utility functions */ @@ -150,6 +151,7 @@ static void _set_usage(char *cmd_name) " * \"freq\" - sets the \"channel\" center frequency\n" " * \"channel\" - sets the frequency channel\n" " * \"chan\" - alias for \"channel\"\n" + " * \"checksum\" - set checksumming on-off\n" " * \"csma_retries\" - set max. number of channel access attempts\n" " * \"encrypt\" - set the encryption on-off\n" " * \"hop_limit\" - set hop limit\n" @@ -276,6 +278,10 @@ static void _print_netopt(netopt_t opt) printf("coding rate"); break; + case NETOPT_CHECKSUM: + printf("checksum"); + break; + default: /* we don't serve these options here */ break; From 7781da77995a1e9ae5fae9265afc808e685e4f45 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Sun, 6 May 2018 22:39:20 +0200 Subject: [PATCH 2/2] sys: netopt: add busy option --- sys/include/net/netopt.h | 8 ++++++++ sys/net/crosslayer/netopt/netopt.c | 1 + sys/shell/commands/sc_gnrc_netif.c | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 132bc20fc2..5646d2db32 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -546,6 +546,14 @@ typedef enum { */ NETOPT_CHECKSUM, + /** + * @brief (@ref netopt_enable_t) enable busy mode + * + * When set, the PHY will enter busy mode, in which it will not accept + * incoming frames until unset. + */ + NETOPT_PHY_BUSY, + /* add more options if needed */ /** diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index 4f1355a1e0..ac04811054 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -91,6 +91,7 @@ static const char *_netopt_strmap[] = { [NETOPT_6LO_IPHC] = "NETOPT_6LO_IPHC", [NETOPT_BLE_CTX] = "NETOPT_BLE_CTX", [NETOPT_CHECKSUM] = "NETOPT_CHECKSUM", + [NETOPT_PHY_BUSY] = "NETOPT_PHY_BUSY", [NETOPT_NUMOF] = "NETOPT_NUMOF", }; diff --git a/sys/shell/commands/sc_gnrc_netif.c b/sys/shell/commands/sc_gnrc_netif.c index 46b48411ee..39e37bbfe8 100644 --- a/sys/shell/commands/sc_gnrc_netif.c +++ b/sys/shell/commands/sc_gnrc_netif.c @@ -67,6 +67,7 @@ static const struct { { "iphc", NETOPT_6LO_IPHC }, { "preload", NETOPT_PRELOADING }, { "promisc", NETOPT_PROMISCUOUSMODE }, + { "phy_busy", NETOPT_PHY_BUSY }, { "raw", NETOPT_RAWMODE }, { "rtr_adv", NETOPT_IPV6_SND_RTR_ADV }, { "iq_invert", NETOPT_IQ_INVERT }, @@ -162,6 +163,7 @@ static void _set_usage(char *cmd_name) " * \"page\" - set the channel page (IEEE 802.15.4)\n" " * \"pan\" - alias for \"nid\"\n" " * \"pan_id\" - alias for \"nid\"\n" + " * \"phy_busy\" - set busy mode on-off\n" " * \"bw\" - alias for channel bandwidth\n" " * \"sf\" - alias for spreading factor\n" " * \"cr\" - alias for coding rate\n" @@ -282,6 +284,10 @@ static void _print_netopt(netopt_t opt) printf("checksum"); break; + case NETOPT_PHY_BUSY: + printf("PHY busy"); + break; + default: /* we don't serve these options here */ break;