Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: maheshb@google.com
Cc: netdev@vger.kernel.org, edumazet@google.com, maze@google.com,
	chavey@google.com, thockin@google.com,
	brandon.philips@coreos.com, xemul@parallels.com
Subject: Re: [PATCH net-next v2] ipvlan: Initial check-in of the IPVLAN driver.
Date: Tue, 18 Nov 2014 15:54:37 -0500 (EST)	[thread overview]
Message-ID: <20141118.155437.1582768084232091503.davem@davemloft.net> (raw)
In-Reply-To: <1416205634-26611-1-git-send-email-maheshb@google.com>

From: Mahesh Bandewar <maheshb@google.com>
Date: Sun, 16 Nov 2014 22:27:14 -0800

> +/* Define IPVL_DEBUG and set the appropriate dbg_level for debugging. */
> +#ifdef	IPVL_DEBUG
> +/*
> + * 1 : non-datapath debugging
> + * 2 : Custom
> + * 3 : function enters and exists.
> + * 4 : printk in data path (be careful!)
> + */
> +#define IPVL_DBG_LEVEL 1
> +#define ipvlan_dbg(level, msg...)	do { \
> +						if (level <= IPVL_DBG_LEVEL) \
> +						printk(KERN_DEBUG msg); \
> +					} while (0)
> +#else
> +#define ipvlan_dbg(level, msg...) do { ; } while (0)
> +#endif

The day of having code use custom local debug logging facilities is long
gone, please use a standard mechanism for this rather than home cooked
reimplementations.

> +/* ---- Prototype declarations ---- */
> +/* ---- ipvlan_main.c ---- */

Everone knows these are prototype declarations by virtue of them being
functions declarations in a header file.

Anyone who wants to know where these are defined can run grep.

So these comments are superfluous, please remove them across this
entire submission.

> +	const struct in_addr *ip4_addr = iaddr;
> +	return jhash_1word(ip4_addr->s_addr, ipvlan_jhash_secret)
> +	       & IPVLAN_HASH_MASK;

When an expression spans multiple lines, lines end rather than begin
with an operator.

> +		if (is_v6 && addr->atype == IPVL_IPV6 &&
> +			ipv6_addr_equal(&addr->ip6addr, iaddr))

For multi-line if() statements, the second line and subsequent lines
must begine exactly at the first column after the openning parenthesis
of the first line.

If you are purely using TAB characters to indent, you are likely doing
it wrong.
> +		if ((is_v6 && addr->atype == IPVL_IPV6 &&
> +		     ipv6_addr_equal(&addr->ip6addr, iaddr))
> +		   || (!is_v6 && addr->atype == IPVL_IPV4 &&
> +		      addr->ip4addr.s_addr == ((struct in_addr *)iaddr)->s_addr)

Lines end, not begin, with operators.

> --- /dev/null
> +++ b/drivers/net/ipvlan/ipvlan_sysfs.c

Please do not add sysfs configuration knobs, netlink is sufficient.

  reply	other threads:[~2014-11-18 20:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17  6:27 [PATCH net-next v2] ipvlan: Initial check-in of the IPVLAN driver Mahesh Bandewar
2014-11-18 20:54 ` David Miller [this message]
2014-11-19  5:27   ` Mahesh Bandewar
2014-11-19  5:48     ` David Miller
2014-11-21  1:20     ` Ben Hutchings
2014-11-21  6:38       ` Mahesh Bandewar

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=20141118.155437.1582768084232091503.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=brandon.philips@coreos.com \
    --cc=chavey@google.com \
    --cc=edumazet@google.com \
    --cc=maheshb@google.com \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=thockin@google.com \
    --cc=xemul@parallels.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