[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F85992F.8010708@intel.com>
Date: Wed, 11 Apr 2012 07:46:07 -0700
From: John Fastabend <john.r.fastabend@...el.com>
To: Ben Hutchings <bhutchings@...arflare.com>
CC: mst@...hat.com, stephen.hemminger@...tta.com, davem@...emloft.net,
hadi@...erus.ca, jeffrey.t.kirsher@...el.com,
netdev@...r.kernel.org, gregory.v.rose@...el.com,
krkumar2@...ibm.com, sri@...ibm.com
Subject: Re: [net-next PATCH v1 2/7] net: addr_list: add exclusive dev_uc_add
and dev_mc_add
On 4/10/2012 8:33 PM, Ben Hutchings wrote:
> On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
>> This adds a dev_uc_add_excl() and dev_mc_add_excl() calls
>> similar to the original dev_{uc|mc}_add() except it sets
>> the global bit and returns -EEXIST for duplicat entires.
>>
>> This is useful for drivers that support SR-IOV, macvlan
>> devices and any other devices that need to manage the
>> unicast and multicast lists.
> [...]
>> +/**
>> + * dev_mc_add_excl - Add a global secondary multicast address
>> + * @dev: device
>> + * @addr: address to add
>> + */
>> +int dev_mc_add_excl(struct net_device *dev, unsigned char *addr)
>> +{
>> + struct netdev_hw_addr *ha;
>> + int err;
>> +
>> + netif_addr_lock_bh(dev);
>> + list_for_each_entry(ha, &dev->mc.list, list) {
>> + if (!memcmp(ha->addr, addr, dev->addr_len) &&
>> + ha->type == NETDEV_HW_ADDR_T_UNICAST) {
>> + err = -EEXIST;
>> + goto out;
>> + }
>> + }
>> + err = __hw_addr_create_ex(&dev->mc, addr, dev->addr_len,
>> + NETDEV_HW_ADDR_T_UNICAST, true);
> [...]
>
> The address types are wrong. But do we even need this function yet?
>
> Ben.
>
macvlan wants to manage multicast addresses as well. Good catch thanks.
.John
--
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