diff options
author | Roland Dreier <rolandd@cisco.com> | 2008-04-23 14:52:18 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-23 14:52:18 -0400 |
commit | 2bd01c5d2ed04838d50548cb7b955505a20ac0bd (patch) | |
tree | 1e9821dd9178f0a48e54c7aa0781db3b34e7efc4 /drivers/infiniband | |
parent | 807501475fce0ebe68baedf87f202c3e4ee0d12c (diff) |
RDMA/nes: Use print_mac() to format ethernet addresses for printing
Removing open-coded MAC formats shrinks the source and the generated
code too, eg on x86-64:
add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-103 (-103)
function old new delta
make_cm_node 932 912 -20
nes_netdev_set_mac_address 427 406 -21
nes_netdev_set_multicast_list 1148 1124 -24
nes_probe 2349 2311 -38
Acked-by: Glenn Streiff <gstreiff@neteffect.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/nes/nes.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_nic.c | 18 |
3 files changed, 15 insertions, 21 deletions
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c index b046262ed638..c0671ad7de82 100644 --- a/drivers/infiniband/hw/nes/nes.c +++ b/drivers/infiniband/hw/nes/nes.c | |||
@@ -353,13 +353,11 @@ struct ib_qp *nes_get_qp(struct ib_device *device, int qpn) | |||
353 | */ | 353 | */ |
354 | static void nes_print_macaddr(struct net_device *netdev) | 354 | static void nes_print_macaddr(struct net_device *netdev) |
355 | { | 355 | { |
356 | nes_debug(NES_DBG_INIT, "%s: MAC %02X:%02X:%02X:%02X:%02X:%02X, IRQ %u\n", | 356 | DECLARE_MAC_BUF(mac); |
357 | netdev->name, | ||
358 | netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2], | ||
359 | netdev->dev_addr[3], netdev->dev_addr[4], netdev->dev_addr[5], | ||
360 | netdev->irq); | ||
361 | } | ||
362 | 357 | ||
358 | nes_debug(NES_DBG_INIT, "%s: %s, IRQ %u\n", | ||
359 | netdev->name, print_mac(mac, netdev->dev_addr), netdev->irq); | ||
360 | } | ||
363 | 361 | ||
364 | /** | 362 | /** |
365 | * nes_interrupt - handle interrupts | 363 | * nes_interrupt - handle interrupts |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index d0738623bcf3..b53bceb44255 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -1054,6 +1054,7 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core, | |||
1054 | int arpindex = 0; | 1054 | int arpindex = 0; |
1055 | struct nes_device *nesdev; | 1055 | struct nes_device *nesdev; |
1056 | struct nes_adapter *nesadapter; | 1056 | struct nes_adapter *nesadapter; |
1057 | DECLARE_MAC_BUF(mac); | ||
1057 | 1058 | ||
1058 | /* create an hte and cm_node for this instance */ | 1059 | /* create an hte and cm_node for this instance */ |
1059 | cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC); | 1060 | cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC); |
@@ -1116,11 +1117,8 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core, | |||
1116 | 1117 | ||
1117 | /* copy the mac addr to node context */ | 1118 | /* copy the mac addr to node context */ |
1118 | memcpy(cm_node->rem_mac, nesadapter->arp_table[arpindex].mac_addr, ETH_ALEN); | 1119 | memcpy(cm_node->rem_mac, nesadapter->arp_table[arpindex].mac_addr, ETH_ALEN); |
1119 | nes_debug(NES_DBG_CM, "Remote mac addr from arp table:%02x," | 1120 | nes_debug(NES_DBG_CM, "Remote mac addr from arp table: %s\n", |
1120 | " %02x, %02x, %02x, %02x, %02x\n", | 1121 | print_mac(mac, cm_node->rem_mac)); |
1121 | cm_node->rem_mac[0], cm_node->rem_mac[1], | ||
1122 | cm_node->rem_mac[2], cm_node->rem_mac[3], | ||
1123 | cm_node->rem_mac[4], cm_node->rem_mac[5]); | ||
1124 | 1122 | ||
1125 | add_hte_node(cm_core, cm_node); | 1123 | add_hte_node(cm_core, cm_node); |
1126 | atomic_inc(&cm_nodes_created); | 1124 | atomic_inc(&cm_nodes_created); |
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 01cd0effc492..e5366b013c1a 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -787,16 +787,14 @@ static int nes_netdev_set_mac_address(struct net_device *netdev, void *p) | |||
787 | int i; | 787 | int i; |
788 | u32 macaddr_low; | 788 | u32 macaddr_low; |
789 | u16 macaddr_high; | 789 | u16 macaddr_high; |
790 | DECLARE_MAC_BUF(mac); | ||
790 | 791 | ||
791 | if (!is_valid_ether_addr(mac_addr->sa_data)) | 792 | if (!is_valid_ether_addr(mac_addr->sa_data)) |
792 | return -EADDRNOTAVAIL; | 793 | return -EADDRNOTAVAIL; |
793 | 794 | ||
794 | memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len); | 795 | memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len); |
795 | printk(PFX "%s: Address length = %d, Address = %02X%02X%02X%02X%02X%02X..\n", | 796 | printk(PFX "%s: Address length = %d, Address = %s\n", |
796 | __func__, netdev->addr_len, | 797 | __func__, netdev->addr_len, print_mac(mac, mac_addr->sa_data)); |
797 | mac_addr->sa_data[0], mac_addr->sa_data[1], | ||
798 | mac_addr->sa_data[2], mac_addr->sa_data[3], | ||
799 | mac_addr->sa_data[4], mac_addr->sa_data[5]); | ||
800 | macaddr_high = ((u16)netdev->dev_addr[0]) << 8; | 798 | macaddr_high = ((u16)netdev->dev_addr[0]) << 8; |
801 | macaddr_high += (u16)netdev->dev_addr[1]; | 799 | macaddr_high += (u16)netdev->dev_addr[1]; |
802 | macaddr_low = ((u32)netdev->dev_addr[2]) << 24; | 800 | macaddr_low = ((u32)netdev->dev_addr[2]) << 24; |
@@ -878,11 +876,11 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) | |||
878 | if (mc_nic_index < 0) | 876 | if (mc_nic_index < 0) |
879 | mc_nic_index = nesvnic->nic_index; | 877 | mc_nic_index = nesvnic->nic_index; |
880 | if (multicast_addr) { | 878 | if (multicast_addr) { |
881 | nes_debug(NES_DBG_NIC_RX, "Assigning MC Address = %02X%02X%02X%02X%02X%02X to register 0x%04X nic_idx=%d\n", | 879 | DECLARE_MAC_BUF(mac); |
882 | multicast_addr->dmi_addr[0], multicast_addr->dmi_addr[1], | 880 | nes_debug(NES_DBG_NIC_RX, "Assigning MC Address %s to register 0x%04X nic_idx=%d\n", |
883 | multicast_addr->dmi_addr[2], multicast_addr->dmi_addr[3], | 881 | print_mac(mac, multicast_addr->dmi_addr), |
884 | multicast_addr->dmi_addr[4], multicast_addr->dmi_addr[5], | 882 | perfect_filter_register_address+(mc_index * 8), |
885 | perfect_filter_register_address+(mc_index * 8), mc_nic_index); | 883 | mc_nic_index); |
886 | macaddr_high = ((u16)multicast_addr->dmi_addr[0]) << 8; | 884 | macaddr_high = ((u16)multicast_addr->dmi_addr[0]) << 8; |
887 | macaddr_high += (u16)multicast_addr->dmi_addr[1]; | 885 | macaddr_high += (u16)multicast_addr->dmi_addr[1]; |
888 | macaddr_low = ((u32)multicast_addr->dmi_addr[2]) << 24; | 886 | macaddr_low = ((u32)multicast_addr->dmi_addr[2]) << 24; |