diff --git a/VERSION b/VERSION index a41796b3..58dfef16 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -23.10.2 +24.03.0 diff --git a/app/lpktgenlib.c b/app/lpktgenlib.c index 9eb84c0c..e9e3841a 100644 --- a/app/lpktgenlib.c +++ b/app/lpktgenlib.c @@ -3814,11 +3814,6 @@ static const char *lua_help_info[] = { "portCount - Number of port being used\n", "totalPorts - Total number of ports seen by DPDK\n", "\n", - "compile - Convert a structure into a frame to be sent\n", - "decompile - decompile a frame into Ethernet, IP, TCP, UDP or other protocols\n", - "sendPkt - Not working.\n", - "recvPkt - Not working.\n", - "\n", "run - Load a Lua string or command file and execute it.\n", "continue - Display a message and wait for keyboard key and return\n", "input - Wait for a keyboard input line and return line.\n", diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c index 9f46fc16..ece20c65 100644 --- a/app/pktgen-cmds.c +++ b/app/pktgen-cmds.c @@ -572,18 +572,19 @@ pktgen_lua_save(char *path) fprintf(fd, "pktgen.jitter('%d', %lu);\n", i, lat->jitter_threshold_us); fprintf(fd, "pktgen.mpls('%d', '%sable');\n", i, (flags & SEND_MPLS_LABEL) ? "en" : "dis"); sprintf(buff, "0x%x", pkt->mpls_entry); - fprintf(fd, "pktgen.mpls_entry('%d', '%s');\n", i, buff); + fprintf(fd, "pktgen.range.mpls_entry('%d', '%s');\n", i, buff); fprintf(fd, "pktgen.qinq('%d', '%sable');\n", i, (flags & SEND_Q_IN_Q_IDS) ? "en" : "dis"); - fprintf(fd, "pktgen.qinqids('%d', %d, %d);\n", i, pkt->qinq_outerid, pkt->qinq_innerid); + fprintf(fd, "pktgen.range.qinqids('%d', %d, %d);\n", i, pkt->qinq_outerid, + pkt->qinq_innerid); fprintf(fd, "pktgen.gre('%d', '%sable');\n", i, (flags & SEND_GRE_IPv4_HEADER) ? "en" : "dis"); fprintf(fd, "pktgen.gre_eth('%d', '%sable');\n", i, (flags & SEND_GRE_ETHER_HEADER) ? "en" : "dis"); - fprintf(fd, "pktgen.gre_key('%d', %d);\n", i, pkt->gre_key); + fprintf(fd, "pktgen.range.gre_key('%d', %d);\n", i, pkt->gre_key); - fprintf(fd, "pkrgen.vxlan('%d', '%sable');\n", i, + fprintf(fd, "pktgen.vxlan('%d', '%sable');\n", i, (flags & SEND_VXLAN_PACKETS) ? "en" : "dis"); fprintf(fd, "pktgen.vxlan_id('%d', '0x%x', '%d', '%d');\n", i, pkt->vni_flags, pkt->group_id, pkt->vxlan_id); @@ -606,94 +607,94 @@ pktgen_lua_save(char *path) fprintf(fd, "pktgen.vlan('%d', '%sable');\n\n", i, (flags & SEND_VLAN_ID) ? "en" : "dis"); fflush(fd); fprintf(fd, "--\n-- Range packet information:\n"); - fprintf(fd, "pktgen.src_mac('%d', 'start', '%s');\n", i, + fprintf(fd, "pktgen.range.src_mac('%d', 'start', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac, &eaddr))); - fprintf(fd, "pktgen.src_mac('%d', 'min', '%s');\n", i, + fprintf(fd, "pktgen.range.src_mac('%d', 'min', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac_min, &eaddr))); - fprintf(fd, "pktgen.src_mac('%d', 'max', '%s');\n", i, + fprintf(fd, "pktgen.range.src_mac('%d', 'max', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac_max, &eaddr))); - fprintf(fd, "pktgen.src_mac('%d', 'inc', '%s');\n", i, + fprintf(fd, "pktgen.range.src_mac('%d', 'inc', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac_inc, &eaddr))); - fprintf(fd, "pktgen.dst_mac('%d', 'start', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_mac('%d', 'start', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac, &eaddr))); - fprintf(fd, "pktgen.dst_mac('%d', 'min', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_mac('%d', 'min', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac_min, &eaddr))); - fprintf(fd, "pktgen.dst_mac('%d', 'max', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_mac('%d', 'max', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac_max, &eaddr))); - fprintf(fd, "pktgen.dst_mac('%d', 'inc', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_mac('%d', 'inc', '%s');\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac_inc, &eaddr))); fprintf(fd, "\n"); - fprintf(fd, "pktgen.src_ip('%d', 'start', '%s');\n", i, + fprintf(fd, "pktgen.range.src_ip('%d', 'start', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->src_ip), 0xFFFFFFFF)); - fprintf(fd, "pktgen.src_ip('%d', 'min', '%s');\n", i, + fprintf(fd, "pktgen.range.src_ip('%d', 'min', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->src_ip_min), 0xFFFFFFFF)); - fprintf(fd, "pktgen.src_ip('%d', 'max', '%s');\n", i, + fprintf(fd, "pktgen.range.src_ip('%d', 'max', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->src_ip_max), 0xFFFFFFFF)); - fprintf(fd, "pktgen.src_ip('%d', 'inc', '%s');\n", i, + fprintf(fd, "pktgen.range.src_ip('%d', 'inc', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->src_ip_inc), 0xFFFFFFFF)); fprintf(fd, "\n"); - fprintf(fd, "pktgen.dst_ip('%d', 'start', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_ip('%d', 'start', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->dst_ip), 0xFFFFFFFF)); - fprintf(fd, "pktgen.dst_ip('%d', 'min', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_ip('%d', 'min', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->dst_ip_min), 0xFFFFFFFF)); - fprintf(fd, "pktgen.dst_ip('%d', 'max', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_ip('%d', 'max', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->dst_ip_max), 0xFFFFFFFF)); - fprintf(fd, "pktgen.dst_ip('%d', 'inc', '%s');\n", i, + fprintf(fd, "pktgen.range.dst_ip('%d', 'inc', '%s');\n", i, inet_ntop4(buff, sizeof(buff), ntohl(range->dst_ip_inc), 0xFFFFFFFF)); fprintf(fd, "\n"); - fprintf(fd, "pktgen.ip_proto('%d', '%s');\n", i, + fprintf(fd, "pktgen.range.ip_proto('%d', '%s');\n", i, (range->ip_proto == PG_IPPROTO_UDP) ? "udp" : (range->ip_proto == PG_IPPROTO_ICMP) ? "icmp" : "tcp"); fprintf(fd, "\n"); - fprintf(fd, "pktgen.src_port('%d', 'start', %d);\n", i, range->src_port); - fprintf(fd, "pktgen.src_port('%d', 'min', %d);\n", i, range->src_port_min); - fprintf(fd, "pktgen.src_port('%d', 'max', %d);\n", i, range->src_port_max); - fprintf(fd, "pktgen.src_port('%d', 'inc', %d);\n", i, range->src_port_inc); + fprintf(fd, "pktgen.range.src_port('%d', 'start', %d);\n", i, range->src_port); + fprintf(fd, "pktgen.range.src_port('%d', 'min', %d);\n", i, range->src_port_min); + fprintf(fd, "pktgen.range.src_port('%d', 'max', %d);\n", i, range->src_port_max); + fprintf(fd, "pktgen.range.src_port('%d', 'inc', %d);\n", i, range->src_port_inc); fprintf(fd, "\n"); - fprintf(fd, "pktgen.dst_port('%d', 'start', %d);\n", i, range->dst_port); - fprintf(fd, "pktgen.dst_port('%d', 'min', %d);\n", i, range->dst_port_min); - fprintf(fd, "pktgen.dst_port('%d', 'max', %d);\n", i, range->dst_port_max); - fprintf(fd, "pktgen.dst_port('%d', 'inc', %d);\n", i, range->dst_port_inc); + fprintf(fd, "pktgen.range.dst_port('%d', 'start', %d);\n", i, range->dst_port); + fprintf(fd, "pktgen.range.dst_port('%d', 'min', %d);\n", i, range->dst_port_min); + fprintf(fd, "pktgen.range.dst_port('%d', 'max', %d);\n", i, range->dst_port_max); + fprintf(fd, "pktgen.range.dst_port('%d', 'inc', %d);\n", i, range->dst_port_inc); fprintf(fd, "\n"); - fprintf(fd, "pktgen.ttl('%d', 'start', %d);\n", i, range->ttl); - fprintf(fd, "pktgen.ttl('%d', 'min', %d);\n", i, range->ttl_min); - fprintf(fd, "pktgen.ttl('%d', 'max', %d);\n", i, range->ttl_max); - fprintf(fd, "pktgen.ttl('%d', 'inc', %d);\n", i, range->ttl_inc); + fprintf(fd, "pktgen.range.ttl('%d', 'start', %d);\n", i, range->ttl); + fprintf(fd, "pktgen.range.ttl('%d', 'min', %d);\n", i, range->ttl_min); + fprintf(fd, "pktgen.range.ttl('%d', 'max', %d);\n", i, range->ttl_max); + fprintf(fd, "pktgen.range.ttl('%d', 'inc', %d);\n", i, range->ttl_inc); fprintf(fd, "\n"); - fprintf(fd, "pktgen.vlan_id('%d', 'start', %d);\n", i, range->vlan_id); - fprintf(fd, "pktgen.vlan_id('%d', 'min', %d);\n", i, range->vlan_id_min); - fprintf(fd, "pktgen.vlan_id('%d', 'max', %d);\n", i, range->vlan_id_max); - fprintf(fd, "pktgen.vlan_id('%d', 'inc', %d);\n", i, range->vlan_id_inc); + fprintf(fd, "pktgen.range.vlan_id('%d', 'start', %d);\n", i, range->vlan_id); + fprintf(fd, "pktgen.range.vlan_id('%d', 'min', %d);\n", i, range->vlan_id_min); + fprintf(fd, "pktgen.range.vlan_id('%d', 'max', %d);\n", i, range->vlan_id_max); + fprintf(fd, "pktgen.range.vlan_id('%d', 'inc', %d);\n", i, range->vlan_id_inc); fprintf(fd, "\n"); - fprintf(fd, "pktgen.cos('%d', 'start', %d);\n", i, range->cos); - fprintf(fd, "pktgen.cos('%d', 'min', %d);\n", i, range->cos_min); - fprintf(fd, "pktgen.cos('%d', 'max', %d);\n", i, range->cos_max); - fprintf(fd, "pktgen.cos('%d', 'inc', %d);\n", i, range->cos_inc); + fprintf(fd, "pktgen.range.cos('%d', 'start', %d);\n", i, range->cos); + fprintf(fd, "pktgen.range.cos('%d', 'min', %d);\n", i, range->cos_min); + fprintf(fd, "pktgen.range.cos('%d', 'max', %d);\n", i, range->cos_max); + fprintf(fd, "pktgen.range.cos('%d', 'inc', %d);\n", i, range->cos_inc); fprintf(fd, "\n"); - fprintf(fd, "pktgen.tos('%d', 'start', %d);\n", i, range->tos); - fprintf(fd, "pktgen.tos('%d', 'min', %d);\n", i, range->tos_min); - fprintf(fd, "pktgen.tos('%d', 'max', %d);\n", i, range->tos_max); - fprintf(fd, "pktgen.tos('%d', 'inc', %d);\n", i, range->tos_inc); + fprintf(fd, "pktgen.range.tos('%d', 'start', %d);\n", i, range->tos); + fprintf(fd, "pktgen.range.tos('%d', 'min', %d);\n", i, range->tos_min); + fprintf(fd, "pktgen.range.tos('%d', 'max', %d);\n", i, range->tos_max); + fprintf(fd, "pktgen.range.tos('%d', 'inc', %d);\n", i, range->tos_inc); fprintf(fd, "\n"); - fprintf(fd, "pktgen.pkt_size('%d', 'start', %d);\n", i, + fprintf(fd, "pktgen.range.pkt_size('%d', 'start', %d);\n", i, range->pkt_size + RTE_ETHER_CRC_LEN); - fprintf(fd, "pktgen.pkt_size('%d', 'min', %d);\n", i, + fprintf(fd, "pktgen.range.pkt_size('%d', 'min', %d);\n", i, range->pkt_size_min + RTE_ETHER_CRC_LEN); - fprintf(fd, "pktgen.pkt_size('%d', 'max', %d);\n", i, + fprintf(fd, "pktgen.range.pkt_size('%d', 'max', %d);\n", i, range->pkt_size_max + RTE_ETHER_CRC_LEN); - fprintf(fd, "pktgen.pkt_size('%d', 'inc', %d);\n\n", i, range->pkt_size_inc); + fprintf(fd, "pktgen.range.pkt_size('%d', 'inc', %d);\n\n", i, range->pkt_size_inc); fprintf(fd, "--\n-- Set up the sequence data for the port.\n"); fprintf(fd, "pktgen.set('%d', 'seq_cnt', %d);\n\n", info->pid, info->seqCnt); diff --git a/cfg/four-ports.cfg b/cfg/four-ports.cfg new file mode 100644 index 00000000..e5122848 --- /dev/null +++ b/cfg/four-ports.cfg @@ -0,0 +1,61 @@ +description = 'A Pktgen default simple configuration' + +# Setup configuration +setup = { + 'exec': ( + 'sudo', '-E' + ), + + 'devices': ( + '03:00.0', + '03:00.1', + '05:00.0', + '05:00.1', + ), + # UIO module type, igb_uio, vfio-pci or uio_pci_generic + 'uio': 'vfio-pci' + } + +# Run command and options +run = { + 'exec': ('sudo', '-E'), + + # Application name and use app_path to help locate the app + 'app_name': 'pktgen', + + # using (sdk) or (target) for specific variables + # add (app_name) of the application + # Each path is tested for the application + 'app_path': ( + './usr/local/bin/%(app_name)s', + '/usr/local/bin/%(app_name)s' + ), + + 'cores': '4,5-8,9-13', + 'nrank': '4', + 'proc': 'auto', + 'log': '7', + 'prefix': 'pg', + + 'allowlist': ( + '03:00.0', + '03:00.1', + '05:00.0', + '05:00.1', + ), + + 'opts': ( + '-v', + '-T', + '-P', + '-G', + ), + 'map': ( + '[5:6-7].0', + '[8:9].1', + '[10:11].2', + '[12:13].3', + ), + + 'theme': 'themes/black-yellow.theme', + } diff --git a/changelog.txt b/changelog.txt index 49814f07..70056e81 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,11 +1,14 @@ Pktgen-DPDK - Traffic Generator powered by DPDK ===================================================== -**Pktgen-DPDK is a traffic generator powered by DPDK at wire rate traffic with 64 byte frames.** +**Pktgen-DPDK is a traffic generator powered by DPDK** ** (Pktgen) Sounds like 'Packet-Gen'** **=== Modifications ===** + - 24.03.0 - Fix a number of problems with save command for lua scripts. + Removed the decompile/compile/sendPkt/recvPkt references. + Compiled with DPDK 24.03.0 - 23.10.2 - Fix range tcp flags and help messages - 23.10.1 - Fix rte_thread_setname() change to rte_thread_set_name() for lua builds - 23.10.0 - Change TX rate calculations to be more accurate diff --git a/test/main.lua b/test/main.lua index 6bb1d2e0..aece2a93 100644 --- a/test/main.lua +++ b/test/main.lua @@ -37,7 +37,6 @@ pktgen.screen("off"); -- sequence command in one line pktgen.seq(0, "all", "0000:4455:6677", "0000:1234:5678", "10.11.0.1", "10.10.0.1/16", 5, 6, "ipv4", "udp", 1, 128); -prints("seq", pktgen.decompile(0, "all")); -- sequence command using a table of packet configurations local seq_table = { @@ -54,8 +53,6 @@ local seq_table = { }; pktgen.seqTable(0, "all", seq_table ); -prints("seqTable", pktgen.decompile(0, "all")); - pktgen.ports_per_page(2); pktgen.icmp_echo("all", "on"); pktgen.send_arp("all", "g"); diff --git a/test/portstats.lua b/test/portstats.lua new file mode 100644 index 00000000..018de1d1 --- /dev/null +++ b/test/portstats.lua @@ -0,0 +1,10 @@ +package.path = package.path ..";?.lua;test/?.lua;app/?.lua;" + +require "Pktgen" +-- A list of the test script for Pktgen and Lua. +-- Each command somewhat mirrors the pktgen command line versions. +-- A couple of the arguments have be changed to be more like the others. +-- + +prints("portStats", pktgen.portStats("all", "port")); +prints("portStats", pktgen.portStats('2', 'port'));