From: David Miller <davem@davemloft.net>
To: jassisinghbrar@gmail.com
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
arnd.bergmann@linaro.org, andrew@lunn.ch,
ard.biesheuvel@linaro.org, robh+dt@kernel.org,
mark.rutland@arm.com, masami.hiramatsu@linaro.org,
jaswinder.singh@linaro.org
Subject: Re: [PATCHv5 2/3] net: socionext: Add Synquacer NetSec driver
Date: Wed, 03 Jan 2018 10:35:46 -0500 (EST) [thread overview]
Message-ID: <20180103.103546.528269429969753470.davem@davemloft.net> (raw)
In-Reply-To: <1514783689-4352-1-git-send-email-jassisinghbrar@gmail.com>
From: jassisinghbrar@gmail.com
Date: Mon, 1 Jan 2018 10:44:49 +0530
> +#define DRING_TAIL(r) ((r)->tail)
> +
> +#define DRING_HEAD(r) ((r)->head)
These macros do not help readability at all.
> +#define MOVE_TAIL(r) do { \
> + if (++(r)->tail == DESC_NUM) \
> + (r)->tail = 0; \
> + } while (0)
> +
> +#define MOVE_HEAD(r) do { \
> + if (++(r)->head == DESC_NUM) \
> + (r)->head = 0; \
> + } while (0)
> +
> +#define JUMP_HEAD(r, n) do { \
> + int i; \
> + for (i = 0; i < (n); i++) \
> + MOVE_HEAD(r); \
> + } while (0)
Neither do these.
And JUMP_HEAD is so inefficient, it's a constant time calculation:
r->head += n;
if (r->head >= DESC_NUM)
r->head -= DESC_NUM;
All of this stuff can be done inline without all of these CPP macros
which are discouraged, have multiple evaluation issues, and decrease
the amount of type checking going on.
If you absolutely must have helpers, use static functions (without
the inline keyword, let the compiler device).
> +static inline int available_descs(struct netsec_desc_ring *r)
No inline functions in foo.c files, let the compiler device.
> +/*************************************************************/
> +/*********************** NETDEV_OPS **************************/
> +/*************************************************************/
Please, comments are not billboards or Star Wars openning sequences.
Simplify this, thank you.
> +
> +static void netsec_set_tx_de(struct netsec_priv *priv,
> + struct netsec_desc_ring *dring,
> + const struct netsec_tx_pkt_ctrl *tx_ctrl,
> + const struct netsec_desc *desc,
> + struct sk_buff *skb)
> +{
> + struct netsec_de *de;
> + int idx = DRING_HEAD(dring);
> + u32 attr;
Please order local variables from longest to shortest line.
Please audit your entire submission for this issue.
Thank you.
next prev parent reply other threads:[~2018-01-03 15:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-01 5:12 [PATCHv5 0/3] Socionext Synquacer NETSEC driver jassisinghbrar
[not found] ` <1514783559-4226-1-git-send-email-jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-01 5:14 ` [PATCHv5 1/3] dt-bindings: net: Add DT bindings for Socionext Netsec jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w
2018-01-03 20:48 ` Rob Herring
2018-01-03 21:37 ` Ard Biesheuvel
2018-01-05 16:41 ` Jassi Brar
2018-01-01 5:14 ` [PATCHv5 2/3] net: socionext: Add Synquacer NetSec driver jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w
2018-01-03 15:35 ` David Miller [this message]
2018-01-05 16:53 ` Jassi Brar
2018-01-01 5:15 ` [PATCHv5 3/3] MAINTAINERS: Add entry for Socionext ethernet driver jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w
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=20180103.103546.528269429969753470.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=andrew@lunn.ch \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd.bergmann@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=jaswinder.singh@linaro.org \
--cc=mark.rutland@arm.com \
--cc=masami.hiramatsu@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
/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).