Subject: Re: [patch net-next 10/26] bonding: fill-up LAG changeupper info struct and pass it along

From: Nikolay Aleksandrov <[email-masked]>
Date: Wed, 2 Dec 2015 12:00:47 +0100

On 12/01/2015 02:48 PM, Jiri Pirko wrote:
> From: Jiri Pirko <[email-masked]>
> 
> Initialize netdev_lag_upper_info structure by TX type according to
> current bonding mode and pass it along via netdev_master_upper_dev_link.
> 
> Signed-off-by: Jiri Pirko <[email-masked]>
> ---
>  drivers/net/bonding/bond_main.c | 43 +++++++++++++++++++++++++++--------------
>  1 file changed, 29 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index fa3ed1d..8747746 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1198,26 +1198,41 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
>  	return ret;
>  }
>  
> -static int bond_master_upper_dev_link(struct net_device *bond_dev,
> -				      struct net_device *slave_dev,
> -				      struct slave *slave)
> +static enum netdev_lag_tx_type bond_lag_tx_type(struct bonding *bond)
>  {
> +	switch (BOND_MODE(bond)) {
> +	case BOND_MODE_ROUNDROBIN:
> +		return NETDEV_LAG_TX_TYPE_ROUNDROBIN;
> +	case BOND_MODE_ACTIVEBACKUP:
> +		return NETDEV_LAG_TX_TYPE_ACTIVEBACKUP;
> +	case BOND_MODE_XOR:
> +	case BOND_MODE_8023AD:
> +		return NETDEV_LAG_TX_TYPE_HASH;
> +	default:
> +		return NETDEV_LAG_TX_TYPE_UNKNOWN;
> +	}
> +}

Bonding also has the broadcast mode (NETDEV_LAG_TX_BROADCAST).

> +
[snip]