DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adam Drescher <adam.r.drescher@gmail.com>
To: keith.wiles@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] pktgen: fix config file output
Date: Thu, 29 Aug 2019 22:54:13 +0000	[thread overview]
Message-ID: <20190829225413.4756-1-adam.r.drescher@gmail.com> (raw)

The 'save' TUI command does not export certain configuration commands
with the correct syntax. As a result, when loading this config file
later these commands will fail (eg. range MAC addresses, range ports).
This patch fixes a number of these cases.

Signed-off-by: Adam Drescher <adam.r.drescher@gmail.com>
---
 app/pktgen-cmds.c | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c
index 1f00a21..ca62d20 100644
--- a/app/pktgen-cmds.c
+++ b/app/pktgen-cmds.c
@@ -184,7 +184,7 @@ pktgen_script_save(char *path)
 			inet_mtoa(buff, sizeof(buff), &pkt->eth_dst_addr));
 		fprintf(fd, "set %d src mac %s\n", info->pid,
 			inet_mtoa(buff, sizeof(buff), &pkt->eth_src_addr));
-		fprintf(fd, "set %d vlanid %d\n\n", i, pkt->vlanid);
+		fprintf(fd, "set %d vlan %d\n\n", i, pkt->vlanid);
 
 		fprintf(fd, "set %d pattern %s\n", i,
 			(info->fill_pattern_type == ABC_FILL_PATTERN) ? "abc" :
@@ -238,35 +238,36 @@ pktgen_script_save(char *path)
 			(flags & PROCESS_RX_TAP_PKTS) ? "en" : "dis", i);
 		fprintf(fd, "%sable %d tx_tap\n",
 			(flags & PROCESS_TX_TAP_PKTS) ? "en" : "dis", i);
-		fprintf(fd, "%sable %d vlan\n\n",
+		fprintf(fd, "%sable %d vlan\n",
 			(flags & SEND_VLAN_ID) ? "en" : "dis", i);
-		fprintf(fd, "%sable %d vlan\n\n",
+		fprintf(fd, "%sable %d rate\n\n",
 			(flags & SEND_RATE_PACKETS) ? "en" : "dis", i);
 
 		fprintf(fd, "#\n# Range packet information:\n");
-		fprintf(fd, "range %d mac src start %s\n", i,
+		fprintf(fd, "range %d src mac start %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->src_mac, &eaddr)));
-		fprintf(fd, "range %d mac src min %s\n", i,
+		fprintf(fd, "range %d src mac min %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->src_mac_min, &eaddr)));
-		fprintf(fd, "range %d mac src max %s\n", i,
+		fprintf(fd, "range %d src mac max %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->src_mac_max, &eaddr)));
-		fprintf(fd, "range %d mac src inc %s\n", i,
+		fprintf(fd, "range %d src mac inc %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->src_mac_inc, &eaddr)));
 
-		fprintf(fd, "range %d mac dst start %s\n", i,
+		fprintf(fd, "\n");
+		fprintf(fd, "range %d dst mac start %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->dst_mac, &eaddr)));
-		fprintf(fd, "range %d mac dst min %s\n", i,
+		fprintf(fd, "range %d dst mac min %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->dst_mac_min, &eaddr)));
-		fprintf(fd, "range %d mac dst max %s\n", i,
+		fprintf(fd, "range %d dst mac max %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->dst_mac_max, &eaddr)));
-		fprintf(fd, "range %d mac dst inc %s\n", i,
+		fprintf(fd, "range %d dst mac inc %s\n", i,
 			inet_mtoa(buff, sizeof(buff),
 				  inet_h64tom(range->dst_mac_inc, &eaddr)));
 
@@ -304,16 +305,16 @@ pktgen_script_save(char *path)
 			(range->ip_proto == PG_IPPROTO_ICMP) ? "icmp" : "tcp");
 
 		fprintf(fd, "\n");
-		fprintf(fd, "range %d sport start %d\n", i, range->src_port);
-		fprintf(fd, "range %d sport min %d\n", i, range->src_port_min);
-		fprintf(fd, "range %d sport max %d\n", i, range->src_port_max);
-		fprintf(fd, "range %d sport inc %d\n", i, range->src_port_inc);
+		fprintf(fd, "range %d src port start %d\n", i, range->src_port);
+		fprintf(fd, "range %d src port min %d\n", i, range->src_port_min);
+		fprintf(fd, "range %d src port max %d\n", i, range->src_port_max);
+		fprintf(fd, "range %d src port inc %d\n", i, range->src_port_inc);
 
 		fprintf(fd, "\n");
-		fprintf(fd, "range %d dport start %d\n", i, range->dst_port);
-		fprintf(fd, "range %d dport min %d\n", i, range->dst_port_min);
-		fprintf(fd, "range %d dport max %d\n", i, range->dst_port_max);
-		fprintf(fd, "range %d dport inc %d\n", i, range->dst_port_inc);
+		fprintf(fd, "range %d dst port start %d\n", i, range->dst_port);
+		fprintf(fd, "range %d dst port min %d\n", i, range->dst_port_min);
+		fprintf(fd, "range %d dst port max %d\n", i, range->dst_port_max);
+		fprintf(fd, "range %d dst port inc %d\n", i, range->dst_port_inc);
 
 		fprintf(fd, "\n");
 		fprintf(fd, "range %d ttl start %d\n", i, range->ttl);
@@ -353,7 +354,7 @@ pktgen_script_save(char *path)
 		fprintf(fd, "rate %d fps %d\n", i, rate->fps);
 		fprintf(fd, "rate %d lines %d\n", i, rate->vlines);
 		fprintf(fd, "rate %d pixels %d\n", i, rate->pixels);
-		fprintf(fd, "rate %d color %d\n", i, rate->color_bits);
+		fprintf(fd, "rate %d color bits %d\n", i, rate->color_bits);
 		fprintf(fd, "rate %d payload size %d\n\n", i, rate->payload);
 		fprintf(fd, "rate %d overhead %d\n", i, rate->overhead);
 
-- 
2.20.1


                 reply	other threads:[~2019-08-29 22:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190829225413.4756-1-adam.r.drescher@gmail.com \
    --to=adam.r.drescher@gmail.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).