Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
zperf.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation
3 * Copyright (c) 2022 Nordic Semiconductor ASA
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
18
19#ifndef ZEPHYR_INCLUDE_NET_ZPERF_H_
20#define ZEPHYR_INCLUDE_NET_ZPERF_H_
21
22#include <zephyr/net/net_ip.h>
23#include <zephyr/net/socket.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30
31enum zperf_status {
32 ZPERF_SESSION_STARTED,
33 ZPERF_SESSION_PERIODIC_RESULT,
34 ZPERF_SESSION_FINISHED,
35 ZPERF_SESSION_ERROR
36} __packed;
37
49typedef int (*zperf_data_load_custom)(void *user_ctx, uint64_t offset,
50 uint8_t *data, uint32_t len);
51
52struct zperf_upload_params {
53 uint64_t unix_offset_us;
54 zperf_data_load_custom data_loader;
55 void *data_loader_ctx;
56 struct net_sockaddr peer_addr;
57 uint32_t duration_ms;
58 uint32_t rate_kbps;
59 uint16_t packet_size;
60 char if_name[NET_IFNAMSIZ];
61 struct {
62 uint8_t tos;
63 int tcp_nodelay;
64 int priority;
65#ifdef CONFIG_ZPERF_SESSION_PER_THREAD
66 int thread_priority;
67 bool wait_for_start;
68#endif
69 uint32_t report_interval_ms;
70 } options;
71};
72
73struct zperf_download_params {
74 uint16_t port;
75 struct net_sockaddr addr;
76 char if_name[NET_IFNAMSIZ];
77};
78
79#ifdef CONFIG_NET_ZPERF_RAW_TX
95struct zperf_raw_upload_params {
96 uint32_t duration_ms;
97 uint32_t rate_kbps;
98 uint16_t packet_size;
99 uint8_t *hdr;
100 uint16_t hdr_len;
101 int if_index;
102};
103#endif /* CONFIG_NET_ZPERF_RAW_TX */
104
106
121
129typedef void (*zperf_callback)(enum zperf_status status,
130 struct zperf_results *result,
131 void *user_data);
132
142int zperf_udp_upload(const struct zperf_upload_params *param,
143 struct zperf_results *result);
144
154int zperf_tcp_upload(const struct zperf_upload_params *param,
155 struct zperf_results *result);
156
169int zperf_udp_upload_async(const struct zperf_upload_params *param,
170 zperf_callback callback, void *user_data);
171
184int zperf_tcp_upload_async(const struct zperf_upload_params *param,
185 zperf_callback callback, void *user_data);
186
198int zperf_udp_download(const struct zperf_download_params *param,
199 zperf_callback callback, void *user_data);
200
212int zperf_tcp_download(const struct zperf_download_params *param,
213 zperf_callback callback, void *user_data);
214
221
228
229#ifdef CONFIG_NET_ZPERF_RAW_TX
239int zperf_raw_upload(const struct zperf_raw_upload_params *param,
240 struct zperf_results *result);
241
254int zperf_raw_upload_async(const struct zperf_raw_upload_params *param,
255 zperf_callback callback, void *user_data);
256#endif /* CONFIG_NET_ZPERF_RAW_TX */
257
258#ifdef __cplusplus
259}
260#endif
261
265
266#endif /* ZEPHYR_INCLUDE_NET_ZPERF_H_ */
int zperf_tcp_upload_async(const struct zperf_upload_params *param, zperf_callback callback, void *user_data)
Asynchronous TCP upload operation.
int zperf_tcp_upload(const struct zperf_upload_params *param, struct zperf_results *result)
Synchronous TCP upload operation.
int zperf_udp_download_stop(void)
Stop UDP server.
int zperf_udp_upload(const struct zperf_upload_params *param, struct zperf_results *result)
Synchronous UDP upload operation.
int zperf_tcp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data)
Start TCP server.
int zperf_udp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data)
Start UDP server.
int zperf_tcp_download_stop(void)
Stop TCP server.
int zperf_udp_upload_async(const struct zperf_upload_params *param, zperf_callback callback, void *user_data)
Asynchronous UDP upload operation.
void(* zperf_callback)(enum zperf_status status, struct zperf_results *result, void *user_data)
Zperf callback function used for asynchronous operations.
Definition zperf.h:129
BSD Sockets compatible API definitions.
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Performance results.
Definition zperf.h:108
uint64_t total_len
Total length of the transferred data.
Definition zperf.h:113
uint64_t client_time_in_us
Client connection time in microseconds.
Definition zperf.h:116
uint32_t nb_packets_errors
Number of packet errors.
Definition zperf.h:118
uint32_t packet_size
Packet size.
Definition zperf.h:117
bool is_multicast
True if this session used IP multicast.
Definition zperf.h:119
uint32_t nb_packets_outorder
Number of packets out of order.
Definition zperf.h:112
uint64_t time_in_us
Total time of the transfer in microseconds.
Definition zperf.h:114
uint32_t nb_packets_lost
Number of packets lost.
Definition zperf.h:111
uint32_t nb_packets_rcvd
Number of packets received.
Definition zperf.h:110
uint32_t nb_packets_sent
Number of packets sent.
Definition zperf.h:109
uint32_t jitter_in_us
Jitter in microseconds.
Definition zperf.h:115