Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3819987pxt; Tue, 10 Aug 2021 12:03:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxy6mwWHNsyC4vtqS7EmN0tTwjnRHpndYQt6dJW+vbJitH2XtIzF2s/Z5PzY7LlnGuuR5x/ X-Received: by 2002:a17:906:16cb:: with SMTP id t11mr35006ejd.16.1628622239402; Tue, 10 Aug 2021 12:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628622239; cv=none; d=google.com; s=arc-20160816; b=kc1QzmxPRbdkdn0Fyg70reKcNmbLxX/LtkT57JKj2iumOuVY6qbrQgayBw9GNvjWqL dShtOKuGKbgo8o4Qc/yugE9R8doOTKuRxOGX+ziJkREDi7vT9hSHNpQiN1gLEEH46+Gb S5jTrINbgDb8JMvtCKqO5oIdIdAWyb5aSYx77sILcG3q11tUNyZjCMPHsJIt6eu4QabW RZksBlWXj1IfhTfzEKonkEdERPqSTBmwDcIsmvFZZFujc7VwXOzdgaBisYIE0iuGnyZo hreEDpUYZxH/fl0ORq+c1L5Oodj65IQh6Q6gtr/hs2My9V60Vsz+zLmiHndmyxOMDwWp T7uw== 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=X6g7ICk492Gxyfph4kIwhGSOwiekjxuFWOsErFX/4sw=; b=rUa6qMwmG8QDgj3kA+nD5BAVRNfwvFbKF0Uev813b8CGHaqrz9+/HEBjYZI0B155U3 ReM9QzSjL9ZnZ5SSIrg51pv0oNCnjRH1MHIYrSLq98tmsxzDgeaqaznKQP9gnVg9zIUH 0A6j4Prpble4X0976+qzpemXC7ESt3DsZpGxBMnE6S5OdTuIxIlKafmXUGs0P6fwP/TP 5qrL18s4yhdgC7f/zhD4USflgX+JrUrKVBP29MdYsRdOOGb3YgbiK8bhtSRTuqFHdmAm 0CSLz6ouNKqfLHfAZa0osfhv0gPCJkE4gv5LysNMxni+kow9dOOb4v0FU40QEf07e2Zt 9Gdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Gm9Lhds1; 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 ne31si7307275ejc.157.2021.08.10.12.03.34; Tue, 10 Aug 2021 12:03:59 -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=Gm9Lhds1; 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 S231898AbhHJTCc (ORCPT + 99 others); Tue, 10 Aug 2021 15:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbhHJTCZ (ORCPT ); Tue, 10 Aug 2021 15:02:25 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F1C2C0613C1 for ; Tue, 10 Aug 2021 12:02:03 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id b4-20020a252e440000b0290593da85d104so320758ybn.6 for ; Tue, 10 Aug 2021 12:02:03 -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=X6g7ICk492Gxyfph4kIwhGSOwiekjxuFWOsErFX/4sw=; b=Gm9Lhds1E+qOMg/ChCJsQf3NfCNOPV2A0uhEAObtIbJbeEGAh6+favE4VWlWimjvtm jU94uSGExUcNHEufojQCvmZfk+SGsm2aDwgBsInte8E0JgCDRmjMsEQEl3pOimzjqoKW Bo1oYRlZm2qI03BP1I+tX2AHwI1dVRdt24PQvEE1cOZTMcowffSZYJ/+IawFRW2sjd/l 8jiMrrQ1fhmmmJknIuoXiDkVr4NIy8JPVfTunaWSObhGIvqptB4Toamo151y29Ubt2Ub k6uSlOw+X1SLqECz9bA8VQW/bRHa7YPgf76arb0gq87eWsKEP4SISNSNRAIIB9x+yZSc WI+Q== 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=X6g7ICk492Gxyfph4kIwhGSOwiekjxuFWOsErFX/4sw=; b=j5K1SsK41IxfjiQXRRG2yOH1bMvQJj7v0EMVE/PmwpEVSJwSwSpNzum3qzluAkPTNg sk5qFVJrH+/OlQIgX8+gQSfAXmmmhJEVOhm/g4TLDs3TkkrakLhDOjA4SjLhp7iZoBkb l5hx3L3/QU72MHosJtzVBhD/UWw1gDIQAkOf+N6QXnVYSDSJeL3mop/KNoL0qjt4LK9M 6umx9dV6M42O+dYvyDkioPMkD4HtHwB0M9bWjKzEoxPPSdTKEfwMBu8qAtSZEflttnkS Sx9zAZSMw7K4AVPh1RoNLJAmyiDxQmwg4ipu3C1XfEXJzEa7aonvLBzvNmNAX2gTBuyS xX8A== X-Gm-Message-State: AOAM532OG1KYaezgTF0UAYnb22JXvwv0qQBVBN4Bgzfl+7ysPEidUPbB fRxaYE48cPbffYfaq1Jyq118buLYUACoayvxPg/sSw== X-Received: from mustash.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:337b]) (user=richardsonnick job=sendgmr) by 2002:a25:eb0c:: with SMTP id d12mr40983840ybs.206.1628622122396; Tue, 10 Aug 2021 12:02:02 -0700 (PDT) Date: Tue, 10 Aug 2021 19:01:52 +0000 Message-Id: <20210810190159.4103778-1-richardsonnick@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.32.0.605.g8dce9f2422-goog Subject: [PATCH V2 0/3] pktgen: Add IMIX mode From: Nicholas Richardson To: davem@davemloft.net, kuba@kernel.org Cc: nrrichar@ncsu.edu, promanov@google.com, arunkaly@google.com, Nick Richardson , "Gustavo A. R. Silva" , Di Zhu , Ye Bin , Leesoo Ahn , Yejune Deng , netdev@vger.kernel.org, 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 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