From: Cyril Chemparathy <cchemparathy@tilera.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 4/6] test-pmd: allow txpkts to be setup via command line
Date: Thu, 3 Apr 2014 10:30:14 -0700 [thread overview]
Message-ID: <1396546216-29200-5-git-send-email-cchemparathy@tilera.com> (raw)
In-Reply-To: <1396546216-29200-1-git-send-email-cchemparathy@tilera.com>
We allow a new --txpkts command-line parameter to configure segment sizes when
in txonly or flowgen forwarding modes.
Signed-off-by: Cyril Chemparathy <cchemparathy@tilera.com>
---
app/test-pmd/parameters.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 67081d7..ce90399 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -476,6 +476,52 @@ parse_ringnuma_config(const char *q_arg)
return 0;
}
+static unsigned int
+parse_item_list(char* str, unsigned int max_items, unsigned int *parsed_items)
+{
+ unsigned int nb_item;
+ unsigned int value;
+ unsigned int i;
+ int value_ok;
+ char c;
+
+ /*
+ * First parse all items in the list and store their value.
+ */
+ value = 0;
+ nb_item = 0;
+ value_ok = 0;
+ for (i = 0; i < strlen(str); i++) {
+ c = str[i];
+ if ((c >= '0') && (c <= '9')) {
+ value = (unsigned int) (value * 10 + (c - '0'));
+ value_ok = 1;
+ continue;
+ }
+ if (c != ',') {
+ printf("character %c is not a decimal digit\n", c);
+ return (0);
+ }
+ if (! value_ok) {
+ printf("No valid value before comma\n");
+ return (0);
+ }
+ if (nb_item < max_items) {
+ parsed_items[nb_item] = value;
+ value_ok = 0;
+ value = 0;
+ }
+ nb_item++;
+ }
+
+ if (nb_item >= max_items)
+ rte_exit(EXIT_FAILURE, "too many txpkt segments!\n");
+
+ parsed_items[nb_item++] = value;
+
+ return (nb_item);
+}
+
void
launch_args_parse(int argc, char** argv)
{
@@ -538,6 +584,7 @@ launch_args_parse(int argc, char** argv)
{ "tx-queue-stats-mapping", 1, 0, 0 },
{ "rx-queue-stats-mapping", 1, 0, 0 },
{ "no-flush-rx", 0, 0, 0 },
+ { "txpkts", 1, 0, 0 },
{ 0, 0, 0, 0 },
};
@@ -983,6 +1030,16 @@ launch_args_parse(int argc, char** argv)
"invalid RX queue statistics mapping config entered\n");
}
}
+ if (!strcmp(lgopts[opt_idx].name, "txpkts")) {
+ unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];
+ unsigned int nb_segs;
+
+ nb_segs = parse_item_list(optarg, RTE_MAX_SEGS_PER_PKT, seg_lengths);
+ if (nb_segs > 0)
+ set_tx_pkt_segments(seg_lengths, nb_segs);
+ else
+ rte_exit(EXIT_FAILURE, "bad txpkts\n");
+ }
if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
no_flush_rx = 1;
--
1.8.3.1
next prev parent reply other threads:[~2014-04-03 17:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 17:30 [dpdk-dev] [PATCH 0/6] Extensions to test-pmd Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 1/6] test-pmd: add support for single port loopback topology Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 2/6] test-pmd: add support for auto-start when interactive Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 3/6] test-pmd: allow command line selection of forwarding mode Cyril Chemparathy
2014-04-04 8:21 ` Richardson, Bruce
2014-05-14 17:05 ` [dpdk-dev] [PATCH] app/testpmd: list forwarding modes Thomas Monjalon
2014-05-15 9:35 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2014-05-15 16:08 ` [dpdk-dev] [PATCH v3] app/testpmd: list forwarding engines Thomas Monjalon
2014-05-16 7:21 ` Ivan Boule
2014-05-16 14:24 ` Thomas Monjalon
2014-04-03 17:30 ` Cyril Chemparathy [this message]
2014-04-03 17:30 ` [dpdk-dev] [PATCH 5/6] test-pmd: add mac swap forwarding mode Cyril Chemparathy
2014-04-03 17:30 ` [dpdk-dev] [PATCH 6/6] test-pmd: add flowgen forwarding engine Cyril Chemparathy
2014-05-16 14:22 ` [dpdk-dev] [PATCH 0/6] Extensions to test-pmd Thomas Monjalon
2014-05-16 16:55 ` Cyril Chemparathy
2014-05-19 9:31 ` Thomas Monjalon
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=1396546216-29200-5-git-send-email-cchemparathy@tilera.com \
--to=cchemparathy@tilera.com \
--cc=dev@dpdk.org \
/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).