DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Slava Ovsiienko <viacheslavo@nvidia.com>
Cc: Raslan Darawsheh <rasland@nvidia.com>,
	Matan Azrad <matan@nvidia.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix debug variable initialization
Date: Thu, 4 Nov 2021 13:31:44 +0000	[thread overview]
Message-ID: <BYAPR12MB263198F2DC8373E1E8ECCC16A58D9@BYAPR12MB2631.namprd12.prod.outlook.com> (raw)
In-Reply-To: <7341638d-8682-8ebf-13b8-d57b7d938f4d@intel.com>

Hello Ferruh,

I posted updated patch in https://patchwork.dpdk.org/project/dpdk/patch/20211104132853.31403-1-getelson@nvidia.com/

Regards,
Gregory

> 
> On 11/4/2021 12:23 PM, Gregory Etelson wrote:
> > Use `__rte_unused` macro to mask a debug
> variable instead of `#ifdef`.
> > This way, if the variable is used in a macro, it
> does not depend on
> > how the macro is expanded.
> >
> > Fixes: 91f0e029ce5f ("net/mlx5: translate flex
> item pattern into matcher")
> > Signed-off-by: Gregory Etelson
> <getelson@nvidia.com>
> > ---
> >   drivers/net/mlx5/mlx5_flow_flex.c | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_flex.c
> b/drivers/net/mlx5/mlx5_flow_flex.c
> > index bdfa383c45..be0f9821ce 100644
> > --- a/drivers/net/mlx5/mlx5_flow_flex.c
> > +++ b/drivers/net/mlx5/mlx5_flow_flex.c
> > @@ -222,9 +222,7 @@
> mlx5_flex_flow_translate_item(struct
> rte_eth_dev *dev,
> >                             const struct rte_flow_item
> *item,
> >                             bool is_inner)
> >   {
> > -#ifdef RTE_LIBRTE_MLX5_DEBUG
> > -     struct mlx5_priv *priv = dev->data-
> >dev_private;
> > -#endif
> > +     __rte_unused struct mlx5_priv *priv =
> dev->data->dev_private;
> 
> Marking the variable as unused to silence
> compiler for some cases,
> but it is indeed used, what about something like
> this (inspired by
> sfc code):
> 
>   #if defined(RTE_LIBRTE_MLX5_DEBUG) ||
> defined(RTE_ENABLE_ASSERT)
>     struct mlx5_priv *priv = dev->data-
> >dev_private;
>   #endif
> 
> >       const struct rte_flow_item_flex *spec,
> *mask;
> >       void *misc4_m =
> MLX5_ADDR_OF(fte_match_param, matcher,
> >                                    misc_parameters_4);
> >


  reply	other threads:[~2021-11-04 13:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 12:23 Gregory Etelson
2021-11-04 12:31 ` Ferruh Yigit
2021-11-04 13:31   ` Gregory Etelson [this message]
2021-11-04 13:28 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
2021-11-04 14:00   ` Raslan Darawsheh

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=BYAPR12MB263198F2DC8373E1E8ECCC16A58D9@BYAPR12MB2631.namprd12.prod.outlook.com \
    --to=getelson@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=viacheslavo@nvidia.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).