DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Gaetan Rivet <gaetan.rivet@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] net/failsafe: safer subdev iterator
Date: Thu, 17 Aug 2017 17:39:29 -0700	[thread overview]
Message-ID: <20170817173929.4f8951c3@xeon-e3> (raw)
In-Reply-To: <1502985129-7461-1-git-send-email-gaetan.rivet@6wind.com>

On Thu, 17 Aug 2017 17:52:09 +0200
Gaetan Rivet <gaetan.rivet@6wind.com> wrote:

> The sub_device iterator macro should follow the general gist of the
> tailq API for an easier understanding and safer use.
> 
> Once the loop has finished, the iterator should be set to NULL.
> If no sub_device was iterated upon, the iterator should still be NULL.
> 
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
>  drivers/net/failsafe/failsafe_private.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
> index 0361cf4..6fa8de5 100644
> --- a/drivers/net/failsafe/failsafe_private.h
> +++ b/drivers/net/failsafe/failsafe_private.h
> @@ -222,6 +222,7 @@ extern int mac_from_arg;
>   */
>  #define FOREACH_SUBDEV_STATE(s, i, dev, state)				\
>  	for (i = fs_find_next((dev), 0, state);				\
> +	     ((s = NULL) == NULL) &&					\
I assume you are trying to do assignment inside an expression and  just expect that
to always to be true and go onto next part of assignment. This is a convulted
way to put code in the loop iterator.

But this macro is way too complex. Please break it up into inline functions or
figure out how to simplify the logic better.

  reply	other threads:[~2017-08-18  0:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 15:52 Gaetan Rivet
2017-08-18  0:39 ` Stephen Hemminger [this message]
2017-08-18  7:43   ` Gaëtan Rivet
2017-08-23 13:05 ` [dpdk-dev] [PATCH v2] " Gaetan Rivet
2017-08-28 12:30   ` Ferruh Yigit

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=20170817173929.4f8951c3@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=gaetan.rivet@6wind.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).