netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Li Yang <leoli@freescale.com>
Cc: galak@kernel.crashing.org, davem@davemloft.net,
	mporter@kernel.crashing.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@ozlabs.org, netdev@vger.kernel.org,
	leoli@freescale.com, zw@zh-kernel.org
Subject: Re: [PATCH 4/6] rionet: add memory access to simulated Ethernet over rapidio
Date: Tue, 12 May 2009 15:10:29 -0700	[thread overview]
Message-ID: <20090512151029.bc2c99ac.akpm@linux-foundation.org> (raw)
In-Reply-To: <1242117363-14949-4-git-send-email-leoli@freescale.com>

On Tue, 12 May 2009 16:36:01 +0800
Li Yang <leoli@freescale.com> wrote:

> Through the newly added IO memory access of RapidIO, sender can
> write directly to recipient's rx buffer, either by cpu or DMA engine.
>
> ...
>
> +/* Definitions for rionet memory map driver */
> +#define RIONET_DRVID		0x101
> +#define RIONET_MAX_SK_DATA_SIZE	0x1000
> +#define RIONET_MEM_RIO_BASE	0x10000000
> +#define RIONET_TX_RX_BUFF_SIZE	(0x1000 * (128 + 128))
> +#define RIONET_QUEUE_NEXT(x)	(((x) < 127) ? ((x) + 1) : 0)

References its arg multiple times, hence is buggy or inefficient when
passed an expression with side-effects.

	static inline int rionet_queue_next(int x)

would be better.  Assuming that some sane identifier is used instead of
"x".

> +#define RIONET_QUEUE_INC(x)	(x = RIONET_QUEUE_NEXT(x))

It's pretty ugly to hide an assignment inside a macro like this.  Why
not do

	foo = rionet_queue_inc(foo);

at the callsites?  It makes it much clearer for the reader.


>
> ...
>
> +#ifdef CONFIG_RIONET_MEMMAP
> +static int rio_send_mem(struct sk_buff *skb,
> +				struct net_device *ndev, struct rio_dev *rdev)
> +{
> +	struct rionet_private *rnet = netdev_priv(ndev);
> +	int enqueue, dequeue;
> +
> +	if (!rdev)
> +		return -EFAULT;

Is that an appropriate error code?

>
> ...
>

  parent reply	other threads:[~2009-05-12 22:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12  8:35 [PATCH 1/6] rapidio: add common mapping APIs for RapidIO memory access Li Yang
2009-05-12  8:35 ` [PATCH 2/6] powerpc/fsl_rio: use LAW address from device tree Li Yang
2009-05-12  8:36   ` [PATCH 3/6] powerpc: add memory map support to Freescale RapidIO block Li Yang
2009-05-12  8:36     ` [PATCH 4/6] rionet: add memory access to simulated Ethernet over rapidio Li Yang
2009-05-12  8:36       ` [PATCH 5/6] rio: warn_unused_result warnings fix Li Yang
2009-05-12  8:36         ` [PATCH 6/6] rio: fix section mismatch Li Yang
2009-05-13 22:08           ` Kumar Gala
2009-05-12 22:11         ` [PATCH 5/6] rio: warn_unused_result warnings fix Andrew Morton
2009-06-11  4:34         ` Kumar Gala
2009-05-12 22:10       ` Andrew Morton [this message]
2009-05-12 22:05     ` [PATCH 3/6] powerpc: add memory map support to Freescale RapidIO block Andrew Morton
2009-05-21 10:43       ` Li Yang
2009-05-13 22:08   ` [PATCH 2/6] powerpc/fsl_rio: use LAW address from device tree Kumar Gala
2009-06-11  4:13 ` [PATCH 1/6] rapidio: add common mapping APIs for RapidIO memory access Kumar Gala
2009-06-11  9:47   ` Li Yang-R58472
2009-06-11 13:32     ` Kumar Gala
2009-06-12 13:27       ` Li Yang
2009-06-12 13:58         ` Kumar Gala
2009-06-15 10:38           ` Li Yang

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=20090512151029.bc2c99ac.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=galak@kernel.crashing.org \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mporter@kernel.crashing.org \
    --cc=netdev@vger.kernel.org \
    --cc=zw@zh-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).