diff options
author | Joe Perches <joe@perches.com> | 2007-10-03 20:59:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:42 -0400 |
commit | 0795af5729b18218767fab27c44b1384f72dc9ad (patch) | |
tree | 67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /drivers/net/tokenring/lanstreamer.c | |
parent | 95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff) |
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tokenring/lanstreamer.c')
-rw-r--r-- | drivers/net/tokenring/lanstreamer.c | 64 |
1 files changed, 27 insertions, 37 deletions
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index f114fb729f54..47d84cd28097 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
@@ -447,6 +447,9 @@ static int streamer_reset(struct net_device *dev) | |||
447 | unsigned int uaa_addr; | 447 | unsigned int uaa_addr; |
448 | struct sk_buff *skb = NULL; | 448 | struct sk_buff *skb = NULL; |
449 | __u16 misr; | 449 | __u16 misr; |
450 | #if STREAMER_DEBUG | ||
451 | DECLARE_MAC_BUF(mac); | ||
452 | #endif | ||
450 | 453 | ||
451 | streamer_priv = netdev_priv(dev); | 454 | streamer_priv = netdev_priv(dev); |
452 | streamer_mmio = streamer_priv->streamer_mmio; | 455 | streamer_mmio = streamer_priv->streamer_mmio; |
@@ -575,11 +578,8 @@ static int streamer_reset(struct net_device *dev) | |||
575 | dev->dev_addr[i+1]= addr & 0xff; | 578 | dev->dev_addr[i+1]= addr & 0xff; |
576 | } | 579 | } |
577 | #if STREAMER_DEBUG | 580 | #if STREAMER_DEBUG |
578 | printk("Adapter address: "); | 581 | printk("Adapter address: %s\n", |
579 | for (i = 0; i < 6; i++) { | 582 | print_mac(mac, dev->dev_addr)); |
580 | printk("%02x:", dev->dev_addr[i]); | ||
581 | } | ||
582 | printk("\n"); | ||
583 | #endif | 583 | #endif |
584 | } | 584 | } |
585 | return 0; | 585 | return 0; |
@@ -1539,6 +1539,7 @@ static void streamer_arb_cmd(struct net_device *dev) | |||
1539 | 1539 | ||
1540 | #if STREAMER_NETWORK_MONITOR | 1540 | #if STREAMER_NETWORK_MONITOR |
1541 | struct trh_hdr *mac_hdr; | 1541 | struct trh_hdr *mac_hdr; |
1542 | DECLARE_MAC_BUF(mac); | ||
1542 | #endif | 1543 | #endif |
1543 | 1544 | ||
1544 | writew(streamer_priv->arb, streamer_mmio + LAPA); | 1545 | writew(streamer_priv->arb, streamer_mmio + LAPA); |
@@ -1611,15 +1612,11 @@ static void streamer_arb_cmd(struct net_device *dev) | |||
1611 | dev->name); | 1612 | dev->name); |
1612 | mac_hdr = tr_hdr(mac_frame); | 1613 | mac_hdr = tr_hdr(mac_frame); |
1613 | printk(KERN_WARNING | 1614 | printk(KERN_WARNING |
1614 | "%s: MAC Frame Dest. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", | 1615 | "%s: MAC Frame Dest. Addr: %s\n", |
1615 | dev->name, mac_hdr->daddr[0], mac_hdr->daddr[1], | 1616 | dev->name, print_mac(mac, mac_hdr->daddr)); |
1616 | mac_hdr->daddr[2], mac_hdr->daddr[3], | ||
1617 | mac_hdr->daddr[4], mac_hdr->daddr[5]); | ||
1618 | printk(KERN_WARNING | 1617 | printk(KERN_WARNING |
1619 | "%s: MAC Frame Srce. Addr: %02x:%02x:%02x:%02x:%02x:%02x \n", | 1618 | "%s: MAC Frame Srce. Addr: %s\n", |
1620 | dev->name, mac_hdr->saddr[0], mac_hdr->saddr[1], | 1619 | dev->name, DEV->ADDR6(mac_hdr->saddr)); |
1621 | mac_hdr->saddr[2], mac_hdr->saddr[3], | ||
1622 | mac_hdr->saddr[4], mac_hdr->saddr[5]); | ||
1623 | #endif | 1620 | #endif |
1624 | netif_rx(mac_frame); | 1621 | netif_rx(mac_frame); |
1625 | 1622 | ||
@@ -1854,6 +1851,8 @@ static int sprintf_info(char *buffer, struct net_device *dev) | |||
1854 | struct streamer_parameters_table spt; | 1851 | struct streamer_parameters_table spt; |
1855 | int size = 0; | 1852 | int size = 0; |
1856 | int i; | 1853 | int i; |
1854 | DECLARE_MAC_BUF(mac); | ||
1855 | DECLARE_MAC_BUF(mac2); | ||
1857 | 1856 | ||
1858 | writew(streamer_priv->streamer_addr_table_addr, streamer_mmio + LAPA); | 1857 | writew(streamer_priv->streamer_addr_table_addr, streamer_mmio + LAPA); |
1859 | for (i = 0; i < 14; i += 2) { | 1858 | for (i = 0; i < 14; i += 2) { |
@@ -1875,37 +1874,30 @@ static int sprintf_info(char *buffer, struct net_device *dev) | |||
1875 | size = sprintf(buffer, "\n%6s: Adapter Address : Node Address : Functional Addr\n", dev->name); | 1874 | size = sprintf(buffer, "\n%6s: Adapter Address : Node Address : Functional Addr\n", dev->name); |
1876 | 1875 | ||
1877 | size += sprintf(buffer + size, | 1876 | size += sprintf(buffer + size, |
1878 | "%6s: %02x:%02x:%02x:%02x:%02x:%02x : %02x:%02x:%02x:%02x:%02x:%02x : %02x:%02x:%02x:%02x\n", | 1877 | "%6s: %s : %s : %02x:%02x:%02x:%02x\n", |
1879 | dev->name, dev->dev_addr[0], dev->dev_addr[1], | 1878 | dev->name, print_mac(mac, dev->dev_addr), |
1880 | dev->dev_addr[2], dev->dev_addr[3], dev->dev_addr[4], | 1879 | print_mac(mac2, sat.node_addr), |
1881 | dev->dev_addr[5], sat.node_addr[0], sat.node_addr[1], | 1880 | sat.func_addr[0], sat.func_addr[1], |
1882 | sat.node_addr[2], sat.node_addr[3], sat.node_addr[4], | 1881 | sat.func_addr[2], sat.func_addr[3]); |
1883 | sat.node_addr[5], sat.func_addr[0], sat.func_addr[1], | ||
1884 | sat.func_addr[2], sat.func_addr[3]); | ||
1885 | 1882 | ||
1886 | size += sprintf(buffer + size, "\n%6s: Token Ring Parameters Table:\n", dev->name); | 1883 | size += sprintf(buffer + size, "\n%6s: Token Ring Parameters Table:\n", dev->name); |
1887 | 1884 | ||
1888 | size += sprintf(buffer + size, "%6s: Physical Addr : Up Node Address : Poll Address : AccPri : Auth Src : Att Code :\n", dev->name); | 1885 | size += sprintf(buffer + size, "%6s: Physical Addr : Up Node Address : Poll Address : AccPri : Auth Src : Att Code :\n", dev->name); |
1889 | 1886 | ||
1890 | size += sprintf(buffer + size, | 1887 | size += sprintf(buffer + size, |
1891 | "%6s: %02x:%02x:%02x:%02x : %02x:%02x:%02x:%02x:%02x:%02x : %02x:%02x:%02x:%02x:%02x:%02x : %04x : %04x : %04x :\n", | 1888 | "%6s: %02x:%02x:%02x:%02x : %s : %s : %04x : %04x : %04x :\n", |
1892 | dev->name, spt.phys_addr[0], spt.phys_addr[1], | 1889 | dev->name, spt.phys_addr[0], spt.phys_addr[1], |
1893 | spt.phys_addr[2], spt.phys_addr[3], | 1890 | spt.phys_addr[2], spt.phys_addr[3], |
1894 | spt.up_node_addr[0], spt.up_node_addr[1], | 1891 | print_mac(mac, spt.up_node_addr), |
1895 | spt.up_node_addr[2], spt.up_node_addr[3], | 1892 | print_mac(mac2, spt.poll_addr), |
1896 | spt.up_node_addr[4], spt.up_node_addr[4], | ||
1897 | spt.poll_addr[0], spt.poll_addr[1], spt.poll_addr[2], | ||
1898 | spt.poll_addr[3], spt.poll_addr[4], spt.poll_addr[5], | ||
1899 | ntohs(spt.acc_priority), ntohs(spt.auth_source_class), | 1893 | ntohs(spt.acc_priority), ntohs(spt.auth_source_class), |
1900 | ntohs(spt.att_code)); | 1894 | ntohs(spt.att_code)); |
1901 | 1895 | ||
1902 | size += sprintf(buffer + size, "%6s: Source Address : Bcn T : Maj. V : Lan St : Lcl Rg : Mon Err : Frame Correl : \n", dev->name); | 1896 | size += sprintf(buffer + size, "%6s: Source Address : Bcn T : Maj. V : Lan St : Lcl Rg : Mon Err : Frame Correl : \n", dev->name); |
1903 | 1897 | ||
1904 | size += sprintf(buffer + size, | 1898 | size += sprintf(buffer + size, |
1905 | "%6s: %02x:%02x:%02x:%02x:%02x:%02x : %04x : %04x : %04x : %04x : %04x : %04x : \n", | 1899 | "%6s: %s : %04x : %04x : %04x : %04x : %04x : %04x : \n", |
1906 | dev->name, spt.source_addr[0], spt.source_addr[1], | 1900 | dev->name, print_mac(mac, spt.source_addr), |
1907 | spt.source_addr[2], spt.source_addr[3], | ||
1908 | spt.source_addr[4], spt.source_addr[5], | ||
1909 | ntohs(spt.beacon_type), ntohs(spt.major_vector), | 1901 | ntohs(spt.beacon_type), ntohs(spt.major_vector), |
1910 | ntohs(spt.lan_status), ntohs(spt.local_ring), | 1902 | ntohs(spt.lan_status), ntohs(spt.local_ring), |
1911 | ntohs(spt.mon_error), ntohs(spt.frame_correl)); | 1903 | ntohs(spt.mon_error), ntohs(spt.frame_correl)); |
@@ -1914,14 +1906,12 @@ static int sprintf_info(char *buffer, struct net_device *dev) | |||
1914 | dev->name); | 1906 | dev->name); |
1915 | 1907 | ||
1916 | size += sprintf(buffer + size, | 1908 | size += sprintf(buffer + size, |
1917 | "%6s: : %02x : %02x : %02x:%02x:%02x:%02x:%02x:%02x : %02x:%02x:%02x:%02x : \n", | 1909 | "%6s: : %02x : %02x : %s : %02x:%02x:%02x:%02x : \n", |
1918 | dev->name, ntohs(spt.beacon_transmit), | 1910 | dev->name, ntohs(spt.beacon_transmit), |
1919 | ntohs(spt.beacon_receive), spt.beacon_naun[0], | 1911 | ntohs(spt.beacon_receive), |
1920 | spt.beacon_naun[1], spt.beacon_naun[2], | 1912 | print_mac(mac, spt.beacon_naun), |
1921 | spt.beacon_naun[3], spt.beacon_naun[4], | 1913 | spt.beacon_phys[0], spt.beacon_phys[1], |
1922 | spt.beacon_naun[5], spt.beacon_phys[0], | 1914 | spt.beacon_phys[2], spt.beacon_phys[3]); |
1923 | spt.beacon_phys[1], spt.beacon_phys[2], | ||
1924 | spt.beacon_phys[3]); | ||
1925 | return size; | 1915 | return size; |
1926 | } | 1916 | } |
1927 | #endif | 1917 | #endif |