[PATCH rtems-libbsd 4/5] mv643xx_nexus.c: added a helper routine that allows printing of driver statistics

Vijay Kumar Banerjee vijay at rtems.org
Tue Mar 30 01:30:14 UTC 2021


From: till straumann <till.straumann at alumni.tu-berlin.de>

The 'legal' access by means of a special ioctl() is way too cumbersome
when you need to do quick diagnosis.

Update #4345
---
 rtemsbsd/sys/dev/mve/mv643xx_nexus.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/rtemsbsd/sys/dev/mve/mv643xx_nexus.c b/rtemsbsd/sys/dev/mve/mv643xx_nexus.c
index 5edcdea4..ef84200d 100644
--- a/rtemsbsd/sys/dev/mve/mv643xx_nexus.c
+++ b/rtemsbsd/sys/dev/mve/mv643xx_nexus.c
@@ -171,6 +171,8 @@ struct mve_enet_softc {
 	int                       oif_flags;
 };
 
+static struct mve_enet_softc * ifaces[MV643XXETH_NUM_DRIVER_SLOTS] = { 0 };
+
 typedef struct MveMbufIter {
 	MveEthBufIter it;
 	struct mbuf  *next;
@@ -695,6 +697,18 @@ int                      f, df;
 	return err;
 }
 
+/* SIO RTEMS_SHOW_STATS is too cumbersome to use -- for debugging, provide direct hack */
+int
+mv643xx_nexus_dump_stats(int unit, FILE *f)
+{
+	if ( unit < 0 || unit >= MV643XXETH_NUM_DRIVER_SLOTS || ! ifaces[unit] )
+		return -EINVAL;
+	if ( ! f )
+		f = stdout;
+	BSP_mve_dump_stats(ifaces[unit]->mp, f);
+	return 0;
+}
+
 /*
  * Used to update speed settings in the hardware
  * when the phy setup changes.
@@ -840,6 +854,8 @@ int                     tx_q_size    = MV643XX_TX_QUEUE_SIZE;
 	printk(DRVNAME": mve_attach (leaving)\n");
 #endif
 
+	ifaces[unit] = sc;
+
 	return 0;
 }
 
-- 
2.26.2



More information about the devel mailing list