linux_dsm_epyc7002/drivers/net/can
Jan Altenberg dc760b375e can: c_can: Fix tx_bytes accounting
The current SocketCAN implementation for the Bosch c_can cell doesn't
account the TX bytes correctly, because it calls
c_can_inval_msg_object() (which clears the msg ctrl register) before
reading the DLC value:

for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
        msg_obj_no = get_tx_echo_msg_obj(priv);
        c_can_inval_msg_object(dev, 0, msg_obj_no);
        val = c_can_read_reg32(priv, &priv->regs->txrqst1);
        if (!(val & (1 << msg_obj_no))) {
                can_get_echo_skb(dev,
                                msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
                stats->tx_bytes += priv->read_reg(priv,
                                &priv->regs->ifregs[0].msg_cntrl)
                                & IF_MCONT_DLC_MASK;
                stats->tx_packets++;
        }
}

So, we will always read 0 for the DLC value and "ifconfig" will report
*0* TX Bytes.

The fix is quite easy: Just move c_can_inval_msg_object() to the end of
the if() statement. So:
      * We only call c_can_inval_msg_object() if the message was
        actually transmitted
      * We read out the DLC value _before_ clearing the msg ctrl
        register

Signed-off-by: Jan Altenberg <jan@linutronix.de>
Acked-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-03-27 23:35:01 -07:00
..
c_can can: c_can: Fix tx_bytes accounting 2011-03-27 23:35:01 -07:00
mscan dt/net: Eliminate users of of_platform_{,un}register_driver 2011-02-28 13:22:44 -07:00
sja1000 dt/net: Eliminate users of of_platform_{,un}register_driver 2011-02-28 13:22:44 -07:00
softing CAN: add controller hardware name for Softing cards 2011-02-28 12:08:48 -08:00
usb can: wrong index used in inner loop 2011-03-14 14:44:42 -07:00
at91_can.c net: can: at91_can: world-writable sysfs files 2011-02-04 13:06:27 -08:00
bfin_can.c net: trans_start cleanups 2010-05-10 05:01:31 -07:00
dev.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
flexcan.c can: flexcan: fix use after free of priv 2010-10-26 10:48:58 -07:00
janz-ican3.c net: can: janz-ican3: world-writable sysfs termination file 2011-02-04 13:06:27 -08:00
Kconfig can: c_can: Added support for Bosch C_CAN controller 2011-02-13 22:51:44 -08:00
Makefile can: c_can: Added support for Bosch C_CAN controller 2011-02-13 22:51:44 -08:00
mcp251x.c workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable' 2011-02-16 17:48:59 +01:00
pch_can.c pch_can: fix tseg1/tseg2 setting issue 2011-02-09 16:46:21 -08:00
slcan.c can: slcan: Add missing linux/sched.h include. 2010-12-08 18:41:03 -08:00
ti_hecc.c Fix some #includes in CAN drivers (rebased for net-next-2.6) 2010-04-13 03:32:42 -07:00
vcan.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00