Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1620913pxb; Tue, 17 Aug 2021 16:53:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvJJQbX56XoXt18cwb8wI4cNGNNRYAgZhSBVwLxMsg0WEKYqQJTWuU+qw9F+jAx3TU+NbX X-Received: by 2002:a92:6610:: with SMTP id a16mr3911420ilc.71.1629244383967; Tue, 17 Aug 2021 16:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629244383; cv=none; d=google.com; s=arc-20160816; b=hbR1nEz1g1UdMD8dKkbCyXo/AzSkLsWtJuaSHKbk4wmhxNk1vhYEjw+AiG3YzwFvxY lToO0Bi1ZrPaz2PhgkYGAFsoAzit+GZZrFL+Rjl1IkEvDDXNAHZ6BoTh3Xc7OGLBdy8y XuTpsEiVOhOJZTBctmXU3DNb4AfGcsAkxazA8lBcMFxJ21OyYxC2i87qY2EpvMNwcWtk NYKxJ4W3z9Radf5/ICuXYwJJsO5UGlddzB1eiqqbBlqNaYZlaIydQkM5/QJ0bjXqpzqy w8QOwv9iJ91MmpbkxcOeppDte2mZPphJambliVwCRdsr/OWxs7C5kSJLXyuPTat3UChX NSSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=MEiCR9Cah5aHQ1J6uzdzF/HLObdzrDnYsPZJ2mdDD/k=; b=zTMdvhInz3rsN2UqwpkuTyE8MaoNBJIMNiFEPnMDoC+89i0OP6QzS7DrFk86IQ+0nQ VnWn3EktlU99sYBc/gmLUVhHDxCyP6xlT8TJgPIydg66Sc7qmIr3CkKzFVP5F6sjOUHx KuvaSAjI2dm1XkQ9W65BS8K9OVS4C6yNttdtSDWMPvqW7me8mrnqrUAsl3qmaRmI3+fL b/zOx6kUni6VPsaQu5Ws84x0wQQZF+UUjgPgO4ZDTF9imB1fYwEkJrEpqUDzFj9nPeda 1qibkkpOnN39lLDOJ1Ow1wTXPqRBXcSSACdFPY/9PDSykDEI+BlpVqwOBV0KK++xAusw KyUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hFsDfI0n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si3826130ilb.36.2021.08.17.16.52.51; Tue, 17 Aug 2021 16:53:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hFsDfI0n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236631AbhHQXwS (ORCPT + 99 others); Tue, 17 Aug 2021 19:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbhHQXwS (ORCPT ); Tue, 17 Aug 2021 19:52:18 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BCBC061764 for ; Tue, 17 Aug 2021 16:51:44 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id o4-20020ae9f504000000b003d39d97b227so481829qkg.2 for ; Tue, 17 Aug 2021 16:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=MEiCR9Cah5aHQ1J6uzdzF/HLObdzrDnYsPZJ2mdDD/k=; b=hFsDfI0n/o2qCkm9UydXHf8uoIZXd7u3Hp0MVTQ3zaFyOU4IBANP9ybLqzawFDzzaR or5MDAjXNancOPd50WJC6RMv2bpiKLmcKZ3yiRZ6bM8KVeiS3sE7bxwCr8SmsSsvMjuw KuZ0Zb+T0rlLquKeblcRFtpTpVk0Xd4bAFvK9ECFygZ+4PYyzk5n2trFNSTa5inZJnxr dQKFpd+23ST+wHYuFfNcEUpzaIfBu6w4JjHVtE5hCObhxvP5ZPcxSMA9RTNwJ3+uPXWF Vo+3ppGQAOHJhkaun+ZPiEl2hwiVVtl8crVTgpfFtnfGak40S7a6y/RzgqKvmEY6JaDy EhBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=MEiCR9Cah5aHQ1J6uzdzF/HLObdzrDnYsPZJ2mdDD/k=; b=T7ktxRZ1tOcnaAo+R4H4Dex6vt9DpB9Sk8nKifCvytgo41ogfbwrNmlGEHJIdBbGqt 8QbocXmp86AQIBKGYCLJhfNCX3S6D2+7yl31tlRASqr0B+XGug9OlYStdKC8ppm70PFJ ac6m+xE4OKYwvgsxiRpUxOqQwmaKdRBaBPiWWoSWl+rRgbMyQle1elpnnJqFX/2y5mLf tCGWcQF6PeEhQ+nfk8d0WMiYheHK09tAXP2Eogr/9js2axXAIA3kVzKiocwF6mvTfVtP OyVxhNrOg/DOEqZEmVLvfTZqjuVxaeFFE6/3d2N5J7pSEVYJisyuSPiNkbraQTHEgoD/ OnsQ== X-Gm-Message-State: AOAM531MYtVC8hwLfsBchLT8EmEhwtrUa7/iPMusyKHP3pjL7wcld5oW TOZzrnAXBQGUPU3v02r3xhOoKKyN1BO/839goWb9ZA== X-Received: from mustash.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:337b]) (user=richardsonnick job=sendgmr) by 2002:ad4:4043:: with SMTP id r3mr5991218qvp.1.1629244303671; Tue, 17 Aug 2021 16:51:43 -0700 (PDT) Date: Tue, 17 Aug 2021 23:51:35 +0000 Message-Id: <20210817235141.1136355-1-richardsonnick@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog Subject: [PATCH v3 0/3] pktgen: Add IMIX mode From: Nicholas Richardson To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: nrrichar@ncsu.edu, promanov@google.com, arunkaly@google.com, Nick Richardson , "Gustavo A. R. Silva" , Di Zhu , Yejune Deng , Leesoo Ahn , Ye Bin , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Richardson Adds internet mix (IMIX) mode to pktgen. Internet mix is included in many user-space network perf testing tools. It allows for the user to specify a distribution of discrete packet sizes to be generated. This type of test is common among vendors when perf testing their devices. [RFC link: https://datatracker.ietf.org/doc/html/rfc2544#section-9.1] This allows users to get a more complete picture of how their device will perform in the real-world. This feature adds a command that allows users to specify an imix distribution in the following format: imix_weights size_1,weight_1 size_2,weight_2 ... size_n,weight_n The distribution of packets with size_i will be (weight_i / total_weights) where total_weights = weight_1 + weight_2 + ... + weight_n For example: imix_weights 40,7 576,4 1500,1 The pkt_size "40" will account for 7 / (7 + 4 + 1) = ~58% of the total packets sent. This patch was tested with the following: 1. imix_weights = 40,7 576,4 1500,1 2. imix_weights = 0,7 576,4 1500,1 - Packet size of 0 is resized to the minimum, 42 3. imix_weights = 40,7 576,4 1500,1 count = 0 - Zero count. - Runs until user stops pktgen. Invalid Configurations 1. clone_skb = 200 imix_weights = 40,7 576,4 1500,1 - Returns error code -524 (-ENOTSUPP) when setting imix_weights 2. len(imix_weights) > MAX_IMIX_ENTRIES - Returns -7 (-E2BIG) This patch is split into three parts, each provide different aspects of required functionality: 1. Parse internet mix input. 2. Add IMIX Distribution representation. 3. Process and output IMIX results. Changes in v2: * Remove __ prefix outside of uAPI. * Use seq_puts instead of seq_printf where necessary. * Reorder variable declaration. * Return -EINVAL instead of -ENOTSUPP when using IMIX with clone_skb > 0. Changes in v3: * Move fill_imix_bins() out of #ifdef CONFIG_XFRM block. Nick Richardson (3): pktgen: Parse internet mix (imix) input pktgen: Add imix distribution bins pktgen: Add output for imix results net/core/pktgen.c | 163 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) -- 2.32.0.605.g8dce9f2422-goog