From 4968caab8288664d4fd21417f312f3c5a05df155 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 3 Jul 2007 00:15:53 +0100 Subject: Add trivial net device statistics (TX and RX packet count), reported via UNDI API and also by ifstat command; may be useful for debugging. --- src/interface/pxe/pxe_undi.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/interface/pxe') diff --git a/src/interface/pxe/pxe_undi.c b/src/interface/pxe/pxe_undi.c index f456a0b1c..4e7529a31 100644 --- a/src/interface/pxe/pxe_undi.c +++ b/src/interface/pxe/pxe_undi.c @@ -343,28 +343,33 @@ PXENV_EXIT_t pxenv_undi_get_information ( struct s_PXENV_UNDI_GET_INFORMATION /* PXENV_UNDI_GET_STATISTICS * - * Status: won't implement (would require driver API changes for no - * real benefit) + * Status: working */ PXENV_EXIT_t pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS *undi_get_statistics ) { DBG ( "PXENV_UNDI_GET_STATISTICS" ); - undi_get_statistics->Status = PXENV_STATUS_UNSUPPORTED; - return PXENV_EXIT_FAILURE; + undi_get_statistics->XmtGoodFrames = pxe_netdev->stats.tx_count; + undi_get_statistics->RcvGoodFrames = pxe_netdev->stats.rx_count; + undi_get_statistics->RcvCRCErrors = 0; + undi_get_statistics->RcvResourceErrors = 0; + + undi_get_statistics->Status = PXENV_STATUS_SUCCESS; + return PXENV_EXIT_SUCCESS; } /* PXENV_UNDI_CLEAR_STATISTICS * - * Status: won't implement (would require driver API changes for no - * real benefit) + * Status: working */ PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS *undi_clear_statistics ) { DBG ( "PXENV_UNDI_CLEAR_STATISTICS" ); - undi_clear_statistics->Status = PXENV_STATUS_UNSUPPORTED; - return PXENV_EXIT_FAILURE; + memset ( &pxe_netdev->stats, 0, sizeof ( pxe_netdev->stats ) ); + + undi_clear_statistics->Status = PXENV_STATUS_SUCCESS; + return PXENV_EXIT_SUCCESS; } /* PXENV_UNDI_INITIATE_DIAGS -- cgit v1.2.3-55-g7522