patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Wei Zhao <wei.zhao1@intel.com>
Cc: Yuan Peng <yuan.peng@intel.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'app/testpmd: fix hex string parser support for flow API' has been queued to LTS release 18.11.2
Date: Tue, 30 Apr 2019 18:01:11 +0100	[thread overview]
Message-ID: <20190430170133.2331-16-ktraynor@redhat.com> (raw)
In-Reply-To: <20190430170133.2331-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/07/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches can be viewed on a temporary branch at:
	https://github.com/kevintraynor/dpdk-stable-queue.git

Thanks.

Kevin Traynor

---
From 7548453b0461ea73824d2d2771d2c4db0af64e7d Mon Sep 17 00:00:00 2001
From: Wei Zhao <wei.zhao1@intel.com>
Date: Tue, 9 Apr 2019 16:41:31 +0800
Subject: [PATCH] app/testpmd: fix hex string parser support for flow API

[ upstream commit 169a9fed1f4cbca7e432fdc9ad1d44922ad783f6 ]

There is need for users to set configuration of HEX number for RSS
key. The key byte should be pass down as hex number not as char
string. This patch enable cmdline flow parse HEX number,
in order to not using string which pass ASIC number.

Fixes: f4d623f96119 ("app/testpmd: fix missing RSS fields in flow action")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test-pmd/cmdline_flow.c | 128 +++++++++++++++++++++++++++++++++++-
 1 file changed, 127 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5c0108fa7..d202566b2 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -36,4 +36,5 @@ enum index {
 	BOOLEAN,
 	STRING,
+	HEX,
 	MAC_ADDR,
 	IPV4_ADDR,
@@ -1123,4 +1124,7 @@ static int parse_string(struct context *, const struct token *,
 			const char *, unsigned int,
 			void *, unsigned int);
+static int parse_hex(struct context *ctx, const struct token *token,
+			const char *str, unsigned int len,
+			void *buf, unsigned int size);
 static int parse_mac_addr(struct context *, const struct token *,
 			  const char *, unsigned int,
@@ -1199,4 +1203,11 @@ static const struct token token_list[] = {
 		.comp = comp_none,
 	},
+	[HEX] = {
+		.name = "{hex}",
+		.type = "HEX",
+		.help = "fixed string",
+		.call = parse_hex,
+		.comp = comp_none,
+	},
 	[MAC_ADDR] = {
 		.name = "{MAC address}",
@@ -2307,5 +2318,5 @@ static const struct token token_list[] = {
 		.name = "key",
 		.help = "RSS hash key",
-		.next = NEXT(action_rss, NEXT_ENTRY(STRING)),
+		.next = NEXT(action_rss, NEXT_ENTRY(HEX)),
 		.args = ARGS(ARGS_ENTRY_ARB(0, 0),
 			     ARGS_ENTRY_ARB
@@ -4442,4 +4453,119 @@ error:
 }
 
+static int
+parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)
+{
+	char *c = NULL;
+	uint32_t i, len;
+	char tmp[3];
+
+	/* Check input parameters */
+	if ((src == NULL) ||
+		(dst == NULL) ||
+		(size == NULL) ||
+		(*size == 0))
+		return -1;
+
+	/* Convert chars to bytes */
+	for (i = 0, len = 0; i < *size; i += 2) {
+		snprintf(tmp, 3, "%s", src + i);
+		dst[len++] = strtoul(tmp, &c, 16);
+		if (*c != 0) {
+			len--;
+			dst[len] = 0;
+			*size = len;
+			return -1;
+		}
+	}
+	dst[len] = 0;
+	*size = len;
+
+	return 0;
+}
+
+static int
+parse_hex(struct context *ctx, const struct token *token,
+		const char *str, unsigned int len,
+		void *buf, unsigned int size)
+{
+	const struct arg *arg_data = pop_args(ctx);
+	const struct arg *arg_len = pop_args(ctx);
+	const struct arg *arg_addr = pop_args(ctx);
+	char tmp[16]; /* Ought to be enough. */
+	int ret;
+	unsigned int hexlen = len;
+	unsigned int length = 256;
+	uint8_t hex_tmp[length];
+
+	/* Arguments are expected. */
+	if (!arg_data)
+		return -1;
+	if (!arg_len) {
+		push_args(ctx, arg_data);
+		return -1;
+	}
+	if (!arg_addr) {
+		push_args(ctx, arg_len);
+		push_args(ctx, arg_data);
+		return -1;
+	}
+	size = arg_data->size;
+	/* Bit-mask fill is not supported. */
+	if (arg_data->mask)
+		goto error;
+	if (!ctx->object)
+		return len;
+
+	/* translate bytes string to array. */
+	if (str[0] == '0' && ((str[1] == 'x') ||
+			(str[1] == 'X'))) {
+		str += 2;
+		hexlen -= 2;
+	}
+	if (hexlen > length)
+		return -1;
+	ret = parse_hex_string(str, hex_tmp, &hexlen);
+	if (ret < 0)
+		goto error;
+	/* Let parse_int() fill length information first. */
+	ret = snprintf(tmp, sizeof(tmp), "%u", hexlen);
+	if (ret < 0)
+		goto error;
+	push_args(ctx, arg_len);
+	ret = parse_int(ctx, token, tmp, ret, NULL, 0);
+	if (ret < 0) {
+		pop_args(ctx);
+		goto error;
+	}
+	buf = (uint8_t *)ctx->object + arg_data->offset;
+	/* Output buffer is not necessarily NUL-terminated. */
+	memcpy(buf, hex_tmp, hexlen);
+	memset((uint8_t *)buf + hexlen, 0x00, size - hexlen);
+	if (ctx->objmask)
+		memset((uint8_t *)ctx->objmask + arg_data->offset,
+					0xff, hexlen);
+	/* Save address if requested. */
+	if (arg_addr->size) {
+		memcpy((uint8_t *)ctx->object + arg_addr->offset,
+		       (void *[]){
+			(uint8_t *)ctx->object + arg_data->offset
+		       },
+		       arg_addr->size);
+		if (ctx->objmask)
+			memcpy((uint8_t *)ctx->objmask + arg_addr->offset,
+			       (void *[]){
+				(uint8_t *)ctx->objmask + arg_data->offset
+			       },
+			       arg_addr->size);
+	}
+	return len;
+error:
+	push_args(ctx, arg_addr);
+	push_args(ctx, arg_len);
+	push_args(ctx, arg_data);
+	return -1;
+
+}
+
 /**
  * Parse a MAC address.
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-04-30 17:58:14.577048644 +0100
+++ 0016-app-testpmd-fix-hex-string-parser-support-for-flow-A.patch	2019-04-30 17:58:13.784140250 +0100
@@ -1 +1 @@
-From 169a9fed1f4cbca7e432fdc9ad1d44922ad783f6 Mon Sep 17 00:00:00 2001
+From 7548453b0461ea73824d2d2771d2c4db0af64e7d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 169a9fed1f4cbca7e432fdc9ad1d44922ad783f6 ]
+
@@ -12 +13,0 @@
-Cc: stable@dpdk.org
@@ -22 +23 @@
-index 1c83bc9bc..54ff1753c 100644
+index 5c0108fa7..d202566b2 100644
@@ -25 +26 @@
-@@ -37,4 +37,5 @@ enum index {
+@@ -36,4 +36,5 @@ enum index {
@@ -31 +32 @@
-@@ -1124,4 +1125,7 @@ static int parse_string(struct context *, const struct token *,
+@@ -1123,4 +1124,7 @@ static int parse_string(struct context *, const struct token *,
@@ -39 +40 @@
-@@ -1200,4 +1204,11 @@ static const struct token token_list[] = {
+@@ -1199,4 +1203,11 @@ static const struct token token_list[] = {
@@ -51 +52 @@
-@@ -2308,5 +2319,5 @@ static const struct token token_list[] = {
+@@ -2307,5 +2318,5 @@ static const struct token token_list[] = {
@@ -58 +59 @@
-@@ -4477,4 +4488,119 @@ error:
+@@ -4442,4 +4453,119 @@ error:

  parent reply	other threads:[~2019-04-30 17:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 17:00 [dpdk-stable] patch 'net/mlx5: fix memory event on secondary process' " Kevin Traynor
2019-04-30 17:00 ` [dpdk-stable] patch 'net/mlx4: change device reference for " Kevin Traynor
2019-04-30 17:00 ` [dpdk-stable] patch 'net/mlx: remove debug messages on datapath' " Kevin Traynor
2019-04-30 17:00 ` [dpdk-stable] patch 'net/mlx5: fix external memory registration' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/sfc: improve TSO header length check in EFX datapath' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/sfc: improve TSO header length check in EF10 " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net: fix Tx VLAN flag for offload emulation' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'app/testpmd: fix Tx VLAN and QinQ dependency' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'app/testpmd: fix Tx QinQ set' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'table: fix arm64 hash function selection' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/nfp: fix file descriptor check' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/nfp: fix potential integer overflow' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/nfp: check return value' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/nfp: fix memory leak' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'app/testpmd: fix mempool free on exit' " Kevin Traynor
2019-04-30 17:01 ` Kevin Traynor [this message]
2019-04-30 17:01 ` [dpdk-stable] patch 'app/testpmd: fix return value check' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/bnxt: fix big endian build' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'net/i40e: fix scattered Rx enabling' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'doc: fix spelling in testpmd guide' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'doc: add flow API to qede NIC features' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'devtools: accept experimental symbol promotion' " Kevin Traynor
2019-05-02  7:25   ` David Marchand
2019-05-02  8:01     ` Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'devtools: skip meson build for missing compilers' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'devtools: support older compilers with meson test' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'examples/l2fwd-cat: fix build on FreeBSD' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'build: use default flags for default Arm machine' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'drivers/event: disable OcteonTx for buggy Arm compilers' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'examples/fips_validation: fix CMAC test' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'doc: add missing algorithms for AESNI-MB PMD' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'crypto/caam_jr: fix shared descriptor endianness' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'crypto/caam_jr: fix total length in auth only s/g' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'crypto/caam_jr: fix memory leak and illegal access' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'doc: fix missing asymmetric crypto table' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'app/crypto-perf: check range of socket id' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'crypto/dpaa: fix session destroy' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'kni: fix build with Linux 5.1' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'kni: fix type for MAC address' " Kevin Traynor
2019-04-30 17:01 ` [dpdk-stable] patch 'mbuf: update Tx VLAN and QinQ flags documentation' " Kevin Traynor

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=20190430170133.2331-16-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    --cc=wei.zhao1@intel.com \
    --cc=yuan.peng@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).