Browse Source

[netdevice] Use net device name in debugging messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
24fc6aa5b0
2 changed files with 37 additions and 36 deletions
  1. 10
    10
      src/net/eth_slow.c
  2. 27
    26
      src/net/netdevice.c

+ 10
- 10
src/net/eth_slow.c View File

111
 	struct eth_slow_lacp *lacp = &eth_slow->lacp;
111
 	struct eth_slow_lacp *lacp = &eth_slow->lacp;
112
 
112
 
113
 	DBGC ( netdev,
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
 	       eth_ntoa ( lacp->actor.system ),
116
 	       eth_ntoa ( lacp->actor.system ),
117
 	       ntohs ( lacp->actor.key ),
117
 	       ntohs ( lacp->actor.key ),
118
 	       ntohs ( lacp->actor.port_priority ),
118
 	       ntohs ( lacp->actor.port_priority ),
119
 	       ntohs ( lacp->actor.port ),
119
 	       ntohs ( lacp->actor.port ),
120
 	       eth_slow_lacp_state_name ( lacp->actor.state ) );
120
 	       eth_slow_lacp_state_name ( lacp->actor.state ) );
121
 	DBGC ( netdev,
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
 	       eth_ntoa ( lacp->partner.system ),
124
 	       eth_ntoa ( lacp->partner.system ),
125
 	       ntohs ( lacp->partner.key ),
125
 	       ntohs ( lacp->partner.key ),
126
 	       ntohs ( lacp->partner.port_priority ),
126
 	       ntohs ( lacp->partner.port_priority ),
127
 	       ntohs ( lacp->partner.port ),
127
 	       ntohs ( lacp->partner.port ),
128
 	       eth_slow_lacp_state_name ( lacp->partner.state ) );
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
 	       ( ntohs ( lacp->collector.max_delay ) * 10 ) );
131
 	       ( ntohs ( lacp->collector.max_delay ) * 10 ) );
132
 	DBGC2_HDA ( netdev, 0, iobuf, iob_len ( iobuf ) );
132
 	DBGC2_HDA ( netdev, 0, iobuf, iob_len ( iobuf ) );
133
 }
133
 }
191
 	union eth_slow_packet *eth_slow = iobuf->data;
191
 	union eth_slow_packet *eth_slow = iobuf->data;
192
 	struct eth_slow_marker *marker = &eth_slow->marker;
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
 	       eth_slow_marker_tlv_name ( marker->marker.tlv.type ),
196
 	       eth_slow_marker_tlv_name ( marker->marker.tlv.type ),
197
 	       ntohs ( marker->marker.port ),
197
 	       ntohs ( marker->marker.port ),
198
 	       eth_ntoa ( marker->marker.system ),
198
 	       eth_ntoa ( marker->marker.system ),
255
 	case ETH_SLOW_SUBTYPE_MARKER:
255
 	case ETH_SLOW_SUBTYPE_MARKER:
256
 		return eth_slow_marker_rx ( iobuf, netdev );
256
 		return eth_slow_marker_rx ( iobuf, netdev );
257
 	default:
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
 		free_iob ( iobuf );
260
 		free_iob ( iobuf );
261
 		return -EINVAL;
261
 		return -EINVAL;
262
 	}
262
 	}

+ 27
- 26
src/net/netdevice.c View File

79
 	/* Record link state */
79
 	/* Record link state */
80
 	netdev->link_rc = rc;
80
 	netdev->link_rc = rc;
