Devicetree
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Joe Perches <joe@perches.com>,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Mischa Jonker <Mischa.Jonker@synopsys.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	"David S. Miller" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree-discuss@lists.ozlabs.org"
	<devicetree-discuss@lists.ozlabs.org>
Subject: Re: [PATCH v3] ethernet/arc/arc_emac - Add new driver
Date: Fri, 14 Jun 2013 21:27:04 +0200	[thread overview]
Message-ID: <20130614192704.GA4857@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <4881796E12491D4BB15146FE0209CE643F5E3A07@DE02WEMBXB.internal.synopsys.com>

Alexey Brodkin <Alexey.Brodkin@synopsys.com> :
> On 06/14/2013 02:20 AM, Francois Romieu wrote:
[...]
> >> +struct arc_emac_priv {
> >> +	struct net_device_stats stats;
> >> +	unsigned int clock_frequency;
> >> +	unsigned int max_speed;
> >> +
> >> +	/* Pointers to BD rings - CPU side */
> >> +	struct arc_emac_bd_t *rxbd;
> >
> > There does not seem to be much need for rxbd->data.
> 
> Could you please clarify this comment? Not clear what do you mean.

Rx and Tx use the same struct but they don't work the same.
They could/should use differents struct.

[...]
> > The descriptor entry is left unchanged. Afaiu the driver will move to the
> > next descriptor and crash on dereferencing NULL (rx_buff->)skb next time
> > it wraps.
> >
> > I suggest avoiding holes: don't netif_receive_skb if you can't alloc a new
> > skb.
> 
> Frankly I cannot understand how "don't netif_receive_skb" for one of the 
> received packets helps to prevent crash on the next iteration?
> And I don't see a way to return any error state from NAPI poll handler.
> Could you please clarify your idea?

The driver assigns the otherwise-netif_received skb to the current rx
descriptor as if it was a newly allocated one. The driver increases
stats.rx_dropped. The rx descriptor ring doesn't ever exhibit a hole.

[...]
> >> +static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
> >> +{
> >> +	struct arc_emac_priv *priv = netdev_priv(ndev);
> >> +	unsigned int info, len, *txbd_curr = &priv->txbd_curr;
> >> +	dma_addr_t addr;
> >> +	char *pkt = skb->data;
> >> +
> >> +	len = max_t(unsigned int, ETH_ZLEN, skb->len);
> >
> > The device automatically pads, right ?
> 
> What do you mean here?

Does the device fill a smaller than 64 bytes packet with zeroes or may
the driver leak information ? The driver should use skb_pad if the
latter applies.

-- 
Ueimor

  reply	other threads:[~2013-06-14 19:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-13 14:37 [PATCH v3] ethernet/arc/arc_emac - Add new driver Alexey Brodkin
2013-06-13 18:25 ` Andy Shevchenko
     [not found]   ` <CAHp75Vf4zjtebbaQMp4L0EmUPDVyrNPfvLODo7gHBuBEsWmZeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-13 18:33     ` Joe Perches
2013-06-13 19:16       ` Andy Shevchenko
2013-06-13 19:54       ` David Miller
2013-06-13 19:42   ` Francois Romieu
2013-06-13 20:25   ` Alexey Brodkin
2013-06-13 20:50     ` Andy Shevchenko
2013-06-13 21:48       ` Alexey Brodkin
2013-06-13 22:19 ` Francois Romieu
2013-06-14 14:14   ` Alexey Brodkin
2013-06-14 19:27     ` Francois Romieu [this message]
2013-06-15  8:51       ` Alexey Brodkin
2013-06-15 11:12         ` Francois Romieu

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=20130614192704.GA4857@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Mischa.Jonker@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=rob.herring@calxeda.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