[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090413075638.61839874@nehalam>
Date: Mon, 13 Apr 2009 07:56:38 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Jiri Pirko <jpirko@...hat.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
jgarzik@...ox.com, davem@...emloft.net,
bridge@...ts.linux-foundation.org, fubar@...ibm.com,
bonding-devel@...ts.sourceforge.net, kaber@...sh.net,
mschmidt@...hat.com, dada1@...mosbay.com, ivecera@...hat.com
Subject: Re: [PATCH 4/4] net: bonding: add slave device addresses in mode
alb
On Mon, 13 Apr 2009 10:46:15 +0200
Jiri Pirko <jpirko@...hat.com> wrote:
> When in mode alb, add all device addresses which belong to an enslaved slave
> device to the bond device. This ensures that all mac addresses will be
> treated as local and bonding in this mode will work fine in bridge.
>
> Signed-off-by: Jiri Pirko <jpirko@...hat.com>
> ---
> drivers/net/bonding/bond_main.c | 30 +++++++++++++++++++++++++++++-
> 1 files changed, 29 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 99610f3..47795c7 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1385,6 +1385,11 @@ static void bond_setup_by_slave(struct net_device *bond_dev,
> bond->setup_by_slave = 1;
> }
>
> +static inline int should_copy_dev_addrs(struct bonding *bond)
> +{
> + return bond->params.mode == BOND_MODE_ALB ? 1 : 0;
> +}
static inline bool should_copy_dev_addrs(const struct bonding *bond)
{
return (bond->params.mode == BOND_MODE_ALB);
}
Three things are wrong with your style here:
1. Needless use of tri-graph operator, just return the result
2. Use const for test_foo() type functions
3. Use bool to make it clearer what the result is.
> /* enslave device <slave> to bond device <master> */
> int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> {
> @@ -1510,6 +1515,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> */
> new_slave->original_flags = slave_dev->flags;
>
> + if (should_copy_dev_addrs(bond)) {
> + res = dev_addr_add_multiple(bond_dev, slave_dev);
> + if (res)
> + goto err_free;
> + dev_mac_address_changed(bond_dev);
The notifier (dev_mac_address_changed) should be part of dev_addr_add
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists