patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1
@ 2018-02-01  9:47 Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'service: fix possible mem leak on initialize' " Yuanhan Liu
                   ` (43 more replies)
  0 siblings, 44 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Harry van Haaren, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From daaab9dfce1428bcf9582a6eb6ca4ac1f85a9062 Mon Sep 17 00:00:00 2001
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Date: Fri, 19 Jan 2018 12:08:29 +0530
Subject: [PATCH] event/sw: fix debug logging config option

[ upstream commit 5b118e894d317b6acd4be398db760b1c3dcf822e ]

align the config option name with config/common_base

Fixes: aaa4a221da26 ("event/sw: add new software-only eventdev driver")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 drivers/event/sw/sw_evdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
index e0dec91..ee0edb3 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -88,7 +88,7 @@ static const uint8_t sw_qe_flag_map[] = {
 		QE_FLAG_VALID | QE_FLAG_COMPLETE | QE_FLAG_NOT_EOP,
 };
 
-#ifdef RTE_LIBRTE_PMD_EVDEV_SW_DEBUG
+#ifdef RTE_LIBRTE_PMD_SW_EVENTDEV_DEBUG
 #define SW_LOG_INFO(fmt, args...) \
 	RTE_LOG(INFO, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \
 			SW_PMD_NAME, \
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'service: fix possible mem leak on initialize' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'cmdline: fix dynamic tokens parsing' " Yuanhan Liu
                   ` (42 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Harry van Haaren; +Cc: Vipin Varghese, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 0fddb7867cd952540da7a56c23ea7df82dca158a Mon Sep 17 00:00:00 2001
From: Harry van Haaren <harry.van.haaren@intel.com>
Date: Wed, 24 Jan 2018 17:02:47 +0000
Subject: [PATCH] service: fix possible mem leak on initialize

[ upstream commit da9ac508c3b77c83c201dd01d7736ccf139d1767 ]

This commit ensures that if that if we run out of memory
during the initialization of the service library, that the
first allocated memory is correctly freed instead of leaked.

Fixes: 21698354c832 ("service: introduce service cores concept")

Reported-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 lib/librte_eal/common/rte_service.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 9ff4136..1f92294 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -111,14 +111,14 @@ int32_t rte_service_init(void)
 			RTE_CACHE_LINE_SIZE);
 	if (!rte_services) {
 		printf("error allocating rte services array\n");
-		return -ENOMEM;
+		goto fail_mem;
 	}
 
 	lcore_states = rte_calloc("rte_service_core_states", RTE_MAX_LCORE,
 			sizeof(struct core_state), RTE_CACHE_LINE_SIZE);
 	if (!lcore_states) {
 		printf("error allocating core states array\n");
-		return -ENOMEM;
+		goto fail_mem;
 	}
 
 	int i;
@@ -135,6 +135,12 @@ int32_t rte_service_init(void)
 
 	rte_service_library_initialized = 1;
 	return 0;
+fail_mem:
+	if (rte_services)
+		rte_free(rte_services);
+	if (lcore_states)
+		rte_free(lcore_states);
+	return -ENOMEM;
 }
 
 /* returns 1 if service is registered and has not been unregistered
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'cmdline: fix dynamic tokens parsing' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'service: fix possible mem leak on initialize' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'cmdline: avoid garbage in unused fields of parsed result' " Yuanhan Liu
                   ` (41 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Xueming Li; +Cc: Olivier Matz, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From abab0573ee5b94cc97501134d355d3dc6b03f23a Mon Sep 17 00:00:00 2001
From: Xueming Li <xuemingl@mellanox.com>
Date: Sat, 20 Jan 2018 02:16:10 +0800
Subject: [PATCH] cmdline: fix dynamic tokens parsing

[ upstream commit 2acf7432ad3e67f676d7d14a6acc3b90a2d9117e ]

When using dynamic tokens, the result buffer contains pointers to some
location inside the result buffer. When the content of the temporary
buffer is copied in the final one, these pointers still point to the
temporary buffer.

This works until the temporary buffer is kept intact, but the next
commit introduces a memset() that breaks this assumption.

This commit keeps the successfully parsed buffers, and ensures that the
pointers point to the valid location, by using temp buffer for following
parsing.

Fixes: 9b3fbb051d2e ("cmdline: fix parsing")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_cmdline/cmdline_parse.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index 3e12ee5..c74b146 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -263,6 +263,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
 	char debug_buf[BUFSIZ];
 #endif
+	char *result_buf = result.buf;
 
 	if (!cl || !buf)
 		return CMDLINE_PARSE_BAD_ARGS;
@@ -312,16 +313,14 @@ cmdline_parse(struct cmdline *cl, const char * buf)
 		debug_printf("INST %d\n", inst_num);
 
 		/* fully parsed */
