iPerf#

The iPerf component offers a solution compatible with iPerf2 for measuring UDP throughput. It provides comprehensive UDP support and implements both server and client modes, enabling the exchange of packets to assess bandwidth performance, inter-arrival jitter, and packet loss. The component relies on various functions, to configure and execute your iPerf test. Parameters such as the server and client ports, preferred bandwidth, packet count, and remote peer address can be customized. Upon completion of each iPerf test, an iPerf report is generated.

To integrate the iPerf component into the application, simply add it to the project and initialize it using sl_iperf_service_init().

The following examples show how you can initialize a iPerf server and then an iPerf client

#include <string.h>
#include "cmsis_os2.h"
#include "sl_iperf.h"
#include "sl_iperf_util.h"

static void exec_iperf_server(void) {
  sl_iperf_test_t srv_test = { 0 };

  // Initialize Server test
  sl_iperf_test_init(&srv_test, SL_IPERF_MODE_SERVER, SL_IPERF_IPROTOV6_UDP);

  // Set minimum time duration for the test
  srv_test.opt.duration_ms = 10000;

  // Add the test to the execution queue
  if (sl_iperf_test_add(&srv_test) == false) {
    // Error handling
    return;
  }

  // Waiting for the test result
  if (sl_iperf_test_get(&srv_test, osWaitForever) == false) {
    // Error handling
    return;
  }

  // Print the result in JSON format
  sl_iperf_print_test_log_json(&srv_test);
}
static void exec_iperf_client(void)
{
  sl_iperf_test_t clnt_test = { 0 };

  // Initialize Client test
  sl_iperf_test_init(&clnt_test, SL_IPERF_MODE_CLIENT, SL_IPERF_IPROTOV6_UDP);

  // Configure test parameters
  // Set the remote server address
  strncpy(clnt_test.opt.remote_addr, "2001:db8::1", SL_IPERF_IP_STR_BUFF_LEN);

  // Set the bandwidth to 10 kBit/s
  clnt_test.opt.bandwidth = 10000;

  // Add the test to the execution queue
  if (sl_iperf_test_add(&clnt_test) == false) {
    // Error handling
    return;
  }

  // Waiting for the test result
  if (sl_iperf_test_get(&clnt_test, osWaitForever) == false) {
    // Error handling
    return;
  }

  // Print the result in JSON format
  sl_iperf_print_test_log_json(&clnt_test);
}

Modules#

Configurations

Type definitions

Portable interface

Functions#

void

Initialize the iPerf service.

bool
sl_iperf_test_add(sl_iperf_test_t *const test)

Add the iPerf test to the execution queue.

bool
sl_iperf_test_get(sl_iperf_test_t *const test, const uint32_t timeout_ms)

Get the iPerf test from the result queue.

void
sl_iperf_test_init(sl_iperf_test_t *const test, sl_iperf_mode_t mode, sl_iperf_protocol_t protocol)

Initialize the iPerf test.

void
sl_iperf_test_set_default_buff(sl_iperf_test_t *const test)

Set the default internal test buffer.

void
sl_iperf_test_set_default_logger(sl_iperf_test_t *const test)

Set the default internal logger for the test descriptor.

void
sl_iperf_test_udp_client(sl_iperf_test_t *test)

Execute the iPerf UDP client test.

void
sl_iperf_test_udp_server(sl_iperf_test_t *test)

Execute the iPerf UDP server test.

Macros#

#define

iPerf header epoch start mask

#define
SL_IPERF_HEADER_EXTEND (0x40000000UL)

iPerf header extended mask

#define

iPerf header seqno 64bit mask

#define

iPerf header time mode mask

#define

iPerf header triptime mask

#define

iPerf header UDP test mask

#define

iPerf header version1 mask

#define

iPerf header version2 mask

#define

iPerf Server TX FINACK max count to retry

#define

iPerf UDP server final ack size

Function Documentation#

sl_iperf_service_init#

void sl_iperf_service_init (void )

Initialize the iPerf service.

Parameters
N/A

