summaryrefslogtreecommitdiffstats
path: root/src/net/netdevice.c
diff options
context:
space:
mode:
authorMichael Brown2011-03-30 13:45:12 +0200
committerMichael Brown2011-03-30 13:45:12 +0200
commit1588b9336eb144a7f62113361731d93a528fbb79 (patch)
tree66dcf1d8b716159ac37e3c7cd1f9f5daa4c1e811 /src/net/netdevice.c
parent[bofm] Use BOFM protocol version 2 if available (diff)
downloadipxe-1588b9336eb144a7f62113361731d93a528fbb79.tar.gz
ipxe-1588b9336eb144a7f62113361731d93a528fbb79.tar.xz
ipxe-1588b9336eb144a7f62113361731d93a528fbb79.zip
[netdevice] Simplify link-down status message
For devices that start in a link-down state, the user will see a message such as: [Link status: The socket is not connected (http://ipxe.org/38086001)] Waiting for link-up on net0... This is potentially misleading, since it suggests that there is a genuine problem. Add a dedicated error message for "link down", giving instead: [Link status: Down (http://ipxe.org/38086101)] Waiting for link-up on net0... Reported-by: Tal Aloni <tal.aloni.il@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r--src/net/netdevice.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 30173817..9b0ea199 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -46,14 +46,20 @@ struct list_head net_devices = LIST_HEAD_INIT ( net_devices );
/** List of open network devices, in reverse order of opening */
static struct list_head open_net_devices = LIST_HEAD_INIT ( open_net_devices );
-/** Default link status code */
+/** Default unknown link status code */
#define EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS )
#define EINFO_EUNKNOWN_LINK_STATUS \
__einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" )
-/** Human-readable message for the default link status */
+/** Default link-down status code */
+#define ENOTCONN_LINK_DOWN __einfo_error ( EINFO_ENOTCONN_LINK_DOWN )
+#define EINFO_ENOTCONN_LINK_DOWN \
+ __einfo_uniqify ( EINFO_ENOTCONN, 0x01, "Down" )
+
+/** Human-readable message for the default link statuses */
struct errortab netdev_errors[] __errortab = {
__einfo_errortab ( EINFO_EUNKNOWN_LINK_STATUS ),
+ __einfo_errortab ( EINFO_ENOTCONN_LINK_DOWN ),
};
/**
@@ -101,7 +107,7 @@ void netdev_link_down ( struct net_device *netdev ) {
*/
if ( ( netdev->link_rc == 0 ) ||
( netdev->link_rc == -EUNKNOWN_LINK_STATUS ) ) {
- netdev_link_err ( netdev, -ENOTCONN );
+ netdev_link_err ( netdev, -ENOTCONN_LINK_DOWN );
}
}