From patchwork Thu Sep 17 05:30:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Krawczyk X-Patchwork-Id: 77961 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ABBEFA04B6; Thu, 17 Sep 2020 07:30:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 277B01D52D; Thu, 17 Sep 2020 07:30:53 +0200 (CEST) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id 40DAC1D51B for ; Thu, 17 Sep 2020 07:30:50 +0200 (CEST) Received: by mail-lf1-f68.google.com with SMTP id b22so741880lfs.13 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=icuNfxNdx72LkFVGfFUCf9Tifg9ICqjhPyqM9oRIpEFMee+yHTuoDT3xoclm8pTikz tz5tNo9Q7SZJcRivlITEKTUA8sHzo9LsW9y2PasG4GoFJuQxibTLTeLBkmWW4SyvHQMY CSYm451BJSMSdoVYDAa6hOFbpFRMe8asWw885VfgsiEFKVkchfDhcBj37ORYn76mDUFr R476B+dMV7pmF5zV8B40o0suFvKTjIiCS7HA6J39FpUnZ4GsbjqhAcGU6Mzdx8Esl2AE I2FUqysB2YppPod5n8gS55dKAN5Yu8zOHXyVUpW3llRNYJ7ZbJ4+hdCKKJIBvK9dVrgv q7/A== X-Gm-Message-State: AOAM533YyElFZMGR9Y05HF4K50Er80NkVXXm672pxmjGkXfj5rLjETy7 tlh711Ro7K5NMXk/cSGoHB3JrwW9AlxQ4IxT 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 Subject: [dpdk-dev] [PATCH 01/20] net/ena/base: use min/max macros with type conversion X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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