From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40018C432BE for ; Wed, 18 Aug 2021 01:32:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2309B61029 for ; Wed, 18 Aug 2021 01:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233027AbhHRBdb (ORCPT ); Tue, 17 Aug 2021 21:33:31 -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-Google-Smtp-Source: ABdhPJytIaSaLZfB5oh6aVtn64Gw3GQ/SLbacTPCPjwrqofp9Cbpc3Nrje1IVJ+7gLPmaNM3c4ZdYMhX2GLe5z2AszQHDQ== 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