Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/net/http_server/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ tests:
test_usbnet_ecm:
harness: net
extra_args: CONF_FILE="prj_netusb.conf"
platform_whitelist: quark_se_c1000_devboard 96b_carbon
platform_whitelist: 96b_carbon
tags: net usb
test_usbnet_eem:
harness: net
extra_args: CONF_FILE="prj_netusb.conf"
extra_configs:
- CONFIG_USB_DEVICE_NETWORK_ECM=n
- CONFIG_USB_DEVICE_NETWORK_EEM=y
platform_whitelist: quark_se_c1000_devboard 96b_carbon
platform_whitelist: 96b_carbon
tags: net usb
12 changes: 4 additions & 8 deletions samples/net/mqtt_publisher/prj_96b_nitrogen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ CONFIG_NET_IPV6_MAX_NEIGHBORS=6
CONFIG_NET_MAX_CONTEXTS=5
CONFIG_NET_SHELL=y

CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_PKT_RX_COUNT=15
CONFIG_NET_PKT_TX_COUNT=15
CONFIG_NET_BUF_DATA_SIZE=256
CONFIG_NET_BUF_RX_COUNT=15
CONFIG_NET_BUF_TX_COUNT=15
CONFIG_NET_BUF_RX_COUNT=11
CONFIG_NET_BUF_TX_COUNT=11

CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
Expand Down Expand Up @@ -60,7 +60,3 @@ CONFIG_BT_CONN=y
CONFIG_BT_SIGNING=y
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_DEBUG_LOG=y

CONFIG_CONSOLE_SHELL=y
CONFIG_CONSOLE_SHELL_STACKSIZE=1504
CONFIG_CONSOLE_SHELL_MAX_CMD_QUEUED=3
57 changes: 38 additions & 19 deletions samples/net/rpl_border_router/src/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#define NET_LOG_LEVEL LOG_LEVEL_DBG

#include <zephyr.h>
#include <shell/legacy_shell.h>
#include <shell/shell.h>
#include <shell/shell_uart.h>
#include <stdio.h>

#include "../../../subsys/net/ip/rpl.h"
Expand All @@ -17,57 +18,75 @@

#define BR_SHELL_MODULE "br"

int br_repair(int argc, char *argv[])
static int cmd_br_repair(const struct shell *shell,
size_t argc, char *argv[])
{
ARG_UNUSED(argc);
ARG_UNUSED(argv);

NET_INFO("Starting global repair...");
if (shell_help_requested(shell)) {
shell_help_print(shell, NULL, 0);
return -ENOEXEC;
}

shell_fprintf(shell, SHELL_INFO, "Starting global repair...\n");

net_rpl_repair_root(CONFIG_NET_RPL_DEFAULT_INSTANCE);

return 0;
}

int coap_send(int argc, char *argv[])
static int cmd_coap_send(const struct shell *shell,
size_t argc, char *argv[])
{
struct in6_addr peer_addr;
enum coap_request_type type;
int r;

if (shell_help_requested(shell)) {
shell_help_print(shell, NULL, 0);
return -ENOEXEC;
}

if (argc != 3 || !argv[1] || !argv[2]) {
NET_INFO("Invalid arguments");
return -EINVAL;
shell_fprintf(shell, SHELL_ERROR, "Invalid arguments.\n");
return -ENOEXEC;
}

r = net_addr_pton(AF_INET6, argv[2], &peer_addr);
if (r < 0) {
return -EINVAL;
return -ENOEXEC;
}

if (strcmp(argv[1], "toggle") == 0) {
type = COAP_REQ_TOGGLE_LED;
} else if (strcmp(argv[1], "rpl_obs") == 0) {
type = COAP_REQ_RPL_OBS;
} else {
NET_INFO("Invalid arguments");
return -EINVAL;
shell_fprintf(shell, SHELL_ERROR, "Invalid arguments.\n");
return -ENOEXEC;
}

coap_send_request(&peer_addr, type, NULL, NULL);

return 0;
}

static struct shell_cmd br_commands[] = {
/* Keep the commands in alphabetical order */
{ "coap", coap_send, "\n\tSend CoAP commands to Node\n"
"toggle <host>\n\tToggle the LED on Node\n"
"rpl_obs <host>\n\tSet RPL observer on Node\n"
},
{ "repair", br_repair,
"\n\tGlobal repair RPL network" },
{ NULL, NULL, NULL }
SHELL_CREATE_STATIC_SUBCMD_SET(br_commands)
{
SHELL_CMD(coap, NULL,
"Send CoAP commands to Node\n"
"toggle <host> Toggle the LED on Node\n"
"rpl_obs <host> Set RPL observer on Node",
cmd_coap_send),
SHELL_CMD(repair, NULL,
"Global repair RPL network",
cmd_br_repair),
SHELL_SUBCMD_SET_END
};

SHELL_REGISTER(BR_SHELL_MODULE, br_commands);
SHELL_CMD_REGISTER(br, &br_commands, "Border router commands", NULL);

void br_shell_init(void)
{
}
7 changes: 0 additions & 7 deletions samples/net/wpanusb/src/wpanusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <net_private.h>

#include <device.h>
#include <shell/legacy_shell.h>

#include <usb/usb_device.h>
#include <usb/usb_common.h>
Expand Down Expand Up @@ -494,10 +493,6 @@ int net_recv_data(struct net_if *iface, struct net_pkt *pkt)
return 0;
}

