Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: tariqt@mellanox.com
Cc: netdev@vger.kernel.org, eranbe@mellanox.com
Subject: Re: [PATCH net-next 0/4] mlx4 misc for 4.16
Date: Thu, 28 Dec 2017 12:28:41 -0500 (EST)	[thread overview]
Message-ID: <20171228.122841.875412773096063390.davem@davemloft.net> (raw)
In-Reply-To: <1514471171-3894-1-git-send-email-tariqt@mellanox.com>

From: Tariq Toukan <tariqt@mellanox.com>
Date: Thu, 28 Dec 2017 16:26:07 +0200

> This patchset contains misc cleanups and improvements
> to the mlx4 Core and Eth drivers.
> 
> In patches 1 and 2 I reduce and reorder the branches in the RX csum flow.
> In patch 3 I align the FMR unmapping flow with the device spec, to allow
>   a remapping afterwards.
> Patch 4 by Moni changes the default QoS settings so that a pause
>   frame stops all traffic regardless of its prio.
> 
> Series generated against net-next commit:
> 836df24a7062 net: hns3: hns3_get_channels() can be static

Series applied, thanks Tariq.

I can't say that that ipv6 ifdef you added in patch #1 is the nicest.

It's one thing to ifdef control entire blocks of code, or individual
values.

It's another thing to partially include pieces of code structure
such as closing parenthesis, arithmetic operators, and curly braces.
Two of those were included in the ifdef section.

For example, if we have:

	if (x & (IPV4_THING | IPV6_THING)) {

I don't want to see:

	if (x & (IPV4_THING |
#ifdef IPV6_TEST
		 IPV6_THING)) {
#else
		 0)) {
#endif

Those closing parenthesis and the openning curly brace are there
regardless of the CPP test, and duplicating them in both arms of
the CPP test only makes the code more confusing to read.

I can say I would prefer:

	if (x & (IPV4_THING |
#ifdef IPV6_TEST
		 IPV6_THING
#else
		 0
#endif
		 )) {

which is better.  However, best would be:

#ifdef IPV6_TEST
#define THING_MASK	IPV4_THING | IPV6_THING
#else
#define THING_MASK	IPV4_THING
#endif

	if (x & THING_MASK) {

is the best.

  parent reply	other threads:[~2017-12-28 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 14:26 [PATCH net-next 0/4] mlx4 misc for 4.16 Tariq Toukan
2017-12-28 14:26 ` [PATCH net-next 1/4] net/mlx4_en: RX csum, remove redundant branches and checks Tariq Toukan
2017-12-28 14:26 ` [PATCH net-next 2/4] net/mlx4_en: RX csum, reorder branches Tariq Toukan
2017-12-28 14:26 ` [PATCH net-next 3/4] net/mlx4_core: Cleanup FMR unmapping flow Tariq Toukan
2017-12-28 14:26 ` [PATCH net-next 4/4] net/mlx4_en: Change default QoS settings Tariq Toukan
2017-12-28 17:28 ` David Miller [this message]
2017-12-31  8:29   ` [PATCH net-next 0/4] mlx4 misc for 4.16 Tariq Toukan

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=20171228.122841.875412773096063390.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@mellanox.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