DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>,
	 Devendra Singh Rawat <dsinghrawat@marvell.com>,
	Alok Prasad <palok@marvell.com>, Rosen Xu <rosen.xu@intel.com>
Subject: Re: [PATCH v2 2/3] drivers: use common min/max macros
Date: Sun, 18 Feb 2024 18:13:03 -0800	[thread overview]
Message-ID: <CACZ4nhs=PWpWXCqrEY=LkBJ0UQ7KdFnqj2LWDLQkjwUr-DA4kA@mail.gmail.com> (raw)
In-Reply-To: <20240216102454.4156609-3-david.marchand@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3502 bytes --]

On Fri, Feb 16, 2024 at 2:25 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Use newly introduced macro.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  drivers/net/bnxt/bnxt_ethdev.c                   | 12 +-----------
>  drivers/net/qede/base/bcm_osal.h                 |  6 ++----
>  drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++---------
>  3 files changed, 5 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 45d840d7af..8cc012206a 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)
>
>  #define bnxt_roundup(x, y)   ((((x) + ((y) - 1)) / (y)) * (y))
>
> -#define min_t(type, x, y) ({                    \
> -       type __min1 = (x);                      \
> -       type __min2 = (y);                      \
> -       __min1 < __min2 ? __min1 : __min2; })
> -
> -#define max_t(type, x, y) ({                    \
> -       type __max1 = (x);                      \
> -       type __max2 = (y);                      \
> -       __max1 > __max2 ? __max1 : __max2; })
> -
> -#define clamp_t(type, _x, min, max)     min_t(type, max_t(type, _x, min), max)
> +#define clamp_t(type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min, type), max, type)
>
>  int bnxt_alloc_ctx_mem(struct bnxt *bp)
>  {
> diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
> index 11019b5623..7869103c63 100644
> --- a/drivers/net/qede/base/bcm_osal.h
> +++ b/drivers/net/qede/base/bcm_osal.h
> @@ -443,10 +443,8 @@ u32 qede_osal_log2(u32);
>  #define OSAL_IOMEM volatile
>  #define OSAL_UNUSED    __rte_unused
>  #define OSAL_UNLIKELY(x)  __builtin_expect(!!(x), 0)
> -#define OSAL_MIN_T(type, __min1, __min2)       \
> -       ((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2))
> -#define OSAL_MAX_T(type, __max1, __max2)       \
> -       ((type)(__max1) > (type)(__max2) ? (type)(__max1) : (type)(__max2))
> +#define OSAL_MIN_T(type, __min1, __min2) RTE_MIN_T(__min1, __min2, type)
> +#define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1, __max2, type)
>
>  void qede_get_mcp_proto_stats(struct ecore_dev *, enum ecore_mcp_protocol_type,
>                               union ecore_mcp_protocol_stats *);
> diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> index 62c5666ca9..427793a578 100644
> --- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> +++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> @@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype;
>  #define min(a, b) RTE_MIN(a, b)
>  #define max(a, b) RTE_MAX(a, b)
>
> -#define min_t(type, x, y) ({                    \
> -       type __min1 = (x);                      \
> -       type __min2 = (y);                      \
> -       __min1 < __min2 ? __min1 : __min2; })
> -
> -#define max_t(type, x, y) ({                    \
> -       type __max1 = (x);                      \
> -       type __max2 = (y);                      \
> -       __max1 > __max2 ? __max1 : __max2; })
> +#define min_t(type, x, y) RTE_MIN_T(x, y, type)
> +#define max_t(type, x, y) RTE_MAX_T(x, y, type)
>
>  #define spinlock_t rte_spinlock_t
>  #define spinlock_init(x) rte_spinlock_init(x)
> --
> 2.43.0
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

  parent reply	other threads:[~2024-02-19  2:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
2023-11-15 23:02 ` [PATCH 1/4] lib: add extension " Tyler Retzlaff
2023-11-15 23:02 ` [PATCH 2/4] app: " Tyler Retzlaff
2023-11-15 23:02 ` [PATCH 3/4] drivers: " Tyler Retzlaff
2023-11-20  7:42   ` Ruifeng Wang
2023-11-15 23:02 ` [PATCH 4/4] examples: " Tyler Retzlaff
2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
2024-02-16 10:24   ` [PATCH v2 1/3] eal: add helper to skip whitespaces David Marchand
2024-02-16 10:27     ` David Marchand
2024-02-16 10:39       ` Bruce Richardson
2024-02-16 10:24   ` [PATCH v2 2/3] drivers: use common min/max macros David Marchand
2024-02-19  1:37     ` Xu, Rosen
2024-02-19  2:13     ` Ajit Khaparde [this message]
2024-02-16 10:24   ` [PATCH v2 3/3] add extension keyword to GCC statement expressions David Marchand
2024-02-18  3:07     ` fengchengwen
2024-02-16 17:04   ` [PATCH v2 0/3] add __extension__ keyword to " David Marchand

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to='CACZ4nhs=PWpWXCqrEY=LkBJ0UQ7KdFnqj2LWDLQkjwUr-DA4kA@mail.gmail.com' \
    --to=ajit.khaparde@broadcom.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dsinghrawat@marvell.com \
    --cc=palok@marvell.com \
    --cc=rosen.xu@intel.com \
    --cc=somnath.kotur@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).