From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9925BA04B6 for ; Thu, 17 Sep 2020 07:30:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 611881D532; Thu, 17 Sep 2020 07:30:54 +0200 (CEST) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 2653C1D508 for ; Thu, 17 Sep 2020 07:30:50 +0200 (CEST) Received: by mail-lf1-f66.google.com with SMTP id y2so752915lfy.10 for ; Wed, 16 Sep 2020 22:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ixuVkmusewtM4rTnFY+1VAqwyLLxdGwKpPRz1hHfcS0=; b=EmIPu4xRMvLZu0s0nQrUa71qC3DtntP24wlfkzN2zIIbDgDGZvro1q+U+JaZsbSp6K ei2v0AJtqHa4XSdnK8d/LSErbo3siKcSfKB2VC+/djYBCK/7uv9DIigNwokQJIGSDWLe 7Rd9w4JMNGNxhRNIex3JIdX80fO9glX9FXBZ/J599++uwVYESgb7v7zHBkgxUNytVGl2 e+2QsrzT3V38H2icRqWBFo0lZImPtdGAe5ZxIVxxBkMI6bP2sRv9SidoyLVhTxlbUc+W LYOfzFPPOq2TeIBn5hY0TcVjA+VCESx5RA4c7hwtjNwk853U9fB9LoOPLbULmQCk9dYO BQAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ixuVkmusewtM4rTnFY+1VAqwyLLxdGwKpPRz1hHfcS0=; b=mtrYxA03FYVvGhx/MAX7OJnVwcoi7lSNL7Nu/MpqFbTkNJqajVIq6fF6igVLywN5fo yxc/pmA8wQQ1Q6Y+ugIE4tzU2s9Sb4SAtR39FMPL3XlZo1KuQquJepkwT6vWiG1/9EN3 ZOVHNXf8NplfqcifpR5MwoJEbgkHyi1CGUAwTWPLDMCw6glSnGAisTqbDXUtOIYj+6Sb UJIxgVeoG/vHbGOACnM9eYbBwVkJUgEgnftJm+TC63He+WC2jPssaQvIGUJwyViK5pGh x/Z5J6TxfPYISxIxqf78Kz98SbZb2PB1kK44XRCMab3clqT0dC2lgi5s+ZXGoXFmpA2d +/dQ== X-Gm-Message-State: AOAM532fnb/k7Ypp7Keu8hhrG/tdb7uX25VNkSYRRxJiQg/SsshYhdVz cAkXw/lJyO/MbWysO6K2FD4VYA== X-Google-Smtp-Source: ABdhPJxIAIklINiQNHAPGnhxiBiTtgHwTpmWdK9hD0wxeJLPkx1f+mQ4fgfy4kznYT7mfvfl7Y6fuQ== X-Received: by 2002:a19:a41a:: with SMTP id q26mr9461873lfc.467.1600320649577; Wed, 16 Sep 2020 22:30:49 -0700 (PDT) Received: from mkPC.semihalf.local (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id j3sm5033686lfb.185.2020.09.16.22.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 22:30:48 -0700 (PDT) From: Michal Krawczyk To: dev@dpdk.org Cc: gtzalik@amazon.com, igorch@amazon.com, Michal Krawczyk , stable@dpdk.org, Marcin Wojtas , Evgeny Schemeilin Date: Thu, 17 Sep 2020 07:30:16 +0200 Message-Id: <20200917053035.1889989-2-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917053035.1889989-1-mk@semihalf.com> References: <20200917053035.1889989-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH 01/20] net/ena/base: use min/max macros with type conversion X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 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) #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