hw/net: implement MIB counters in mcf_fec driver
commitadb560f7fc92903f52071086a46422be1e3f4640
authorGreg Ungerer <gerg@uclinux.org>
Mon, 13 Mar 2017 04:56:57 +0000 (13 14:56 +1000)
committerJason Wang <jasowang@redhat.com>
Tue, 14 Mar 2017 07:39:55 +0000 (14 15:39 +0800)
treeef7e85a62795d0c966ce54153db24e888b199c50
parente630b2bf7c8a7900d1e19ca006e6335df24f2928
hw/net: implement MIB counters in mcf_fec driver

The FEC ethernet hardware module used on ColdFire SoC parts contains a
block of RAM used to maintain hardware counters. This block is accessible
via the usual FEC register address space. There is currently no support
for this in the QEMU mcf_fec driver.

Add support for storing a MIB RAM block, and provide register level
access to it. Also implement a basic set of stats collection functions
to populate MIB data fields.

This support tested running a Linux target and using the net-tools
"ethtool -S" option. As of linux-4.9 the kernels FEC driver makes
accesses to the MIB counters during its initialization (which it never
did before), and so this version of Linux will now fail with the QEMU
error:

    qemu: hardware error: mcf_fec_read: Bad address 0x200

This MIB counter support fixes this problem.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/mcf_fec.c