public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Shreyas Bhatewara <sbhatewara@vmware.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Pankaj Thakkar <pthakkar@vmware.com>,
	"pv-drivers@vmware.com" <pv-drivers@vmware.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>
Subject: Re: [Pv-drivers] RFC: Network Plugin Architecture (NPA) for vmxnet3
Date: Wed, 14 Jul 2010 14:06:06 -0700	[thread overview]
Message-ID: <20100714210606.GA29786@kroah.com> (raw)
In-Reply-To: <alpine.LRH.2.00.1007141335570.12881@localhost.localdomain>

On Wed, Jul 14, 2010 at 01:42:59PM -0700, Shreyas Bhatewara wrote:
> +/* vmkernel and device backend shared definitions */
> +
> +#define VMXNET3_PLUGIN_NAME_LEN  256
> +#define VMXNET3_PLUGIN_REPOSITORY "/usr/lib/vmware/npa_plugins"

Why would the kernel care about this file path?  And since when do we
hard-code file paths in the kernel in the first place (yeah, in some
places we do, but not like this...)

> +#define NPA_MEMIO_REGIONS_u64X    6
> +
> +typedef u32 VF_ID;
> +
> +struct Vmxnet3_VFInfo {
> +	char     pluginName[VMXNET3_PLUGIN_NAME_LEN];

This is never used.

> +	u32   deviceInfo[VMXNET3_PLUGIN_INFO_LEN];	/* opaque data returned
> +							 * by PF driver */

This is happily copied around and zeroed out, but never actually used by
anything.


> +	u64       memioAddr;
> +	u32   memioLen;

This field is never used.

Why have fields in a structure that are never used?

> +};

<...>

> +/*
> + * Easy shell API calling macros.
> + */
> +#define Shell_AllocSmallBuffer(_state, _handle, _ringOffset)		\
> +	((_state)->shellApi.allocSmallBuffer((_handle), (_ringOffset)))
> +#define Shell_AllocLargeBuffer(_state, _handle, _ringOffset)		\
> +	((_state)->shellApi.allocLargeBuffer((_handle), (_ringOffset)))
> +#define Shell_FreeBuffer(_state, _handle, _ringOffset)			\
> +	((_state)->shellApi.freeBuffer((_handle), (_ringOffset)))
> +#define Shell_CompleteSend(_state, _handle, _numPkt)			\
> +	((_state)->shellApi.completeSend((_handle), (_numPkt)))
> +#define Shell_IndicateRecv(_state, _handle, _frame)			\
> +	((_state)->shellApi.indicateRecv((_handle), (_frame)))
> +#define Shell_Log(_state, _loglevel, _n, _fmt, ...)			\
> +	do {								\
> +		if (logEnabled && (_loglevel) <= (u32)logLevel) {	\
> +			(_state)->shellApi.log((_n) + 1,		\
> +					"%s: " _fmt,		\
> +					__func__,		\
> +##__VA_ARGS__);		\
> +		}							\
> +	} while (0)


This hiding of functions kind of implies that something odd is going on
here, right?  At the least, make them inline functions so you get the
proper typechecking warnings/errors in a format that you can understand.

> +/*
> + * Some standard definitions
> + */
> +#ifndef NULL
> +#define NULL (void *)0
> +#endif

What's wrong with the kernel-provided version of this?

> +/*
> + * Utility macro to write a register's value (BAR0)
> + */
> +#define VMXNET3_WRITE_REG(_state, _offset, _value)		\
> +	(*(u32 *)((u8 *)(_state)->memioAddr + (_offset)) =	\
> +	(_value))

This will never work, sorry.  Please use the proper functions for doing
this type of access.  I'm amazed that anyone even thought this would
succeed...

> +/*
> + * Utility macro to align a virtual address
> + */
> +#define ALIGN_VA(_ptr, _align) ((void *)(((uintptr_t)(_ptr) + ((_align) - 1)) &\
> +			~((_align) - 1)))

What's wrong with the kernel provided function for this?

Anyway, just randomly poking at the code like this turns up these types
of trivial issues, has this code ever been run?

wierd,

greg k-h

  reply	other threads:[~2010-07-14 21:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-04 23:02 RFC: Network Plugin Architecture (NPA) for vmxnet3 Pankaj Thakkar
2010-05-05  0:05 ` Stephen Hemminger
2010-05-05  0:18   ` Pankaj Thakkar
2010-05-05  0:32     ` David Miller
2010-05-05  0:38       ` Pankaj Thakkar
2010-05-05  2:44     ` Stephen Hemminger
2010-05-05  0:58 ` Chris Wright
2010-05-05 19:00   ` Pankaj Thakkar
2010-05-05 17:23 ` Christoph Hellwig
2010-05-05 17:29   ` [Pv-drivers] " Dmitry Torokhov
2010-05-05 17:31     ` Christoph Hellwig
2010-05-05 17:35       ` Dmitry Torokhov
2010-05-05 17:39         ` Christoph Hellwig
2010-05-05 17:47           ` Pankaj Thakkar
2010-05-05 20:09             ` Arnd Bergmann
2010-05-05 20:36               ` Dmitry Torokhov
2010-05-05 21:53                 ` Arnd Bergmann
2010-05-05 22:05                   ` Shreyas Bhatewara
2010-05-06  2:03                     ` Scott Feldman
2010-05-06  7:25                       ` Shreyas Bhatewara
2010-05-06  7:25                       ` Shreyas Bhatewara
2010-05-06  8:19             ` Gleb Natapov
2010-05-06 18:04               ` Pankaj Thakkar
2010-05-06 20:19                 ` Christoph Hellwig
2010-05-06 20:17             ` Christoph Hellwig
2010-05-05 17:52           ` Stephen Hemminger
2010-05-06 20:21             ` Christoph Hellwig
2010-07-13  3:06               ` Shreyas Bhatewara
2010-07-13  5:16                 ` Stephen Hemminger
2010-07-14  0:31                 ` Stephen Hemminger
2010-07-14  9:49                 ` Greg KH
2010-07-14 17:18                   ` Pankaj Thakkar
2010-07-14 17:54                     ` David Miller
2010-07-14 18:03                       ` Jeremy Fitzhardinge
2010-07-14 20:20                     ` Greg KH
2010-07-14 17:19                   ` Shreyas Bhatewara
2010-07-14 20:42                   ` Shreyas Bhatewara
2010-07-14 21:06                     ` Greg KH [this message]
2010-05-05 17:59 ` Avi Kivity
2010-05-05 19:44   ` Pankaj Thakkar
2010-05-06  8:58     ` Avi Kivity
2010-05-10 20:46       ` Pankaj Thakkar

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=20100714210606.GA29786@kroah.com \
    --to=greg@kroah.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pthakkar@vmware.com \
    --cc=pv-drivers@vmware.com \
    --cc=sbhatewara@vmware.com \
    --cc=shemminger@vyatta.com \
    --cc=virtualization@lists.linux-foundation.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