netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>,
	"Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, mcgrof@frijolero.org,
	qca-linux-team@qualcomm.com, nic-devel@qualcomm.com,
	kgiori@qca.qualcomm.com, chris.snook@gmail.com,
	mathieu@qca.qualcomm.com, bryanh@quicinc.com
Subject: Re: [PATCH] net: add QCA alx Ethernet driver
Date: Thu, 01 Mar 2012 16:56:19 -0800	[thread overview]
Message-ID: <1330649779.23314.80.camel@joe2Laptop> (raw)
In-Reply-To: <20120301234007.GA18488@electric-eye.fr.zoreil.com>

On Fri, 2012-03-02 at 00:40 +0100, Francois Romieu wrote:
> Stephen Hemminger <shemminger@vyatta.com> :
> [...]
> > Evolution is better. The new driver has lots of new callbacks to handle
> > the fact it is dealing with two different chipsets. Not only that your callbacks
> > are built at runtime which leads to security concerns.
> > 
> > There is a reason the two Marvell based drivers (skge and sky2) are
> > different drivers. Having to do extra per-chip callbacks is a clear sign
> > the driver should be split in two.
> 
> (arguable)
[]
> > +void alx_hw_printk(const char *level, const struct alx_hw *hw,
> > +		   const char *fmt, ...)
> > +{
> > +	struct va_format vaf;
> > +	va_list args;
> > +
> > +	va_start(args, fmt);
> > +	vaf.fmt = fmt;
> > +	vaf.va = &args;
> > +
> > +	if (hw && hw->adpt && hw->adpt->netdev)
> > +		__netdev_printk(level, hw->adpt->netdev, &vaf);
> > +	else
> > +		printk("%salx_hw: %pV", level, &vaf);
> > +
> > +	va_end(args);
> > +}
> 
> Designing a new logging facility smells like being unable to figure
> the current context.
> 
> And the printk does not even use KERN_... :o(

Sure it does.

level is the first argument and is emitted as %s

> > +/*
> > + *  alx_validate_mac_addr - Validate MAC address
> > + */
> > +static int alx_validate_mac_addr(u8 *mac_addr)
> > +{
> > +	int retval = 0;
> > +
> > +	if (mac_addr[0] & 0x01) {
> > +		printk(KERN_DEBUG "MAC address is multicast\n");
> > +		retval = -EADDRNOTAVAIL;
> > +	} else if (mac_addr[0] == 0xff && mac_addr[1] == 0xff) {
> > +		printk(KERN_DEBUG "MAC address is broadcast\n");
> > +		retval = -EADDRNOTAVAIL;
> > +	} else if (mac_addr[0] == 0 && mac_addr[1] == 0 &&
> > +		   mac_addr[2] == 0 && mac_addr[3] == 0 &&
> > +		   mac_addr[4] == 0 && mac_addr[5] == 0) {
> > +		printk(KERN_DEBUG "MAC address is all zeros\n");
> > +		retval = -EADDRNOTAVAIL;
> > +	}
> > +	return retval;
> > +}
> 
> Bloat. It should use is_valid_ether_addr.

I sent patches already.
It's also out of order, testing multicast then broadcast
instead of the reverse.

  reply	other threads:[~2012-03-02  0:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29  1:50 [PATCH] net: add QCA alx Ethernet driver Luis R. Rodriguez
2012-02-29  1:50 ` [PATCH] net: add new QCA alx ethernet driver which supercedes atl1c Luis R. Rodriguez
2012-02-29  1:58   ` David Miller
2012-02-29  1:53 ` [PATCH] net: add QCA alx Ethernet driver David Miller
2012-02-29  2:12   ` Luis R. Rodriguez
2012-02-29  2:15     ` David Miller
2012-02-29  2:19     ` Huang, Xiong
2012-02-29  2:28       ` David Miller
2012-02-29  3:11         ` Huang, Xiong
2012-02-29  3:32           ` David Miller
2012-02-29  7:30             ` Huang, Xiong
2012-02-29  9:38               ` Luis R. Rodriguez
2012-03-22  1:28             ` Luis R. Rodriguez
2012-03-22  9:27               ` Francois Romieu
2012-03-22 13:38                 ` Luis R. Rodriguez
2012-03-30 17:10               ` Luis R. Rodriguez
2012-03-30 20:45                 ` David Miller
2012-03-30 20:52                   ` Luis R. Rodriguez
2012-02-29  3:32 ` Stephen Hemminger
2012-03-01 23:40   ` Francois Romieu
2012-03-02  0:56     ` Joe Perches [this message]
2012-02-29  3:52 ` Joe Perches
     [not found] ` <CAA93jw4NwHaLazxK2Eo6a6TuvF3svqdZjTpHUwOyEHv-Q=busQ@mail.gmail.com>
2012-03-30 18:31   ` Luis R. Rodriguez

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=1330649779.23314.80.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=bryanh@quicinc.com \
    --cc=chris.snook@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kgiori@qca.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu@qca.qualcomm.com \
    --cc=mcgrof@frijolero.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic-devel@qualcomm.com \
    --cc=qca-linux-team@qualcomm.com \
    --cc=rodrigue@qca.qualcomm.com \
    --cc=romieu@fr.zoreil.com \
    --cc=shemminger@vyatta.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;
as well as URLs for NNTP newsgroup(s).