mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Wilson <msw@amzn.com>
To: David Miller <davem@davemloft.net>
Cc: netanel@annapurnalabs.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, zorik@annapurnalabs.com,
	saeed@annapurnalabs.com, alex@annapurnalabs.com,
	aliguori@amazon.com, antoine.tenart@free-electrons.com
Subject: Re: [PATCH net-next] net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)
Date: Tue, 14 Jun 2016 23:23:36 -0700	[thread overview]
Message-ID: <20160615062336.GA26911@u54ee753d2d1854bda401.ant.amazon.com> (raw)
In-Reply-To: <20160614.222516.1192717052949905017.davem@davemloft.net>

On Tue, Jun 14, 2016 at 10:25:16PM -0700, David Miller wrote:
> From: Netanel Belgazal <netanel@annapurnalabs.com>
> Date: Mon, 13 Jun 2016 11:46:13 +0300
> 
> > +#define ena_trc_dbg(format, arg...) \
> > +	pr_debug("[ENA_COM: %s] " format, __func__, ##arg)
> > +#define ena_trc_info(format, arg...) \
> > +	pr_info("[ENA_COM: %s] " format, __func__, ##arg)
> > +#define ena_trc_warn(format, arg...) \
> > +	pr_warn("[ENA_COM: %s] " format, __func__, ##arg)
> > +#define ena_trc_err(format, arg...) \
> > +	pr_err("[ENA_COM: %s] " format, __func__, ##arg)
> 
> These custom tracing macros are quite inappropriate.
> 
> We have the function tracer in the kernel when that is needed.  So spitting
> out __func__ all over the place is not something that should be found in
> drivers these days.

Point taken, though existing drivers (even fairly popular ones) also
aren't as clean as you might like. A quick look around...

msw@carbon:~/git/upstream/linux$ git grep -B1 '__func__' drivers/net/ethernet/ | grep -A1 '#define' 
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h-#define BNX2X_ERROR(fmt, ...)	    			    	     \
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h:	    pr_err("[%s:%d]" fmt, __func__, __LINE__, ##__VA_ARGS__)
[...]
drivers/net/ethernet/intel/ixgb/ixgb_osdep.h:#define ENTER() pr_debug("%s\n", __func__);

Like many other network drivers, some of this is common code used for
non-Linux systems, and that's why there is some overlap with Linux
facilities. For example, here's the common ENA parts as it's situated
in DPDK as a PMD:

   http://dpdk.org/browse/dpdk/tree/drivers/net/ena/base/ena_com.c

When you compare to the DPDK version you can see that the common code
has already been contextualized for Linux in this patch in
anticipation of this type of feedback. (e.g., ENA_SPINLOCK_LOCK() ->
spin_lock_irqsave(), etc., as that would obviously never fly).

The Linux-specific bits (ena_netdev.c, ena_ethtool.c, etc.) don't make
use of any of the overlapping functionality needed for the common
code.

> And one can modify pr_fmt do make pr_debug et al. have whatever prefix
> one wants.

Yup, that's an easy improvement.

> I suspect there will be several rounds of review to weed out things
> like this.  You can preempt a lot of that by removing as much in your
> driver that the kernel has existing facilities for.

Are there other things that jump out at you? I felt like this was
pretty good for an initial submission in terms of striking a balance
between using a portable core while avoiding a lot of compatibility
shims.

--msw

  reply	other threads:[~2016-06-15  6:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13  8:46 Netanel Belgazal
2016-06-13 20:36 ` Matt Wilson
2016-06-15  5:25 ` David Miller
2016-06-15  6:23   ` Matt Wilson [this message]
2016-06-15  6:27     ` David Miller
2016-06-15  6:40       ` Matt Wilson
2016-06-15 18:07 ` Matt Wilson
2016-06-15 18:22   ` Matt Wilson
     [not found]     ` <CAO+Uck_mkRmhkFedb1FsbvuEFFebhYEfYb1UqM+VGSFfKFWN0Q@mail.gmail.com>
2016-06-15 18:39       ` Matt Wilson
2016-06-16 17:55 ` Benjamin Poirier
2016-06-16 18:06   ` Ben Hutchings
2016-06-18  6:16     ` Matt Wilson
2016-06-16 20:46 ` Francois Romieu
2016-06-17  1:09   ` Matt Wilson
2016-06-20 15:18     ` Netanel Belgazal
2016-06-17 21:11 ` Francois Romieu
2016-06-20 15:32   ` Netanel Belgazal
2016-06-20 22:43     ` Francois Romieu
2016-06-21 10:02       ` Netanel Belgazal
2016-06-20  5:20 ` Rosen, Rami
2016-06-20 15:42   ` Netanel Belgazal

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=20160615062336.GA26911@u54ee753d2d1854bda401.ant.amazon.com \
    --to=msw@amzn.com \
    --cc=alex@annapurnalabs.com \
    --cc=aliguori@amazon.com \
    --cc=antoine.tenart@free-electrons.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netanel@annapurnalabs.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@annapurnalabs.com \
    --cc=zorik@annapurnalabs.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

all inboxes | Powered by JetHome®