bonding: More ether_addr_copy and neatenings.
Subsystems (3)
cover bonding: More ether_addr_copy and neatenings.
Joe Perches (3):
bonding: More use of ether_addr_copy
bonding: Remove unnecessary else
bonding: Invert test
drivers/net/bonding/bond_3ad.c | 21 ++++++++++----------- drivers/net/bonding/bond_alb.c | 17 ++++++++--------- drivers/net/bonding/bond_main.c | 6 +++--- 3 files changed, 21 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 1/3 bonding: More use of ether_addr_copy
It's smaller and faster for some architectures.
--- drivers/net/bonding/bond_3ad.c | 4 ++-- drivers/net/bonding/bond_alb.c | 5 ++--- drivers/net/bonding/bond_main.c | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_3ad.c +2 -2
@@ -2386,8 +2386,8 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond, ad_info->ports = aggregator->num_of_ports; ad_info->actor_key = aggregator->actor_oper_aggregator_key; ad_info->partner_key = aggregator->partner_oper_aggregator_key; -memcpy (ad_info->partner_system, - aggregator->partner_system.mac_addr_value,ETH_ALEN ); +ether_addr_copy (ad_info->partner_system, + aggregator->partner_system.mac_addr_value);return 0 ; }
drivers/net/bonding/bond_alb.c +2 -3
@@ -1449,9 +1449,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)if (tx_slave &&SLAVE_IS_OK (tx_slave)) {if (tx_slave !=rcu_dereference (bond->curr_active_slave)) { -memcpy (eth_data->h_source, - tx_slave->dev->dev_addr, -ETH_ALEN ); +ether_addr_copy (eth_data->h_source, + tx_slave->dev->dev_addr); }bond_dev_queue_xmit (bond, skb, tx_slave->dev);
drivers/net/bonding/bond_main.c +3 -3
@@ -674,8 +674,8 @@ static void bond_do_fail_over_mac(struct bonding *bond,if (old_active) {ether_addr_copy (tmp_mac, new_active->dev->dev_addr); -memcpy (saddr.sa_data, old_active->dev->dev_addr, -ETH_ALEN ); +ether_addr_copy (saddr.sa_data, + old_active->dev->dev_addr); saddr.sa_family = new_active->dev->type; }else {ether_addr_copy (saddr.sa_data, bond->dev->dev_addr);
@@ -1142,7 +1142,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)kfree_skb (skb);return RX_HANDLER_CONSUMED ; } -memcpy (eth_hdr (skb)->h_dest, bond->dev->dev_addr,ETH_ALEN ); +ether_addr_copy (eth_hdr (skb)->h_dest, bond->dev->dev_addr); }return ret;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 2/3 bonding: Remove unnecessary else
In reply to Joe PerchesIt's unnecessary and less readable after a clause ending in a goto.
--- drivers/net/bonding/bond_alb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/bonding/bond_alb.c +6 -6
@@ -1455,12 +1455,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)bond_dev_queue_xmit (bond, skb, tx_slave->dev); goto out; - }else { -if (tx_slave) { -_lock_tx_hashtbl (bond); -__tlb_clear_slave (bond, tx_slave,0 ); -_unlock_tx_hashtbl (bond); - } + } + +if (tx_slave) { +_lock_tx_hashtbl (bond); +__tlb_clear_slave (bond, tx_slave,0 ); +_unlock_tx_hashtbl (bond); }/* no suitable interface, frame not sent */
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 3/3 bonding: Invert test
In reply to Joe PerchesMake the error case return early.
Make the normal return at the bottom of the function. Reduces indent for readability.
--- drivers/net/bonding/bond_3ad.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/net/bonding/bond_3ad.c +10 -11
@@ -2381,17 +2381,16 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond, } } -if (aggregator) { - ad_info->aggregator_id = aggregator->aggregator_identifier; - ad_info->ports = aggregator->num_of_ports; - ad_info->actor_key = aggregator->actor_oper_aggregator_key; - ad_info->partner_key = aggregator->partner_oper_aggregator_key; -ether_addr_copy (ad_info->partner_system, - aggregator->partner_system.mac_addr_value); -return 0 ; - } - -return -1 ; +if (!aggregator) +return -1 ; + + ad_info->aggregator_id = aggregator->aggregator_identifier; + ad_info->ports = aggregator->num_of_ports; + ad_info->actor_key = aggregator->actor_oper_aggregator_key; + ad_info->partner_key = aggregator->partner_oper_aggregator_key; +ether_addr_copy (ad_info->partner_system, + aggregator->partner_system.mac_addr_value); +return 0 ; }/* Wrapper used to hold bond->lock so no slave manipulation can occur */
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Quoted 10 lines · Joe Perches
Joe Perches (3):
bonding: More use ofether_addr_copy
bonding: Remove unnecessary else
bonding: Invert testdrivers/net/bonding/bond_3ad.c | 21 ++++++++++----------- drivers/net/bonding/bond_alb.c | 17 ++++++++--------- drivers/net/bonding/bond_main.c | 6 +++--- 3 files changed, 21 insertions(+), 23 deletions(-)
From: Ding Tianhong <[email protected]>
Date: Wed, 19 Feb 2014 09:44:54 +0800
Quoted 6 lines · Joe Perches
Quoted 5 lines
Joe Perches (3):
bonding: More use ofether_addr_copy
bonding: Remove unnecessary else
bonding: Invert test
Quoted 7 lines
Quoted 5 lines
drivers/net/bonding/bond_3ad.c | 21 ++++++++++----------- drivers/net/bonding/bond_alb.c | 17 ++++++++--------- drivers/net/bonding/bond_main.c | 6 +++--- 3 files changed, 21 insertions(+), 23 deletions(-)Reviewed-by Ding Tianhong <[email protected]>
Series applied, thanks Joe.