Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion surrounding range commands #295

Open
vaastav opened this issue Nov 14, 2024 · 6 comments
Open

Confusion surrounding range commands #295

vaastav opened this issue Nov 14, 2024 · 6 comments

Comments

@vaastav
Copy link

vaastav commented Nov 14, 2024

Hi, I am trying to use the range commands to control the number of unique flows for my workload.
This is the lua script I have right now

package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"

require "Pktgen";
pkt_size = 64;
local dstip = "10.10.0.100";
local srcip = "10.10.0.101";
local netmask = "/24";
sendport = 0;
recvport = 0;


printf("\nStarting Experiment!!!\n");
print("Pkt_size is", pkt_size, "\n");
pktgen.set("all", "size", pkt_size)
--pktgen.start("0");
pktgen.set("all", "sport", 0x5678);
pktgen.set("all", "dport", 0x1234);
pktgen.set_ipaddr("all", "src", srcip..netmask);
pktgen.range.dst_ip("0", "start", "10.12.0.1");
pktgen.range.dst_ip("0", "inc", "0.0.0.1");
pktgen.range.dst_ip("0", "min", "10.12.0.1");
pktgen.range.dst_ip("0", "max", "10.12.0.64");

pktgen.set_range("0", "on");
pktgen.start("0");
pktgen.delay(10000);
pktgen.stop("0");
pktgen.quit();

My confusion is that when I execute this workload, the source port and destination port do not remain static. But the src ip remains static but the destination ip address seems to also exceed the range.
Have I configured the range commands incorrectly? Any help would be appreciated.

@KeithWiles
Copy link
Collaborator

The script is mixing single mode calls and range calls. The page range command will let you see the configuration. The destination IP address defaults to increment of 0.0.0.1 and source IP address increment defaults to 0.0.0.0, these need to be set up correctly for you use case. Here is an updated script, please let me know if this does not work and most likely did not get the exact use case you wanted.

package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"

require "Pktgen";
pkt_size = 64;

local dstip     = "10.12.0.1";
local min_dstip = "10.12.0.1";
local max_dstip = "10.12.0.64";
local inc_dstip = "0.0.0.1"

local srcip     = "10.12.0.101";
local min_srcip = "10.12.0.101";
local max_srcip = "10.12.0.101";
local inc_srcip = "0.0.0.0"

local dst_port     = 5678
local inc_dst_port = 0;
local min_dst_port = dst_port
local max_dst_port = dst_port;

local src_port     = 1234
local inc_src_port = 0;
local min_src_port = src_port
local max_src_port = src_port;

local netmask = "/24";
sendport = 0;
recvport = 0;


printf("\nStarting Experiment!!!\n");
print("Pkt_size is", pkt_size, "\n");

pktgen.set("all", "size", pkt_size)

pktgen.page("range")

pktgen.range.dst_port("all", "start", dst_port);
pktgen.range.dst_port("all", "inc", inc_dst_port);
pktgen.range.dst_port("all", "min", min_dst_port);
pktgen.range.dst_port("all", "max", max_dst_port);

pktgen.range.src_port("all", "start", src_port);
pktgen.range.src_port("all", "inc", inc_src_port);
pktgen.range.src_port("all", "min", min_src_port);
pktgen.range.src_port("all", "max", max_src_port);

pktgen.range.dst_ip("all", "start", dstip);
pktgen.range.dst_ip("all", "inc", inc_dstip);
pktgen.range.dst_ip("all", "min", min_dstip);
pktgen.range.dst_ip("all", "max", max_dstip);

pktgen.range.src_ip("all", "start", srcip);
pktgen.range.src_ip("all", "inc", inc_srcip);
pktgen.range.src_ip("all", "min", srcip);
pktgen.range.src_ip("all", "max", srcip);

pktgen.set_range("0", "on");

@vaastav
Copy link
Author

vaastav commented Nov 14, 2024

Hi, thanks for the quick response.
This is the output I see when I execute the script:
image

Couple of issues:

  1. I would like this ranged command to cycle through and keep generating packets (like pktgen.start does) until a stop is called. At the moment, this script finishes quickly after sending 64 packets I think.
  2. The IP address shown still doesn't seem to match the ip that was set.

Ideally, I want to be able to execute a workload at line rate for a fixed period of time. Normally, I do this using

pktgen.start("0")
pktgen.delay(60000) -- Sleep for 60 seconds so that we generate packets at line rate for 1 minute.
pktgen.stop("0")

But, I want the additional restriction of ensuring that the flow information of the packet ranges between pre-determined values. For example,
Packet 1: 10.12.0.101:5678 -> 10.12.0.1:1234
...
Packet 64: 10.12.0.101:5678 -> 10.12.0.64:1234
Packet 65: 10.12.0.101:5678 -> 10.12.0.1:1234
...
Packet 10million: 10.12.0.101:5678 -> 10.12.0.64:1234

Is it possible to get this type of workload with the range commands or should I try a different type of workload?

@KeithWiles
Copy link
Collaborator

KeithWiles commented Nov 14, 2024

Please update pktgen to latest version 24.10.3 and you may have to update DPDK to the current version as well. DPDK has changed defines and APIs, which makes it difficult to maintain backward compatibility so I only support latest Pktgen and DPDK.

Give that a try and see if that works as the above screen does not look correct for you configuration.

When I have more time today, I will read the rest of the post above.

@KeithWiles
Copy link
Collaborator

When using range command it does cycle thru the packet until you stop sending traffic as long as send forever is set as the TX packet count. Make sure you did not set the TX count to some value.

The only way to get something different then what the range mode supports is to use PCAP file with the traffic you need.

@vaastav
Copy link
Author

vaastav commented Nov 14, 2024

That doesn't seem to be the case when I run the script you sent. It immediately exits.
I haven't tried it with pktgen 24.10 as I can't seem to upgrade dpdk version atm.

@KeithWiles
Copy link
Collaborator

In the script I did not start pktgen sending packets unless you added that code back. After loading the script you can do the start 0 from the command line. If you did add that framement of code and is the latest Pktgen and DPDK it is a bug. Also I only enabled range mode of port 0 not any of the other ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants