Thread (20 messages) flat view 20 messages, 6 authors, 2016-08-11

Re: [PATCH RESEND] net: can: Introduce MEN 16Z192-00 CAN controller driver

From: Benjamin Poirier <hidden>
Date: 2016-08-09 03:24:02
Also in: linux-can, lkml

On 2016/08/08 09:26, Andreas Werner wrote:
[...]
quoted
quoted
+
+	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help