patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 01/20] net/ena/base: use min/max macros with type conversion
       [not found] <20200917053035.1889989-1-mk@semihalf.com>
@ 2020-09-17  5:30 ` Michal Krawczyk
  2020-09-17  5:30 ` [dpdk-stable] [PATCH 02/20] net/ena/base: specify operations of rte_delay Michal Krawczyk
  2020-09-17  5:30 ` [dpdk-stable] [PATCH 05/20] net/ena/base: fix release of wait event Michal Krawczyk
  2 siblings, 0 replies; 3+ messages in thread
From: Michal Krawczyk @ 2020-09-17  5:30 UTC (permalink / raw)
  To: dev
  Cc: gtzalik, igorch, Michal Krawczyk, stable, Marcin Wojtas,
	Evgeny Schemeilin

Usage of RTE_MIN(MAX) in ENA_MIN32, ENA_MIN16, ENA_MIN8 (and same for
the MAX), was not enough, as the HAL code is assuming that those macros
will conver both arguments to the specified uintX_t type.

As RTE_MIN(MAX) is using 'typeof' operator, the behavior won't be the
same, especially if arguments has different types (and it could cause
compilation warnings).

To satisfy that, the ENA_MIN_T and ENA_MAX_T macros were added, which
are converting both arguments to the type which is being passed as an
argument.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
---
 drivers/net/ena/base/ena_plat_dpdk.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 595967e6e3..ba7a098f59 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -86,12 +86,14 @@ extern int ena_logtype_com;
 #define ENA_ASSERT(cond, format, arg...) do {} while (0)
 #endif
 
-#define ENA_MAX32(x, y) RTE_MAX((x), (y))
-#define ENA_MAX16(x, y) RTE_MAX((x), (y))
-#define ENA_MAX8(x, y) RTE_MAX((x), (y))
-#define ENA_MIN32(x, y) RTE_MIN((x), (y))
-#define ENA_MIN16(x, y) RTE_MIN((x), (y))
-#define ENA_MIN8(x, y) RTE_MIN((x), (y))
+#define ENA_MAX_T(type, x, y) RTE_MAX((type)(x), (type)(y))
+#define ENA_MAX32(x, y) ENA_MAX_T(uint32_t, (x), (y))
+#define ENA_MAX16(x, y) ENA_MAX_T(uint16_t, (x), (y))
+#define ENA_MAX8(x, y) ENA_MAX_T(uint8_t, (x), (y))
+#define ENA_MIN_T(type, x, y) RTE_MIN((type)(x), (type)(y))
+#define ENA_MIN32(x, y) ENA_MIN_T(uint32_t, (x), (y))
+#define ENA_MIN16(x, y) ENA_MIN_T(uint16_t, (x), (y))
+#define ENA_MIN8(x, y) ENA_MIN_T(uint8_t, (x), (y))
 
 #define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)
 #define U64_C(x) x ## ULL
-- 
2.25.1


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

* [dpdk-stable] [PATCH 02/20] net/ena/base: specify operations of rte_delay
       [not found] <20200917053035.1889989-1-mk@semihalf.com>
  2020-09-17  5:30 ` [dpdk-stable] [PATCH 01/20] net/ena/base: use min/max macros with type conversion Michal Krawczyk
@ 2020-09-17  5:30 ` Michal Krawczyk
  2020-09-17  5:30 ` [dpdk-stable] [PATCH 05/20] net/ena/base: fix release of wait event Michal Krawczyk
  2 siblings, 0 replies; 3+ messages in thread
From: Michal Krawczyk @ 2020-09-17  5:30 UTC (permalink / raw)
  To: dev
  Cc: gtzalik, igorch, Michal Krawczyk, stable, Marcin Wojtas,
	Evgeny Schemeilin

ENA_MSLEEP() and ENA_UDELAY() were expecting different behavior - the
first one is expecting driver to sleep, while the other, to busy wait.

For both cases, the rte_delay_(u|m)s() function was used, which could
be either sleep or block, depending on the configuration.

To make the macros valid, the operations should be specified directly.
Because of that, the rte_delay_us_sleep() and rte_delay_us_block() are
now being used.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
---
 drivers/net/ena/base/ena_plat_dpdk.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index ba7a098f59..d9b728c4d6 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -56,8 +56,8 @@ typedef uint64_t dma_addr_t;
 
 #define ENA_ABORT() abort()
 
-#define ENA_MSLEEP(x) rte_delay_ms(x)
-#define ENA_UDELAY(x) rte_delay_us(x)
+#define ENA_MSLEEP(x) rte_delay_us_sleep(x * 1000)
+#define ENA_UDELAY(x) rte_delay_us_block(x)
 
 #define ENA_TOUCH(x) ((void)(x))
 #define memcpy_toio memcpy
-- 
2.25.1


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

* [dpdk-stable] [PATCH 05/20] net/ena/base: fix release of wait event
       [not found] <20200917053035.1889989-1-mk@semihalf.com>
  2020-09-17  5:30 ` [dpdk-stable] [PATCH 01/20] net/ena/base: use min/max macros with type conversion Michal Krawczyk
  2020-09-17  5:30 ` [dpdk-stable] [PATCH 02/20] net/ena/base: specify operations of rte_delay Michal Krawczyk
@ 2020-09-17  5:30 ` Michal Krawczyk
  2 siblings, 0 replies; 3+ messages in thread
From: Michal Krawczyk @ 2020-09-17  5:30 UTC (permalink / raw)
  To: dev
  Cc: gtzalik, igorch, Michal Krawczyk, stable, Marcin Wojtas,
	Evgeny Schemeilin

The wait event is being accessed without making sure it the completion
context exists. The check for that is just below, so it could be used
for releasing wait even safely.

Fixes: 3adcba9a8987 ("net/ena: update HAL to the newer version")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
---
 drivers/net/ena/base/ena_com.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index b4e54318c6..ce239ab164 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -1655,11 +1655,13 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev)
 	struct ena_com_aenq *aenq = &ena_dev->aenq;
 	u16 size;
 
-	ENA_WAIT_EVENT_DESTROY(admin_queue->comp_ctx->wait_event);
-	if (admin_queue->comp_ctx)
+	if (admin_queue->comp_ctx) {
+		ENA_WAIT_EVENT_DESTROY(admin_queue->comp_ctx->wait_event);
 		ENA_MEM_FREE(ena_dev->dmadev,
 			     admin_queue->comp_ctx,
 			     (admin_queue->q_depth * sizeof(struct ena_comp_ctx)));
+	}
+
 	admin_queue->comp_ctx = NULL;
 	size = ADMIN_SQ_SIZE(admin_queue->q_depth);
 	if (sq->entries)
-- 
2.25.1


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

end of thread, other threads:[~2020-09-17  5:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200917053035.1889989-1-mk@semihalf.com>
2020-09-17  5:30 ` [dpdk-stable] [PATCH 01/20] net/ena/base: use min/max macros with type conversion Michal Krawczyk
2020-09-17  5:30 ` [dpdk-stable] [PATCH 02/20] net/ena/base: specify operations of rte_delay Michal Krawczyk
2020-09-17  5:30 ` [dpdk-stable] [PATCH 05/20] net/ena/base: fix release of wait event Michal Krawczyk

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