[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111019173927.GA2922@minipsycho>
Date: Wed, 19 Oct 2011 19:39:28 +0200
From: Jiri Pirko <jpirko@...hat.com>
To: Benjamin Poirier <benjamin.poirier@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
eric.dumazet@...il.com, bhutchings@...arflare.com,
shemminger@...tta.com, fubar@...ibm.com, andy@...yhouse.net,
tgraf@...radead.org, ebiederm@...ssion.com, mirqus@...il.com,
kaber@...sh.net, greearb@...delatech.com, jesse@...ira.com
Subject: Re: [patch net-next-2.6] net: introduce ethernet teaming device
Wed, Oct 19, 2011 at 07:26:24PM CEST, benjamin.poirier@...il.com wrote:
>Hi Jiri, just a few late comments:
>
>On 11/10/04 16:15, Jiri Pirko wrote:
>> This patch introduces new network device called team. It supposes to be
>> very fast, simple, userspace-driven alternative to existing bonding
>> driver.
>>
>> Userspace library called libteam with couple of demo apps is available
>> here:
>> https://github.com/jpirko/libteam
>> Note it's still in its dipers atm.
>>
>> team<->libteam use generic netlink for communication. That and rtnl
>> suppose to be the only way to configure team device, no sysfs etc.
>>
>> In near future python binding for libteam will be introduced. Also
>> daemon providing arpmon/miimon active-backup functionality will
>> be introduced. All what's necessary is already implemented in kernel team
>> driver.
>>
>> Signed-off-by: Jiri Pirko <jpirko@...hat.com>
>
>[...]
>
>> +/******************************
>> + * Round-robin mode definition
>> + ******************************/
>> +
>> +static struct team_port *__get_first_port_up(struct team *team,
>> + struct team_port *port)
>
>This is more like __get_"next"_port_up() no?
Might be.
>
>> +{
>> + struct team_port *cur;
>> +
>> + if (port->linkup)
>> + return port;
>> + cur = port;
>> + list_for_each_entry_continue_rcu(cur, &team->port_list, list)
>> + if (cur->linkup)
>> + return cur;
>> + list_for_each_entry_rcu(cur, &team->port_list, list) {
>> + if (cur == port)
>> + break;
>> + if (cur->linkup)
>> + return cur;
>> + }
>> + return NULL;
>> +}
>> +
>
>[...]
>
>> +
>> +
>> +/****************
>> + * Mode handling
>> + ****************/
>> +
>> +static const struct team_mode *team_modes[] = {
>> + &rr_mode,
>> + &ab_mode,
>> +};
>> +
>> +static const int team_mode_count = ARRAY_SIZE(team_modes);
>> +
>> +static int team_find_mode(const char *kind)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < team_mode_count; i++) {
>> + const struct team_mode *mode = team_modes[i];
>> +
>> + if (strcmp(mode->kind, kind) == 0)
>> + return i;
>> + }
>> + return -ENOENT;
>> +}
>> +
>> +/*
>> + * We can benefit from the fact that it's ensured no port is present
>> + * at the time of mode change.
>> + */
>> +static void __team_change_mode(struct team *team, const int mode_index)
>> +{
>> + const struct team_mode *mode = team_modes[mode_index];
>
>team_uninit() calls __team_change_mode(team, -1) which will therefore
>dereference team_modes[-1]. Is this always safe?
I changed this bits. New patch is coming soon...
Thanks.
Jirka
>
>-Ben
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists