From 02395e593d76c02d52a6c9e5a133583e3d993e92 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Tue, 10 Apr 2018 23:59:50 +0200 Subject: [PATCH] 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;