[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091022142806.GJ2868@psychotron.lab.eng.brq.redhat.com>
Date: Thu, 22 Oct 2009 16:28:06 +0200
From: Jiri Pirko <jpirko@...hat.com>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
eric.dumazet@...il.com, jeffrey.t.kirsher@...el.com,
jesse.brandeburg@...el.com, bruce.w.allan@...el.com,
peter.p.waskiewicz.jr@...el.com, john.ronciak@...el.com,
e1000-devel@...ts.sourceforge.net, mchehab@...radead.org,
linux-media@...r.kernel.org
Subject: Re: [PATCH net-next-2.6 1/4] net: introduce mc list helpers
Thu, Oct 22, 2009 at 04:18:32PM CEST, bhutchings@...arflare.com wrote:
>On Thu, 2009-10-22 at 15:52 +0200, Jiri Pirko wrote:
>> This helpers should be used by network drivers to access to netdev
>> multicast lists.
>[...]
>> +static inline void netdev_mc_walk(struct net_device *dev,
>> + void (*func)(void *, unsigned char *),
>> + void *data)
>> +{
>> + struct dev_addr_list *mclist;
>> + int i;
>> +
>> + for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
>> + i++, mclist = mclist->next)
>> + func(data, mclist->dmi_addr);
>> +}
>[...]
>
>We usually implement iteration as macros so that any context doesn't
>have to be squeezed through a single untyped (void *) variable. A macro
>for this would look something like:
>
>#define netdev_for_each_mc_addr(dev, addr) \
> for (addr = (dev)->mc_list ? (dev)->mc_list->dmi_addr : NULL; \
> addr; \
> addr = (container_of(addr, struct dev_addr_list, dmi_addr)->next ? \
> container_of(addr, struct dev_addr_list, dmi_addr)->next->dmi_addr : \
> NULL))
I admit this would look better. Going to change this and then repost.
Thanks Ben
>
>Once you change the list type this can presumably be made less ugly.
>
>Ben.
>
>--
>Ben Hutchings, Senior Software Engineer, Solarflare Communications
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
--
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