linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] for C_CAN driver.
@ 2013-11-25 14:48 Holger Bechtold
  0 siblings, 0 replies; only message in thread
From: Holger Bechtold @ 2013-11-25 14:48 UTC (permalink / raw)
  To: wg, mkl; +Cc: linux-can

Hello all

As suggested by Marc Kleine-Budde I re-submit a modified version of the
patch for the transmitted bytes counter.

---------- patch description -----------------------------------------------

The number of bytes transmitted was not updated correctly, if several
CAN messages (with different length) were transmitted in one 'bunch'.
Thus programs like 'ifconfig' showed wrong transmit byte counts.
Reason was, that the message object whose DLC is to be read was not
necessarily the active one at the time when
   priv->read_reg(priv, C_CAN_IFACE(MSGCTRL_REG, 0)) & IF_MCONT_DLC_MASK;
was executed.

---------- patch -----------------------------------------------------------

--- linux-3.8.13/drivers/net/can/c_can/c_can.c.Orig	2013-05-11 22:57:46.000000000 +0200
+++ linux-3.8.13/drivers/net/can/c_can/c_can.c	2013-11-25 15:21:29.000763007 +0100
@@ -751,6 +751,7 @@ static void c_can_do_tx(struct net_devic
 		if (!(val & (1 << (msg_obj_no - 1)))) {
 			can_get_echo_skb(dev,
 					msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
+			c_can_object_get(dev, 0, msg_obj_no, IF_COMM_ALL);
 			stats->tx_bytes += priv->read_reg(priv,
 					C_CAN_IFACE(MSGCTRL_REG, 0))
 					& IF_MCONT_DLC_MASK;

------------------------------------------------------------------------------

Signed-off-by: Holger Bechtold <Holger.Bechtold@gmx.net>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-25 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25 14:48 [PATCH] for C_CAN driver Holger Bechtold

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).