Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3823051pxt; Tue, 10 Aug 2021 12:07:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQx0m50H7I4jz3gxf7YgrzD0fKgSCi04pE42JV9Ye1oA5equrs/7Cw9oL1wygQ6uciAr0W X-Received: by 2002:a17:906:2495:: with SMTP id e21mr42560ejb.244.1628622477736; Tue, 10 Aug 2021 12:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628622477; cv=none; d=google.com; s=arc-20160816; b=uMwOvs0jJLrAnraSbOB5TScNV2XI72DnG692vIhtLC0mcPWtDOlKOgIMQkyO2/oMAv rIYRasaCSwK1VZTysQFBEcWyZW+b/lgbd9uFFDG4uQtEDlKdRaRHoHRJWnLxzb6W1NiU R/CXK6jknwveylvyS3sNJ1ZuUjtIQcQeBnjirXbmOyRXeaqAD0E8gIqgJccW6uuUP97c 988h9FEuFIj0eCG8ox2j5WtQ3QyHgTW6ccRPDWKZzkxTvQyZapXLbhrrdZfY5bRSgbg9 NUnOsvmbQqZoXseQPFaYwwzTnqhRLagGyZIXJSJlP8kstrqY6nC2QmX4ljf4QF+JnF8q DwVA== 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:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=LD5EM5kZNOu66+iSv1Q9X75TvjKmtvXyw6oUcsk/oJc=; b=n7fvUOjhyWL5nqJINPIpSsBBj6d8URmQzf7gD5uvtMnqFDsSnL1vegoxSR+OG9pMMc z/vLnBtKMSvk1sMi0VkpUHKdcQe43DaYZ+XrLMtmoZSsYiQ7fUKaU9vrN4g/jn9JCp+s Gp74rqQiz/xYeN0KBw/hWQ5e3hi1zxONvZCZePo8uU7JEzzVxJxOulQ+s1KneE/I04kU 4wCZjuS8Iz7BgeBrirZ9hVo0nutWbI5FJARiL+y1ngQJJFgEcRtS9AbQbFzI4jZ4di/w HqAhxKCA5Pt5L8QpuYGFWDitAt2VC5kQbopwkQMeoVjTMwjczm+U8X7PpvMliKFYxb9R 7oMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hvL77SsK; 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 j4si7089191eje.704.2021.08.10.12.07.26; Tue, 10 Aug 2021 12:07:57 -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=hvL77SsK; 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 S232486AbhHJTCs (ORCPT + 99 others); Tue, 10 Aug 2021 15:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbhHJTCm (ORCPT ); Tue, 10 Aug 2021 15:02:42 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89FE2C0617A0 for ; Tue, 10 Aug 2021 12:02:17 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id z12-20020ac8710c0000b0290291f4eb83d3so2567624qto.10 for ; Tue, 10 Aug 2021 12:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=LD5EM5kZNOu66+iSv1Q9X75TvjKmtvXyw6oUcsk/oJc=; b=hvL77SsKpxUXlNdVpZW+5fBRnSR5XhA5CxfsiXvB56MNTbW1MNRzVDAeXcZfiQRJVR dY7AO7BLxaSEdmjDseD+Uo89DPBg2Z4j5MBkVEntaCa11BWuczlPevVw1SQbqR6cMpgx 6un5YRvEgW1gIMhEf4ZZugg/XH3efTTc6tijwzDUvbtO1NPK/XMe9OlgHbVZwb+T82u5 oYdNtc/FCiD/uPVUECfzq2XKBGXpKjcO3LXVACivTHucWafUJ21XhDrj5i/kdAPwOf97 jQPWl09xkD+BL4C1h/XMEPEabx4Lu1Yi5Nz2ogFLnEPQnyCcu/hXeRJmhbJ7q1HQHK0p /MVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=LD5EM5kZNOu66+iSv1Q9X75TvjKmtvXyw6oUcsk/oJc=; b=Xcl+lqjYJKce1RudY1QCSRTtY8o0uKa1xZW8TCIkP4sR6qlchSLTF3QhGQlyc1yzg7 YpsWG6UBQ0aHqCgIklaAY7/iI+WJA3DNXquqFmiiELmbXdfDw+Ln9RuRweMry5ueRF3d Sdt5D4T9N6tATSZRO2RmzHgBG5wG4wHt6EfZw5JsU4qDgv2cfCrM6g4/LOGq6c7tgLW7 khxQjlbmJooPi0nGag5yYzphpAmkHkjgcaCsu/3xCCde9VR0qlkvxkWWkpUxcXofVXaq gyTpqDwf0B5dbZC/DWAQB6VyyxGY/NTEheWrwRizhDQ0WlRMjDw5Dp8ESS8/dGDzHtME 6KQw== X-Gm-Message-State: AOAM531gvQqugv+27rrNlh/JtSs0jitvjiiLjVUv4BWjBW2vulaOzgaW oW3IEGbMfn+B4RCol6S1NG4IiB1BuOZicgkhjzK/0g== X-Received: from mustash.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:337b]) (user=richardsonnick job=sendgmr) by 2002:a05:6214:d05:: with SMTP id 5mr11741968qvh.54.1628622136748; Tue, 10 Aug 2021 12:02:16 -0700 (PDT) Date: Tue, 10 Aug 2021 19:01:55 +0000 In-Reply-To: <20210810190159.4103778-1-richardsonnick@google.com> Message-Id: <20210810190159.4103778-4-richardsonnick@google.com> Mime-Version: 1.0 References: <20210810190159.4103778-1-richardsonnick@google.com> X-Mailer: git-send-email 2.32.0.605.g8dce9f2422-goog Subject: [PATCH v2 3/3] pktgen: Add output for imix results 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" , Leesoo Ahn , Di Zhu , Ye Bin , 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 The bps for imix mode is calculated by: sum(imix_entry.size) / time_elapsed The actual counts of each imix_entry are displayed under the "Current:" section of the interface output in the following format: imix_size_counts: size_1,count_1 size_2,count_2 ... size_n,count_n Example (count = 200000): imix_weights: 256,1 859,3 205,2 imix_size_counts: 256,32082 859,99796 205,68122 Result: OK: 17992362(c17964678+d27684) usec, 200000 (859byte,0frags) 11115pps 47Mb/sec (47977140bps) errors: 0 Summary of changes: Calculate bps based on imix counters when in IMIX mode. Add output for IMIX counters. Signed-off-by: Nick Richardson --- net/core/pktgen.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index ac1de15000e2..7aca175e749b 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -695,6 +695,18 @@ static int pktgen_if_show(struct seq_file *seq, void *v) (unsigned long long)pkt_dev->sofar, (unsigned long long)pkt_dev->errors); + if (pkt_dev->n_imix_entries > 0) { + int i; + + seq_puts(seq, " imix_size_counts: "); + for (i = 0; i < pkt_dev->n_imix_entries; i++) { + seq_printf(seq, "%llu,%llu ", + pkt_dev->imix_entries[i].size, + pkt_dev->imix_entries[i].count_so_far); + } + seq_puts(seq, "\n"); + } + seq_printf(seq, " started: %lluus stopped: %lluus idle: %lluus\n", (unsigned long long) ktime_to_us(pkt_dev->started_at), @@ -3282,7 +3294,19 @@ static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) pps = div64_u64(pkt_dev->sofar * NSEC_PER_SEC, ktime_to_ns(elapsed)); - bps = pps * 8 * pkt_dev->cur_pkt_size; + if (pkt_dev->n_imix_entries > 0) { + int i; + struct imix_pkt *entry; + + bps = 0; + for (i = 0; i < pkt_dev->n_imix_entries; i++) { + entry = &pkt_dev->imix_entries[i]; + bps += entry->size * entry->count_so_far; + } + bps = div64_u64(bps * 8 * NSEC_PER_SEC, ktime_to_ns(elapsed)); + } else { + bps = pps * 8 * pkt_dev->cur_pkt_size; + } mbps = bps; do_div(mbps, 1000000); -- 2.32.0.605.g8dce9f2422-goog