Skip to content

Commit

Permalink
[netdevice] Use net device name in debugging messages
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Nov 18, 2010
1 parent 312ae02 commit 24fc6aa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
20 changes: 10 additions & 10 deletions src/net/eth_slow.c
Expand Up @@ -111,23 +111,23 @@ static void eth_slow_lacp_dump ( struct io_buffer *iobuf,
struct eth_slow_lacp *lacp = &eth_slow->lacp;

DBGC ( netdev,
"SLOW %p %s LACP actor (%04x,%s,%04x,%02x,%04x) [%s]\n",
netdev, label, ntohs ( lacp->actor.system_priority ),
"SLOW %s %s LACP actor (%04x,%s,%04x,%02x,%04x) [%s]\n",
netdev->name, label, ntohs ( lacp->actor.system_priority ),
eth_ntoa ( lacp->actor.system ),
ntohs ( lacp->actor.key ),
ntohs ( lacp->actor.port_priority ),
ntohs ( lacp->actor.port ),
eth_slow_lacp_state_name ( lacp->actor.state ) );
DBGC ( netdev,
"SLOW %p %s LACP partner (%04x,%s,%04x,%02x,%04x) [%s]\n",
netdev, label, ntohs ( lacp->partner.system_priority ),
"SLOW %s %s LACP partner (%04x,%s,%04x,%02x,%04x) [%s]\n",
netdev->name, label, ntohs ( lacp->partner.system_priority ),
eth_ntoa ( lacp->partner.system ),
ntohs ( lacp->partner.key ),
ntohs ( lacp->partner.port_priority ),
ntohs ( lacp->partner.port ),
eth_slow_lacp_state_name ( lacp->partner.state ) );
DBGC ( netdev, "SLOW %p %s LACP collector %04x (%d us)\n",
netdev, label, ntohs ( lacp->collector.max_delay ),
DBGC ( netdev, "SLOW %s %s LACP collector %04x (%d us)\n",
netdev->name, label, ntohs ( lacp->collector.max_delay ),
( ntohs ( lacp->collector.max_delay ) * 10 ) );
DBGC2_HDA ( netdev, 0, iobuf, iob_len ( iobuf ) );
}
Expand Down Expand Up @@ -191,8 +191,8 @@ static void eth_slow_marker_dump ( struct io_buffer *iobuf,
union eth_slow_packet *eth_slow = iobuf->data;
struct eth_slow_marker *marker = &eth_slow->marker;

DBGC ( netdev, "SLOW %p %s marker %s port %04x system %s xact %08x\n",
netdev, label,
DBGC ( netdev, "SLOW %s %s marker %s port %04x system %s xact %08x\n",
netdev->name, label,
eth_slow_marker_tlv_name ( marker->marker.tlv.type ),
ntohs ( marker->marker.port ),
eth_ntoa ( marker->marker.system ),
Expand Down Expand Up @@ -255,8 +255,8 @@ static int eth_slow_rx ( struct io_buffer *iobuf,
case ETH_SLOW_SUBTYPE_MARKER:
return eth_slow_marker_rx ( iobuf, netdev );
default:
DBGC ( netdev, "SLOW %p RX unknown subtype %02x\n",
netdev, eth_slow->header.subtype );
DBGC ( netdev, "SLOW %s RX unknown subtype %02x\n",
netdev->name, eth_slow->header.subtype );
free_iob ( iobuf );
return -EINVAL;
}
Expand Down
53 changes: 27 additions & 26 deletions src/net/netdevice.c
Expand Up @@ -79,10 +79,10 @@ void netdev_link_err ( struct net_device *netdev, int rc ) {
/* Record link state */
netdev->link_rc = rc;
if ( netdev->link_rc == 0 ) {
DBGC ( netdev, "NETDEV %p link is up\n", netdev );
DBGC ( netdev, "NETDEV %s link is up\n", netdev->name );
} else {
DBGC ( netdev, "NETDEV %p link is down: %s\n",
netdev, strerror ( netdev->link_rc ) );
DBGC ( netdev, "NETDEV %s link is down: %s\n",
netdev->name, strerror ( netdev->link_rc ) );
}

/* Notify drivers of link state change */
Expand Down Expand Up @@ -157,8 +157,8 @@ static void netdev_record_stat ( struct net_device_stats *stats, int rc ) {
int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf ) {
int rc;

DBGC ( netdev, "NETDEV %p transmitting %p (%p+%zx)\n",
netdev, iobuf, iobuf->data, iob_len ( iobuf ) );
DBGC ( netdev, "NETDEV %s transmitting %p (%p+%zx)\n",
netdev->name, iobuf, iobuf->data, iob_len ( iobuf ) );

/* Enqueue packet */
list_add_tail ( &iobuf->list, &netdev->tx_queue );
Expand Down Expand Up @@ -202,11 +202,11 @@ void netdev_tx_complete_err ( struct net_device *netdev,
/* Update statistics counter */
netdev_record_stat ( &netdev->tx_stats, rc );
if ( rc == 0 ) {
DBGC ( netdev, "NETDEV %p transmission %p complete\n",
netdev, iobuf );
DBGC ( netdev, "NETDEV %s transmission %p complete\n",
netdev->name, iobuf );
} else {
DBGC ( netdev, "NETDEV %p transmission %p failed: %s\n",
netdev, iobuf, strerror ( rc ) );
DBGC ( netdev, "NETDEV %s transmission %p failed: %s\n",
netdev->name, iobuf, strerror ( rc ) );
}

/* Catch data corruption as early as possible */
Expand Down Expand Up @@ -259,8 +259,8 @@ static void netdev_tx_flush ( struct net_device *netdev ) {
*/
void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf ) {

DBGC ( netdev, "NETDEV %p received %p (%p+%zx)\n",
netdev, iobuf, iobuf->data, iob_len ( iobuf ) );
DBGC ( netdev, "NETDEV %s received %p (%p+%zx)\n",
netdev->name, iobuf, iobuf->data, iob_len ( iobuf ) );

/* Discard packet (for test purposes) if applicable */
if ( ( NETDEV_DISCARD_RATE > 0 ) &&
Expand Down Expand Up @@ -291,8 +291,8 @@ void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf ) {
void netdev_rx_err ( struct net_device *netdev,
struct io_buffer *iobuf, int rc ) {

DBGC ( netdev, "NETDEV %p failed to receive %p: %s\n",
netdev, iobuf, strerror ( rc ) );
DBGC ( netdev, "NETDEV %s failed to receive %p: %s\n",
netdev->name, iobuf, strerror ( rc ) );

/* Discard packet */
free_iob ( iobuf );
Expand Down Expand Up @@ -414,23 +414,24 @@ int register_netdev ( struct net_device *netdev ) {
/* Add to device list */
netdev_get ( netdev );
list_add_tail ( &netdev->list, &net_devices );
DBGC ( netdev, "NETDEV %p registered as %s (phys %s hwaddr %s)\n",
netdev, netdev->name, netdev->dev->name,
DBGC ( netdev, "NETDEV %s registered (phys %s hwaddr %s)\n",
netdev->name, netdev->dev->name,
netdev_addr ( netdev ) );

/* Register per-netdev configuration settings */
if ( ( rc = register_settings ( netdev_settings ( netdev ),
NULL ) ) != 0 ) {
DBGC ( netdev, "NETDEV %p could not register settings: %s\n",
netdev, strerror ( rc ) );
DBGC ( netdev, "NETDEV %s could not register settings: %s\n",
netdev->name, strerror ( rc ) );
goto err_register_settings;
}

/* Probe device */
for_each_table_entry ( driver, NET_DRIVERS ) {
if ( ( rc = driver->probe ( netdev ) ) != 0 ) {
DBGC ( netdev, "NETDEV %p could not add %s device: "
"%s\n", netdev, driver->name, strerror ( rc ) );
DBGC ( netdev, "NETDEV %s could not add %s device: "
"%s\n", netdev->name, driver->name,
strerror ( rc ) );
goto err_probe;
}
}
Expand Down Expand Up @@ -458,7 +459,7 @@ int netdev_open ( struct net_device *netdev ) {
if ( netdev->state & NETDEV_OPEN )
return 0;

DBGC ( netdev, "NETDEV %p opening\n", netdev );
DBGC ( netdev, "NETDEV %s opening\n", netdev->name );

/* Open the device */
if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
Expand Down Expand Up @@ -487,7 +488,7 @@ void netdev_close ( struct net_device *netdev ) {
if ( ! ( netdev->state & NETDEV_OPEN ) )
return;

DBGC ( netdev, "NETDEV %p closing\n", netdev );
DBGC ( netdev, "NETDEV %s closing\n", netdev->name );

/* Remove from open devices list */
list_del ( &netdev->open_list );
Expand Down Expand Up @@ -529,7 +530,7 @@ void unregister_netdev ( struct net_device *netdev ) {
/* Remove from device list */
list_del ( &netdev->list );
netdev_put ( netdev );
DBGC ( netdev, "NETDEV %p unregistered\n", netdev );
DBGC ( netdev, "NETDEV %s unregistered\n", netdev->name );
}

/** Enable or disable interrupts
Expand Down Expand Up @@ -661,8 +662,8 @@ int net_rx ( struct io_buffer *iobuf, struct net_device *netdev,
ll_source );
}

DBGC ( netdev, "NETDEV %p unknown network protocol %04x\n",
netdev, ntohs ( net_proto ) );
DBGC ( netdev, "NETDEV %s unknown network protocol %04x\n",
netdev->name, ntohs ( net_proto ) );
free_iob ( iobuf );
return -ENOTSUP;
}
Expand Down Expand Up @@ -698,8 +699,8 @@ static void net_step ( struct process *process __unused ) {
*/
if ( ( iobuf = netdev_rx_dequeue ( netdev ) ) ) {

DBGC ( netdev, "NETDEV %p processing %p (%p+%zx)\n",
netdev, iobuf, iobuf->data,
DBGC ( netdev, "NETDEV %s processing %p (%p+%zx)\n",
netdev->name, iobuf, iobuf->data,
iob_len ( iobuf ) );

/* Remove link-layer header */
Expand Down

0 comments on commit 24fc6aa

Please sign in to comment.