]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pktgen: Remove fill_imix_distribution() CONFIG_XFRM dependency
authorNick Richardson <richardsonnick@google.com>
Wed, 18 Aug 2021 01:31:26 +0000 (01:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Aug 2021 10:41:13 +0000 (11:41 +0100)
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 <richardsonnick@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/pktgen.c

index 94008536a9d6b8ec888d9c12f5065e119a0409e4..9e5a3249373c239f0d3ba2088f79a09cf4085403 100644 (file)
@@ -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)
 {