Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp40071pxb; Tue, 17 Aug 2021 18:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxy7TS7yP779CgTJJkBYHCtTZQFSFu7bXGtQ17JAJRLswZxspVuhOebLyt2dcIWXeOmFeWC X-Received: by 2002:a05:6402:1395:: with SMTP id b21mr7093028edv.119.1629250475920; Tue, 17 Aug 2021 18:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629250475; cv=none; d=google.com; s=arc-20160816; b=a/4fssAwLaDFYVOQUZ93ps4AhUS5MV1pxUj1pzvGxeQz2WL5MVvwf2y4RVOemj/Y/9 CexFleRbH5bftehiM7jRMLvsHmCm+oAP2xgMYRE36wZ6UfVSF2b9jcv5kgoXGG0k4tbU rKLZzhjD4eZ7tCdsFRRUnmgUMntPVvF307qxhM5P0FL27NwCjWiNkfZyxbJu0Kr1qeLO AwrSwTmBJaNQL0zYcMXWYztI10Q085sqg2DkRoffbkLTZj8ZVOhvqqluxm0K+2NMcYrI YTUmkykCbp4vehp4ELB4e9KEQDwJ7wAbYfzW4b/1yjBbgHrtvdxLMW6rU6bcliWOAfAf nqpg== 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=L5moxT2jLL1QoSiZ11RqMC3wpmZIVwXe69nsWU69g+w=; b=fLW2NlaNXtfjV1kUQUw3dYi90VnQ+A0u+ZiixiNmwq40a4xFeaKUomCiliPd6cql4m z7aO6aY5ahba3uxWeBPyiNXKJLfr8AEavko71Jl/MhKMr1nF77X9uR2skpbwZbgBLsdF 7Vd7o5XoW1hGDMyz6CKWDEnLtrc6pYoKbP5AyZj4rDHmI0xVSlMA7SH2HvBsKRxQkHo8 bvCrAps6jUfDQpf70iWbHoHsN/nnsaxDiId6uRrv/AdMGuSjkw1g0cc8mekqYanvihd/ Dz+/S9FK6QWBuxTS8iwdxCtFxh29Tbvbn0pXT5P2BgRKbw2tcaxj+JNFRL4avny39WdZ 198Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DEJLI4Ne; 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 a9si3986255edj.313.2021.08.17.18.34.12; Tue, 17 Aug 2021 18:34:35 -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=DEJLI4Ne; 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 S235426AbhHRBda (ORCPT + 99 others); Tue, 17 Aug 2021 21:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234828AbhHRBd3 (ORCPT ); Tue, 17 Aug 2021 21:33:29 -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 E7681C061764 for ; Tue, 17 Aug 2021 18:32:55 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id k18-20020a05620a1432b02903d293480ee4so672612qkj.1 for ; Tue, 17 Aug 2021 18:32:55 -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=L5moxT2jLL1QoSiZ11RqMC3wpmZIVwXe69nsWU69g+w=; b=DEJLI4Nej2HbG/RrjQzEYC6ehvq9nqUASq/uIN+gk2Q32HREUxa6ZgSQF5Q9Givt+p 8jdLmDUhVwxhSLUQmjIyTqbamZYg3kFklHx9weptXptHnJkaCVRER7kaflsI/fONDMrQ 0A30YXwRXVz5HxdmG5v3YY+N9cSSgDVoL+ZcYKjUBcfifxJqZ2zaMibUHoZYrQh6MKXF dDps22Lqbdptg807hKOqB1SrWYcGB2emVm537yX7vczzfGOiZjaQZVGEZJueF2cZna07 kG4JOCXEKuA72qCfutilAPD94g70xADzwC9bKdO4tQBJzYalSkb+Mg44l5LkphVKwh3g 1fkg== 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=L5moxT2jLL1QoSiZ11RqMC3wpmZIVwXe69nsWU69g+w=; b=Q2pWOmfCqbruzYg9H7Tbi3sdUBHK1f+XgX5LcZ3zRw+h9ksP55c3mya9WY8+/uvYsb 4/JlI4SKFHxE4yUngywcxtyH9oaYt0qpZA9cpW8LGe0Zy5kZuppAm5igxONBdG7kQ20g a/t0ctTE5CzXrI+quwB+N7/Wzg/MQoJpc9kcHpoES781YyNryYZXm6mqzu3xROgumw0J apNU/tcvUwg65KEP1lCcFvOmYM5hDI8iWvQ+e3roXUBhsOXir/x4zzZtFNBi9ORGzEb9 HMcjnT8qS5fylxmPAjosMo2oNj1AtPbKmlCw8xqdUd0w/14bH1Te0pADDqdBSM9ivMGT XYrw== X-Gm-Message-State: AOAM530QMceGCgjfNWMqt//1f9OPlC5VhDzvsy7U+QH1a6eU6RJedgDK qRdSh1AU4htOkUO50qtUbTS7NsXP5hbS4Rt7a1uSTw== X-Received: from mustash.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:337b]) (user=richardsonnick job=sendgmr) by 2002:ad4:50ce:: with SMTP id e14mr6436544qvq.9.1629250375156; Tue, 17 Aug 2021 18:32:55 -0700 (PDT) Date: Wed, 18 Aug 2021 01:31:26 +0000 Message-Id: <20210818013129.1147350-1-richardsonnick@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog Subject: [PATCH] pktgen: Remove fill_imix_distribution() CONFIG_XFRM dependency 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" , 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 Currently, the declaration of fill_imix_distribution() is dependent on CONFIG_XFRM. This is incorrect. Move fill_imix_distribution() declaration out of #ifndef CONFIG_XFRM block. Signed-off-by: Nick Richardson --- net/core/pktgen.c | 53 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 94008536a9d6..9e5a3249373c 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2601,6 +2601,32 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) pkt_dev->flows[flow].count++; } +static void fill_imix_distribution(struct pktgen_dev *pkt_dev) +{ + int cumulative_probabilites[MAX_IMIX_ENTRIES]; + int j = 0; + __u64 cumulative_prob = 0; + __u64 total_weight = 0; + int i = 0; + + for (i = 0; i < pkt_dev->n_imix_entries; i++) + total_weight += pkt_dev->imix_entries[i].weight; + + /* Fill cumulative_probabilites with sum of normalized probabilities */ + for (i = 0; i < pkt_dev->n_imix_entries - 1; i++) { + cumulative_prob += div64_u64(pkt_dev->imix_entries[i].weight * + IMIX_PRECISION, + total_weight); + cumulative_probabilites[i] = cumulative_prob; + } + cumulative_probabilites[pkt_dev->n_imix_entries - 1] = 100; + + for (i = 0; i < IMIX_PRECISION; i++) { + if (i == cumulative_probabilites[j]) + j++; + pkt_dev->imix_distribution[i] = j; + } +} #ifdef CONFIG_XFRM static u32 pktgen_dst_metrics[RTAX_MAX + 1] = { @@ -2662,33 +2688,6 @@ static void free_SAs(struct pktgen_dev *pkt_dev) } } -static void fill_imix_distribution(struct pktgen_dev *pkt_dev) -{ - int cumulative_probabilites[MAX_IMIX_ENTRIES]; - int j = 0; - __u64 cumulative_prob = 0; - __u64 total_weight = 0; - int i = 0; - - for (i = 0; i < pkt_dev->n_imix_entries; i++) - total_weight += pkt_dev->imix_entries[i].weight; - - /* Fill cumulative_probabilites with sum of normalized probabilities */ - for (i = 0; i < pkt_dev->n_imix_entries - 1; i++) { - cumulative_prob += div64_u64(pkt_dev->imix_entries[i].weight * - IMIX_PRECISION, - total_weight); - cumulative_probabilites[i] = cumulative_prob; - } - cumulative_probabilites[pkt_dev->n_imix_entries - 1] = 100; - - for (i = 0; i < IMIX_PRECISION; i++) { - if (i == cumulative_probabilites[j]) - j++; - pkt_dev->imix_distribution[i] = j; - } -} - static int process_ipsec(struct pktgen_dev *pkt_dev, struct sk_buff *skb, __be16 protocol) { -- 2.33.0.rc1.237.g0d66db33f3-goog