소스 검색

[netdevice] Use net device name in debugging messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 년 전
부모
커밋
24fc6aa5b0
2개의 변경된 파일37개의 추가작업 그리고 36개의 파일을 삭제
  1. 10
    10
      src/net/eth_slow.c
  2. 27
    26
      src/net/netdevice.c

+ 10
- 10
src/net/eth_slow.c 파일 보기

@@ -111,23 +111,23 @@ static void eth_slow_lacp_dump ( struct io_buffer *iobuf,
111 111
 	struct eth_slow_lacp *lacp = &eth_slow->lacp;
112 112
 
113 113
 	DBGC ( netdev,
114
-	       "SLOW %p %s LACP actor (%04x,%s,%04x,%02x,%04x) [%s]\n",
115
-	       netdev, label, ntohs ( lacp->actor.system_priority ),
114
+	       "SLOW %s %s LACP actor (%04x,%s,%04x,%02x,%04x) [%s]\n",
115
+	       netdev->name, label, ntohs ( lacp->actor.system_priority ),
116 116
 	       eth_ntoa ( lacp->actor.system ),
117 117
 	       ntohs ( lacp->actor.key ),
118 118
 	       ntohs ( lacp->actor.port_priority ),
119 119
 	       ntohs ( lacp->actor.port ),
120 120
 	       eth_slow_lacp_state_name ( lacp->actor.state ) );
121 121
 	DBGC ( netdev,
122
-	       "SLOW %p %s LACP partner (%04x,%s,%04x,%02x,%04x) [%s]\n",
123
-	       netdev, label, ntohs ( lacp->partner.system_priority ),
122
+	       "SLOW %s %s LACP partner (%04x,%s,%04x,%02x,%04x) [%s]\n",
123
+	       netdev->name, label, ntohs ( lacp->partner.system_priority ),
124 124
 	       eth_ntoa ( lacp->partner.system ),
125 125
 	       ntohs ( lacp->partner.key ),
126 126
 	       ntohs ( lacp->partner.port_priority ),
127 127
 	       ntohs ( lacp->partner.port ),
128 128
 	       eth_slow_lacp_state_name ( lacp->partner.state ) );
129
-	DBGC ( netdev, "SLOW %p %s LACP collector %04x (%d us)\n",
130
-	       netdev, label, ntohs ( lacp->collector.max_delay ),
129
+	DBGC ( netdev, "SLOW %s %s LACP collector %04x (%d us)\n",
130
+	       netdev->name, label, ntohs ( lacp->collector.max_delay ),
131 131
 	       ( ntohs ( lacp->collector.max_delay ) * 10 ) );
132 132
 	DBGC2_HDA ( netdev, 0, iobuf, iob_len ( iobuf ) );
133 133
 }
@@ -191,8 +191,8 @@ static void eth_slow_marker_dump ( struct io_buffer *iobuf,
191 191
 	union eth_slow_packet *eth_slow = iobuf->data;
192 192
 	struct eth_slow_marker *marker = &eth_slow->marker;
193 193
 
194
-	DBGC ( netdev, "SLOW %p %s marker %s port %04x system %s xact %08x\n",
195
-	       netdev, label,
194
+	DBGC ( netdev, "SLOW %s %s marker %s port %04x system %s xact %08x\n",
195
+	       netdev->name, label,
196 196
 	       eth_slow_marker_tlv_name ( marker->marker.tlv.type ),
197 197
 	       ntohs ( marker->marker.port ),
198 198
 	       eth_ntoa ( marker->marker.system ),
@@ -255,8 +255,8 @@ static int eth_slow_rx ( struct io_buffer *iobuf,
255 255
 	case ETH_SLOW_SUBTYPE_MARKER:
256 256
 		return eth_slow_marker_rx ( iobuf, netdev );
257 257
 	default:
258
-		DBGC ( netdev, "SLOW %p RX unknown subtype %02x\n",
259
-		       netdev, eth_slow->header.subtype );
258
+		DBGC ( netdev, "SLOW %s RX unknown subtype %02x\n",
259
+		       netdev->name, eth_slow->header.subtype );
260 260
 		free_iob ( iobuf );
261 261
 		return -EINVAL;
262 262
 	}

+ 27
- 26
src/net/netdevice.c 파일 보기

@@ -79,10 +79,10 @@ void netdev_link_err ( struct net_device *netdev, int rc ) {
79 79
 	/* Record link state */
80 80
 	netdev->link_rc = rc;
81 81
 	if ( netdev->link_rc == 0 ) {
82
-		DBGC ( netdev, "NETDEV %p link is up\n", netdev );
82
+		DBGC ( netdev, "NETDEV %s link is up\n", netdev->name );
83 83
 	} else {
84
-		DBGC ( netdev, "NETDEV %p link is down: %s\n",
85
-		       netdev, strerror ( netdev->link_rc ) );
84
+		DBGC ( netdev, "NETDEV %s link is down: %s\n",
85
+		       netdev->name, strerror ( netdev->link_rc ) );
86 86
 	}
87 87
 
88 88
 	/* Notify drivers of link state change */
@@ -157,8 +157,8 @@ static void netdev_record_stat ( struct net_device_stats *stats, int rc ) {
157 157
 int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf ) {
158 158
 	int rc;
159 159
 
160
-	DBGC ( netdev, "NETDEV %p transmitting %p (%p+%zx)\n",
161
-	       netdev, iobuf, iobuf->data, iob_len ( iobuf ) );
160
+	DBGC ( netdev, "NETDEV %s transmitting %p (%p+%zx)\n",
161
+	       netdev->name, iobuf, iobuf->data, iob_len ( iobuf ) );
162 162
 
163 163
 	/* Enqueue packet */
164 164
 	list_add_tail ( &iobuf->list, &netdev->tx_queue );
@@ -202,11 +202,11 @@ void netdev_tx_complete_err ( struct net_device *netdev,
202 202
 	/* Update statistics counter */
203 203
 	netdev_record_stat ( &netdev->tx_stats, rc );
204 204
 	if ( rc == 0 ) {
205
-		DBGC ( netdev, "NETDEV %p transmission %p complete\n",
206
-		       netdev, iobuf );
205
+		DBGC ( netdev, "NETDEV %s transmission %p complete\n",
206
+		       netdev->name, iobuf );
207 207
 	} else {
208
-		DBGC ( netdev, "NETDEV %p transmission %p failed: %s\n",
209
-		       netdev, iobuf, strerror ( rc ) );
208
+		DBGC ( netdev, "NETDEV %s transmission %p failed: %s\n",
209
+		       netdev->name, iobuf, strerror ( rc ) );
210 210
 	}
211 211
 
212 212
 	/* Catch data corruption as early as possible */
@@ -259,8 +259,8 @@ static void netdev_tx_flush ( struct net_device *netdev ) {
259 259
  */
260 260
 void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf ) {
261 261
 
262
-	DBGC ( netdev, "NETDEV %p received %p (%p+%zx)\n",
263
-	       netdev, iobuf, iobuf->data, iob_len ( iobuf ) );
262
+	DBGC ( netdev, "NETDEV %s received %p (%p+%zx)\n",
263
+	       netdev->name, iobuf, iobuf->data, iob_len ( iobuf ) );
264 264
 
265 265
 	/* Discard packet (for test purposes) if applicable */
266 266
 	if ( ( NETDEV_DISCARD_RATE > 0 ) &&
@@ -291,8 +291,8 @@ void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf ) {
291 291
 void netdev_rx_err ( struct net_device *netdev,
292 292
 		     struct io_buffer *iobuf, int rc ) {
293 293
 
294
-	DBGC ( netdev, "NETDEV %p failed to receive %p: %s\n",
295
-	       netdev, iobuf, strerror ( rc ) );
294
+	DBGC ( netdev, "NETDEV %s failed to receive %p: %s\n",
295
+	       netdev->name, iobuf, strerror ( rc ) );
296 296
 
297 297
 	/* Discard packet */
298 298
 	free_iob ( iobuf );
@@ -414,23 +414,24 @@ int register_netdev ( struct net_device *netdev ) {
414 414
 	/* Add to device list */
415 415
 	netdev_get ( netdev );
416 416
 	list_add_tail ( &netdev->list, &net_devices );
417
-	DBGC ( netdev, "NETDEV %p registered as %s (phys %s hwaddr %s)\n",
418
-	       netdev, netdev->name, netdev->dev->name,
417
+	DBGC ( netdev, "NETDEV %s registered (phys %s hwaddr %s)\n",
418
+	       netdev->name, netdev->dev->name,
419 419
 	       netdev_addr ( netdev ) );
420 420
 
421 421
 	/* Register per-netdev configuration settings */
422 422
 	if ( ( rc = register_settings ( netdev_settings ( netdev ),
423 423
 					NULL ) ) != 0 ) {
424
-		DBGC ( netdev, "NETDEV %p could not register settings: %s\n",
425
-		       netdev, strerror ( rc ) );
424
+		DBGC ( netdev, "NETDEV %s could not register settings: %s\n",
425
+		       netdev->name, strerror ( rc ) );
426 426
 		goto err_register_settings;
427 427
 	}
428 428
 
429 429
 	/* Probe device */
430 430
 	for_each_table_entry ( driver, NET_DRIVERS ) {
431 431
 		if ( ( rc = driver->probe ( netdev ) ) != 0 ) {
432
-			DBGC ( netdev, "NETDEV %p could not add %s device: "
433
-			       "%s\n", netdev, driver->name, strerror ( rc ) );
432
+			DBGC ( netdev, "NETDEV %s could not add %s device: "
433
+			       "%s\n", netdev->name, driver->name,
434
+			       strerror ( rc ) );
434 435
 			goto err_probe;
435 436
 		}
436 437
 	}
@@ -458,7 +459,7 @@ int netdev_open ( struct net_device *netdev ) {
458 459
 	if ( netdev->state & NETDEV_OPEN )
459 460
 		return 0;
460 461
 
461
-	DBGC ( netdev, "NETDEV %p opening\n", netdev );
462
+	DBGC ( netdev, "NETDEV %s opening\n", netdev->name );
462 463
 
463 464
 	/* Open the device */
464 465
 	if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
@@ -487,7 +488,7 @@ void netdev_close ( struct net_device *netdev ) {
487 488
 	if ( ! ( netdev->state & NETDEV_OPEN ) )
488 489
 		return;
489 490
 
490
-	DBGC ( netdev, "NETDEV %p closing\n", netdev );
491
+	DBGC ( netdev, "NETDEV %s closing\n", netdev->name );
491 492
 
492 493
 	/* Remove from open devices list */
493 494
 	list_del ( &netdev->open_list );
@@ -529,7 +530,7 @@ void unregister_netdev ( struct net_device *netdev ) {
529 530
 	/* Remove from device list */
530 531
 	list_del ( &netdev->list );
531 532
 	netdev_put ( netdev );
532
-	DBGC ( netdev, "NETDEV %p unregistered\n", netdev );
533
+	DBGC ( netdev, "NETDEV %s unregistered\n", netdev->name );
533 534
 }
534 535
 
535 536
 /** Enable or disable interrupts
@@ -661,8 +662,8 @@ int net_rx ( struct io_buffer *iobuf, struct net_device *netdev,
661 662
 						  ll_source );
662 663
 	}
663 664
 
664
-	DBGC ( netdev, "NETDEV %p unknown network protocol %04x\n",
665
-	       netdev, ntohs ( net_proto ) );
665
+	DBGC ( netdev, "NETDEV %s unknown network protocol %04x\n",
666
+	       netdev->name, ntohs ( net_proto ) );
666 667
 	free_iob ( iobuf );
667 668
 	return -ENOTSUP;
668 669
 }
@@ -698,8 +699,8 @@ static void net_step ( struct process *process __unused ) {
698 699
 		 */
699 700
 		if ( ( iobuf = netdev_rx_dequeue ( netdev ) ) ) {
700 701
 
701
-			DBGC ( netdev, "NETDEV %p processing %p (%p+%zx)\n",
702
-			       netdev, iobuf, iobuf->data,
702
+			DBGC ( netdev, "NETDEV %s processing %p (%p+%zx)\n",
703
+			       netdev->name, iobuf, iobuf->data,
703 704
 			       iob_len ( iobuf ) );
704 705
 
705 706
 			/* Remove link-layer header */

Loading…
취소
저장