81
 	if ( netdev->link_rc == 0 ) {
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
 	} else {
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
 	/* Notify drivers of link state change */
88
 	/* Notify drivers of link state change */
157
 int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf ) {
157
 int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf ) {
158
 	int rc;
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
 	/* Enqueue packet */
163
 	/* Enqueue packet */
164
 	list_add_tail ( &iobuf->list, &netdev->tx_queue );
164
 	list_add_tail ( &iobuf->list, &netdev->tx_queue );
202
 	/* Update statistics counter */
202
 	/* Update statistics counter */
203
 	netdev_record_stat ( &netdev->tx_stats, rc );
203
 	netdev_record_stat ( &netdev->tx_stats, rc );
204
 	if ( rc == 0 ) {
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
 	} else {
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
 	/* Catch data corruption as early as possible */
212
 	/* Catch data corruption as early as possible */
259
  */
259
  */
260
 void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf ) {
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
 	/* Discard packet (for test purposes) if applicable */
265
 	/* Discard packet (for test purposes) if applicable */
266
 	if ( ( NETDEV_DISCARD_RATE > 0 ) &&
266
 	if ( ( NETDEV_DISCARD_RATE > 0 ) &&
291
 void netdev_rx_err ( struct net_device *netdev,
291
 void netdev_rx_err ( struct net_device *netdev,
292
 		     struct io_buffer *iobuf, int rc ) {
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
 	/* Discard packet */
297
 	/* Discard packet */
298
 	free_iob ( iobuf );
298
 	free_iob ( iobuf );
414
 	/* Add to device list */
414
 	/* Add to device list */
415
 	netdev_get ( netdev );
415
 	netdev_get ( netdev );
416
 	list_add_tail ( &netdev->list, &net_devices );
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
 	       netdev_addr ( netdev ) );
419
 	       netdev_addr ( netdev ) );
420
 
420
 
421
 	/* Register per-netdev configuration settings */
421
 	/* Register per-netdev configuration settings */
422
 	if ( ( rc = register_settings ( netdev_settings ( netdev ),
422
 	if ( ( rc = register_settings ( netdev_settings ( netdev ),
423
 					NULL ) ) != 0 ) {
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
 		goto err_register_settings;
426
 		goto err_register_settings;
427
 	}
427
 	}
428
 
428
 
429
 	/* Probe device */
429
 	/* Probe device */
430
 	for_each_table_entry ( driver, NET_DRIVERS ) {
430
 	for_each_table_entry ( driver, NET_DRIVERS ) {
431
 		if ( ( rc = driver->probe ( netdev ) ) != 0 ) {
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
 			goto err_probe;
435
 			goto err_probe;
435
 		}
436
 		}
436
 	}
437
 	}
458
 	if ( netdev->state & NETDEV_OPEN )
459
 	if ( netdev->state & NETDEV_OPEN )
459
 		return 0;
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
 	/* Open the device */
464
 	/* Open the device */
464
 	if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
465
 	if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
487
 	if ( ! ( netdev->state & NETDEV_OPEN ) )
488
 	if ( ! ( netdev->state & NETDEV_OPEN ) )
488
 		return;
489
 		return;
489
 
490
 
490
-	DBGC ( netdev, "NETDEV %p closing\n", netdev );
491
+	DBGC ( netdev, "NETDEV %s closing\n", netdev->name );
491
 
492
 
492
 	/* Remove from open devices list */
493
 	/* Remove from open devices list */
493
 	list_del ( &netdev->open_list );
494
 	list_del ( &netdev->open_list );
529
 	/* Remove from device list */
530
 	/* Remove from device list */
530
 	list_del ( &netdev->list );
531
 	list_del ( &netdev->list );
531
 	netdev_put ( netdev );
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
 /** Enable or disable interrupts
536
 /** Enable or disable interrupts
661
 						  ll_source );
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
 	free_iob ( iobuf );
667
 	free_iob ( iobuf );
667
 	return -ENOTSUP;
668
 	return -ENOTSUP;
668
 }
669
 }
698
 		 */
699
 		 */
699
 		if ( ( iobuf = netdev_rx_dequeue ( netdev ) ) ) {
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
 			       iob_len ( iobuf ) );
704
 			       iob_len ( iobuf ) );
704
 
705
 
705
 			/* Remove link-layer header */
706
 			/* Remove link-layer header */

Loading…
Cancel
Save