Subject: Re: [PATCH v2 net-next 5/9] bonding: create a macro for bond mode and use it

From: Jay Vosburgh <[email-masked]>
Date: Thu, 15 May 2014 11:32:41 -0700

Veaceslav Falico <[email-masked]> wrote:

>On Thu, May 15, 2014 at 10:51:51AM -0700, Jay Vosburgh wrote:
>>Veaceslav Falico <[email-masked]> wrote:
>>
>>>CC: Jay Vosburgh <[email-masked]>
>>>CC: Andy Gospodarek <[email-masked]>
>>>Signed-off-by: Veaceslav Falico <[email-masked]>
>>>---
>...snip...
>>	Would it be better to use "bond_uses_primary(struct bonding *)"
>>instead of the above?  That would simplify the above calling pattern,
>>and shorten the calls elsewhere.  Maybe I missed one, but it looks like
>>all of the calls to _uses_primary have BOND_MODE(bond) as the argument.
>
>There's at least one call, when checking the params, where it checks the
>int:
>
>bond_main.c:
>4271         if (primary && !bond_mode_uses_primary(bond_mode)) {
>
>so, either we'll use something else here, or leave it with BOND_MODE()...

	The something else isn't so bad, and would look better for most
callers:

static inline bool bond_uses_primary(struct bonding *bond)
{
	return bond_mode_uses_primary(bond->params.mode);
}

	This ends up replacing "USES_PRIMARY(bond->params.mode)" with
"bond_uses_primary(bond)" for most call sites, which actually looks like
an improvement (it's even shorter).

	-J

---
	-Jay Vosburgh, [email-masked]