All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Werner <andreas.werner@men.de>
To: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: Andreas Werner <andreas.werner@men.de>,
	wg@grandegger.com, mkl@pengutronix.de, linux-can@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, jthumshirn@suse.de, andy@wernerandy.de
Subject: Re: [PATCH RESEND] net: can: Introduce MEN 16Z192-00 CAN controller driver
Date: Tue, 9 Aug 2016 08:11:21 +0200	[thread overview]
Message-ID: <20160809061121.GD1733@awelinux> (raw)
In-Reply-To: <20160809032355.fzbdpudsqg2bdn27@f1.synalogic.ca>

On Mon, Aug 08, 2016 at 08:23:55PM -0700, Benjamin Poirier wrote:
> On 2016/08/08 09:26, Andreas Werner wrote:
> [...]
> > > > +
> > > > +	if (cf->can_dlc > 0)
> > > > +		data[0] = be32_to_cpup((__be32 *)(cf->data));
> > > > +	if (cf->can_dlc > 3)
> > > > +		data[1] = be32_to_cpup((__be32 *)(cf->data + 4));
> > > > +
> > > > +	writel(id, &cf_buf->can_id);
> > > > +	writel(cf->can_dlc, &cf_buf->length);
> > > > +
> > > > +	if (!(cf->can_id & CAN_RTR_FLAG)) {
> > > > +		writel(data[0], &cf_buf->data[0]);
> > > > +		writel(data[1], &cf_buf->data[1]);
> > > > +
> > > > +		stats->tx_bytes += cf->can_dlc;
> > > > +	}
> > > > +
> > > > +	/* be sure everything is written to the
> > > > +	 * device before acknowledge the data.
> > > > +	 */
> > > > +	mmiowb();
> > > > +
> > > > +	/* trigger the transmission */
> > > > +	men_z192_ack_tx_pkg(priv, 1);
> > > > +
> > > > +	stats->tx_packets++;
> > > > +
> > > > +	kfree_skb(skb);
> > > 
> > > What prevents the skb data to be freed/reused before the device has
> > > accessed it?
> 
> I'm sorry, I hadn't realized that all of the data (all 8 bytes of it!)
> is written directly to the device. I was thinking about ethernet devices
> that dma packet data.

Ah ok :-)
I thought you just want me to free the skb earlier.

Regards
Andy

WARNING: multiple messages have this Message-ID (diff)
From: Andreas Werner <andreas.werner@men.de>
To: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: Andreas Werner <andreas.werner@men.de>, <wg@grandegger.com>,
	<mkl@pengutronix.de>, <linux-can@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<davem@davemloft.net>, <jthumshirn@suse.de>, <andy@wernerandy.de>
Subject: Re: [PATCH RESEND] net: can: Introduce MEN 16Z192-00 CAN controller driver
Date: Tue, 9 Aug 2016 08:11:21 +0200	[thread overview]
Message-ID: <20160809061121.GD1733@awelinux> (raw)
In-Reply-To: <20160809032355.fzbdpudsqg2bdn27@f1.synalogic.ca>

On Mon, Aug 08, 2016 at 08:23:55PM -0700, Benjamin Poirier wrote:
> On 2016/08/08 09:26, Andreas Werner wrote:
> [...]
> > > > +
> > > > +	if (cf->can_dlc > 0)
> > > > +		data[0] = be32_to_cpup((__be32 *)(cf->data));
> > > > +	if (cf->can_dlc > 3)
> > > > +		data[1] = be32_to_cpup((__be32 *)(cf->data + 4));
> > > > +
> > > > +	writel(id, &cf_buf->can_id);
> > > > +	writel(cf->can_dlc, &cf_buf->length);
> > > > +
> > > > +	if (!(cf->can_id & CAN_RTR_FLAG)) {
> > > > +		writel(data[0], &cf_buf->data[0]);
> > > > +		writel(data[1], &cf_buf->data[1]);
> > > > +
> > > > +		stats->tx_bytes += cf->can_dlc;
> > > > +	}
> > > > +
> > > > +	/* be sure everything is written to the
> > > > +	 * device before acknowledge the data.
> > > > +	 */
> > > > +	mmiowb();
> > > > +
> > > > +	/* trigger the transmission */
> > > > +	men_z192_ack_tx_pkg(priv, 1);
> > > > +
> > > > +	stats->tx_packets++;
> > > > +
> > > > +	kfree_skb(skb);
> > > 
> > > What prevents the skb data to be freed/reused before the device has
> > > accessed it?
> 
> I'm sorry, I hadn't realized that all of the data (all 8 bytes of it!)
> is written directly to the device. I was thinking about ethernet devices
> that dma packet data.

Ah ok :-)
I thought you just want me to free the skb earlier.

Regards
Andy

  reply	other threads:[~2016-08-09  6:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  9:16 [PATCH RESEND] net: can: Introduce MEN 16Z192-00 CAN controller driver Andreas Werner
2016-07-26  9:16 ` Andreas Werner
2016-08-08  3:58 ` Benjamin Poirier
2016-08-08  7:26   ` Andreas Werner
2016-08-08  7:26     ` Andreas Werner
2016-08-09  3:23     ` Benjamin Poirier
2016-08-09  6:11       ` Andreas Werner [this message]
2016-08-09  6:11         ` Andreas Werner
2016-08-08  9:27 ` Wolfgang Grandegger
2016-08-08 11:39   ` Andreas Werner
2016-08-08 11:39     ` Andreas Werner
2016-08-08 12:28     ` Wolfgang Grandegger
2016-08-08 13:06       ` Kurt Van Dijck
2016-08-08 14:12         ` Andreas Werner
2016-08-08 14:12           ` Andreas Werner
2016-08-08 14:05       ` Andreas Werner
2016-08-08 14:05         ` Andreas Werner
2016-08-08 14:35         ` Wolfgang Grandegger
2016-08-09  6:10           ` Andreas Werner
2016-08-09  6:10             ` Andreas Werner
2016-08-09 11:54             ` Wolfgang Grandegger
2016-08-10 20:28             ` Oliver Hartkopp
2016-08-11  7:14               ` Andreas Werner
2016-08-11  7:14                 ` Andreas Werner
2016-08-11  8:45                 ` Oliver Hartkopp
2016-08-11  8:58                   ` Andreas Werner
2016-08-11  8:58                     ` Andreas Werner
2016-08-11 11:46                     ` Oliver Hartkopp
2016-08-09  9:35 ` Ramesh Shanmugasundaram

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=20160809061121.GD1733@awelinux \
    --to=andreas.werner@men.de \
    --cc=andy@wernerandy.de \
    --cc=benjamin.poirier@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jthumshirn@suse.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.