-		tok = match_inst(inst, buf, 0, tmp_result.buf,
-				 sizeof(tmp_result.buf));
+		tok = match_inst(inst, buf, 0, result_buf,
+				 CMDLINE_PARSE_RESULT_BUFSIZE);
 
 		if (tok > 0) /* we matched at least one token */
 			err = CMDLINE_PARSE_BAD_ARGS;
 
 		else if (!tok) {
 			debug_printf("INST fully parsed\n");
-			memcpy(&result, &tmp_result,
-			       sizeof(result));
 			/* skip spaces */
 			while (isblank2(*curbuf)) {
 				curbuf++;
@@ -332,6 +331,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)
 				if (!f) {
 					memcpy(&f, &inst->f, sizeof(f));
 					memcpy(&data, &inst->data, sizeof(data));
+					result_buf = tmp_result.buf;
 				}
 				else {
 					/* more than 1 inst matches */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'cmdline: avoid garbage in unused fields of parsed result' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'service: fix possible mem leak on initialize' " Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'cmdline: fix dynamic tokens parsing' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'keepalive: fix state alignment' " Yuanhan Liu
                   ` (40 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Xueming Li; +Cc: Olivier Matz, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 32f343066718228b41ba38eb7d11c5eb81f19aab Mon Sep 17 00:00:00 2001
From: Xueming Li <xuemingl@mellanox.com>
Date: Sat, 20 Jan 2018 11:26:31 +0800
Subject: [PATCH] cmdline: avoid garbage in unused fields of parsed result

[ upstream commit 0bf876008f4e51d8c006a3adb3866f0c35c33fbb ]

The result buffer was not initialized before parsing, inducing garbage
in unused fields or padding of the parsed structure.

Initialize the result buffer each time before parsing.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_cmdline/cmdline_parse.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index c74b146..7f799f9 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -168,6 +168,8 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,
 	int n = 0;
 	struct cmdline_token_hdr token_hdr;
 
+	if (resbuf != NULL)
+		memset(resbuf, 0, resbuf_size);
 	/* check if we match all tokens of inst */
 	while (!nb_match_token || i < nb_match_token) {
 		token_p = get_token(inst, i);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'keepalive: fix state alignment' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (2 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'cmdline: avoid garbage in unused fields of parsed result' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'log: fix memory leak in regexp level set' " Yuanhan Liu
                   ` (39 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Andriy Berestovskyy; +Cc: Remy Horton, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 0197da770df2a30d6753634f00db8b39132a64ae Mon Sep 17 00:00:00 2001
From: Andriy Berestovskyy <aber@semihalf.com>
Date: Tue, 23 Jan 2018 16:43:16 +0100
Subject: [PATCH] keepalive: fix state alignment

[ upstream commit 462d9189374f582166ff77b8c301b89947d016cc ]

The __rte_cache_aligned was applied to the whole array,
not the array elements. This leads to a false sharing between
the monitored cores.

Fixes: e70a61ad50ab ("keepalive: export states")

Signed-off-by: Andriy Berestovskyy <aber@semihalf.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
 doc/guides/sample_app_ug/keep_alive.rst |  2 +-
 lib/librte_eal/common/rte_keepalive.c   | 28 ++++++++++++++++++----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/doc/guides/sample_app_ug/keep_alive.rst b/doc/guides/sample_app_ug/keep_alive.rst
index 9b8be48..6c131a8 100644
--- a/doc/guides/sample_app_ug/keep_alive.rst
+++ b/doc/guides/sample_app_ug/keep_alive.rst
@@ -168,5 +168,5 @@ The rte_keepalive_mark_alive function simply sets the core state to alive.
     static inline void
     rte_keepalive_mark_alive(struct rte_keepalive *keepcfg)
     {
-        keepcfg->state_flags[rte_lcore_id()] = ALIVE;
+        keepcfg->live_data[rte_lcore_id()].core_state = RTE_KA_STATE_ALIVE;
     }
diff --git a/lib/librte_eal/common/rte_keepalive.c b/lib/librte_eal/common/rte_keepalive.c
index cdd6956..0c7ecba 100644
--- a/lib/librte_eal/common/rte_keepalive.c
+++ b/lib/librte_eal/common/rte_keepalive.c
@@ -41,8 +41,12 @@
 
 struct rte_keepalive {
 	/** Core Liveness. */
-	enum rte_keepalive_state __rte_cache_aligned state_flags[
-		RTE_KEEPALIVE_MAXCORES];
+	struct {
+		/*
+		 * Each element must be cache aligned to prevent false sharing.
+		 */
+		enum rte_keepalive_state core_state __rte_cache_aligned;
+	} live_data[RTE_KEEPALIVE_MAXCORES];
 
 	/** Last-seen-alive timestamps */
 	uint64_t last_alive[RTE_KEEPALIVE_MAXCORES];
@@ -95,19 +99,22 @@ rte_keepalive_dispatch_pings(__rte_unused void *ptr_timer,
 		if (keepcfg->active_cores[idx_core] == 0)
 			continue;
 
-		switch (keepcfg->state_flags[idx_core]) {
+		switch (keepcfg->live_data[idx_core].core_state) {
 		case RTE_KA_STATE_UNUSED:
 			break;
 		case RTE_KA_STATE_ALIVE: /* Alive */
-			keepcfg->state_flags[idx_core] = RTE_KA_STATE_MISSING;
+			keepcfg->live_data[idx_core].core_state =
+			    RTE_KA_STATE_MISSING;
 			keepcfg->last_alive[idx_core] = rte_rdtsc();
 			break;
 		case RTE_KA_STATE_MISSING: /* MIA */
 			print_trace("Core MIA. ", keepcfg, idx_core);
-			keepcfg->state_flags[idx_core] = RTE_KA_STATE_DEAD;
+			keepcfg->live_data[idx_core].core_state =
+			    RTE_KA_STATE_DEAD;
 			break;
 		case RTE_KA_STATE_DEAD: /* Dead */
-			keepcfg->state_flags[idx_core] = RTE_KA_STATE_GONE;
+			keepcfg->live_data[idx_core].core_state =
+			    RTE_KA_STATE_GONE;
 			print_trace("Core died. ", keepcfg, idx_core);
 			if (keepcfg->callback)
 				keepcfg->callback(
@@ -118,7 +125,8 @@ rte_keepalive_dispatch_pings(__rte_unused void *ptr_timer,
 		case RTE_KA_STATE_GONE: /* Buried */
 			break;
 		case RTE_KA_STATE_DOZING: /* Core going idle */
-			keepcfg->state_flags[idx_core] = RTE_KA_STATE_SLEEP;
+			keepcfg->live_data[idx_core].core_state =
+			    RTE_KA_STATE_SLEEP;
 			keepcfg->last_alive[idx_core] = rte_rdtsc();
 			break;
 		case RTE_KA_STATE_SLEEP: /* Idled core */
@@ -128,7 +136,7 @@ rte_keepalive_dispatch_pings(__rte_unused void *ptr_timer,
 			keepcfg->relay_callback(
 				keepcfg->relay_callback_data,
 				idx_core,
-				keepcfg->state_flags[idx_core],
+				keepcfg->live_data[idx_core].core_state,
 				keepcfg->last_alive[idx_core]
 				);
 	}
@@ -172,11 +180,11 @@ rte_keepalive_register_core(struct rte_keepalive *keepcfg, const int id_core)
 void
 rte_keepalive_mark_alive(struct rte_keepalive *keepcfg)
 {
-	keepcfg->state_flags[rte_lcore_id()] = RTE_KA_STATE_ALIVE;
+	keepcfg->live_data[rte_lcore_id()].core_state = RTE_KA_STATE_ALIVE;
 }
 
 void
 rte_keepalive_mark_sleep(struct rte_keepalive *keepcfg)
 {
-	keepcfg->state_flags[rte_lcore_id()] = RTE_KA_STATE_DOZING;
+	keepcfg->live_data[rte_lcore_id()].core_state = RTE_KA_STATE_DOZING;
 }
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'log: fix memory leak in regexp level set' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (3 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'keepalive: fix state alignment' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'eal/arm64: remove the braces in memory barrier macros' " Yuanhan Liu
                   ` (38 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Ivan Malov; +Cc: Andrew Rybchenko, Ferruh Yigit, Olivier Matz, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 7b1dff51501017d9baacc674cd9cb68313938db8 Mon Sep 17 00:00:00 2001
From: Ivan Malov <ivan.malov@oktetlabs.ru>
Date: Sun, 21 Jan 2018 17:05:10 +0000
Subject: [PATCH] log: fix memory leak in regexp level set

[ upstream commit 01aa0d95c82163e72e69ac90b3c8cfa15728ce61 ]

Fixes: a5279180f510 ("eal: change several log levels matching a regexp")

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_eal/common/eal_common_log.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index e894b75..4b2409a 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -139,6 +139,8 @@ rte_log_set_level_regexp(const char *pattern, uint32_t level)
 			rte_logs.dynamic_types[i].loglevel = level;
 	}
 
+	regfree(&r);
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'eal/arm64: remove the braces in memory barrier macros' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (4 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'log: fix memory leak in regexp level set' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'mbuf: fix NULL freeing when debug enabled' " Yuanhan Liu
                   ` (37 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Jia He; +Cc: Jerin Jacob, Hemant Agrawal, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 6b297ebc966e73844b93887dc0f725047ac2036d Mon Sep 17 00:00:00 2001
From: Jia He <jia.he@hxt-semitech.com>
Date: Sun, 21 Jan 2018 20:41:26 -0800
Subject: [PATCH] eal/arm64: remove the braces in memory barrier macros

[ upstream commit 59a3cae5305816b3739b4197d277f9455af53b9f ]

for the code as follows:
if (condition)
	rte_smp_rmb();
else
	rte_smp_wmb();
Without this patch, compiler will report this error:
error: 'else' without a previous 'if'

Fixes: 84733fd0d75e ("eal/arm64: fix memory barrier definition")

Signed-off-by: Jia He <jia.he@hxt-semitech.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/common/include/arch/arm/rte_atomic_64.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
index 0b70d62..71da29c 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
@@ -43,8 +43,8 @@ extern "C" {
 
 #include "generic/rte_atomic.h"
 
-#define dsb(opt)  { asm volatile("dsb " #opt : : : "memory"); }
-#define dmb(opt)  { asm volatile("dmb " #opt : : : "memory"); }
+#define dsb(opt) asm volatile("dsb " #opt : : : "memory")
+#define dmb(opt) asm volatile("dmb " #opt : : : "memory")
 
 #define rte_mb() dsb(sy)
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'mbuf: fix NULL freeing when debug enabled' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (5 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'eal/arm64: remove the braces in memory barrier macros' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix out-of-bounds access' " Yuanhan Liu
                   ` (36 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Keith Wiles, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 09c8e4abb5d7f95bf4b5bfde19d34e8f067134a7 Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz@6wind.com>
Date: Mon, 29 Jan 2018 10:39:23 +0100
Subject: [PATCH] mbuf: fix NULL freeing when debug enabled

[ upstream commit 9f8d9b2ee358c496fe206d1e6f111067afd501b3 ]

Do not panic when calling rte_pktmbuf_free(NULL) with mbuf debug
enabled, it is a valid operation.

Fixes: af75078fece3 ("first public release")

Reported-by: Keith Wiles <keith.wiles@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_mbuf/rte_mbuf.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index bf85124..16a6048 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1427,13 +1427,14 @@ rte_pktmbuf_free_seg(struct rte_mbuf *m)
  * segment is added back into its original mempool.
  *
  * @param m
- *   The packet mbuf to be freed.
+ *   The packet mbuf to be freed. If NULL, the function does nothing.
  */
 static inline void rte_pktmbuf_free(struct rte_mbuf *m)
 {
 	struct rte_mbuf *m_next;
 
-	__rte_mbuf_sanity_check(m, 1);
+	if (m != NULL)
+		__rte_mbuf_sanity_check(m, 1);
 
 	while (m != NULL) {
 		m_next = m->next;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'crypto/qat: fix out-of-bounds access' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (6 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'mbuf: fix NULL freeing when debug enabled' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix parameter type' " Yuanhan Liu
                   ` (35 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Tomasz Jozwiak; +Cc: Fiona Trahe, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 5e78a44894532a96dd0ba0a428547bdf2ac476d9 Mon Sep 17 00:00:00 2001
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Date: Mon, 22 Jan 2018 17:28:03 +0100
Subject: [PATCH] crypto/qat: fix out-of-bounds access

[ upstream commit 8aa8ee9d2d87ba1a0560cfdbe936c3fd7c5dc12b ]

This commit fixes
  - bpi_cipher_encrypt to prevent before 'array subscript is
    above array bounds' error
  - bpi_cipher_decrypt to prevent before 'array subscript is
    above array bounds' error

Fixes: d18ab45f7654 ("crypto/qat: support DOCSIS BPI mode")

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/qat_crypto.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index a572967..f85c2c8 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -69,6 +69,10 @@
 #include "adf_transport_access_macros.h"
 
 #define BYTE_LENGTH    8
+/* bpi is only used for partial blocks of DES and AES
+ * so AES block len can be assumed as max len for iv, src and dst
+ */
+#define BPI_MAX_ENCR_IV_LEN ICP_QAT_HW_AES_BLK_SZ
 
 static int
 qat_is_cipher_alg_supported(enum rte_crypto_cipher_algorithm algo,
@@ -121,16 +125,16 @@ bpi_cipher_encrypt(uint8_t *src, uint8_t *dst,
 {
 	EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
 	int encrypted_ivlen;
-	uint8_t encrypted_iv[16];
-	int i;
+	uint8_t encrypted_iv[BPI_MAX_ENCR_IV_LEN];
+	uint8_t *encr = encrypted_iv;
 
 	/* ECB method: encrypt the IV, then XOR this with plaintext */
 	if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
 								<= 0)
 		goto cipher_encrypt_err;
 
-	for (i = 0; i < srclen; i++)
-		*(dst+i) = *(src+i)^(encrypted_iv[i]);
+	for (; srclen != 0; --srclen, ++dst, ++src, ++encr)
+		*dst = *src ^ *encr;
 
 	return 0;
 
@@ -150,16 +154,16 @@ bpi_cipher_decrypt(uint8_t *src, uint8_t *dst,
 {
 	EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
 	int encrypted_ivlen;
-	uint8_t encrypted_iv[16];
-	int i;
+	uint8_t encrypted_iv[BPI_MAX_ENCR_IV_LEN];
+	uint8_t *encr = encrypted_iv;
 
 	/* ECB method: encrypt (not decrypt!) the IV, then XOR with plaintext */
 	if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
 								<= 0)
 		goto cipher_decrypt_err;
 
-	for (i = 0; i < srclen; i++)
-		*(dst+i) = *(src+i)^(encrypted_iv[i]);
+	for (; srclen != 0; --srclen, ++dst, ++src, ++encr)
+		*dst = *src ^ *encr;
 
 	return 0;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'crypto/qat: fix parameter type' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (7 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix out-of-bounds access' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'cryptodev: fix session pointer cast' " Yuanhan Liu
                   ` (34 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Tomasz Jozwiak; +Cc: Fiona Trahe, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 5be0172eff06705dfd41e9e5d5bbaba0debe660a Mon Sep 17 00:00:00 2001
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Date: Mon, 22 Jan 2018 17:28:05 +0100
Subject: [PATCH] crypto/qat: fix parameter type

[ upstream commit c202320775bb8094c41eaaff562a38cd6d7bce70 ]

This commit fixes right cast from qat_cipher_get_block_size
function. This function can return -EFAULT in case of
any error, and that value must be cast to int instead of uint8_t

Fixes: d18ab45f7654 ("crypto/qat: support DOCSIS BPI mode")

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/qat_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index f85c2c8..8629595 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -848,7 +848,7 @@ static inline uint32_t
 qat_bpicipher_preprocess(struct qat_session *ctx,
 				struct rte_crypto_op *op)
 {
-	uint8_t block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
+	int block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	uint8_t last_block_len = block_len > 0 ?
 			sym_op->cipher.data.length % block_len : 0;
@@ -903,7 +903,7 @@ static inline uint32_t
 qat_bpicipher_postprocess(struct qat_session *ctx,
 				struct rte_crypto_op *op)
 {
-	uint8_t block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
+	int block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	uint8_t last_block_len = block_len > 0 ?
 			sym_op->cipher.data.length % block_len : 0;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'cryptodev: fix session pointer cast' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (8 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix parameter type' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix null auth algo overwrite' " Yuanhan Liu
                   ` (33 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Zhiyong Yang; +Cc: Akhil Goyal, Pablo de Lara, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 8828baa809878cee37b45db17457bbf1c673874d Mon Sep 17 00:00:00 2001
From: Zhiyong Yang <zhiyong.yang@intel.com>
Date: Tue, 23 Jan 2018 17:48:13 +0800
Subject: [PATCH] cryptodev: fix session pointer cast

[ upstream commit 513942f07c8e6d55fe109732b68d79056f4e885c ]

The wrong casts don't cause actual error, but they should conform to C
standard.

Fixes: c261d1431bd8 ("security: introduce security API and framework")
Fixes: b3bbd9e5f265 ("cryptodev: support device independent sessions")

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 2 +-
 lib/librte_security/rte_security.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index fb9c0d4..9fe0d9d 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1122,7 +1122,7 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 	struct rte_cryptodev_sym_session *sess;
 
 	/* Allocate a session structure from the session pool */
-	if (rte_mempool_get(mp, (void *)&sess)) {
+	if (rte_mempool_get(mp, (void **)&sess)) {
 		CDEV_LOG_ERR("couldn't get object from session mempool");
 		return NULL;
 	}
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index 1227fca..685729f 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -49,7 +49,7 @@ rte_security_session_create(struct rte_security_ctx *instance,
 
 	RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->session_create, NULL);
 
-	if (rte_mempool_get(mp, (void *)&sess))
+	if (rte_mempool_get(mp, (void **)&sess))
 		return NULL;
 
 	if (instance->ops->session_create(instance->device, conf, sess, mp)) {
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'crypto/qat: fix null auth algo overwrite' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (9 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'cryptodev: fix session pointer cast' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix return value of start operation' " Yuanhan Liu
                   ` (32 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Fiona Trahe; +Cc: Radu Nicolau, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From a50d7a400b50f569b08295cd4eece503502aab94 Mon Sep 17 00:00:00 2001
From: Fiona Trahe <fiona.trahe@intel.com>
Date: Thu, 25 Jan 2018 17:19:14 +0000
Subject: [PATCH] crypto/qat: fix null auth algo overwrite

[ upstream commit 4e0955bddb0880949fb12de3a1a8f07eb9ace832 ]

If auth algorithm is RTE_CRYPTO_AUTH_NULL and digest_length is 0
in the xform and digest pointer is set in the op, then
the PMD may overwrite memory at the digest pointer.
With this patch the memory is not overwritten.

Fixes: db0e952a5c01 ("crypto/qat: add NULL capability")

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/crypto/qat/qat_crypto.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 8629595..acd979d 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -1371,7 +1371,9 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
 		}
 		min_ofs = auth_ofs;
 
-		auth_param->auth_res_addr = op->sym->auth.digest.phys_addr;
+		if (likely(ctx->qat_hash_alg != ICP_QAT_HW_AUTH_ALGO_NULL))
+			auth_param->auth_res_addr =
+					op->sym->auth.digest.phys_addr;
 
 	}
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix return value of start operation' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (10 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix null auth algo overwrite' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/enic: fix crash due to static max number of queues' " Yuanhan Liu
                   ` (31 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Nelio Laranjeiro, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 961c2a9546f971d394b1dd2dcde7dae55ed2f777 Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz@6wind.com>
Date: Mon, 22 Jan 2018 13:33:37 +0100
Subject: [PATCH] net/mlx5: fix return value of start operation

[ upstream commit 80554894c4618f6f3bd202565bc881215d99dde6 ]

On error, mlx5_dev_start() does not return a negative value
as it is supposed to do. The consequence is that the application
(ex: testpmd) does not notice that the port is not started
and begins the rxtx on an uninitialized port, which crashes.

Fixes: e1016cb73383 ("net/mlx5: fix Rx interrupts management")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 3540b5d..39c5ec5 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -199,7 +199,7 @@ error:
 	priv_rxq_stop(priv);
 	priv_flow_delete_drop_queue(priv);
 	priv_unlock(priv);
-	return -err;
+	return err;
 }
 
 /**
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/enic: fix crash due to static max number of queues' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (11 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix return value of start operation' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/e1000: fix null pointer check' " Yuanhan Liu
                   ` (30 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Hyong Youb Kim; +Cc: John Daley, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From acc4c80cf3b5fb3c0f87bcb7c4eb68958f60ef15 Mon Sep 17 00:00:00 2001
From: Hyong Youb Kim <hyonkim@cisco.com>
Date: Mon, 22 Jan 2018 17:05:28 -0800
Subject: [PATCH] net/enic: fix crash due to static max number of queues

[ upstream commit 6c45c330589d334c4f7b729e61ae30a6acfcc119 ]

ENIC_CQ_MAX, ENIC_WQ_MAX and others are arbitrary values that
prevent the app from using more queues when they are available on
hardware. Remove them and dynamically allocate vnic_cq and such
arrays to accommodate all available hardware queues.

As a side effect of removing ENIC_CQ_MAX, this commit fixes a segfault
that would happen when the app requests more than 16 CQs, because
enic_set_vnic_res() does not consider ENIC_CQ_MAX. For example, the
following command causes a crash.

testpmd -- --rxq=16 --txq=16

Fixes: ce93d3c36db0 ("net/enic: fix resource check failures when bonding devices")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic.h        | 25 +++++++++---------------
 drivers/net/enic/enic_ethdev.c | 20 ++------------------
 drivers/net/enic/enic_main.c   | 43 ++++++++++++++++++++++++++++++++----------
 3 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index e36ec38..a43fddc 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -53,13 +53,6 @@
 #define DRV_DESCRIPTION		"Cisco VIC Ethernet NIC Poll-mode Driver"
 #define DRV_COPYRIGHT		"Copyright 2008-2015 Cisco Systems, Inc"
 
-#define ENIC_WQ_MAX		8
-/* With Rx scatter support, we use two RQs on VIC per RQ used by app. Both
- * RQs use the same CQ.
- */
-#define ENIC_RQ_MAX		16
-#define ENIC_CQ_MAX		(ENIC_WQ_MAX + (ENIC_RQ_MAX / 2))
-#define ENIC_INTR_MAX		(ENIC_CQ_MAX + 2)
 #define ENIC_MAX_MAC_ADDR	64
 
 #define VLAN_ETH_HLEN           18
@@ -150,17 +143,17 @@ struct enic {
 	unsigned int flags;
 	unsigned int priv_flags;
 
-	/* work queue */
-	struct vnic_wq wq[ENIC_WQ_MAX];
-	unsigned int wq_count;
+	/* work queue (len = conf_wq_count) */
+	struct vnic_wq *wq;
+	unsigned int wq_count; /* equals eth_dev nb_tx_queues */
 
-	/* receive queue */
-	struct vnic_rq rq[ENIC_RQ_MAX];
-	unsigned int rq_count;
+	/* receive queue (len = conf_rq_count) */
+	struct vnic_rq *rq;
+	unsigned int rq_count; /* equals eth_dev nb_rx_queues */
 
-	/* completion queue */
-	struct vnic_cq cq[ENIC_CQ_MAX];
-	unsigned int cq_count;
+	/* completion queue (len = conf_cq_count) */
+	struct vnic_cq *cq;
+	unsigned int cq_count; /* equals rq_count + wq_count */
 
 	/* interrupt resource */
 	struct vnic_intr intr;
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 669dbf3..98391b0 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -205,13 +205,7 @@ static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
 		return -E_RTE_SECONDARY;
 
 	ENICPMD_FUNC_TRACE();
-	if (queue_idx >= ENIC_WQ_MAX) {
-		dev_err(enic,
-			"Max number of TX queues exceeded.  Max is %d\n",
-			ENIC_WQ_MAX);
-		return -EINVAL;
-	}
-
+	RTE_ASSERT(queue_idx < enic->conf_wq_count);
 	eth_dev->data->tx_queues[queue_idx] = (void *)&enic->wq[queue_idx];
 
 	ret = enic_alloc_wq(enic, queue_idx, socket_id, nb_desc);
@@ -325,17 +319,7 @@ static int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -E_RTE_SECONDARY;
-
-	/* With Rx scatter support, two RQs are now used on VIC per RQ used
-	 * by the application.
-	 */
-	if (queue_idx * 2 >= ENIC_RQ_MAX) {
-		dev_err(enic,
-			"Max number of RX queues exceeded.  Max is %d. This PMD uses 2 RQs on VIC per RQ used by DPDK.\n",
-			ENIC_RQ_MAX);
-		return -EINVAL;
-	}
-
+	RTE_ASSERT(enic_rte_rq_idx_to_sop_idx(queue_idx) < enic->conf_rq_count);
 	eth_dev->data->rx_queues[queue_idx] =
 		(void *)&enic->rq[enic_rte_rq_idx_to_sop_idx(queue_idx)];
 
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 8af0ccd..1694aed 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1075,6 +1075,9 @@ static void enic_dev_deinit(struct enic *enic)
 	vnic_dev_notify_unset(enic->vdev);
 
 	rte_free(eth_dev->data->mac_addrs);
+	rte_free(enic->cq);
+	rte_free(enic->rq);
+	rte_free(enic->wq);
 }
 
 
@@ -1082,27 +1085,28 @@ int enic_set_vnic_res(struct enic *enic)
 {
 	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	int rc = 0;
+	unsigned int required_rq, required_wq, required_cq;
 
-	/* With Rx scatter support, two RQs are now used per RQ used by
-	 * the application.
-	 */
-	if (enic->conf_rq_count < eth_dev->data->nb_rx_queues) {
+	/* Always use two vNIC RQs per eth_dev RQ, regardless of Rx scatter. */
+	required_rq = eth_dev->data->nb_rx_queues * 2;
+	required_wq = eth_dev->data->nb_tx_queues;
+	required_cq = eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues;
+
+	if (enic->conf_rq_count < required_rq) {
 		dev_err(dev, "Not enough Receive queues. Requested:%u which uses %d RQs on VIC, Configured:%u\n",
 			eth_dev->data->nb_rx_queues,
-			eth_dev->data->nb_rx_queues * 2, enic->conf_rq_count);
+			required_rq, enic->conf_rq_count);
 		rc = -EINVAL;
 	}
-	if (enic->conf_wq_count < eth_dev->data->nb_tx_queues) {
+	if (enic->conf_wq_count < required_wq) {
 		dev_err(dev, "Not enough Transmit queues. Requested:%u, Configured:%u\n",
 			eth_dev->data->nb_tx_queues, enic->conf_wq_count);
 		rc = -EINVAL;
 	}
 
-	if (enic->conf_cq_count < (eth_dev->data->nb_rx_queues +
-				   eth_dev->data->nb_tx_queues)) {
+	if (enic->conf_cq_count < required_cq) {
 		dev_err(dev, "Not enough Completion queues. Required:%u, Configured:%u\n",
-			(eth_dev->data->nb_rx_queues +
-			 eth_dev->data->nb_tx_queues), enic->conf_cq_count);
+			required_cq, enic->conf_cq_count);
 		rc = -EINVAL;
 	}
 
@@ -1307,6 +1311,25 @@ static int enic_dev_init(struct enic *enic)
 		dev_err(enic, "See the ENIC PMD guide for more information.\n");
 		return -EINVAL;
 	}
+	/* Queue counts may be zeros. rte_zmalloc returns NULL in that case. */
+	enic->cq = rte_zmalloc("enic_vnic_cq", sizeof(struct vnic_cq) *
+			       enic->conf_cq_count, 8);
+	enic->rq = rte_zmalloc("enic_vnic_rq", sizeof(struct vnic_rq) *
+			       enic->conf_rq_count, 8);
+	enic->wq = rte_zmalloc("enic_vnic_wq", sizeof(struct vnic_wq) *
+			       enic->conf_wq_count, 8);
+	if (enic->conf_cq_count > 0 && enic->cq == NULL) {
+		dev_err(enic, "failed to allocate vnic_cq, aborting.\n");
+		return -1;
+	}
+	if (enic->conf_rq_count > 0 && enic->rq == NULL) {
+		dev_err(enic, "failed to allocate vnic_rq, aborting.\n");
+		return -1;
+	}
+	if (enic->conf_wq_count > 0 && enic->wq == NULL) {
+		dev_err(enic, "failed to allocate vnic_wq, aborting.\n");
+		return -1;
+	}
 
 	/* Get the supported filters */
 	enic_fdir_info(enic);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/e1000: fix null pointer check' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (12 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/enic: fix crash due to static max number of queues' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/i40e: fix memory leak' " Yuanhan Liu
                   ` (29 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Yong Wang; +Cc: Wenzhuo Lu, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 76f8876e860971cbfd1792fd79e388bcde7f265a Mon Sep 17 00:00:00 2001
From: Yong Wang <wang.yong19@zte.com.cn>
Date: Thu, 25 Jan 2018 02:43:04 -0500
Subject: [PATCH] net/e1000: fix null pointer check

[ upstream commit 516e525ebfcf9875c86eb5ce88a536470e279739 ]

There are several func calls to rte_zmalloc() which don't have null
pointer check for the return value. It fixes that by adding null
pointer check.

Fixes: 22bb13410cb2 ("net/igb: create consistent filter")

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/e1000/igb_flow.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index 22bad26..057579b 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -1345,6 +1345,11 @@ igb_flow_create(struct rte_eth_dev *dev,
 		if (!ret) {
 			ntuple_filter_ptr = rte_zmalloc("igb_ntuple_filter",
 				sizeof(struct igb_ntuple_filter_ele), 0);
+			if (!ntuple_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&ntuple_filter_ptr->filter_info,
 				&ntuple_filter,
 				sizeof(struct rte_eth_ntuple_filter));
@@ -1367,6 +1372,11 @@ igb_flow_create(struct rte_eth_dev *dev,
 			ethertype_filter_ptr = rte_zmalloc(
 				"igb_ethertype_filter",
 				sizeof(struct igb_ethertype_filter_ele), 0);
+			if (!ethertype_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&ethertype_filter_ptr->filter_info,
 				&ethertype_filter,
 				sizeof(struct rte_eth_ethertype_filter));
@@ -1387,6 +1397,11 @@ igb_flow_create(struct rte_eth_dev *dev,
 		if (!ret) {
 			syn_filter_ptr = rte_zmalloc("igb_syn_filter",
 				sizeof(struct igb_eth_syn_filter_ele), 0);
+			if (!syn_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&syn_filter_ptr->filter_info,
 				&syn_filter,
 				sizeof(struct rte_eth_syn_filter));
@@ -1408,6 +1423,11 @@ igb_flow_create(struct rte_eth_dev *dev,
 		if (!ret) {
 			flex_filter_ptr = rte_zmalloc("igb_flex_filter",
 				sizeof(struct igb_flex_filter_ele), 0);
+			if (!flex_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&flex_filter_ptr->filter_info,
 				&flex_filter,
 				sizeof(struct rte_eth_flex_filter));
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix memory leak' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (13 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/e1000: fix null pointer check' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix missing RSS capability' " Yuanhan Liu
                   ` (28 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Yong Wang; +Cc: Beilei Xing, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From b520dc48a6942978d6b0b71ffc4952e97d7588ed Mon Sep 17 00:00:00 2001
From: Yong Wang <wang.yong19@zte.com.cn>
Date: Thu, 25 Jan 2018 04:01:04 -0500
Subject: [PATCH] net/i40e: fix memory leak

[ upstream commit b4502b43f08968e8b996ba56c09dd3856c844553 ]

There are several func calls to rte_zmalloc() which don't have null
pointer check on the return value. And before return, the memory
is not freed. It fixes by adding null pointer check and rte_free().

Fixes: 078259773da9 ("net/i40e: store ethertype filter")
Fixes: 425c3325f0b0 ("net/i40e: store tunnel filter")
Fixes: c50474f31efe ("net/i40e: support tunnel filter to VF")
Fixes: 5c53c82c8174 ("net/i40e: store flow director filter")

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 32 ++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_fdir.c   |  7 +++++++
 2 files changed, 39 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 87c0cfe..5f2c504 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7087,11 +7087,13 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 	node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &check_filter.input);
 	if (add && node) {
 		PMD_DRV_LOG(ERR, "Conflict with existing tunnel rules!");
+		rte_free(cld_filter);
 		return -EINVAL;
 	}
 
 	if (!add && !node) {
 		PMD_DRV_LOG(ERR, "There's no corresponding tunnel filter!");
+		rte_free(cld_filter);
 		return -EINVAL;
 	}
 
@@ -7100,16 +7102,26 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 					vsi->seid, &cld_filter->element, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "Failed to add a tunnel filter.");
+			rte_free(cld_filter);
 			return -ENOTSUP;
 		}
 		tunnel = rte_zmalloc("tunnel_filter", sizeof(*tunnel), 0);
+		if (tunnel == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+			rte_free(cld_filter);
+			return -ENOMEM;
+		}
+
 		rte_memcpy(tunnel, &check_filter, sizeof(check_filter));
 		ret = i40e_sw_tunnel_filter_insert(pf, tunnel);
+		if (ret < 0)
+			rte_free(tunnel);
 	} else {
 		ret = i40e_aq_remove_cloud_filters(hw, vsi->seid,
 						   &cld_filter->element, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "Failed to delete a tunnel filter.");
+			rte_free(cld_filter);
 			return -ENOTSUP;
 		}
 		ret = i40e_sw_tunnel_filter_del(pf, &node->input);
@@ -7538,6 +7550,7 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 	else {
 		if (tunnel_filter->vf_id >= pf->vf_num) {
 			PMD_DRV_LOG(ERR, "Invalid argument.");
+			rte_free(cld_filter);
 			return -EINVAL;
 		}
 		vf = &pf->vfs[tunnel_filter->vf_id];
@@ -7552,11 +7565,13 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 	node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &check_filter.input);
 	if (add && node) {
 		PMD_DRV_LOG(ERR, "Conflict with existing tunnel rules!");
+		rte_free(cld_filter);
 		return -EINVAL;
 	}
 
 	if (!add && !node) {
 		PMD_DRV_LOG(ERR, "There's no corresponding tunnel filter!");
+		rte_free(cld_filter);
 		return -EINVAL;
 	}
 
@@ -7569,11 +7584,20 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 					vsi->seid, &cld_filter->element, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "Failed to add a tunnel filter.");
+			rte_free(cld_filter);
 			return -ENOTSUP;
 		}
 		tunnel = rte_zmalloc("tunnel_filter", sizeof(*tunnel), 0);
+		if (tunnel == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+			rte_free(cld_filter);
+			return -ENOMEM;
+		}
+
 		rte_memcpy(tunnel, &check_filter, sizeof(check_filter));
 		ret = i40e_sw_tunnel_filter_insert(pf, tunnel);
+		if (ret < 0)
+			rte_free(tunnel);
 	} else {
 		if (big_buffer)
 			ret = i40e_aq_remove_cloud_filters_big_buffer(
@@ -7583,6 +7607,7 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 						   &cld_filter->element, 1);
 		if (ret < 0) {
 			PMD_DRV_LOG(ERR, "Failed to delete a tunnel filter.");
+			rte_free(cld_filter);
 			return -ENOTSUP;
 		}
 		ret = i40e_sw_tunnel_filter_del(pf, &node->input);
@@ -9194,9 +9219,16 @@ i40e_ethertype_filter_set(struct i40e_pf *pf,
 	if (add) {
 		ethertype_filter = rte_zmalloc("ethertype_filter",
 				       sizeof(*ethertype_filter), 0);
+		if (ethertype_filter == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+			return -ENOMEM;
+		}
+
 		rte_memcpy(ethertype_filter, &check_filter,
 			   sizeof(check_filter));
 		ret = i40e_sw_ethertype_filter_insert(pf, ethertype_filter);
+		if (ret < 0)
+			rte_free(ethertype_filter);
 	} else {
 		ret = i40e_sw_ethertype_filter_del(pf, &node->input);
 	}
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 525611a..bf94723 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1616,8 +1616,15 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
 	if (add) {
 		fdir_filter = rte_zmalloc("fdir_filter",
 					  sizeof(*fdir_filter), 0);
+		if (fdir_filter == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+			return -ENOMEM;
+		}
+
 		rte_memcpy(fdir_filter, &check_filter, sizeof(check_filter));
 		ret = i40e_sw_fdir_filter_insert(pf, fdir_filter);
+		if (ret < 0)
+			rte_free(fdir_filter);
 	} else {
 		ret = i40e_sw_fdir_filter_del(pf, &node->fdir.input);
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix missing RSS capability' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (14 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/i40e: fix memory leak' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix flow item validation' " Yuanhan Liu
                   ` (27 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: Yongseok Koh, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 146815427adc7fd8c78085fb2d2bc96d977cd6f3 Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Mon, 22 Jan 2018 22:52:14 +0200
Subject: [PATCH] net/mlx5: fix missing RSS capability

[ upstream commit b233b027490b858f740a75fac19632a25d3aefdd ]

The PMD was not reporting the supported RSS capabilities.

Fixes: 2f97422e7759 ("mlx5: support RSS hash update and get")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index ce0d769..e91c0f6 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -720,6 +720,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
 		priv->reta_idx_n : priv->ind_table_max_size;
 	info->hash_key_size = priv->rss_conf.rss_key_len;
 	info->speed_capa = priv->link_speed_capa;
+	info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK;
 	priv_unlock(priv);
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix flow item validation' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (15 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix missing RSS capability' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region cache lookup' " Yuanhan Liu
                   ` (26 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Nélio Laranjeiro; +Cc: Yongseok Koh, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From e93a85e46ec0bf92e5f3abcaff7c9e192d7f2d98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?N=C3=A9lio=20Laranjeiro?= <nelio.laranjeiro@6wind.com>
Date: Tue, 23 Jan 2018 09:05:09 +0100
Subject: [PATCH] net/mlx5: fix flow item validation

[ upstream commit 537e168450ce5e191c8d3ee89fa7fa9901e8e27f ]

Two masks were compared instead of verifying the spec was included in the
supported mask.

Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 00f4bec..d49aed8 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -539,7 +539,7 @@ mlx5_flow_item_validate(const struct rte_flow_item *item,
 	}
 	if (item->mask) {
 		unsigned int i;
-		const uint8_t *spec = item->mask;
+		const uint8_t *spec = item->spec;
 
 		for (i = 0; i < size; ++i)
 			if ((spec[i] | mask[i]) != mask[i])
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix memory region cache lookup' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (16 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix flow item validation' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region cache last index' " Yuanhan Liu
                   ` (25 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: Xueming Li, Nelio Laranjeiro, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From d4192ea73b94736c8095e6b7b7a7a1bf4fc58eaf Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Thu, 25 Jan 2018 18:17:58 +0200
Subject: [PATCH] net/mlx5: fix memory region cache lookup

[ upstream commit 95086c654322861a10f9835233a333d7c2188df3 ]

The Memory Region (MR) cache contains pointers to mlx5_mr.
The MR cache indexes are filled when a new MR is created. As it is
possible for MR to be created on the flight, an extra validation must be
added to avoid segmentation fault.

Fixes: b0b093845793 ("net/mlx5: use buffer address for LKEY search")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 05aec29..ab71a68 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -550,7 +550,8 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 	if (likely(txq->mp2mr[i]->start <= addr && txq->mp2mr[i]->end >= addr))
 		return txq->mp2mr[i]->lkey;
 	for (i = 0; (i != RTE_DIM(txq->mp2mr)); ++i) {
-		if (unlikely(txq->mp2mr[i]->mr == NULL)) {
+		if (unlikely(txq->mp2mr[i] == NULL ||
+		    txq->mp2mr[i]->mr == NULL)) {
 			/* Unknown MP, add a new MR for it. */
 			break;
 		}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix memory region cache last index' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (17 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region cache lookup' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region boundary checks' " Yuanhan Liu
                   ` (24 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: Xueming Li, Nelio Laranjeiro, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 1eee333eaa818ccd1721064a8628dadbf360306e Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Thu, 25 Jan 2018 18:18:02 +0200
Subject: [PATCH] net/mlx5: fix memory region cache last index

[ upstream commit 627cbfad1ca0d4e12744a28d61b8881ab5ff3757 ]

In case Memory Region cache is full, the new mempool will be
inserted in the last index of the array.

Update the last entry being hit to reflect it.

Fixes: b0b093845793 ("net/mlx5: use buffer address for LKEY search")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index ab71a68..604f308 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -564,7 +564,6 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 			return txq->mp2mr[i]->lkey;
 		}
 	}
-	txq->mr_cache_idx = 0;
 	mr = mlx5_txq_mp2mr_reg(txq, mlx5_tx_mb2mp(mb), i);
 	/*
 	 * Request the reference to use in this queue, the original one is
@@ -572,6 +571,7 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 	 */
 	if (mr) {
 		rte_atomic32_inc(&mr->refcnt);
+		txq->mr_cache_idx = i >= RTE_DIM(txq->mp2mr) ? i - 1 : i;
 		return mr->lkey;
 	}
 	return (uint32_t)-1;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/mlx5: fix memory region boundary checks' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (18 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region cache last index' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/ena: do not set Tx L4 offloads in Rx path' " Yuanhan Liu
                   ` (23 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: Xueming Li, Nelio Laranjeiro, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From d01327d95624923003b6e984040c8c17c06b5361 Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Thu, 25 Jan 2018 18:18:03 +0200
Subject: [PATCH] net/mlx5: fix memory region boundary checks

[ upstream commit 25f28d9d294d00a1c539d47a13c14ce282e31b09 ]

Since commit f81ec748434b ("net/mlx5: fix memory region lookup") the
Memory Region (MR) are no longer overlaps.

Comparing the end address of the MR should be exclusive, otherwise two
contiguous MRs may cause wrong matching.

Fixes: f81ec748434b ("net/mlx5: fix memory region lookup")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 604f308..de5b769 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -547,7 +547,7 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 	struct mlx5_mr *mr;
 
 	assert(i < RTE_DIM(txq->mp2mr));
-	if (likely(txq->mp2mr[i]->start <= addr && txq->mp2mr[i]->end >= addr))
+	if (likely(txq->mp2mr[i]->start <= addr && txq->mp2mr[i]->end > addr))
 		return txq->mp2mr[i]->lkey;
 	for (i = 0; (i != RTE_DIM(txq->mp2mr)); ++i) {
 		if (unlikely(txq->mp2mr[i] == NULL ||
@@ -556,7 +556,7 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 			break;
 		}
 		if (txq->mp2mr[i]->start <= addr &&
-		    txq->mp2mr[i]->end >= addr) {
+		    txq->mp2mr[i]->end > addr) {
 			assert(txq->mp2mr[i]->lkey != (uint32_t)-1);
 			assert(rte_cpu_to_be_32(txq->mp2mr[i]->mr->lkey) ==
 			       txq->mp2mr[i]->lkey);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/ena: do not set Tx L4 offloads in Rx path' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (19 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region boundary checks' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio-user: fix crash as features change' " Yuanhan Liu
                   ` (22 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Rafal Kozik; +Cc: Matthew Smith, Michal Krawczyk, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 2cdcc8be44f3fdd05f0cb0bba92efdfaba02b723 Mon Sep 17 00:00:00 2001
From: Rafal Kozik <rk@semihalf.com>
Date: Thu, 25 Jan 2018 16:27:43 +0100
Subject: [PATCH] net/ena: do not set Tx L4 offloads in Rx path

[ upstream commit fd617795679019c7aea5ab1e8c85db02cf53f169 ]

Information about received packet type detected by NIC should be
stored in packet_type field of rte_mbuf. TX L4 offload flags should
not be set in RX path. Only fields that could be set in of_flags
during packet receiving are information if L4 and L3 checksum is
correct.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")

Reported-by: Matthew Smith <mgsmith@netgate.com>
Signed-off-by: Rafal Kozik <rk@semihalf.com>
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 22db895..aa24ef3 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -260,16 +260,17 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
 				       struct ena_com_rx_ctx *ena_rx_ctx)
 {
 	uint64_t ol_flags = 0;
+	uint32_t packet_type = 0;
 
 	if (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP)
-		ol_flags |= PKT_TX_TCP_CKSUM;
+		packet_type |= RTE_PTYPE_L4_TCP;
 	else if (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)
-		ol_flags |= PKT_TX_UDP_CKSUM;
+		packet_type |= RTE_PTYPE_L4_UDP;
 
 	if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4)
-		ol_flags |= PKT_TX_IPV4;
+		packet_type |= RTE_PTYPE_L3_IPV4;
 	else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6)
-		ol_flags |= PKT_TX_IPV6;
+		packet_type |= RTE_PTYPE_L3_IPV6;
 
 	if (unlikely(ena_rx_ctx->l4_csum_err))
 		ol_flags |= PKT_RX_L4_CKSUM_BAD;
@@ -277,6 +278,7 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
 		ol_flags |= PKT_RX_IP_CKSUM_BAD;
 
 	mbuf->ol_flags = ol_flags;
+	mbuf->packet_type = packet_type;
 }
 
 static inline void ena_tx_mbuf_prepare(struct rte_mbuf *mbuf,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/virtio-user: fix crash as features change' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (20 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/ena: do not set Tx L4 offloads in Rx path' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix Rx and Tx handler selection for ARM32' " Yuanhan Liu
                   ` (21 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: Lei Yao, Tiwei Bie, Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 05550183d6f547420d7be479b8ab3f6b9965594b Mon Sep 17 00:00:00 2001
From: Jianfeng Tan <jianfeng.tan@intel.com>
Date: Tue, 23 Jan 2018 09:52:43 +0000
Subject: [PATCH] net/virtio-user: fix crash as features change

[ upstream commit 0d6a8752ac9d1088fed721f81aaa9abbdab53be1 ]

Since commit 59fe5e17d930 ("vhost: propagate set features handling error"),
vhost does not allow to set different features without reset.

The virtio-user driver fails to reset the device in below commit.

To fix, we send the reset message as stopping the device.

Fixes: c12a26ee209e ("net/virtio-user: fix not properly reset device")

Reported-by: Lei Yao <lei.a.yao@intel.com>
Reported-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 906d7a2..7ce512c 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -171,6 +171,11 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
 	for (i = 0; i < dev->max_queue_pairs; ++i)
 		dev->ops->enable_qp(dev, i, 0);
 
+	if (dev->ops->send_request(dev, VHOST_USER_RESET_OWNER, NULL) < 0) {
+		PMD_DRV_LOG(INFO, "Failed to reset the device\n");
+		return -1;
+	}
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix Rx and Tx handler selection for ARM32' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (21 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio-user: fix crash as features change' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix queue flushing with vector Rx enabled' " Yuanhan Liu
                   ` (20 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Samuel Gauthier; +Cc: Maxime Coquelin, Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 3d735b4e553f1f2ddd9e79f5bb00e5cdd2e5f6b4 Mon Sep 17 00:00:00 2001
From: Samuel Gauthier <samuel.gauthier@6wind.com>
Date: Thu, 14 Dec 2017 15:32:13 +0100
Subject: [PATCH] net/virtio: fix Rx and Tx handler selection for ARM32

[ upstream commit 8f3d451dff2b91eb6c7636e92794c2b256267f8e ]

On arm32, we were always selecting the simple handler, but it is only
available if neon is present.

This is due to a typo in the name of the config option.
CONFIG_RTE_ARCH_ARM is for Makefiles. One should use RTE_ARCH_ARM.

Fixes: 2d7c37194ee4 ("net/virtio: add NEON based Rx handler")

Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 95da470..bfb9dab 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1784,7 +1784,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)
 	hw->use_simple_rx = 1;
 	hw->use_simple_tx = 1;
 
-#if defined RTE_ARCH_ARM64 || defined CONFIG_RTE_ARCH_ARM
+#if defined RTE_ARCH_ARM64 || defined RTE_ARCH_ARM
 	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) {
 		hw->use_simple_rx = 0;
 		hw->use_simple_tx = 0;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix queue flushing with vector Rx enabled' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (22 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix Rx and Tx handler selection for ARM32' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix memory leak when reinitializing device' " Yuanhan Liu
                   ` (19 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From cdf245dd9a63747e62905c2fff5ac37baa5a39fb Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz@6wind.com>
Date: Tue, 23 Jan 2018 16:54:40 +0100
Subject: [PATCH] net/virtio: fix queue flushing with vector Rx enabled

[ upstream commit e67ae1e27e27b0fce9974dbf1b5bc6adff27a213 ]

When using vector Rx mode (use_simple_rx = 1), vq->vq_descx[] is not
kept up to date. To properly detach the mbufs in this case, browse
sw_ring[] instead, as it's done in virtqueue_rxvq_flush().

Since we need virtio_get_queue_type(), also move this function in
virtqueue.h as a static inline.

Fixes: fc3d66212fed ("virtio: add vector Rx")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
---
 drivers/net/virtio/virtio_ethdev.c | 11 -----------
 drivers/net/virtio/virtqueue.c     | 28 +++++++++++++++++++++++++---
 drivers/net/virtio/virtqueue.h     | 11 +++++++++++
 3 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index bfb9dab..74e3c24 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -294,17 +294,6 @@ virtio_dev_queue_release(void *queue __rte_unused)
 	/* do nothing */
 }
 
-static int
-virtio_get_queue_type(struct virtio_hw *hw, uint16_t vtpci_queue_idx)
-{
-	if (vtpci_queue_idx == hw->max_queue_pairs * 2)
-		return VTNET_CQ;
-	else if (vtpci_queue_idx % 2 == 0)
-		return VTNET_RQ;
-	else
-		return VTNET_TQ;
-}
-
 static uint16_t
 virtio_get_nr_vq(struct virtio_hw *hw)
 {
diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
index 696d0e4..7f5e996 100644
--- a/drivers/net/virtio/virtqueue.c
+++ b/drivers/net/virtio/virtqueue.c
@@ -48,16 +48,38 @@ struct rte_mbuf *
 virtqueue_detatch_unused(struct virtqueue *vq)
 {
 	struct rte_mbuf *cookie;
-	int idx;
+	struct virtio_hw *hw;
+	uint16_t start, end;
+	int type, idx;
 
-	if (vq != NULL)
-		for (idx = 0; idx < vq->vq_nentries; idx++) {
+	if (vq == NULL)
+		return NULL;
+
+	hw = vq->hw;
+	type = virtio_get_queue_type(hw, vq->vq_queue_index);
+	start = vq->vq_avail_idx & (vq->vq_nentries - 1);
+	end = (vq->vq_avail_idx + vq->vq_free_cnt) & (vq->vq_nentries - 1);
+
+	for (idx = 0; idx < vq->vq_nentries; idx++) {
+		if (hw->use_simple_rx && type == VTNET_RQ) {
+			if (start <= end && idx >= start && idx < end)
+				continue;
+			if (start > end && (idx >= start || idx < end))
+				continue;
+			cookie = vq->sw_ring[idx];
+			if (cookie != NULL) {
+				vq->sw_ring[idx] = NULL;
+				return cookie;
+			}
+		} else {
 			cookie = vq->vq_descx[idx].cookie;
 			if (cookie != NULL) {
 				vq->vq_descx[idx].cookie = NULL;
 				return cookie;
 			}
 		}
+	}
+
 	return NULL;
 }
 
diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index ab466c2..788d04d 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -312,6 +312,17 @@ virtqueue_full(const struct virtqueue *vq)
 	return vq->vq_free_cnt == 0;
 }
 
+static inline int
+virtio_get_queue_type(struct virtio_hw *hw, uint16_t vtpci_queue_idx)
+{
+	if (vtpci_queue_idx == hw->max_queue_pairs * 2)
+		return VTNET_CQ;
+	else if (vtpci_queue_idx % 2 == 0)
+		return VTNET_RQ;
+	else
+		return VTNET_TQ;
+}
+
 #define VIRTQUEUE_NUSED(vq) ((uint16_t)((vq)->vq_ring.used->idx - (vq)->vq_used_cons_idx))
 
 void vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/virtio: fix memory leak when reinitializing device' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (23 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix queue flushing with vector Rx enabled' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/i40e: fix VF Rx interrupt enabling' " Yuanhan Liu
                   ` (18 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Zijie Pan, Yuanhan Liu, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From f0d46b0954b72cc25147bec8391dd540c47c5731 Mon Sep 17 00:00:00 2001
From: Olivier Matz <olivier.matz@6wind.com>
Date: Tue, 23 Jan 2018 16:54:41 +0100
Subject: [PATCH] net/virtio: fix memory leak when reinitializing device

[ upstream commit 3669a1af893088064778f14fba0c2ca88819e095 ]

Free the previous queues and the attached mbufs before initializing new
ones.

The function virtio_dev_free_mbufs() is now called when reconfiguring the
device, so we also need to add a check to ensure that it won't crash for
uninitialized queues.

Fixes: 60e6f4707ef2 ("net/virtio: reinitialize device when configuring")

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
---
 drivers/net/virtio/virtio_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 74e3c24..4da1ba3 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1394,6 +1394,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 	/* Reset the device although not necessary at startup */
 	vtpci_reset(hw);
 
+	if (hw->vqs) {
+		virtio_dev_free_mbufs(eth_dev);
+		virtio_free_queues(hw);
+	}
+
 	/* Tell the host we've noticed this device. */
 	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);
 
@@ -1887,6 +1892,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		struct virtnet_rx *rxvq = dev->data->rx_queues[i];
 
+		if (rxvq == NULL || rxvq->vq == NULL)
+			continue;
+
 		PMD_INIT_LOG(DEBUG,
 			     "Before freeing rxq[%d] used and unused buf", i);
 		VIRTQUEUE_DUMP(rxvq->vq);
@@ -1906,6 +1914,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		struct virtnet_tx *txvq = dev->data->tx_queues[i];
 
+		if (txvq == NULL || txvq->vq == NULL)
+			continue;
+
 		PMD_INIT_LOG(DEBUG,
 			     "Before freeing txq[%d] used and unused bufs",
 			     i);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/i40e: fix VF Rx interrupt enabling' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (24 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix memory leak when reinitializing device' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/ixgbe: " Yuanhan Liu
                   ` (17 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: Helin Zhang, Beilei Xing, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 0b09a235f0961e4bc2a258b893ccb2339bf68bb8 Mon Sep 17 00:00:00 2001
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
Date: Wed, 24 Jan 2018 16:16:50 +0800
Subject: [PATCH] net/i40e: fix VF Rx interrupt enabling

[ upstream commit 4ae1d081fb75e045e0c6b9e774647056715cd204 ]

When using UIO, after enabling the interrupt to get the PF
message, VF RX queue interrupt is not working.
It's expected, as UIO doesn't support multiple interrupt.
So, PMD should not try to enable RX queue interrupt. Then
APP can know the RX queue interrupt is not enabled and only
choose the polling mode.

Fixes: ae19955e7c86 ("i40evf: support reporting PF reset")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 6160e2f..2d71d7c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2005,7 +2005,8 @@ i40evf_dev_start(struct rte_eth_dev *dev)
 					dev->data->nb_tx_queues);
 
 	/* check and configure queue intr-vector mapping */
-	if (dev->data->dev_conf.intr_conf.rxq != 0) {
+	if (rte_intr_cap_multiple(intr_handle) &&
+	    dev->data->dev_conf.intr_conf.rxq) {
 		intr_vector = dev->data->nb_rx_queues;
 		if (rte_intr_efd_enable(intr_handle, intr_vector))
 			return -1;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/ixgbe: fix VF Rx interrupt enabling' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (25 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/i40e: fix VF Rx interrupt enabling' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/e1000: " Yuanhan Liu
                   ` (16 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: Helin Zhang, Beilei Xing, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 1e3e479cae8d525c7181aa91080bcbf5d68c6cfa Mon Sep 17 00:00:00 2001
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
Date: Wed, 24 Jan 2018 16:16:51 +0800
Subject: [PATCH] net/ixgbe: fix VF Rx interrupt enabling

[ upstream commit 8d1f13f96ce3cb4167244f928f6cb9574f561560 ]

When using UIO, after enabling the interrupt to get the PF
message, VF RX queue interrupt is not working.
It's expected, as UIO doesn't support multiple interrupt.
So, PMD should not try to enable RX queue interrupt. Then
APP can know the RX queue interrupt is not enabled and only
choose the polling mode.

Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link up/down")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 9c09610..1f3a60b 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5059,7 +5059,8 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
 	ixgbevf_dev_rxtx_start(dev);
 
 	/* check and configure queue intr-vector mapping */
-	if (dev->data->dev_conf.intr_conf.rxq != 0) {
+	if (rte_intr_cap_multiple(intr_handle) &&
+	    dev->data->dev_conf.intr_conf.rxq) {
 		/* According to datasheet, only vector 0/1/2 can be used,
 		 * now only one vector is used for Rx queue
 		 */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/e1000: fix VF Rx interrupt enabling' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (26 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/ixgbe: " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/bnxt: fix size of Tx ring in HW' " Yuanhan Liu
                   ` (15 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: Helin Zhang, Beilei Xing, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 8208b72f3056d95298fb7fa9504ed34903f88576 Mon Sep 17 00:00:00 2001
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
Date: Wed, 24 Jan 2018 16:16:52 +0800
Subject: [PATCH] net/e1000: fix VF Rx interrupt enabling

[ upstream commit 61c1f1b7910711922d2c66c9e722d7f1f08eb663 ]

When using UIO, after enabling the interrupt to get the PF
message, VF RX queue interrupt is not working.
It's expected, as UIO doesn't support multiple interrupt.
So, PMD should not try to enable RX queue interrupt. Then
APP can know the RX queue interrupt is not enabled and only
choose the polling mode.

Fixes: 316f4f1adc2e ("net/igb: support VF mailbox interrupt for link up/down")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/e1000/igb_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index c783019..79d0244 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3300,7 +3300,8 @@ igbvf_dev_start(struct rte_eth_dev *dev)
 	}
 
 	/* check and configure queue intr-vector mapping */
-	if (dev->data->dev_conf.intr_conf.rxq != 0) {
+	if (rte_intr_cap_multiple(intr_handle) &&
+	    dev->data->dev_conf.intr_conf.rxq) {
 		intr_vector = dev->data->nb_rx_queues;
 		ret = rte_intr_efd_enable(intr_handle, intr_vector);
 		if (ret)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/bnxt: fix size of Tx ring in HW' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (27 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/e1000: " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/bnxt: fix number of pools for RSS' " Yuanhan Liu
                   ` (14 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 601ef07d8547a90e3f7c2224e106f559a538cb2f Mon Sep 17 00:00:00 2001
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
Date: Fri, 26 Jan 2018 09:31:54 -0800
Subject: [PATCH] net/bnxt: fix size of Tx ring in HW

[ upstream commit c771d289cb6295dd0d4abd37cc1689f0bc87cfcb ]

During Tx ring allocation, the actual ring size configured in the HW
ends up being twice the number of txd parameter specified to the driver.
The power of 2 ring size wrongly adds a +1 while sending the ring
create command to the FW.

Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_txr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 4a152aa..03d2652 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -101,7 +101,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	txr->tx_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
+	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)txr->tx_desc_ring;
 	ring->bd_dma = txr->tx_desc_mapping;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/bnxt: fix number of pools for RSS' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (28 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/bnxt: fix size of Tx ring in HW' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: check tunnel L3 header' " Yuanhan Liu
                   ` (13 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 9c0a1bf801dab035021148ef0d643b8686e4d815 Mon Sep 17 00:00:00 2001
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
Date: Fri, 26 Jan 2018 09:32:00 -0800
Subject: [PATCH] net/bnxt: fix number of pools for RSS

[ upstream commit dbcabb69e2cf9e979da922e8907343135897641a ]

While using RSS, the pool count should be 1.

Fixes: 8103a57ab432a ("net/bnxt: handle Rx multi queue creation properly")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index c4da474..b4e9f38 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -118,7 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 				pools = max_pools;
 			break;
 		case ETH_MQ_RX_RSS:
-			pools = bp->rx_cp_nr_rings;
+			pools = 1;
 			break;
 		default:
 			RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/qede: check tunnel L3 header' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (29 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/bnxt: fix number of pools for RSS' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: fix tunnel header size in Tx BD configuration' " Yuanhan Liu
                   ` (12 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Harish Patil; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From c55f999d4b7ac6a1a8dbaf11507357311d06ea89 Mon Sep 17 00:00:00 2001
From: Harish Patil <harish.patil@cavium.com>
Date: Sat, 27 Jan 2018 13:15:27 -0800
Subject: [PATCH] net/qede: check tunnel L3 header

[ upstream commit 3f72dd780e1078191305e6ed4268f82ff3cf1e02 ]

- Add a check to verify tunnel IP header checksum is valid and mark MBUF
flag as appropriate.
- Bit of refactoring so that inner frame handling for tunneled packets can
be made common as regular (non-tunneled) packets.
- make qede_tunn_exist() as inline.
- remove RTE_PTYPE_L2_ETHER as default L2 pkt_type.

Fixes: 3d4bb4411683 ("net/qede: add fastpath support for VXLAN tunneling")

Signed-off-by: Harish Patil <harish.patil@cavium.com>
---
 drivers/net/qede/qede_rxtx.c | 143 +++++++++++++++++++++++++++----------------
 1 file changed, 91 insertions(+), 52 deletions(-)

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 01a24e5..d210b06 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -812,12 +812,18 @@ void qede_stop_queues(struct rte_eth_dev *eth_dev)
 	}
 }
 
-static bool qede_tunn_exist(uint16_t flag)
+static inline bool qede_tunn_exist(uint16_t flag)
 {
 	return !!((PARSING_AND_ERR_FLAGS_TUNNELEXIST_MASK <<
 		    PARSING_AND_ERR_FLAGS_TUNNELEXIST_SHIFT) & flag);
 }
 
+static inline uint8_t qede_check_tunn_csum_l3(uint16_t flag)
+{
+	return !!((PARSING_AND_ERR_FLAGS_TUNNELIPHDRERROR_MASK <<
+		PARSING_AND_ERR_FLAGS_TUNNELIPHDRERROR_SHIFT) & flag);
+}
+
 /*
  * qede_check_tunn_csum_l4:
  * Returns:
@@ -844,33 +850,51 @@ static inline uint8_t qede_check_notunn_csum_l4(uint16_t flag)
 	return 0;
 }
 
-/* Returns outer L3 and L4 packet_type for tunneled packets */
+/* Returns outer L2, L3 and L4 packet_type for tunneled packets */
 static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m)
 {
 	uint32_t packet_type = RTE_PTYPE_UNKNOWN;
 	struct ether_hdr *eth_hdr;
 	struct ipv4_hdr *ipv4_hdr;
 	struct ipv6_hdr *ipv6_hdr;
+	struct vlan_hdr *vlan_hdr;
+	uint16_t ethertype;
+	bool vlan_tagged = 0;
+	uint16_t len;
 
 	eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
-	if (eth_hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {
+	len = sizeof(struct ether_hdr);
+	ethertype = rte_cpu_to_be_16(eth_hdr->ether_type);
+
+	 /* Note: Valid only if VLAN stripping is disabled */
+	if (ethertype == ETHER_TYPE_VLAN) {
+		vlan_tagged = 1;
+		vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1);
+		len += sizeof(struct vlan_hdr);
+		ethertype = rte_cpu_to_be_16(vlan_hdr->eth_proto);
+	}
+
+	if (ethertype == ETHER_TYPE_IPv4) {
 		packet_type |= RTE_PTYPE_L3_IPV4;
-		ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *,
-						   sizeof(struct ether_hdr));
+		ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len);
 		if (ipv4_hdr->next_proto_id == IPPROTO_TCP)
 			packet_type |= RTE_PTYPE_L4_TCP;
 		else if (ipv4_hdr->next_proto_id == IPPROTO_UDP)
 			packet_type |= RTE_PTYPE_L4_UDP;
-	} else if (eth_hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) {
+	} else if (ethertype == ETHER_TYPE_IPv6) {
 		packet_type |= RTE_PTYPE_L3_IPV6;
-		ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *,
-						   sizeof(struct ether_hdr));
+		ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len);
 		if (ipv6_hdr->proto == IPPROTO_TCP)
 			packet_type |= RTE_PTYPE_L4_TCP;
 		else if (ipv6_hdr->proto == IPPROTO_UDP)
 			packet_type |= RTE_PTYPE_L4_UDP;
 	}
 
+	if (vlan_tagged)
+		packet_type |= RTE_PTYPE_L2_ETHER_VLAN;
+	else
+		packet_type |= RTE_PTYPE_L2_ETHER;
+
 	return packet_type;
 }
 
@@ -1163,17 +1187,17 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
 		[QEDE_PKT_TYPE_TUNN_GRE] = RTE_PTYPE_TUNNEL_GRE,
 		[QEDE_PKT_TYPE_TUNN_VXLAN] = RTE_PTYPE_TUNNEL_VXLAN,
 		[QEDE_PKT_TYPE_TUNN_L2_TENID_NOEXIST_GENEVE] =
-				RTE_PTYPE_TUNNEL_GENEVE | RTE_PTYPE_L2_ETHER,
+				RTE_PTYPE_TUNNEL_GENEVE,
 		[QEDE_PKT_TYPE_TUNN_L2_TENID_NOEXIST_GRE] =
-				RTE_PTYPE_TUNNEL_GRE | RTE_PTYPE_L2_ETHER,
+				RTE_PTYPE_TUNNEL_GRE,
 		[QEDE_PKT_TYPE_TUNN_L2_TENID_NOEXIST_VXLAN] =
-				RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_L2_ETHER,
+				RTE_PTYPE_TUNNEL_VXLAN,
 		[QEDE_PKT_TYPE_TUNN_L2_TENID_EXIST_GENEVE] =
-				RTE_PTYPE_TUNNEL_GENEVE | RTE_PTYPE_L2_ETHER,
+				RTE_PTYPE_TUNNEL_GENEVE,
 		[QEDE_PKT_TYPE_TUNN_L2_TENID_EXIST_GRE] =
-				RTE_PTYPE_TUNNEL_GRE | RTE_PTYPE_L2_ETHER,
+				RTE_PTYPE_TUNNEL_GRE,
 		[QEDE_PKT_TYPE_TUNN_L2_TENID_EXIST_VXLAN] =
-				RTE_PTYPE_TUNNEL_VXLAN | RTE_PTYPE_L2_ETHER,
+				RTE_PTYPE_TUNNEL_VXLAN,
 		[QEDE_PKT_TYPE_TUNN_IPV4_TENID_NOEXIST_GENEVE] =
 				RTE_PTYPE_TUNNEL_GENEVE | RTE_PTYPE_L3_IPV4,
 		[QEDE_PKT_TYPE_TUNN_IPV4_TENID_NOEXIST_GRE] =
@@ -1253,7 +1277,7 @@ print_rx_bd_info(struct rte_mbuf *m, struct qede_rx_queue *rxq,
 		 uint8_t bitfield)
 {
 	PMD_RX_LOG(INFO, rxq,
-		"len 0x%x bf 0x%x hash_val 0x%x"
+		"len 0x%04x bf 0x%04x hash_val 0x%x"
 		" ol_flags 0x%04lx l2=%s l3=%s l4=%s tunn=%s"
 		" inner_l2=%s inner_l3=%s inner_l4=%s\n",
 		m->data_len, bitfield, m->hash.rss,
@@ -1404,47 +1428,62 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 				ol_flags |= PKT_RX_L4_CKSUM_BAD;
 			} else {
 				ol_flags |= PKT_RX_L4_CKSUM_GOOD;
-				if (tpa_start_flg)
-					flags =
-					 cqe_start_tpa->tunnel_pars_flags.flags;
-				else
-					flags = fp_cqe->tunnel_pars_flags.flags;
-				tunn_parse_flag = flags;
-				/* Tunnel_type */
-				packet_type =
-				qede_rx_cqe_to_tunn_pkt_type(tunn_parse_flag);
-
-				/* Inner header */
-				packet_type |=
-				      qede_rx_cqe_to_pkt_type_inner(parse_flag);
-
-				/* Outer L3/L4 types is not available in CQE */
-				packet_type |=
-				      qede_rx_cqe_to_pkt_type_outer(rx_mb);
 			}
-		} else {
-			PMD_RX_LOG(INFO, rxq, "Rx non-tunneled packet\n");
-			if (unlikely(qede_check_notunn_csum_l4(parse_flag))) {
-				PMD_RX_LOG(ERR, rxq,
-					    "L4 csum failed, flags = 0x%x\n",
-					    parse_flag);
-				rxq->rx_hw_errors++;
-				ol_flags |= PKT_RX_L4_CKSUM_BAD;
-			} else {
-				ol_flags |= PKT_RX_L4_CKSUM_GOOD;
-			}
-			if (unlikely(qede_check_notunn_csum_l3(rx_mb,
-							parse_flag))) {
+
+			if (unlikely(qede_check_tunn_csum_l3(parse_flag))) {
 				PMD_RX_LOG(ERR, rxq,
-					   "IP csum failed, flags = 0x%x\n",
-					   parse_flag);
-				rxq->rx_hw_errors++;
-				ol_flags |= PKT_RX_IP_CKSUM_BAD;
+					"Outer L3 csum failed, flags = 0x%x\n",
+					parse_flag);
+				  rxq->rx_hw_errors++;
+				  ol_flags |= PKT_RX_EIP_CKSUM_BAD;
 			} else {
-				ol_flags |= PKT_RX_IP_CKSUM_GOOD;
-				packet_type =
-					qede_rx_cqe_to_pkt_type(parse_flag);
+				  ol_flags |= PKT_RX_IP_CKSUM_GOOD;
 			}
+
+			if (tpa_start_flg)
+				flags = cqe_start_tpa->tunnel_pars_flags.flags;
+			else
+				flags = fp_cqe->tunnel_pars_flags.flags;
+			tunn_parse_flag = flags;
+
+			/* Tunnel_type */
+			packet_type =
+				qede_rx_cqe_to_tunn_pkt_type(tunn_parse_flag);
+
+			/* Inner header */
+			packet_type |=
+			      qede_rx_cqe_to_pkt_type_inner(parse_flag);
+
+			/* Outer L3/L4 types is not available in CQE */
+			packet_type |= qede_rx_cqe_to_pkt_type_outer(rx_mb);
+
+			/* Outer L3/L4 types is not available in CQE.
+			 * Need to add offset to parse correctly,
+			 */
+			rx_mb->data_off = offset + RTE_PKTMBUF_HEADROOM;
+			packet_type |= qede_rx_cqe_to_pkt_type_outer(rx_mb);
+		}
+
+		/* Common handling for non-tunnel packets and for inner
+		 * headers in the case of tunnel.
+		 */
+		if (unlikely(qede_check_notunn_csum_l4(parse_flag))) {
+			PMD_RX_LOG(ERR, rxq,
+				    "L4 csum failed, flags = 0x%x\n",
+				    parse_flag);
+			rxq->rx_hw_errors++;
+			ol_flags |= PKT_RX_L4_CKSUM_BAD;
+		} else {
+			ol_flags |= PKT_RX_L4_CKSUM_GOOD;
+		}
+		if (unlikely(qede_check_notunn_csum_l3(rx_mb, parse_flag))) {
+			PMD_RX_LOG(ERR, rxq, "IP csum failed, flags = 0x%x\n",
+				   parse_flag);
+			rxq->rx_hw_errors++;
+			ol_flags |= PKT_RX_IP_CKSUM_BAD;
+		} else {
+			ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+			packet_type |= qede_rx_cqe_to_pkt_type(parse_flag);
 		}
 
 		if (CQE_HAS_VLAN(parse_flag) ||
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/qede: fix tunnel header size in Tx BD configuration' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (30 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: check tunnel L3 header' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: fix MTU set and max Rx length' " Yuanhan Liu
                   ` (11 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Harish Patil; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 07f11419fa510f9f8ad276c8a182d967a54b808b Mon Sep 17 00:00:00 2001
From: Harish Patil <harish.patil@cavium.com>
Date: Sat, 27 Jan 2018 13:15:28 -0800
Subject: [PATCH] net/qede: fix tunnel header size in Tx BD configuration

[ upstream commit a5b252a415ce15362980e3257dbdf5f0e6412d35 ]

- Fix incorrect header size. In the tunnel case, the outer L2/L3 lengths
should be included to calculate tunnel header_size.
- In TSO case, skip manipulating TX BD1 and TX BD2 data buffer fields
since those fields are already updated with header and payload lengths
respectively.
- Update TX BD debug data collection.

Fixes: 3d4bb4411683 ("net/qede: add fastpath support for VXLAN tunneling")

Signed-off-by: Harish Patil <harish.patil@cavium.com>
---
 drivers/net/qede/qede_rxtx.c | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index d210b06..a89d6c6 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -1588,7 +1588,8 @@ next_cqe:
 /* Populate scatter gather buffer descriptor fields */
 static inline uint16_t
 qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,
-		  struct eth_tx_2nd_bd **bd2, struct eth_tx_3rd_bd **bd3)
+		  struct eth_tx_2nd_bd **bd2, struct eth_tx_3rd_bd **bd3,
+		  uint16_t start_seg)
 {
 	struct qede_tx_queue *txq = p_txq;
 	struct eth_tx_bd *tx_bd = NULL;
@@ -1597,7 +1598,7 @@ qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,
 
 	/* Check for scattered buffers */
 	while (m_seg) {
-		if (nb_segs == 0) {
+		if (start_seg == 0) {
 			if (!*bd2) {
 				*bd2 = (struct eth_tx_2nd_bd *)
 					ecore_chain_produce(&txq->tx_pbl);
@@ -1607,7 +1608,7 @@ qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,
 			mapping = rte_mbuf_data_iova(m_seg);
 			QEDE_BD_SET_ADDR_LEN(*bd2, mapping, m_seg->data_len);
 			PMD_TX_LOG(DEBUG, txq, "BD2 len %04x", m_seg->data_len);
-		} else if (nb_segs == 1) {
+		} else if (start_seg == 1) {
 			if (!*bd3) {
 				*bd3 = (struct eth_tx_3rd_bd *)
 					ecore_chain_produce(&txq->tx_pbl);
@@ -1645,20 +1646,24 @@ print_tx_bd_info(struct qede_tx_queue *txq,
 
 	if (bd1)
 		PMD_TX_LOG(INFO, txq,
-			   "BD1: nbytes=%u nbds=%u bd_flags=%04x bf=%04x",
-			   rte_cpu_to_le_16(bd1->nbytes), bd1->data.nbds,
-			   bd1->data.bd_flags.bitfields,
-			   rte_cpu_to_le_16(bd1->data.bitfields));
+		   "BD1: nbytes=0x%04x nbds=0x%04x bd_flags=0x%04x bf=0x%04x",
+		   rte_cpu_to_le_16(bd1->nbytes), bd1->data.nbds,
+		   bd1->data.bd_flags.bitfields,
+		   rte_cpu_to_le_16(bd1->data.bitfields));
 	if (bd2)
 		PMD_TX_LOG(INFO, txq,
-			   "BD2: nbytes=%u bf=%04x\n",
-			   rte_cpu_to_le_16(bd2->nbytes), bd2->data.bitfields1);
+		   "BD2: nbytes=0x%04x bf1=0x%04x bf2=0x%04x tunn_ip=0x%04x\n",
+		   rte_cpu_to_le_16(bd2->nbytes), bd2->data.bitfields1,
+		   bd2->data.bitfields2, bd2->data.tunn_ip_size);
 	if (bd3)
 		PMD_TX_LOG(INFO, txq,
-			   "BD3: nbytes=%u bf=%04x mss=%u\n",
-			   rte_cpu_to_le_16(bd3->nbytes),
-			   rte_cpu_to_le_16(bd3->data.bitfields),
-			   rte_cpu_to_le_16(bd3->data.lso_mss));
+		   "BD3: nbytes=0x%04x bf=0x%04x MSS=0x%04x "
+		   "tunn_l4_hdr_start_offset_w=0x%04x tunn_hdr_size=0x%04x\n",
+		   rte_cpu_to_le_16(bd3->nbytes),
+		   rte_cpu_to_le_16(bd3->data.bitfields),
+		   rte_cpu_to_le_16(bd3->data.lso_mss),
+		   bd3->data.tunn_l4_hdr_start_offset_w,
+		   bd3->data.tunn_hdr_size_w);
 
 	rte_get_tx_ol_flag_list(tx_ol_flags, ol_buf, sizeof(ol_buf));
 	PMD_TX_LOG(INFO, txq, "TX offloads = %s\n", ol_buf);
@@ -1936,6 +1941,10 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			 * and BD2 onwards for data.
 			 */
 			hdr_size = mbuf->l2_len + mbuf->l3_len + mbuf->l4_len;
+			if (tunn_flg)
+				hdr_size += mbuf->outer_l2_len +
+					    mbuf->outer_l3_len;
+
 			bd1_bd_flags_bf |= 1 << ETH_TX_1ST_BD_FLAGS_LSO_SHIFT;
 			bd1_bd_flags_bf |=
 					1 << ETH_TX_1ST_BD_FLAGS_IP_CSUM_SHIFT;
@@ -2052,9 +2061,11 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Handle fragmented MBUF */
 		m_seg = mbuf->next;
+
 		/* Encode scatter gather buffer descriptors if required */
-		nb_frags = qede_encode_sg_bd(txq, m_seg, &bd2, &bd3);
+		nb_frags = qede_encode_sg_bd(txq, m_seg, &bd2, &bd3, nbds - 1);
 		bd1->data.nbds = nbds + nb_frags;
+
 		txq->nb_tx_avail -= bd1->data.nbds;
 		txq->sw_tx_prod++;
 		rte_prefetch0(txq->sw_tx_ring[TX_PROD(txq)].mbuf);
@@ -2062,7 +2073,6 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		    rte_cpu_to_le_16(ecore_chain_get_prod_idx(&txq->tx_pbl));
 #ifdef RTE_LIBRTE_QEDE_DEBUG_TX
 		print_tx_bd_info(txq, bd1, bd2, bd3, tx_ol_flags);
-		PMD_TX_LOG(INFO, txq, "lso=%d tunn=%d", lso_flg, tunn_flg);
 #endif
 		nb_pkt_sent++;
 		txq->xmit_pkts++;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/qede: fix MTU set and max Rx length' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (31 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: fix tunnel header size in Tx BD configuration' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'eal/ppc: remove the braces in memory barrier macros' " Yuanhan Liu
                   ` (10 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Rasesh Mody; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 40a6c11a287ef759464fdbe8061c7b7a3bb76498 Mon Sep 17 00:00:00 2001
From: Rasesh Mody <rasesh.mody@cavium.com>
Date: Sat, 27 Jan 2018 13:15:30 -0800
Subject: [PATCH] net/qede: fix MTU set and max Rx length

[ upstream commit 9e334305178fd3715c17088632544bf58e5836a9 ]

This patch fixes issues related to MTU set and max_rx_pkt_len usage.
 - Adjust MTU during device configuration when jumbo is enabled

 - In qede_set_mtu():
   Return not supported for VF as currently we do not support it.

   Cache new mtu value in mtu_new for proper update.

   Add check for RXQ allocation before calculating RX buffer size
   if not allocated defer RX buffer size calculation till RXQ setup.

   Add check for before performing device start/stop.

 - Use max_rx_pkt_len appropriately

 - Change QEDE_ETH_OVERHEAD macro to adjust driver specifics

Fixes: 4c4bdadfa9e7 ("net/qede: refactoring multi-queue implementation")
Fixes: 9a6d30ae6d46 ("net/qede: refactoring vport handling code")
Fixes: 1ef4c3a5c1f7 ("net/qede: prevent crash while changing MTU dynamically")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/qede_ethdev.c | 63 ++++++++++++++++++++++++++++--------------
 drivers/net/qede/qede_rxtx.c   |  6 ++--
 drivers/net/qede/qede_rxtx.h   |  2 +-
 3 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index b0c0997..de6e9e1 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1347,18 +1347,24 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
 			return -ENOMEM;
 	}
 
+	/* If jumbo enabled adjust MTU */
+	if (eth_dev->data->dev_conf.rxmode.jumbo_frame)
+		eth_dev->data->mtu =
+				eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
+				ETHER_HDR_LEN - ETHER_CRC_LEN;
+
 	/* VF's MTU has to be set using vport-start where as
 	 * PF's MTU can be updated via vport-update.
 	 */
 	if (IS_VF(edev)) {
-		if (qede_start_vport(qdev, rxmode->max_rx_pkt_len))
+		if (qede_start_vport(qdev, eth_dev->data->mtu))
 			return -1;
 	} else {
-		if (qede_update_mtu(eth_dev, rxmode->max_rx_pkt_len))
+		if (qede_update_mtu(eth_dev, eth_dev->data->mtu))
 			return -1;
 	}
 
-	qdev->mtu = rxmode->max_rx_pkt_len;
+	qdev->mtu = eth_dev->data->mtu;
 	qdev->new_mtu = qdev->mtu;
 
 	/* Enable VLAN offloads by default */
@@ -2237,16 +2243,23 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
 	struct rte_eth_dev_info dev_info = {0};
 	struct qede_fastpath *fp;
+	uint32_t max_rx_pkt_len;
 	uint32_t frame_size;
 	uint16_t rx_buf_size;
 	uint16_t bufsz;
+	bool restart = false;
 	int i;
 
 	PMD_INIT_FUNC_TRACE(edev);
+	if (IS_VF(edev))
+		return -ENOTSUP;
 	qede_dev_info_get(dev, &dev_info);
-	frame_size = mtu + QEDE_ETH_OVERHEAD;
+	max_rx_pkt_len = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	frame_size = max_rx_pkt_len + QEDE_ETH_OVERHEAD;
 	if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) {
-		DP_ERR(edev, "MTU %u out of range\n", mtu);
+		DP_ERR(edev, "MTU %u out of range, %u is maximum allowable\n",
+		       mtu, dev_info.max_rx_pktlen - ETHER_HDR_LEN -
+			ETHER_CRC_LEN - QEDE_ETH_OVERHEAD);
 		return -EINVAL;
 	}
 	if (!dev->data->scattered_rx &&
@@ -2260,29 +2273,39 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	 */
 	dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
 	dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
-	qede_dev_stop(dev);
+	if (dev->data->dev_started) {
+		dev->data->dev_started = 0;
+		qede_dev_stop(dev);
+		restart = true;
+	}
 	rte_delay_ms(1000);
-	qdev->mtu = mtu;
+	qdev->new_mtu = mtu;
 	/* Fix up RX buf size for all queues of the port */
 	for_each_rss(i) {
 		fp = &qdev->fp_array[i];
-		bufsz = (uint16_t)rte_pktmbuf_data_room_size(
-			fp->rxq->mb_pool) - RTE_PKTMBUF_HEADROOM;
-		if (dev->data->scattered_rx)
-			rx_buf_size = bufsz + QEDE_ETH_OVERHEAD;
-		else
-			rx_buf_size = mtu + QEDE_ETH_OVERHEAD;
-		rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rx_buf_size);
-		fp->rxq->rx_buf_size = rx_buf_size;
-		DP_INFO(edev, "buf_size adjusted to %u\n", rx_buf_size);
-	}
-	qede_dev_start(dev);
-	if (frame_size > ETHER_MAX_LEN)
+		if (fp->rxq != NULL) {
+			bufsz = (uint16_t)rte_pktmbuf_data_room_size(
+				fp->rxq->mb_pool) - RTE_PKTMBUF_HEADROOM;
+			if (dev->data->scattered_rx)
+				rx_buf_size = bufsz + ETHER_HDR_LEN +
+					      ETHER_CRC_LEN + QEDE_ETH_OVERHEAD;
+			else
+				rx_buf_size = frame_size;
+			rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rx_buf_size);
+			fp->rxq->rx_buf_size = rx_buf_size;
+			DP_INFO(edev, "buf_size adjusted to %u\n", rx_buf_size);
+		}
+	}
+	if (max_rx_pkt_len > ETHER_MAX_LEN)
 		dev->data->dev_conf.rxmode.jumbo_frame = 1;
 	else
 		dev->data->dev_conf.rxmode.jumbo_frame = 0;
+	if (!dev->data->dev_started && restart) {
+		qede_dev_start(dev);
+		dev->data->dev_started = 1;
+	}
 	/* update max frame size */
-	dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len;
 	/* Reassign back */
 	dev->rx_pkt_burst = qede_recv_pkts;
 	dev->tx_pkt_burst = qede_xmit_pkts;
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index a89d6c6..7efc19a 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -84,7 +84,6 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	rxq->port_id = dev->data->port_id;
 
 	max_rx_pkt_len = (uint16_t)rxmode->max_rx_pkt_len;
-	qdev->mtu = max_rx_pkt_len;
 
 	/* Fix up RX buffer size */
 	bufsz = (uint16_t)rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM;
@@ -97,9 +96,10 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	}
 
 	if (dev->data->scattered_rx)
-		rxq->rx_buf_size = bufsz + QEDE_ETH_OVERHEAD;
+		rxq->rx_buf_size = bufsz + ETHER_HDR_LEN +
+				   ETHER_CRC_LEN + QEDE_ETH_OVERHEAD;
 	else
-		rxq->rx_buf_size = qdev->mtu + QEDE_ETH_OVERHEAD;
+		rxq->rx_buf_size = max_rx_pkt_len + QEDE_ETH_OVERHEAD;
 	/* Align to cache-line size if needed */
 	rxq->rx_buf_size = QEDE_CEIL_TO_CACHE_LINE_SIZE(rxq->rx_buf_size);
 
diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h
index acf9e47..ae88206 100644
--- a/drivers/net/qede/qede_rxtx.h
+++ b/drivers/net/qede/qede_rxtx.h
@@ -64,7 +64,7 @@
 #define QEDE_CEIL_TO_CACHE_LINE_SIZE(n) (((n) + (QEDE_FW_RX_ALIGN_END - 1)) & \
 					~(QEDE_FW_RX_ALIGN_END - 1))
 /* Note: QEDE_LLC_SNAP_HDR_LEN is optional */
-#define QEDE_ETH_OVERHEAD	((ETHER_HDR_LEN) + ((2 * QEDE_VLAN_TAG_SIZE)) \
+#define QEDE_ETH_OVERHEAD	(((2 * QEDE_VLAN_TAG_SIZE)) - (ETHER_CRC_LEN) \
 				+ (QEDE_LLC_SNAP_HDR_LEN))
 
 #define QEDE_RSS_OFFLOAD_ALL    (ETH_RSS_IPV4			|\
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'eal/ppc: remove the braces in memory barrier macros' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (32 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: fix MTU set and max Rx length' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix enum conversion for GCM' " Yuanhan Liu
                   ` (9 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 5630769259bf69955fa3ab45da026798960bb047 Mon Sep 17 00:00:00 2001
From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Date: Tue, 30 Jan 2018 16:23:18 +0530
Subject: [PATCH] eal/ppc: remove the braces in memory barrier macros

[ upstream commit 257515a50057fa97605cc13e5b3b9cc9f964c299 ]

Calling rte_smp_{w/r}mb macro expands into a compound block, which
would break compiling a else clause following it, if that calling
place has been terminated already with ";", as in below code.
This patch adds { } around this macro to allow compiling else too.

Fixes: d23a6bd04d ("eal/ppc: fix memory barrier for IBM POWER")
Fixes: 05c3fd7110 ("eal/ppc: atomic operations for IBM Power")

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
---
 lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
index 150810c..6993dd2 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
@@ -64,9 +64,9 @@ extern "C" {
  * occur before the STORE operations generated after.
  */
 #ifdef RTE_ARCH_64
-#define	rte_wmb() {asm volatile("lwsync" : : : "memory"); }
+#define	rte_wmb() asm volatile("lwsync" : : : "memory")
 #else
-#define	rte_wmb() {asm volatile("sync" : : : "memory"); }
+#define	rte_wmb() asm volatile("sync" : : : "memory")
 #endif
 
 /**
@@ -76,9 +76,9 @@ extern "C" {
  * occur before the LOAD operations generated after.
  */
 #ifdef RTE_ARCH_64
-#define	rte_rmb() {asm volatile("lwsync" : : : "memory"); }
+#define	rte_rmb() asm volatile("lwsync" : : : "memory")
 #else
-#define	rte_rmb() {asm volatile("sync" : : : "memory"); }
+#define	rte_rmb() asm volatile("sync" : : : "memory")
 #endif
 
 #define rte_smp_mb() rte_mb()
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'crypto/dpaa2_sec: fix enum conversion for GCM' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (33 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'eal/ppc: remove the braces in memory barrier macros' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'mk: support renamed Makefile in external project' " Yuanhan Liu
                   ` (8 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From cb524bc20ad44a078110ee7b52a32ec090e378a1 Mon Sep 17 00:00:00 2001
From: Hemant Agrawal <hemant.agrawal@nxp.com>
Date: Thu, 25 Jan 2018 15:23:29 +0530
Subject: [PATCH] crypto/dpaa2_sec: fix enum conversion for GCM

[ upstream commit 681271e85809f2c0c8c0b81433ec00c832661d15 ]

dpaa2_sec/dpaa2_sec_dpseci.c:1287:25: error: implicit conversion from
enumeration type 'enum rte_crypto_aead_algorithm' to different enumeration
type 'enum rte_crypto_cipher_algorithm' [-Werror,-Wenum-conversion]
                session->cipher_alg = RTE_CRYPTO_AEAD_AES_GCM;

Fixes: 13273250eec5 ("crypto/dpaa2_sec: support AES-GCM and CTR")

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 9c64c5d..67fb6e2 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1309,7 +1309,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
 	case RTE_CRYPTO_AEAD_AES_GCM:
 		aeaddata.algtype = OP_ALG_ALGSEL_AES;
 		aeaddata.algmode = OP_ALG_AAI_GCM;
-		session->cipher_alg = RTE_CRYPTO_AEAD_AES_GCM;
+		session->aead_alg = RTE_CRYPTO_AEAD_AES_GCM;
 		break;
 	case RTE_CRYPTO_AEAD_AES_CCM:
 		RTE_LOG(ERR, PMD, "Crypto: Unsupported AEAD alg %u\n",
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
index 14e71df..8e58380 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
@@ -169,6 +169,7 @@ typedef struct dpaa2_sec_session_entry {
 	uint8_t dir;         /*!< Operation Direction */
 	enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/
 	enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/
+	enum rte_crypto_aead_algorithm aead_alg; /*!< AEAD Algorithm*/
 	union {
 		struct {
 			uint8_t *data;	/**< pointer to key data */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'mk: support renamed Makefile in external project' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (34 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix enum conversion for GCM' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/scheduler: fix strncpy' " Yuanhan Liu
                   ` (7 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Marko Kovacevic; +Cc: Vipin Varghese, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 2111436e1703fa6507640d9eff33396cb97ede53 Mon Sep 17 00:00:00 2001
From: Marko Kovacevic <marko.kovacevic@intel.com>
Date: Mon, 22 Jan 2018 10:59:05 +0000
Subject: [PATCH] mk: support renamed Makefile in external project

[ upstream commit 3a5c339d51a4846ee95a848bf493b7fcc80819dc ]

The build system made a recursive call to "make" after
creating the build directory. This recursive call used
the hard-coded filename "Makefile", which prevented
builds from working if the file was renamed and make
called using "make -f". Taking the filename from
MAKEFILES_LIST make variable fixes this.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Acked-by: Vipin Varghese <vipin.varghese@intel.com>
---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
index e2462fd..723c015 100644
--- a/mk/internal/rte.extvars.mk
+++ b/mk/internal/rte.extvars.mk
@@ -48,7 +48,7 @@ ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/$(firstword $(MAKEFILE_LIST))
 export RTE_EXTMK
 
 # RTE_SDK_BIN must point to .config, include/ and lib/.
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'crypto/scheduler: fix strncpy' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (35 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'mk: support renamed Makefile in external project' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port data reset timing' " Yuanhan Liu
                   ` (6 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: Fan Zhang, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From a8eae224c746b0fbb8d25cca5aafc6dc69842f1e Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Date: Mon, 29 Jan 2018 09:22:02 +0000
Subject: [PATCH] crypto/scheduler: fix strncpy

[ upstream commit 6af3b03547d7499e8875f7e32effba172140bbfe ]

The coverity issue was not completely fixed, since strncpy
should not be called with max length.
Instead, snprintf is used as a safer option.

Coverity issue: 143431
Fixes: d040aca67170 ("crypto/scheduler: fix strings not null terminated")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index df8634a..822ce27 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -467,8 +467,8 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
 				RTE_CRYPTODEV_NAME_MAX_LEN);
 		return -EINVAL;
 	}
-	strncpy(sched_ctx->name, scheduler->name,
-			RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
+	snprintf(sched_ctx->name, sizeof(sched_ctx->name), "%s",
+			scheduler->name);
 
 	if (strlen(scheduler->description) >
 			RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN - 1) {
@@ -477,8 +477,8 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
 				RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN - 1);
 		return -EINVAL;
 	}
-	strncpy(sched_ctx->description, scheduler->description,
-			RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN);
+	snprintf(sched_ctx->description, sizeof(sched_ctx->description), "%s",
+			scheduler->description);
 
 	/* load scheduler instance operations functions */
 	sched_ctx->ops.config_queue_pair = scheduler->ops->config_queue_pair;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'ethdev: fix port data reset timing' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (36 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/scheduler: fix strncpy' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port id allocation' " Yuanhan Liu
                   ` (5 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Matan Azrad; +Cc: Thomas Monjalon, Konstantin Ananyev, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 75b1eafa0332177df4c3dae9fe95a82eafbad6ea Mon Sep 17 00:00:00 2001
From: Matan Azrad <matan@mellanox.com>
Date: Mon, 22 Jan 2018 16:38:17 +0000
Subject: [PATCH] ethdev: fix port data reset timing

[ upstream commit 133b54779aa1a0071e67d73b0963d28ef28b41a5 ]

rte_eth_dev_data structure is allocated per ethdev port and can be
used to get a data of the port internally.

rte_eth_dev_attach_secondary tries to find the port identifier using
rte_eth_dev_data name field comparison and may get an identifier of
invalid port in case of this port was released by the primary process
because the port release API doesn't reset the port data.

So, it will be better to reset the port data in release time instead of
allocation time.

Move the port data reset to the port release API.

Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model")

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4f492e3..9dcb0d2 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -233,7 +233,6 @@ rte_eth_dev_allocate(const char *name)
 		return NULL;
 	}
 
-	memset(&rte_eth_dev_data[port_id], 0, sizeof(struct rte_eth_dev_data));
 	eth_dev = eth_dev_get(port_id);
 	snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
 	eth_dev->data->port_id = port_id;
@@ -279,6 +278,7 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
 	if (eth_dev == NULL)
 		return -EINVAL;
 
+	memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));
 	eth_dev->state = RTE_ETH_DEV_UNUSED;
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'ethdev: fix port id allocation' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (37 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port data reset timing' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-11  2:46   ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'app/testpmd: fix port validation' " Yuanhan Liu
                   ` (4 subsequent siblings)
  43 siblings, 1 reply; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Matan Azrad; +Cc: Konstantin Ananyev, Thomas Monjalon, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 67abe74f3c09e6f166902c9fc5f4d7f65f7b3007 Mon Sep 17 00:00:00 2001
From: Matan Azrad <matan@mellanox.com>
Date: Mon, 22 Jan 2018 16:38:18 +0000
Subject: [PATCH] ethdev: fix port id allocation

[ upstream commit 8ee892a2385c50427c03db5cef1789babceb5999 ]

rte_eth_dev_find_free_port() found a free port by state checking.
The state field are in local process memory, so other DPDK processes
may get the same port ID because their local states may be different.

Replace the state checking by the ethdev port name checking,
so, if the name is an empty string the port ID will be detected as
unused.

Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model")

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9dcb0d2..8ea85cd 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -192,8 +192,12 @@ rte_eth_dev_find_free_port(void)
 	unsigned i;
 
 	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-		if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED)
+		/* Using shared name field to find a free port. */
+		if (rte_eth_dev_data[i].name[0] == '\0') {
+			RTE_ASSERT(rte_eth_devices[i].state ==
+				   RTE_ETH_DEV_UNUSED);
 			return i;
+		}
 	}
 	return RTE_MAX_ETHPORTS;
 }
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'app/testpmd: fix port validation' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (38 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port id allocation' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/ixgbe: fix reset error handling' " Yuanhan Liu
                   ` (3 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 188fa9633efa97223e2cc62d183228f7305b05ef Mon Sep 17 00:00:00 2001
From: Matan Azrad <matan@mellanox.com>
Date: Tue, 30 Jan 2018 14:13:39 +0000
Subject: [PATCH] app/testpmd: fix port validation

[ upstream commit 1ae1b8c72d33a1d11ba82178c924ee7df3fd6c9a ]

rte_eth_dev_is_valid_port() API validates each valid port from ethdev
point of view and may validate ports which should not be used by the
application.

Testpmd should use only the ports available through the
RTE_ETH_FOREACH_DEV iterator.

Replace rte_eth_dev_is_valid_port() usage by RTE_ETH_FOREACH_DEV
iterator usage for testpmd ports validation.

Fixes: 7d89b2610353 ("app/testpmd: use ethdev iterator to list devices")

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 app/test-pmd/config.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8a2d30c..726c737 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -724,11 +724,14 @@ port_offload_cap_display(portid_t port_id)
 int
 port_id_is_invalid(portid_t port_id, enum print_warning warning)
 {
+	uint16_t pid;
+
 	if (port_id == (portid_t)RTE_PORT_ALL)
 		return 0;
 
-	if (rte_eth_dev_is_valid_port(port_id))
-		return 0;
+	RTE_ETH_FOREACH_DEV(pid)
+		if (port_id == pid)
+			return 0;
 
 	if (warning == ENABLED_WARN)
 		printf("Invalid port %d\n", port_id);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'net/ixgbe: fix reset error handling' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (39 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'app/testpmd: fix port validation' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'examples/bond: fix vdev name' " Yuanhan Liu
                   ` (2 subsequent siblings)
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Wei Zhao; +Cc: Wenzhuo Lu, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From bf54e2d0ac9b89a1c835e70286fc2d38dbaa4b5e Mon Sep 17 00:00:00 2001
From: Wei Zhao <wei.zhao1@intel.com>
Date: Mon, 29 Jan 2018 16:07:26 +0800
Subject: [PATCH] net/ixgbe: fix reset error handling

[ upstream commit f69166c9a3c968d5162af586b68b43df5fca4e34 ]

Add error handling for resetting HW.

Fixes: 0a45657a6794 ("pci: rework interrupt handling")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 1f3a60b..f219866 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5027,7 +5027,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	hw->mac.ops.reset_hw(hw);
+	err = hw->mac.ops.reset_hw(hw);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to reset vf hardware (%d)", err);
+		return err;
+	}
 	hw->mac.get_link_status = true;
 
 	/* negotiate mailbox API version to use with the PF. */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'examples/bond: fix vdev name' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (40 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'net/ixgbe: fix reset error handling' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix allocation check and leak' " Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'examples/bond: check mbuf allocation' " Yuanhan Liu
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Radu Nicolau; +Cc: Pablo de Lara, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 63152038b36ba75f7361d2b06c4d5aa0f4b50731 Mon Sep 17 00:00:00 2001
From: Radu Nicolau <radu.nicolau@intel.com>
Date: Thu, 25 Jan 2018 16:26:26 +0000
Subject: [PATCH] examples/bond: fix vdev name

[ upstream commit e6509c6cbb484f4a1f36ca4a71fd9d33ee42af2d ]

Fixes: 73db5bad ("net: align ethdev and eal driver names")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/bond/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 8e3b1f3..2b2a916 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -226,7 +226,7 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 	uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
 	uint16_t nb_txd = RTE_TX_DESC_DEFAULT;
 
-	retval = rte_eth_bond_create("bond0", BONDING_MODE_ALB,
+	retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB,
 			0 /*SOCKET_ID_ANY*/);
 	if (retval < 0)
 		rte_exit(EXIT_FAILURE,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'crypto/qat: fix allocation check and leak' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (41 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'examples/bond: fix vdev name' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  2018-02-01  9:47 ` [dpdk-stable] patch 'examples/bond: check mbuf allocation' " Yuanhan Liu
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Yong Wang; +Cc: Fiona Trahe, Ferruh Yigit, dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 2221b1a54e80b114c2dc2618ce1ea2aec213c6d4 Mon Sep 17 00:00:00 2001
From: Yong Wang <wang.yong19@zte.com.cn>
Date: Thu, 25 Jan 2018 01:53:04 -0500
Subject: [PATCH] crypto/qat: fix allocation check and leak

[ upstream commit 963898f0e316611df9dc2964d059b4e16835b95a ]

There are several func calls to rte_zmalloc() which don't do null
point check on the return value. And before return, the memory is not
freed. Fix it by adding null point check and rte_free().

Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")
Fixes: e09231eaa2af ("crypto/qat: add SGL capability")

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 10 ++++++++++
 drivers/crypto/qat/qat_qp.c                      | 10 +++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index db6c9a3..26f854c 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -359,6 +359,11 @@ static int qat_alg_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
 
 		in = rte_zmalloc("working mem for key",
 				ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ, 16);
+		if (in == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to alloc memory");
+			return -ENOMEM;
+		}
+
 		rte_memcpy(in, qat_aes_xcbc_key_seed,
 				ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ);
 		for (x = 0; x < HASH_XCBC_PRECOMP_KEY_NUM; x++) {
@@ -389,6 +394,11 @@ static int qat_alg_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
 				ICP_QAT_HW_GALOIS_E_CTR0_SZ);
 		in = rte_zmalloc("working mem for key",
 				ICP_QAT_HW_GALOIS_H_SZ, 16);
+		if (in == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to alloc memory");
+			return -ENOMEM;
+		}
+
 		memset(in, 0, ICP_QAT_HW_GALOIS_H_SZ);
 		if (AES_set_encrypt_key(auth_key, auth_keylen << 3,
 			&enc_key) != 0) {
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index ced3aa6..c02971e 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -180,6 +180,11 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 	qp->op_cookies = rte_zmalloc("qat PMD op cookie pointer",
 			qp_conf->nb_descriptors * sizeof(*qp->op_cookies),
 			RTE_CACHE_LINE_SIZE);
+	if (qp->op_cookies == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to alloc mem for cookie");
+		rte_free(qp);
+		return -ENOMEM;
+	}
 
 	qp->mmap_bar_addr = pci_dev->mem_resource[0].addr;
 	qp->inflights16 = 0;
@@ -221,7 +226,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 	for (i = 0; i < qp->nb_descriptors; i++) {
 		if (rte_mempool_get(qp->op_cookie_pool, &qp->op_cookies[i])) {
 			PMD_DRV_LOG(ERR, "QAT PMD Cannot get op_cookie");
-			return -EFAULT;
+			goto create_err;
 		}
 
 		struct qat_crypto_op_cookie *sql_cookie =
@@ -246,6 +251,9 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 	return 0;
 
 create_err:
+	if (qp->op_cookie_pool)
+		rte_mempool_free(qp->op_cookie_pool);
+	rte_free(qp->op_cookies);
 	rte_free(qp);
 	return -EFAULT;
 }
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [dpdk-stable] patch 'examples/bond: check mbuf allocation' has been queued to LTS release 17.11.1
  2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
                   ` (42 preceding siblings ...)
  2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix allocation check and leak' " Yuanhan Liu
@ 2018-02-01  9:47 ` Yuanhan Liu
  43 siblings, 0 replies; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-01  9:47 UTC (permalink / raw)
  To: Radu Nicolau; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to LTS release 17.11.1

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

Thanks.

	--yliu

---
>From 3d2804be6e883ed31fe41dc79a840dbee96eb29a Mon Sep 17 00:00:00 2001
From: Radu Nicolau <radu.nicolau@intel.com>
Date: Wed, 24 Jan 2018 13:16:46 +0000
Subject: [PATCH] examples/bond: check mbuf allocation

[ upstream commit 0bb76fc945e626941de2c6e881b69f4e4ef61478 ]

Coverity issue: 257008
Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/bond/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 2b2a916..4f533e2 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -446,6 +446,11 @@ static void cmd_obj_send_parsed(void *parsed_result,
 				(BOND_IP_3 << 16) | (BOND_IP_4 << 24);
 
 	created_pkt = rte_pktmbuf_alloc(mbuf_pool);
+	if (created_pkt == NULL) {
+		cmdline_printf(cl, "Failed to allocate mbuf\n");
+		return;
+	}
+
 	pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr);
 	created_pkt->data_len = pkt_size;
 	created_pkt->pkt_len = pkt_size;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [dpdk-stable] patch 'ethdev: fix port id allocation' has been queued to LTS release 17.11.1
  2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port id allocation' " Yuanhan Liu
@ 2018-02-11  2:46   ` Yuanhan Liu
  2018-02-11  6:40     ` Matan Azrad
  0 siblings, 1 reply; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-11  2:46 UTC (permalink / raw)
  To: Matan Azrad; +Cc: Konstantin Ananyev, Thomas Monjalon, dpdk stable

On Thu, Feb 01, 2018 at 05:47:54PM +0800, Yuanhan Liu wrote:
> Hi,
> 
> FYI, your patch has been queued to LTS release 17.11.1
> 
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
> It will be pushed if I get no objections before 02/03/18. So please
> shout if anyone has objections.

It introduced an crash at port allocation.
And I have now reverted it. Please do a backport if necessary.

Thanks.

	--yliu
> 
> ---
> >From 67abe74f3c09e6f166902c9fc5f4d7f65f7b3007 Mon Sep 17 00:00:00 2001
> From: Matan Azrad <matan@mellanox.com>
> Date: Mon, 22 Jan 2018 16:38:18 +0000
> Subject: [PATCH] ethdev: fix port id allocation
> 
> [ upstream commit 8ee892a2385c50427c03db5cef1789babceb5999 ]
> 
> rte_eth_dev_find_free_port() found a free port by state checking.
> The state field are in local process memory, so other DPDK processes
> may get the same port ID because their local states may be different.
> 
> Replace the state checking by the ethdev port name checking,
> so, if the name is an empty string the port ID will be detected as
> unused.
> 
> Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model")
> 
> Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 9dcb0d2..8ea85cd 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -192,8 +192,12 @@ rte_eth_dev_find_free_port(void)
>  	unsigned i;
>  
>  	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
> -		if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED)
> +		/* Using shared name field to find a free port. */
> +		if (rte_eth_dev_data[i].name[0] == '\0') {
> +			RTE_ASSERT(rte_eth_devices[i].state ==
> +				   RTE_ETH_DEV_UNUSED);
>  			return i;
> +		}
>  	}
>  	return RTE_MAX_ETHPORTS;
>  }
> -- 
> 2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [dpdk-stable] patch 'ethdev: fix port id allocation' has been queued to LTS release 17.11.1
  2018-02-11  2:46   ` Yuanhan Liu
@ 2018-02-11  6:40     ` Matan Azrad
  2018-02-11  6:54       ` Yuanhan Liu
  0 siblings, 1 reply; 49+ messages in thread
From: Matan Azrad @ 2018-02-11  6:40 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Konstantin Ananyev, Thomas Monjalon, dpdk stable

Ho Yuanhan

From: Yuanhan Liu. Sent: Sunday, February 11, 2018 4:47 AM
> On Thu, Feb 01, 2018 at 05:47:54PM +0800, Yuanhan Liu wrote:
> > Hi,
> >
> > FYI, your patch has been queued to LTS release 17.11.1
> >
> > Note it hasn't been pushed to
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpd
> k.org%2Fbrowse%2Fdpdk-
> stable&data=02%7C01%7Cmatan%40mellanox.com%7C1d21efdca33143ad70f
> 808d570f9b78f%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C63653
> 9140229336610&sdata=2Pgtg0sgIoqPmYRPirEjMi2dmJKVKyFljRZHGLIcz5M%3
> D&reserved=0 yet.
> > It will be pushed if I get no objections before 02/03/18. So please
> > shout if anyone has objections.
> 
> It introduced an crash at port allocation.
> And I have now reverted it. Please do a backport if necessary.
> 

Please read the commit log and let me know if it necessary for this version - some secondary scenarios may fail without this patch.
Please send me the crash details, maybe it exposes new bugs in the stable branch.


> Thanks.
> 
> 	--yliu
> >
> > ---
> > >From 67abe74f3c09e6f166902c9fc5f4d7f65f7b3007 Mon Sep 17 00:00:00
> > >2001
> > From: Matan Azrad <matan@mellanox.com>
> > Date: Mon, 22 Jan 2018 16:38:18 +0000
> > Subject: [PATCH] ethdev: fix port id allocation
> >
> > [ upstream commit 8ee892a2385c50427c03db5cef1789babceb5999 ]
> >
> > rte_eth_dev_find_free_port() found a free port by state checking.
> > The state field are in local process memory, so other DPDK processes
> > may get the same port ID because their local states may be different.
> >
> > Replace the state checking by the ethdev port name checking, so, if
> > the name is an empty string the port ID will be detected as unused.
> >
> > Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple
> > process model")
> >
> > Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > Acked-by: Thomas Monjalon <thomas@monjalon.net>
> > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > ---
> >  lib/librte_ether/rte_ethdev.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_ether/rte_ethdev.c
> > b/lib/librte_ether/rte_ethdev.c index 9dcb0d2..8ea85cd 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -192,8 +192,12 @@ rte_eth_dev_find_free_port(void)
> >  	unsigned i;
> >
> >  	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
> > -		if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED)
> > +		/* Using shared name field to find a free port. */
> > +		if (rte_eth_dev_data[i].name[0] == '\0') {
> > +			RTE_ASSERT(rte_eth_devices[i].state ==
> > +				   RTE_ETH_DEV_UNUSED);
> >  			return i;
> > +		}
> >  	}
> >  	return RTE_MAX_ETHPORTS;
> >  }
> > --
> > 2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [dpdk-stable] patch 'ethdev: fix port id allocation' has been queued to LTS release 17.11.1
  2018-02-11  6:40     ` Matan Azrad
@ 2018-02-11  6:54       ` Yuanhan Liu
  2018-02-11  7:15         ` Matan Azrad
  0 siblings, 1 reply; 49+ messages in thread
From: Yuanhan Liu @ 2018-02-11  6:54 UTC (permalink / raw)
  To: Matan Azrad; +Cc: Konstantin Ananyev, Thomas Monjalon, dpdk stable

On Sun, Feb 11, 2018 at 06:40:27AM +0000, Matan Azrad wrote:
> Ho Yuanhan
> 
> From: Yuanhan Liu. Sent: Sunday, February 11, 2018 4:47 AM
> > On Thu, Feb 01, 2018 at 05:47:54PM +0800, Yuanhan Liu wrote:
> > > Hi,
> > >
> > > FYI, your patch has been queued to LTS release 17.11.1
> > >
> > > Note it hasn't been pushed to
> > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpd
> > k.org%2Fbrowse%2Fdpdk-
> > stable&data=02%7C01%7Cmatan%40mellanox.com%7C1d21efdca33143ad70f
> > 808d570f9b78f%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C63653
> > 9140229336610&sdata=2Pgtg0sgIoqPmYRPirEjMi2dmJKVKyFljRZHGLIcz5M%3
> > D&reserved=0 yet.
> > > It will be pushed if I get no objections before 02/03/18. So please
> > > shout if anyone has objections.
> > 
> > It introduced an crash at port allocation.
> > And I have now reverted it. Please do a backport if necessary.
> > 
> 
> Please read the commit log and let me know if it necessary for this version - some secondary scenarios may fail without this patch.
> Please send me the crash details, maybe it exposes new bugs in the stable branch.

I didn't dig, the error happened at tring to access rte_eth_dev_data[0].name.

	if (rte_eth_dev_data[i].name[0] == '\0') {

What I observed is "rte_eth_dev_data" is NULL, looks like it haven't been
initiated yet.

	--yliu
> 
> 
> > Thanks.
> > 
> > 	--yliu
> > >
> > > ---
> > > >From 67abe74f3c09e6f166902c9fc5f4d7f65f7b3007 Mon Sep 17 00:00:00
> > > >2001
> > > From: Matan Azrad <matan@mellanox.com>
> > > Date: Mon, 22 Jan 2018 16:38:18 +0000
> > > Subject: [PATCH] ethdev: fix port id allocation
> > >
> > > [ upstream commit 8ee892a2385c50427c03db5cef1789babceb5999 ]
> > >
> > > rte_eth_dev_find_free_port() found a free port by state checking.
> > > The state field are in local process memory, so other DPDK processes
> > > may get the same port ID because their local states may be different.
> > >
> > > Replace the state checking by the ethdev port name checking, so, if
> > > the name is an empty string the port ID will be detected as unused.
> > >
> > > Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple
> > > process model")
> > >
> > > Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > > Acked-by: Thomas Monjalon <thomas@monjalon.net>
> > > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > > ---
> > >  lib/librte_ether/rte_ethdev.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/lib/librte_ether/rte_ethdev.c
> > > b/lib/librte_ether/rte_ethdev.c index 9dcb0d2..8ea85cd 100644
> > > --- a/lib/librte_ether/rte_ethdev.c
> > > +++ b/lib/librte_ether/rte_ethdev.c
> > > @@ -192,8 +192,12 @@ rte_eth_dev_find_free_port(void)
> > >  	unsigned i;
> > >
> > >  	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
> > > -		if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED)
> > > +		/* Using shared name field to find a free port. */
> > > +		if (rte_eth_dev_data[i].name[0] == '\0') {
> > > +			RTE_ASSERT(rte_eth_devices[i].state ==
> > > +				   RTE_ETH_DEV_UNUSED);
> > >  			return i;
> > > +		}
> > >  	}
> > >  	return RTE_MAX_ETHPORTS;
> > >  }
> > > --
> > > 2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [dpdk-stable] patch 'ethdev: fix port id allocation' has been queued to LTS release 17.11.1
  2018-02-11  6:54       ` Yuanhan Liu
@ 2018-02-11  7:15         ` Matan Azrad
  0 siblings, 0 replies; 49+ messages in thread
From: Matan Azrad @ 2018-02-11  7:15 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: Konstantin Ananyev, Thomas Monjalon, dpdk stable



From: Yuanhan Liu, Sent: Sunday, February 11, 2018 8:54 AM
> On Sun, Feb 11, 2018 at 06:40:27AM +0000, Matan Azrad wrote:
> > Ho Yuanhan
> >
> > From: Yuanhan Liu. Sent: Sunday, February 11, 2018 4:47 AM
> > > On Thu, Feb 01, 2018 at 05:47:54PM +0800, Yuanhan Liu wrote:
> > > > Hi,
> > > >
> > > > FYI, your patch has been queued to LTS release 17.11.1
> > > >
> > > > Note it hasn't been pushed to
> > >
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdp
> > > d
> > > k.org%2Fbrowse%2Fdpdk-
> > >
> stable&data=02%7C01%7Cmatan%40mellanox.com%7C1d21efdca33143ad70f
> > >
> 808d570f9b78f%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C63653
> > >
> 9140229336610&sdata=2Pgtg0sgIoqPmYRPirEjMi2dmJKVKyFljRZHGLIcz5M%3
> > > D&reserved=0 yet.
> > > > It will be pushed if I get no objections before 02/03/18. So
> > > > please shout if anyone has objections.
> > >
> > > It introduced an crash at port allocation.
> > > And I have now reverted it. Please do a backport if necessary.
> > >
> >
> > Please read the commit log and let me know if it necessary for this version -
> some secondary scenarios may fail without this patch.
> > Please send me the crash details, maybe it exposes new bugs in the stable
> branch.
> 
> I didn't dig, the error happened at tring to access
> rte_eth_dev_data[0].name.
> 
> 	if (rte_eth_dev_data[i].name[0] == '\0') {
> 
> What I observed is "rte_eth_dev_data" is NULL, looks like it haven't been
> initiated yet.
>

Yes, you right.
18.02 following patch (ethdev: add port ownership) took care of it.
So, I can backport it easily... will do it soon. 

 
> 	--yliu
> >
> >
> > > Thanks.
> > >
> > > 	--yliu
> > > >
> > > > ---
> > > > >From 67abe74f3c09e6f166902c9fc5f4d7f65f7b3007 Mon Sep 17
> 00:00:00
> > > > >2001
> > > > From: Matan Azrad <matan@mellanox.com>
> > > > Date: Mon, 22 Jan 2018 16:38:18 +0000
> > > > Subject: [PATCH] ethdev: fix port id allocation
> > > >
> > > > [ upstream commit 8ee892a2385c50427c03db5cef1789babceb5999 ]
> > > >
> > > > rte_eth_dev_find_free_port() found a free port by state checking.
> > > > The state field are in local process memory, so other DPDK
> > > > processes may get the same port ID because their local states may be
> different.
> > > >
> > > > Replace the state checking by the ethdev port name checking, so,
> > > > if the name is an empty string the port ID will be detected as unused.
> > > >
> > > > Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple
> > > > process model")
> > > >
> > > > Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > > > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > > > Acked-by: Thomas Monjalon <thomas@monjalon.net>
> > > > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > > > ---
> > > >  lib/librte_ether/rte_ethdev.c | 6 +++++-
> > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/lib/librte_ether/rte_ethdev.c
> > > > b/lib/librte_ether/rte_ethdev.c index 9dcb0d2..8ea85cd 100644
> > > > --- a/lib/librte_ether/rte_ethdev.c
> > > > +++ b/lib/librte_ether/rte_ethdev.c
> > > > @@ -192,8 +192,12 @@ rte_eth_dev_find_free_port(void)
> > > >  	unsigned i;
> > > >
> > > >  	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
> > > > -		if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED)
> > > > +		/* Using shared name field to find a free port. */
> > > > +		if (rte_eth_dev_data[i].name[0] == '\0') {
> > > > +			RTE_ASSERT(rte_eth_devices[i].state ==
> > > > +				   RTE_ETH_DEV_UNUSED);
> > > >  			return i;
> > > > +		}
> > > >  	}
> > > >  	return RTE_MAX_ETHPORTS;
> > > >  }
> > > > --
> > > > 2.7.4

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2018-02-11  7:15 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01  9:47 [dpdk-stable] patch 'event/sw: fix debug logging config option' has been queued to LTS release 17.11.1 Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'service: fix possible mem leak on initialize' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'cmdline: fix dynamic tokens parsing' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'cmdline: avoid garbage in unused fields of parsed result' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'keepalive: fix state alignment' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'log: fix memory leak in regexp level set' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'eal/arm64: remove the braces in memory barrier macros' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'mbuf: fix NULL freeing when debug enabled' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix out-of-bounds access' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix parameter type' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'cryptodev: fix session pointer cast' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix null auth algo overwrite' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix return value of start operation' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/enic: fix crash due to static max number of queues' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/e1000: fix null pointer check' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/i40e: fix memory leak' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix missing RSS capability' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix flow item validation' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region cache lookup' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region cache last index' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/mlx5: fix memory region boundary checks' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/ena: do not set Tx L4 offloads in Rx path' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio-user: fix crash as features change' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix Rx and Tx handler selection for ARM32' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix queue flushing with vector Rx enabled' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/virtio: fix memory leak when reinitializing device' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/i40e: fix VF Rx interrupt enabling' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/ixgbe: " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/e1000: " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/bnxt: fix size of Tx ring in HW' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/bnxt: fix number of pools for RSS' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: check tunnel L3 header' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: fix tunnel header size in Tx BD configuration' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/qede: fix MTU set and max Rx length' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'eal/ppc: remove the braces in memory barrier macros' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix enum conversion for GCM' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'mk: support renamed Makefile in external project' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/scheduler: fix strncpy' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port data reset timing' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'ethdev: fix port id allocation' " Yuanhan Liu
2018-02-11  2:46   ` Yuanhan Liu
2018-02-11  6:40     ` Matan Azrad
2018-02-11  6:54       ` Yuanhan Liu
2018-02-11  7:15         ` Matan Azrad
2018-02-01  9:47 ` [dpdk-stable] patch 'app/testpmd: fix port validation' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'net/ixgbe: fix reset error handling' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'examples/bond: fix vdev name' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'crypto/qat: fix allocation check and leak' " Yuanhan Liu
2018-02-01  9:47 ` [dpdk-stable] patch 'examples/bond: check mbuf allocation' " Yuanhan Liu

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).