MCUMGR and net stats over SMP

Hello,

I have the smp server running on our 5340/7002 Wi-Fi device.

I see how the example code uses the stats.h macros to create simple statistics groups.

I have  CONFIG_NET_STATISTICS_WIFI and CONFIG_NET_STATISTICS_USER_API set to true and can see interface stats via the shell.

Is there a way to register the Ethernet/WiFi stats so that they will be exposed via the SMP service?

thanks

W

  • More info: 

    I am running on a custom board based on the 7002DK and using SDK 2.3.

    The SMP server code is based on the smp sample.

    My app has a shell enabled on the USB port.

    I am using mcumgr in an OS X zsh terminal.

    mcumgr is able to see and retrieve a simple uptime stat I created from the smp server example:

    Here are my configuration settings that are relevent to MCUMGR and SMP

    #MCUMGR - wifi only
    CONFIG_MCUMGR=y
    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    CONFIG_MCUMGR_CMD_STAT_MGMT=y
    #mcu manager shell
    CONFIG_MCUMGR_CMD_SHELL_MGMT=y
    # Required by the `taskstat` command.
    CONFIG_THREAD_MONITOR=y
    # Support for taskstat command
    CONFIG_OS_MGMT_TASKSTAT=y
    # Enable statistics and statistic names.
    CONFIG_STATS=y
    CONFIG_STATS_NAMES=y
    
    # Enable the LittleFS file system.
    CONFIG_FILE_SYSTEM=y
    CONFIG_FILE_SYSTEM_LITTLEFS=y
    
    # Add 256 bytes to accommodate upload command (lfs_stat overflows)
    #CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
    # Enable file system commands
    CONFIG_MCUMGR_CMD_FS_MGMT=y
    # TODO defining a storage partition Flash map and mounting the filesystem in the startup (fs_mount()).
    
    # Enable the UDP mcumgr transports.
    CONFIG_MCUMGR_SMP_UDP=y
    CONFIG_MCUMGR_SMP_UDP_IPV4=y
    CONFIG_MCUMGR_SMP_UDP_IPV6=y
    CONFIG_THREAD_STACK_INFO=y
    CONFIG_THREAD_NAME=y
    CONFIG_MCUMGR_LOG_LEVEL_DBG=y
    
    CONFIG_MCUMGR_SMP_UDP_PORT=1337
    #Stack size of the SMP UDP listening thread
    CONFIG_MCUMGR_SMP_UDP_STACK_SIZE=1024 
    #Scheduling priority of the SMP UDP listening thread.
    CONFIG_MCUMGR_SMP_UDP_THREAD_PRIO=0 
    #	  Maximum size of SMP frames sent and received over UDP, in bytes.
    #	  This value must satisfy the following relation:
    #	  MCUMGR_SMP_UDP_MTU <= MCUMGR_BUF_SIZE + SMP msg overhead - address size
    #	  where address size is determined by IPv4/IPv6 selection.
    CONFIG_MCUMGR_SMP_UDP_MTU=1500
    #	  Enable setting up the UDP SMP transport at boot time without needing
    #	  any code in the application to do this. Will automatically start the
    #	  UDP SMP service when the network interface is up and disable it when
    #	  it goes down (at layer 4).
    CONFIG_MCUMGR_TRANSPORT_UDP_AUTOMATIC_INIT=y
    	

  • Hi, 

    Due to the Easter holidays in Norway, we are less staffed than usual. During this time, you may receive late responses. Our staff will return to normal next Tuesday. Sorry for the inconvenience and thanks for your patience. 

    --

    I have  CONFIG_NET_STATISTICS_WIFI and CONFIG_NET_STATISTICS_USER_API set to true and can see interface stats via the shell.

    It's from https://github.com/nrfconnect/sdk-zephyr/blob/fcaa60a99fa9d5256078ed28557856ec3709cfa9/subsys/net/l2/wifi/wifi_shell.c#L379-L423 

    Is there a way to register the Ethernet/WiFi stats so that they will be exposed via the SMP service?

    Take a look at the Network Statistics API doc and this sample https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/net/stats 

    Regards,
    Amanda H.

Related