Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2355752rdg; Sun, 13 Aug 2023 22:38:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEe86y9u05giMXxsCYiL8fFNdjptxmusWMXHCW7iFMe2D10U2N8HuNduINlo9Nq97VxwjaT X-Received: by 2002:a05:6358:9209:b0:129:c6d6:ce40 with SMTP id d9-20020a056358920900b00129c6d6ce40mr6399729rwb.15.1691991521318; Sun, 13 Aug 2023 22:38:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691991521; cv=pass; d=google.com; s=arc-20160816; b=qP104vCle0m+91sgEYjuGIljMdmYqwPM77Zjs65pKoe1sLj5Jx31wkCtm9ucuRRzhs TIybHlN/tluZZQgPVaPrDTvBkanKQ+a2t/XpUaGMaNhODtAegiFioUH2NLjhmoRhdPwT sdji+7uo5vMD8FLC85LxPu3m/j+usAwjfkOhZhgho2NWbvt/AP+0ClIil4ZUmdK26ahh nswZY9h/KmHY4ylvOWNBCyySC7Zjz9K9gud94qQ2PC3P5HigwblKVRfoz4kPKNC5EKnk /ye581DqCDLobUfupG311HbHj7urYaWmclrJTaqK6/0DO0FA2/KA7Au1dm+gYWIEsrV4 PbwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:mime-version:content-transfer-encoding :message-id:date:subject:cc:from:dkim-signature; bh=BjkszKRacM11YlIxhmX/KT0erpTPSiRH3AqZG33Pneg=; fh=4HhbMNb9a953WYs8XhlZFoEs2JqksG8Z63FRdSNsJpo=; b=EL3GSON6qgexIat6XciPdjtyhzylWjbT8X+wiFJ84v9JLdl0N4OnkpIcK///BkkAJa DtEucNuBziEGYG/CIcfjazCHNMPZlATINGNgqnTvt1t2wHqjZpVL1A8PEbnOqKjyYy6t lq0UH/baTvUUPosu80j/2aV8Hd5SPo72iKbJ7TXTH6sQrHFxJ5jg5ZqMkNWhcJ1eZXx0 BCNx/ccxsi78UHDHSZ0Y4tV9d7tGOqksM5NlBUYgFiU/UqTs4B6l5MSPYng7wvhyqrga 6NUv60Xhqv6JVwWnY3nnWKOpPoRmXSAVEUnGg2du9Fzi/algeKojIdJcOx36o3HO+ptj hZgQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uclouvain.be header.s=selector1 header.b=PxXDYS2z; arc=pass (i=1 spf=pass spfdomain=uclouvain.be dkim=pass dkdomain=uclouvain.be dmarc=pass fromdomain=uclouvain.be); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=uclouvain.be Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a17090a639000b0026800336358si9508506pjj.122.2023.08.13.22.38.29; Sun, 13 Aug 2023 22:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@uclouvain.be header.s=selector1 header.b=PxXDYS2z; arc=pass (i=1 spf=pass spfdomain=uclouvain.be dkim=pass dkdomain=uclouvain.be dmarc=pass fromdomain=uclouvain.be); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=uclouvain.be Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbjHNCeH (ORCPT + 99 others); Sun, 13 Aug 2023 22:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232041AbjHNCdn (ORCPT ); Sun, 13 Aug 2023 22:33:43 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2137.outbound.protection.outlook.com [40.107.249.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1DCAE5C; Sun, 13 Aug 2023 19:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDEY3eKgaJDp6DaV0JjsgttMqHFQxm2YDBt2QUznpAyd7tjw/0TRpowAGp9JNJDGtvkFQQd3LnlFFxz5NYXZRzsMj9mpYYhJP+XycYHSO/OHGX0FDd9f0NrB82xTUGa8G+mS/ZwytVFp7O6CMIQpwcDGnQHT3S+Gn78HU2UOEm/MggT+EWei08LyWrOpIrkMQb957kX4ETk74AFegvux4uNFYcKyhhxMjzrHeC/WXbHvLuEuq1h5hEZYlMw6Z8VtOKHpzfh5NjTz+6KPX5SYdwWlafJ0UqN8bk9w8e769UfkIT/JLFdAC+GuEbgVLZobVIbbFD+2jTGxscyupWVDNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BjkszKRacM11YlIxhmX/KT0erpTPSiRH3AqZG33Pneg=; b=b0U300LJCC6bYZmsE2o9ktATzho41kElsW+EEr7ziRgIP+TyGr7//CEZqsSZ92AVLJ3X2hYJHxEPHUZE1ljYFhS3JwWF6o7TvJCSNgnRW1NyL7d9d/8YtYUBh0vqgHOoOT3CWAbG7N8I48qu4hJyxMtQMuRBlPR/khCAxfInR9U6jB2JmWuxjGBuoCrc51rI2rHdzCIykEm0zN3dYAfLdoohBjEcjEyMSi70B2uHhlL/EB5P98z3A5lMhRx1x+4zcm2iyjXLcl2fnJn76PSVSGN3rIu3PGi4OxKEf0174VQ4EagdRxSMF3m39DZ0tr5xN7St/yiDYQDHAJtprqQoog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uclouvain.be; dmarc=pass action=none header.from=uclouvain.be; dkim=pass header.d=uclouvain.be; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uclouvain.be; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BjkszKRacM11YlIxhmX/KT0erpTPSiRH3AqZG33Pneg=; b=PxXDYS2ziF0neeun0STeNxDlBXH3iCZwug234jhmDos3tiloUM9IVfTe1o3hFGuzQIAIIfppAOX4CoFfkGk3oRsv2wi+ZOjwFKbjCESG9RhU63JdF2ygHFNMUjticMaNua1tzrD0BlI6dAkH80EH4VNH6C5Qcg/zUIRX3lSsg0DONc0Liwirn+wTL9mFV9nsUO4Eb+IpQBozc7zB+VZv1pD316CSZV5E9KufnW39ROGmC0CAcD/JBHwTsKTbMvzsncEPL2t/6d78b/hi4BXnfR3TQzWuFIwPfD1XjbXIf65JloVf227wnEH9EkeB8Rh2sP7TBlN3JKS9n/UWgkynDg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=uclouvain.be; Received: from DB9PR03MB7689.eurprd03.prod.outlook.com (2603:10a6:10:2c2::11) by AM7PR03MB6401.eurprd03.prod.outlook.com (2603:10a6:20b:1c3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 02:33:38 +0000 Received: from DB9PR03MB7689.eurprd03.prod.outlook.com ([fe80::8303:13bd:7736:34cf]) by DB9PR03MB7689.eurprd03.prod.outlook.com ([fe80::8303:13bd:7736:34cf%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 02:33:38 +0000 From: Francois Michel Cc: Francois Michel , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Stephen Hemminger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 0/3] netem: allow using seeded PRNG for loss and corruption events Date: Mon, 14 Aug 2023 04:31:37 +0200 Message-ID: <20230814023147.1389074-1-francois.michel@uclouvain.be> X-Mailer: git-send-email 2.41.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MR1P264CA0034.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:2f::21) To DB9PR03MB7689.eurprd03.prod.outlook.com (2603:10a6:10:2c2::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB7689:EE_|AM7PR03MB6401:EE_ X-MS-Office365-Filtering-Correlation-Id: ef8fb7e4-dff4-4e94-c830-08db9c6edd6a X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SNWBtmy6OfKUju1PDeRhfMfToDYLQGF+jEbW4PTz1pma8PZp24CGy9yo4HDdwiZB7DE/VUG0IjkuXRGcuTIUDOZTuv3rulqulrXIaZVeyun6Y0DqwyjUUML2H3mdTmxyBEv6G9cvWUfNz9RSlgvFEkEkSl9vU8rklhwfwCLYckskyKbSHs4uzSRoMcmtls6wC0wULzlBMmyZJwnZhrQB5W+DIih0Id4b3ZcMY8GVEo+GRW+nYKbHVEjJ1B33kDpbYrBfZXSXg2X64KLHmhorASGyR2Rl6r8BXnVr+cyyHjdsMDdQUisnKC5hrcKtxVOolsTsde5DLr365jLir95rCUYJgUswIHR8QEDynodwafkrhzeVjnuapyTz7jVncLEvdv73EnZ0zXaOnpgxRP6fTNYDoVz94A3HMBIOFlKCKJ3N/BupFfeWmNAnkK66++9ajZVuVpl5pGbj5BKBMtaLhg7g5Rj15unnj81Mxcn/i62LCyH5M3718I8z7YDiE/O0J9+thSP9xc6rGCNXtwPlZu5ufpSvy50ebjrRsgJ42Faymxfb4E/UD22QFtT+UbAWzlQhXrZVjV0nkNlKYok2pulI+BwVLstAk0jAi+wDFA8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR03MB7689.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(346002)(39850400004)(396003)(366004)(376002)(109986019)(451199021)(186006)(1800799006)(38100700002)(52116002)(54906003)(6486002)(478600001)(7416002)(5660300002)(2906002)(36756003)(86362001)(44832011)(4326008)(66476007)(66556008)(66946007)(41300700001)(8936002)(316002)(786003)(8676002)(83380400001)(66574015)(2616005)(6506007)(1076003)(6512007)(266003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UnZjQ0RYeXhaTFBaWlByYWUyMXZ5V1ZkRzh4TnhOU1VaOC9EV1FQMGlmNWlH?= =?utf-8?B?Z3RYMW4ydS9iMG1STzhCZW1RNFBCaEhRMDRsdVhGMFZCMFVndVJkRWQ5REMx?= =?utf-8?B?VXZkWDVHYkRlNGtia2dtL0lIRHJHbDJaSWtLRGNYSjYyZTZIVFZpRm1RZFRE?= =?utf-8?B?eURRYlBBcUdtRjdoNGdaOHAyVHRHRjRLSTNzamxVN0hSY081OHNEbXhyWHlp?= =?utf-8?B?VnpVTlovNUppK2JwMWo1RVNnaS9wYWhvYnpXUWp0VkFmZXlvWS9Tc0tXeVl2?= =?utf-8?B?VU5KSVJMSDFpYW9rQmZTZ2ZQNU9Bc05jcUl3b3M2RUJQaitWbUljVytNODhU?= =?utf-8?B?SklPUjU3cUF0UHozbXVzcUxpT1Z6N2dTcFlXdXE5QnJjSFQxSVN4ZFJQQ3dT?= =?utf-8?B?RVM3K20zY09QT1JhV3ByRC80VWZFTGswQzNRZjBDRUxPYzZtdVJrYjFlOWFU?= =?utf-8?B?S3FiVj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edd6a X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB7689.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 02:33:37.9953 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 7ab090d4-fa2e-4ecf-bc7c-4127b4d582ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q9ZXN0f9WvAXhyg1LookQ7AeO+EyDqoq4KKvraYIerY0Shxf9ZngU60rHk3MTGVh3Iwn6jLbl0JLsfBECvTDV9YLjMGY9Z8eZ2mW7sK4EF0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR03MB6401 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: François Michel 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 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 specified, the qdisc adopts the classical behaviour, i.e. using the unseeded get_random_u32() for generating these events. This patch can be and has been tested using tc from the following iproute2-next fork: git@github.com:francoismichel/iproute2-next.git 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. François Michel (3): netem: add prng attribute to netem_sched_data netem: allow using a seeded PRNG for generating random losses netem: allow using seeded PRNG for correlated loss events include/uapi/linux/pkt_sched.h | 1 + net/sched/sch_netem.c | 62 ++++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 15 deletions(-) base-commit: f614a29d6ca6962139b0eb36b985e3dda80258a6 -- 2.41.0