patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Michal Krawczyk <>
	Michal Krawczyk <>,, Marcin Wojtas <>,
	Evgeny Schemeilin <>
Subject: [dpdk-stable] [PATCH 01/20] net/ena/base: use min/max macros with type conversion
Date: Thu, 17 Sep 2020 07:30:16 +0200
Message-ID: <> (raw)
In-Reply-To: <>

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

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")

Signed-off-by: Michal Krawczyk <>
Reviewed-by: Igor Chauskin <>
Reviewed-by: Guy Tzalik <>
 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)
-#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 U64_C(x) x ## ULL

       reply	other threads:[~2020-09-17  5:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2020-09-17  5:30 ` Michal Krawczyk [this message]
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

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:

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

  git send-email \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone