zephyr/include/net/loopback.h
Sjors Hettinga 951983191b drivers: net: loopback: Add interface to simulate packet drop
To allow for high level robustness tests on protocols, add an interface
to control the packet drop rate. A rate of 0 means no packet dropped, a
rate of 1 means all packets being dropped.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-04-01 12:36:14 -05:00

34 lines
622 B
C

/** @file
* @brief Loopback control interface
*/
/*
* Copyright (c) 2022 Radarxense B.V.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_NET_LOOPBACK_H_
#define ZEPHYR_INCLUDE_NET_LOOPBACK_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef CONFIG_NET_LOOPBACK_SIMULATE_PACKET_DROP
/**
* @brief Set the packet drop rate
*
* @param[in] ratio Value between 0 = no packet loss and 1 = all packets dropped
*
* @return 0 on success, otherwise a negative integer.
*/
int loopback_set_packet_drop_ratio(float ratio);
#endif
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_NET_LOOPBACK_H_ */