Commit 77afc92b authored by Holger Eitzenberger's avatar Holger Eitzenberger Committed by David S. Miller

bonding: use table for mode names

Use a small array in bond_mode_name() for the names, thus saving some
space:

before

    text     data      bss      dec    hex filename
   57736     9372      344    67452  1077c drivers/net/bonding/bonding.ko

after
    text     data      bss      dec    hex filename
   57441     9372      344    67157  10655 drivers/net/bonding/bonding.ko
Signed-off-by: default avatarHolger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 58402054
...@@ -219,24 +219,20 @@ static void bond_deinit(struct net_device *bond_dev); ...@@ -219,24 +219,20 @@ static void bond_deinit(struct net_device *bond_dev);
static const char *bond_mode_name(int mode) static const char *bond_mode_name(int mode)
{ {
switch (mode) { static const char *names[] = {
case BOND_MODE_ROUNDROBIN : [BOND_MODE_ROUNDROBIN] = "load balancing (round-robin)",
return "load balancing (round-robin)"; [BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)",
case BOND_MODE_ACTIVEBACKUP : [BOND_MODE_XOR] = "load balancing (xor)",
return "fault-tolerance (active-backup)"; [BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)",
case BOND_MODE_XOR : [BOND_MODE_8023AD]= "IEEE 802.3ad Dynamic link aggregation",
return "load balancing (xor)"; [BOND_MODE_TLB] = "transmit load balancing",
case BOND_MODE_BROADCAST : [BOND_MODE_ALB] = "adaptive load balancing",
return "fault-tolerance (broadcast)"; };
case BOND_MODE_8023AD:
return "IEEE 802.3ad Dynamic link aggregation"; if (mode < 0 || mode > BOND_MODE_ALB)
case BOND_MODE_TLB:
return "transmit load balancing";
case BOND_MODE_ALB:
return "adaptive load balancing";
default:
return "unknown"; return "unknown";
}
return names[mode];
} }
/*---------------------------------- VLAN -----------------------------------*/ /*---------------------------------- VLAN -----------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment