1. 12 Aug, 2021 3 commits
    • Nick Richardson's avatar
      pktgen: Add output for imix results · 769afb3f
      Nick Richardson authored
      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: default avatarNick Richardson <richardsonnick@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      769afb3f
    • Nick Richardson's avatar
      pktgen: Add imix distribution bins · 90149031
      Nick Richardson authored
      In order to represent the distribution of imix packet sizes, a
      pre-computed data structure is used. It features 100 (IMIX_PRECISION)
      "bins". Contiguous ranges of these bins represent the respective
      packet size of each imix entry. This is done to avoid the overhead of
      selecting the correct imix packet size based on the corresponding weights.
      
      Example:
      imix_weights 40,7 576,4 1500,1
      total_weight = 7 + 4 + 1 = 12
      
      pkt_size 40 occurs 7/total_weight = 58% of the time
      pkt_size 576 occurs 4/total_weight = 33% of the time
      pkt_size 1500 occurs 1/total_weight = 9% of the time
      
      We generate a random number between 0-100 and select the corresponding
      packet size based on the specified weights.
      Eg. random number = 358723895 % 100 = 65
      Selects the packet size corresponding to index:65 in the pre-computed
      imix_distribution array.
      An example of the  pre-computed array is below:
      
      The imix_distribution will look like the following:
      0        ->  0 (index of imix_entry.size == 40)
      1        ->  0 (index of imix_entry.size == 40)
      2        ->  0 (index of imix_entry.size == 40)
      [...]    ->  0 (index of imix_entry.size == 40)
      57       ->  0 (index of imix_entry.size == 40)
      58       ->  1 (index of imix_entry.size == 576)
      [...]    ->  1 (index of imix_entry.size == 576)
      90       ->  1 (index of imix_entry.size == 576)
      91       ->  2 (index of imix_entry.size == 1500)
      [...]    ->  2 (index of imix_entry.size == 1500)
      99       ->  2 (index of imix_entry.size == 1500)
      
      Create and use "bin" representation of the imix distribution.
      Signed-off-by: default avatarNick Richardson <richardsonnick@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      90149031
    • Nick Richardson's avatar
      pktgen: Parse internet mix (imix) input · 52a62f86
      Nick Richardson authored
      Adds "imix_weights" command for specifying internet mix distribution.
      
      The command is in this format:
      "imix_weights size_1,weight_1 size_2,weight_2 ... size_n,weight_n"
      where the probability that packet size_i is picked is:
      weight_i / (weight_1 + weight_2 + .. + weight_n)
      
      The user may provide up to 100 imix entries (size_i,weight_i) in this
      command.
      
      The user specified imix entries will be displayed in the "Params"
      section of the interface output.
      
      Values for clone_skb > 0 is not supported in IMIX mode.
      
      Summary of changes:
      Add flag for enabling internet mix mode.
      Add command (imix_weights) for internet mix input.
      Return -ENOTSUPP when clone_skb > 0 in IMIX mode.
      Display imix_weights in Params.
      Create data structures to store imix entries and distribution.
      Signed-off-by: default avatarNick Richardson <richardsonnick@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52a62f86
  2. 11 Aug, 2021 37 commits