Browse Source

[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>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
1588b9336e
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      src/net/netdevice.c

+ 9
- 3
src/net/netdevice.c View File

46
 /** List of open network devices, in reverse order of opening */
46
 /** List of open network devices, in reverse order of opening */
47
 static struct list_head open_net_devices = LIST_HEAD_INIT ( open_net_devices );
47
 static struct list_head open_net_devices = LIST_HEAD_INIT ( open_net_devices );
48
 
48
 
49
-/** Default link status code */
49
+/** Default unknown link status code */
50
 #define EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS )
50
 #define EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS )
51
 #define EINFO_EUNKNOWN_LINK_STATUS \
51
 #define EINFO_EUNKNOWN_LINK_STATUS \
52
 	__einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" )
52
 	__einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" )
53
 
53
 
54
-/** Human-readable message for the default link status */
54
+/** Default link-down status code */
55
+#define ENOTCONN_LINK_DOWN __einfo_error ( EINFO_ENOTCONN_LINK_DOWN )
56
+#define EINFO_ENOTCONN_LINK_DOWN \
57
+	__einfo_uniqify ( EINFO_ENOTCONN, 0x01, "Down" )
58
+
59
+/** Human-readable message for the default link statuses */
55
 struct errortab netdev_errors[] __errortab = {
60
 struct errortab netdev_errors[] __errortab = {
56
 	__einfo_errortab ( EINFO_EUNKNOWN_LINK_STATUS ),
61
 	__einfo_errortab ( EINFO_EUNKNOWN_LINK_STATUS ),
62
+	__einfo_errortab ( EINFO_ENOTCONN_LINK_DOWN ),
57
 };
63
 };
58
 
64
 
59
 /**
65
 /**
101
 	 */
107
 	 */
102
 	if ( ( netdev->link_rc == 0 ) ||
108
 	if ( ( netdev->link_rc == 0 ) ||
103
 	     ( netdev->link_rc == -EUNKNOWN_LINK_STATUS ) ) {
109
 	     ( netdev->link_rc == -EUNKNOWN_LINK_STATUS ) ) {
104
-		netdev_link_err ( netdev, -ENOTCONN );
110
+		netdev_link_err ( netdev, -ENOTCONN_LINK_DOWN );
105
 	}
111
 	}
106
 }
112
 }
107
 
113
 

Loading…
Cancel
Save