struct shell_cmd commands[] = {
{ NULL, NULL }
};

void main(void)
{
wpanusb_start(&__dev);
Expand All @@ -521,6 +516,4 @@ void main(void)
/* TODO: Initialize more */

NET_DBG("radio_api %p initialized", radio_api);

SHELL_REGISTER("wpan", commands);
}
34 changes: 8 additions & 26 deletions samples/net/zperf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,30 @@
cmake_minimum_required(VERSION 3.8.2)

macro(set_conf_file)
if(PROFILER)
set(CONF_FILE prj_${BOARD}_prof.conf)
if(EXISTS ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf)
set(CONF_FILE "${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf")
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
set(CONF_FILE
"prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf")
else()
set(CONF_FILE prj_${BOARD}.conf)
set(CONF_FILE "prj.conf")
endif()
endmacro()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(
app PRIVATE
target_sources(app PRIVATE
src/shell_utils.c
src/zperf_session.c
src/zperf_shell.c
)
target_sources_ifdef(
CONFIG_NET_UDP
app PRIVATE
src/zperf_udp_receiver.c
src/zperf_udp_uploader.c
)
target_sources_ifdef(
CONFIG_NET_TCP
app PRIVATE
src/zperf_tcp_receiver.c
src/zperf_tcp_uploader.c
)

target_compile_definitions_ifdef(
PROFILER
app PRIVATE
PROFILER
)

target_include_directories(app PRIVATE
$ENV{ZEPHYR_BASE}/subsys/net/ip
$ENV{ZEPHYR_BASE}/samples/task_profiler/profiler/src
)

if(PROFILER)
assert(0 "PROFILER is not supported yet")
# KBuild did this, but this did not work, not sure why.
# export PROFILER_NO_SHELL_REGISTER=1
# obj-y += ../../../task_profiler/profiler/
endif()
13 changes: 6 additions & 7 deletions samples/net/zperf/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Features

- Compatible with iPerf_2.0.5.
- Client or server mode allowed without need to modify the source code.
- Working with task profiler (PROFILER=1 to be set when building zperf)

Supported Boards
****************
Expand Down Expand Up @@ -58,43 +57,43 @@ In the Zephyr console, zperf can be executed as follows:

.. code-block:: console

zperf> udp.upload 2001:db8::2 5001 10 1K 1M
zperf> udp upload 2001:db8::2 5001 10 1K 1M


For TCP the zperf command would look like this:

.. code-block:: console

zperf> tcp.upload 2001:db8::2 5001 10 1K 1M
zperf> tcp upload 2001:db8::2 5001 10 1K 1M


If the IP addresses of Zephyr and the host machine are specified in the
config file, zperf can be started as follows:

.. code-block:: console

zperf> udp.upload2 v6 10 1K 1M
zperf> udp upload2 v6 10 1K 1M


or like this if you want to test TCP:

.. code-block:: console

zperf> tcp.upload2 v6 10 1K 1M
zperf> tcp upload2 v6 10 1K 1M


If Zephyr is acting as a server, set the download mode as follows for UDP:

.. code-block:: console

zperf> udp.download 5001
zperf> udp download 5001


or like this for TCP:

.. code-block:: console

zperf> tcp.download 5001
zperf> tcp download 5001


and in the host side, iPerf must be executed with the following
Expand Down
9 changes: 9 additions & 0 deletions samples/net/zperf/boards/quark_se_c1000_devboard.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_NET_L2_IEEE802154=y
CONFIG_IEEE802154_CC2520=y
CONFIG_NET_6LO_CONTEXT=y

CONFIG_NET_PKT_RX_COUNT=24
CONFIG_NET_PKT_TX_COUNT=24
CONFIG_NET_BUF_RX_COUNT=48
CONFIG_NET_BUF_TX_COUNT=48
CONFIG_NET_BUF_DATA_SIZE=128
2 changes: 2 additions & 0 deletions samples/net/zperf/overlay-bt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_NET_L2_BT=y
CONFIG_NET_L2_BT_SHELL=y
6 changes: 6 additions & 0 deletions samples/net/zperf/overlay-netusb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# USB Device Settings
CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y

# Select USB Configurations
CONFIG_USB_DEVICE_NETWORK_ECM=y
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=n
CONFIG_NET_UDP=y
CONFIG_NET_TCP=n
CONFIG_NET_TCP=y
CONFIG_NET_STATISTICS=y

CONFIG_NET_PKT_RX_COUNT=14
CONFIG_NET_PKT_TX_COUNT=14
CONFIG_NET_BUF_RX_COUNT=28
CONFIG_NET_BUF_TX_COUNT=28
CONFIG_NET_BUF_DATA_SIZE=512
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
CONFIG_NET_MAX_CONTEXTS=3
Expand All @@ -24,12 +23,10 @@ CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_SHELL=y

CONFIG_CONSOLE_HANDLER=y
CONFIG_CONSOLE_SHELL=y
CONFIG_PRINTK=y

CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"

CONFIG_LOG=y
32 changes: 0 additions & 32 deletions samples/net/zperf/prj_bt.conf

This file was deleted.

Loading