include/uapi/linux/pkt_sched.h | 1 + net/sched/sch_netem.c | 49 +++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 15 deletions(-)
From: François Michel <francois.michel@uclouvain.be> In order to reproduce bugs or performance evaluation of network protocols and applications, it is useful to have reproducible test suites and tools. This patch adds a way to specify a PRNG seed through the TCA_NETEM_PRNG_SEED attribute for generating netem loss and corruption events. Initializing the qdisc with the same seed leads to the exact same loss and corruption patterns. If no seed is explicitly specified, the qdisc generates a random seed using get_random_u64(). This patch can be and has been tested using tc from the following iproute2-next fork: https://github.com/francoismichel/iproute2-next For instance, setting the seed 42424242 on the loopback with a loss rate of 10% will systematically drop the 5th, 12th and 24th packet when sending 25 packets. v1 -> v2: Address comments and directly use prandom_u32_state() instead of get_random_u32() for generating loss and corruption events. Generates a random seed using get_random_u64() if none was provided explicitly. François Michel (3): netem: add prng attribute to netem_sched_data netem: use a seeded PRNG for generating random losses netem: use seeded PRNG for correlated loss events include/uapi/linux/pkt_sched.h | 1 + net/sched/sch_netem.c | 49 +++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 15 deletions(-) base-commit: f614a29d6ca6962139b0eb36b985e3dda80258a6 -- 2.41.0
On Tue, Aug 15, 2023 at 11:23:37AM +0200, Francois Michel wrote: > From: François Michel <francois.michel@uclouvain.be> > > In order to reproduce bugs or performance evaluation of > network protocols and applications, it is useful to have > reproducible test suites and tools. This patch adds > a way to specify a PRNG seed through the > TCA_NETEM_PRNG_SEED attribute for generating netem > loss and corruption events. Initializing the qdisc > with the same seed leads to the exact same loss > and corruption patterns. If no seed is explicitly > specified, the qdisc generates a random seed using > get_random_u64(). > > This patch can be and has been tested using tc from > the following iproute2-next fork: > https://github.com/francoismichel/iproute2-next > > For instance, setting the seed 42424242 on the loopback > with a loss rate of 10% will systematically drop the 5th, > 12th and 24th packet when sending 25 packets. > > v1 -> v2: Address comments and directly use > prandom_u32_state() instead of get_random_u32() for > generating loss and corruption events. Generates a random > seed using get_random_u64() if none was provided explicitly. > > François Michel (3): > netem: add prng attribute to netem_sched_data > netem: use a seeded PRNG for generating random losses > netem: use seeded PRNG for correlated loss events > > include/uapi/linux/pkt_sched.h | 1 + > net/sched/sch_netem.c | 49 +++++++++++++++++++++++----------- > 2 files changed, 35 insertions(+), 15 deletions(-) For series, Reviewed-by: Simon Horman <horms@kernel.org>
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 15 Aug 2023 11:23:37 +0200 you wrote:
> From: François Michel <francois.michel@uclouvain.be>
>
> In order to reproduce bugs or performance evaluation of
> network protocols and applications, it is useful to have
> reproducible test suites and tools. This patch adds
> a way to specify a PRNG seed through the
> TCA_NETEM_PRNG_SEED attribute for generating netem
> loss and corruption events. Initializing the qdisc
> with the same seed leads to the exact same loss
> and corruption patterns. If no seed is explicitly
> specified, the qdisc generates a random seed using
> get_random_u64().
>
> [...]
Here is the summary with links:
- [v2,net-next,1/3] netem: add prng attribute to netem_sched_data
https://git.kernel.org/netdev/net-next/c/4072d97ddc44
- [v2,net-next,2/3] netem: use a seeded PRNG for generating random losses
https://git.kernel.org/netdev/net-next/c/9c87b2aeccf1
- [v2,net-next,3/3] netem: use seeded PRNG for correlated loss events
https://git.kernel.org/netdev/net-next/c/3cad70bc74ef
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
On Tue, 15 Aug 2023 11:23:37 +0200 Francois Michel <francois.michel@uclouvain.be> wrote: > From: François Michel <francois.michel@uclouvain.be> > > In order to reproduce bugs or performance evaluation of > network protocols and applications, it is useful to have > reproducible test suites and tools. This patch adds > a way to specify a PRNG seed through the > TCA_NETEM_PRNG_SEED attribute for generating netem > loss and corruption events. Initializing the qdisc > with the same seed leads to the exact same loss > and corruption patterns. If no seed is explicitly > specified, the qdisc generates a random seed using > get_random_u64(). > > This patch can be and has been tested using tc from > the following iproute2-next fork: > https://github.com/francoismichel/iproute2-next > > For instance, setting the seed 42424242 on the loopback > with a loss rate of 10% will systematically drop the 5th, > 12th and 24th packet when sending 25 packets. > > v1 -> v2: Address comments and directly use > prandom_u32_state() instead of get_random_u32() for > generating loss and corruption events. Generates a random > seed using get_random_u64() if none was provided explicitly. For series. Acked-by: Stephen Hemminger <stephen@networkplumber.org>
On Tue, 15 Aug 2023 11:23:37 +0200 Francois Michel <francois.michel@uclouvain.be> wrote: > From: François Michel <francois.michel@uclouvain.be> > > In order to reproduce bugs or performance evaluation of > network protocols and applications, it is useful to have > reproducible test suites and tools. This patch adds > a way to specify a PRNG seed through the > TCA_NETEM_PRNG_SEED attribute for generating netem > loss and corruption events. Initializing the qdisc > with the same seed leads to the exact same loss > and corruption patterns. If no seed is explicitly > specified, the qdisc generates a random seed using > get_random_u64(). > > This patch can be and has been tested using tc from > the following iproute2-next fork: > https://github.com/francoismichel/iproute2-next > > For instance, setting the seed 42424242 on the loopback > with a loss rate of 10% will systematically drop the 5th, > 12th and 24th packet when sending 25 packets. > > v1 -> v2: Address comments and directly use > prandom_u32_state() instead of get_random_u32() for > generating loss and corruption events. Generates a random > seed using get_random_u64() if none was provided explicitly. > > François Michel (3): > netem: add prng attribute to netem_sched_data > netem: use a seeded PRNG for generating random losses > netem: use seeded PRNG for correlated loss events > > include/uapi/linux/pkt_sched.h | 1 + > net/sched/sch_netem.c | 49 +++++++++++++++++++++++----------- > 2 files changed, 35 insertions(+), 15 deletions(-) > > > base-commit: f614a29d6ca6962139b0eb36b985e3dda80258a6 Would you please send an iproute2 patch now for iproute-next
© 2016 - 2025 Red Hat, Inc.