aboutsummaryrefslogtreecommitdiffstats
path: root/gpxe/src/usr/ifmgmt.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-02-17 20:17:17 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-02-17 20:17:17 -0800
commitd0c6656a62113b913948361779d6298fe76f6e61 (patch)
treeefa2541a1abae4760717c6db421ea818114ab6f7 /gpxe/src/usr/ifmgmt.c
parent85b92a462dab7ce36c48614ea18314f8fc83ca9c (diff)
downloadsyslinux.git-d0c6656a62113b913948361779d6298fe76f6e61.tar.gz
syslinux.git-d0c6656a62113b913948361779d6298fe76f6e61.tar.xz
syslinux.git-d0c6656a62113b913948361779d6298fe76f6e61.zip
Update gPXE to version 0.9.6+ 277b84c6e7d49f3cf01c855007f591de8c7cb75f
Update gPXE to version 0.9.6+, from commit 277b84c6e7d49f3cf01c855007f591de8c7cb75f in the main gPXE repository. The only differences is src/config/general.h which has a few protocols added, and src/arch/i386/prefix/boot1a.S which was called boot1a.s in the upstream repository.
Diffstat (limited to 'gpxe/src/usr/ifmgmt.c')
-rw-r--r--gpxe/src/usr/ifmgmt.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/gpxe/src/usr/ifmgmt.c b/gpxe/src/usr/ifmgmt.c
index 9c88ab53..0ebf5615 100644
--- a/gpxe/src/usr/ifmgmt.c
+++ b/gpxe/src/usr/ifmgmt.c
@@ -20,9 +20,11 @@
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
+#include <console.h>
#include <gpxe/netdevice.h>
#include <gpxe/device.h>
#include <gpxe/process.h>
+#include <gpxe/keys.h>
#include <usr/ifmgmt.h>
/** @file
@@ -59,6 +61,25 @@ void ifclose ( struct net_device *netdev ) {
}
/**
+ * Print network device error breakdown
+ *
+ * @v stats Network device statistics
+ * @v prefix Message prefix
+ */
+static void ifstat_errors ( struct net_device_stats *stats,
+ const char *prefix ) {
+ unsigned int i;
+
+ for ( i = 0 ; i < ( sizeof ( stats->errors ) /
+ sizeof ( stats->errors[0] ) ) ; i++ ) {
+ if ( stats->errors[i].count )
+ printf ( " [%s: %d x \"%s\"]\n", prefix,
+ stats->errors[i].count,
+ strerror ( stats->errors[i].rc ) );
+ }
+}
+
+/**
* Print status of network device
*
* @v netdev Network device
@@ -69,8 +90,10 @@ void ifstat ( struct net_device *netdev ) {
netdev->name, netdev_hwaddr ( netdev ), netdev->dev->name,
( ( netdev->state & NETDEV_OPEN ) ? "open" : "closed" ),
( netdev_link_ok ( netdev ) ? "up" : "down" ),
- netdev->stats.tx_ok, netdev->stats.tx_err,
- netdev->stats.rx_ok, netdev->stats.rx_err );
+ netdev->tx_stats.good, netdev->tx_stats.bad,
+ netdev->rx_stats.good, netdev->rx_stats.bad );
+ ifstat_errors ( &netdev->tx_stats, "TXE" );
+ ifstat_errors ( &netdev->rx_stats, "RXE" );
}
/**
@@ -80,12 +103,19 @@ void ifstat ( struct net_device *netdev ) {
* @v max_wait_ms Maximum time to wait, in ms
*/
int iflinkwait ( struct net_device *netdev, unsigned int max_wait_ms ) {
+ int key;
+
while ( 1 ) {
if ( netdev_link_ok ( netdev ) )
return 0;
if ( max_wait_ms-- == 0 )
return -ETIMEDOUT;
step();
+ if ( iskey() ) {
+ key = getchar();
+ if ( key == CTRL_C )
+ return -ECANCELED;
+ }
mdelay ( 1 );
}
}