Init OS objects and default contents


Definition at line 99 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

sl_iperf_test_add#

bool sl_iperf_test_add (sl_iperf_test_t *const test)

Add the iPerf test to the execution queue.

Parameters
[in]test

Test descriptor

Add test to the input messagequeue. Returns

  • true On Success

  • false On Failure


Definition at line 134 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

sl_iperf_test_get#

bool sl_iperf_test_get (sl_iperf_test_t *const test, const uint32_t timeout_ms)

Get the iPerf test from the result queue.

Parameters
[out]test

Destination test descriptor

[in]timeout_ms

Timeout for getting test from messagequeue

Get the test from the output messagequeue. Returns

  • true On Success

  • false On Failure


Definition at line 144 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

sl_iperf_test_init#

void sl_iperf_test_init (sl_iperf_test_t *const test, sl_iperf_mode_t mode, sl_iperf_protocol_t protocol)

Initialize the iPerf test.

Parameters
[inout]test

Test descriptor

[in]mode

Mode

[in]protocol

Protocol

Initialize a test descriptor with default content


Definition at line 108 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

sl_iperf_test_set_default_buff#

void sl_iperf_test_set_default_buff (sl_iperf_test_t *const test)

Set the default internal test buffer.

Parameters
[out]test

Test descriptor

Helper function


Definition at line 124 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

sl_iperf_test_set_default_logger#

void sl_iperf_test_set_default_logger (sl_iperf_test_t *const test)

Set the default internal logger for the test descriptor.

Parameters
[out]test

Test descriptor

Helper function


Definition at line 117 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

sl_iperf_test_udp_client#

void sl_iperf_test_udp_client (sl_iperf_test_t * test)

Execute the iPerf UDP client test.

Parameters
[inout]test

Test descriptor

iPerf UDP client test.


Definition at line 65 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_udp_clnt.h

sl_iperf_test_udp_server#

void sl_iperf_test_udp_server (sl_iperf_test_t * test)

Execute the iPerf UDP server test.

Parameters
[inout]test

Test descriptor

iPerf UDP server test.


Definition at line 65 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf_udp_srv.h

Macro Definition Documentation#

SL_IPERF_HEADER_EPOCH_START#

#define SL_IPERF_HEADER_EPOCH_START
Value:
(0x00001000UL)

iPerf header epoch start mask


Definition at line 75 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_EXTEND#

#define SL_IPERF_HEADER_EXTEND
Value:
(0x40000000UL)

iPerf header extended mask


Definition at line 66 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_SEQNO64B#

#define SL_IPERF_HEADER_SEQNO64B
Value:
(0x08000000UL)

iPerf header seqno 64bit mask


Definition at line 69 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_TIME_MODE#

#define SL_IPERF_HEADER_TIME_MODE
Value:
(0x80000000UL)

iPerf header time mode mask


Definition at line 81 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_TRIPTIME#

#define SL_IPERF_HEADER_TRIPTIME
Value:
(0x00000010UL)

iPerf header triptime mask


Definition at line 78 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_UDPTEST#

#define SL_IPERF_HEADER_UDPTEST
Value:
(0x20000000UL)

iPerf header UDP test mask


Definition at line 72 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_VERSION1#

#define SL_IPERF_HEADER_VERSION1
Value:
(0x80000000UL)

iPerf header version1 mask


Definition at line 60 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_HEADER_VERSION2#

#define SL_IPERF_HEADER_VERSION2
Value:
(0x04000000UL)

iPerf header version2 mask


Definition at line 63 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_SERVER_UDP_TX_FINACK_COUNT#

#define SL_IPERF_SERVER_UDP_TX_FINACK_COUNT
Value:
(10U)

iPerf Server TX FINACK max count to retry


Definition at line 84 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h

SL_IPERF_UDP_SERVER_FIN_ACK_SIZE#

#define SL_IPERF_UDP_SERVER_FIN_ACK_SIZE
Value:
(128U)

iPerf UDP server final ack size


Definition at line 57 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/iperf/sl_iperf.h