mirror of
https://github.com/ipxe/ipxe
synced 2025-12-17 10:01:03 +03:00
[netdevice] Retain and report detailed error breakdowns
netdev_rx_err() and netdev_tx_complete_err() get passed the error code, but currently use it only in debug messages. Retain error numbers and frequencey counts for up to NETDEV_MAX_UNIQUE_ERRORS (4) different errors for each of TX and RX. This allows the "ifstat" command to report the reasons for TX/RX errors in most cases, even in non-debug builds.
This commit is contained in:
@@ -317,14 +317,14 @@ efi_snp_statistics ( EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN reset,
|
||||
|
||||
/* Gather statistics */
|
||||
memset ( &stats_buf, 0, sizeof ( stats_buf ) );
|
||||
stats_buf.TxGoodFrames = snpdev->netdev->stats.tx_ok;
|
||||
stats_buf.TxDroppedFrames = snpdev->netdev->stats.tx_err;
|
||||
stats_buf.TxTotalFrames = ( snpdev->netdev->stats.tx_ok +
|
||||
snpdev->netdev->stats.tx_err );
|
||||
stats_buf.RxGoodFrames = snpdev->netdev->stats.rx_ok;
|
||||
stats_buf.RxDroppedFrames = snpdev->netdev->stats.rx_err;
|
||||
stats_buf.RxTotalFrames = ( snpdev->netdev->stats.rx_ok +
|
||||
snpdev->netdev->stats.rx_err );
|
||||
stats_buf.TxGoodFrames = snpdev->netdev->tx_stats.good;
|
||||
stats_buf.TxDroppedFrames = snpdev->netdev->tx_stats.bad;
|
||||
stats_buf.TxTotalFrames = ( snpdev->netdev->tx_stats.good +
|
||||
snpdev->netdev->tx_stats.bad );
|
||||
stats_buf.RxGoodFrames = snpdev->netdev->rx_stats.good;
|
||||
stats_buf.RxDroppedFrames = snpdev->netdev->rx_stats.bad;
|
||||
stats_buf.RxTotalFrames = ( snpdev->netdev->rx_stats.good +
|
||||
snpdev->netdev->rx_stats.bad );
|
||||
if ( *stats_len > sizeof ( stats_buf ) )
|
||||
*stats_len = sizeof ( stats_buf );
|
||||
if ( stats )
|
||||
@@ -332,8 +332,10 @@ efi_snp_statistics ( EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN reset,
|
||||
|
||||
/* Reset statistics if requested to do so */
|
||||
if ( reset ) {
|
||||
memset ( &snpdev->netdev->stats, 0,
|
||||
sizeof ( snpdev->netdev->stats ) );
|
||||
memset ( &snpdev->netdev->tx_stats, 0,
|
||||
sizeof ( snpdev->netdev->tx_stats ) );
|
||||
memset ( &snpdev->netdev->rx_stats, 0,
|
||||
sizeof ( snpdev->netdev->rx_stats ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -392,10 +392,10 @@ PXENV_EXIT_t pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS
|
||||
*undi_get_statistics ) {
|
||||
DBG ( "PXENV_UNDI_GET_STATISTICS" );
|
||||
|
||||
undi_get_statistics->XmtGoodFrames = pxe_netdev->stats.tx_ok;
|
||||
undi_get_statistics->RcvGoodFrames = pxe_netdev->stats.rx_ok;
|
||||
undi_get_statistics->RcvCRCErrors = pxe_netdev->stats.rx_err;
|
||||
undi_get_statistics->RcvResourceErrors = pxe_netdev->stats.rx_err;
|
||||
undi_get_statistics->XmtGoodFrames = pxe_netdev->tx_stats.good;
|
||||
undi_get_statistics->RcvGoodFrames = pxe_netdev->rx_stats.good;
|
||||
undi_get_statistics->RcvCRCErrors = pxe_netdev->rx_stats.bad;
|
||||
undi_get_statistics->RcvResourceErrors = pxe_netdev->rx_stats.bad;
|
||||
|
||||
undi_get_statistics->Status = PXENV_STATUS_SUCCESS;
|
||||
return PXENV_EXIT_SUCCESS;
|
||||
@@ -409,7 +409,8 @@ PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
|
||||
*undi_clear_statistics ) {
|
||||
DBG ( "PXENV_UNDI_CLEAR_STATISTICS" );
|
||||
|
||||
memset ( &pxe_netdev->stats, 0, sizeof ( pxe_netdev->stats ) );
|
||||
memset ( &pxe_netdev->tx_stats, 0, sizeof ( pxe_netdev->tx_stats ) );
|
||||
memset ( &pxe_netdev->rx_stats, 0, sizeof ( pxe_netdev->rx_stats ) );
|
||||
|
||||
undi_clear_statistics->Status = PXENV_STATUS_SUCCESS;
|
||||
return PXENV_EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user