mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
net: convert multicast list to list_head
Converts the list and the core manipulating with it to be the same as uc_list. +uses two functions for adding/removing mc address (normal and "global" variant) instead of a function parameter. +removes dev_mcast.c completely. +exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for manipulation with lists on a sandbox (used in bonding and 80211 drivers) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a748ee2426
commit
22bedad3ce
@ -876,7 +876,7 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
|
||||
if (!mc_all_on) {
|
||||
char *addrs;
|
||||
int i;
|
||||
struct dev_mc_list *mcaddr;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC);
|
||||
if (!addrs) {
|
||||
@ -884,9 +884,8 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
|
||||
goto unlock;
|
||||
}
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mcaddr, netdev)
|
||||
memcpy(get_addr(addrs, i++),
|
||||
mcaddr->dmi_addr, ETH_ALEN);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN);
|
||||
|
||||
perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW +
|
||||
pft_entries_preallocated * 0x8;
|
||||
|
@ -783,7 +783,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
|
||||
struct ipoib_dev_priv *priv =
|
||||
container_of(work, struct ipoib_dev_priv, restart_task);
|
||||
struct net_device *dev = priv->dev;
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct ipoib_mcast *mcast, *tmcast;
|
||||
LIST_HEAD(remove_list);
|
||||
unsigned long flags;
|
||||
@ -808,14 +808,13 @@ void ipoib_mcast_restart_task(struct work_struct *work)
|
||||
clear_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags);
|
||||
|
||||
/* Mark all of the entries that are found or don't exist */
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
union ib_gid mgid;
|
||||
|
||||
if (!ipoib_mcast_addr_is_valid(mclist->dmi_addr,
|
||||
dev->broadcast))
|
||||
if (!ipoib_mcast_addr_is_valid(ha->addr, dev->broadcast))
|
||||
continue;
|
||||
|
||||
memcpy(mgid.raw, mclist->dmi_addr + 4, sizeof mgid);
|
||||
memcpy(mgid.raw, ha->addr + 4, sizeof mgid);
|
||||
|
||||
mcast = __ipoib_mcast_find(dev, &mgid);
|
||||
if (!mcast || test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) {
|
||||
|
@ -1109,14 +1109,14 @@ static int dvb_net_feed_stop(struct net_device *dev)
|
||||
}
|
||||
|
||||
|
||||
static int dvb_set_mc_filter (struct net_device *dev, struct dev_mc_list *mc)
|
||||
static int dvb_set_mc_filter(struct net_device *dev, unsigned char *addr)
|
||||
{
|
||||
struct dvb_net_priv *priv = netdev_priv(dev);
|
||||
|
||||
if (priv->multi_num == DVB_NET_MULTICAST_MAX)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(priv->multi_macs[priv->multi_num], mc->dmi_addr, 6);
|
||||
memcpy(priv->multi_macs[priv->multi_num], addr, ETH_ALEN);
|
||||
|
||||
priv->multi_num++;
|
||||
return 0;
|
||||
@ -1140,7 +1140,7 @@ static void wq_set_multicast_list (struct work_struct *work)
|
||||
dprintk("%s: allmulti mode\n", dev->name);
|
||||
priv->rx_mode = RX_MODE_ALL_MULTI;
|
||||
} else if (!netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *mc;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
dprintk("%s: set_mc_list, %d entries\n",
|
||||
dev->name, netdev_mc_count(dev));
|
||||
@ -1148,8 +1148,8 @@ static void wq_set_multicast_list (struct work_struct *work)
|
||||
priv->rx_mode = RX_MODE_MULTI;
|
||||
priv->multi_num = 0;
|
||||
|
||||
netdev_for_each_mc_addr(mc, dev)
|
||||
dvb_set_mc_filter(dev, mc);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
dvb_set_mc_filter(dev, ha->addr);
|
||||
}
|
||||
|
||||
netif_addr_unlock_bh(dev);
|
||||
|
@ -1216,7 +1216,7 @@ static int elp_close(struct net_device *dev)
|
||||
static void elp_set_mc_list(struct net_device *dev)
|
||||
{
|
||||
elp_device *adapter = netdev_priv(dev);
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i;
|
||||
unsigned long flags;
|
||||
|
||||
@ -1231,8 +1231,9 @@ static void elp_set_mc_list(struct net_device *dev)
|
||||
adapter->tx_pcb.command = CMD_LOAD_MULTICAST_LIST;
|
||||
adapter->tx_pcb.length = 6 * netdev_mc_count(dev);
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
memcpy(adapter->tx_pcb.data.multicast[i++], dmi->dmi_addr, 6);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
memcpy(adapter->tx_pcb.data.multicast[i++],
|
||||
ha->addr, 6);
|
||||
adapter->got[CMD_LOAD_MULTICAST_LIST] = 0;
|
||||
if (!send_pcb(dev, &adapter->tx_pcb))
|
||||
pr_err("%s: couldn't send set_multicast command\n", dev->name);
|
||||
|
@ -625,7 +625,7 @@ static int init586(struct net_device *dev)
|
||||
volatile struct iasetup_cmd_struct *ias_cmd;
|
||||
volatile struct tdr_cmd_struct *tdr_cmd;
|
||||
volatile struct mcsetup_cmd_struct *mc_cmd;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int num_addrs = netdev_mc_count(dev);
|
||||
|
||||
ptr = (void *) ((char *) p->scb + sizeof(struct scb_struct));
|
||||
@ -788,8 +788,9 @@ static int init586(struct net_device *dev)
|
||||
mc_cmd->cmd_link = 0xffff;
|
||||
mc_cmd->mc_cnt = num_addrs * 6;
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
memcpy((char *) mc_cmd->mc_list[i++], dmi->dmi_addr, 6);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
memcpy((char *) mc_cmd->mc_list[i++],
|
||||
ha->addr, 6);
|
||||
p->scb->cbl_offset = make16(mc_cmd);
|
||||
p->scb->cmd = CUC_START;
|
||||
elmc_id_attn586();
|
||||
|
@ -1533,7 +1533,7 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
|
||||
{
|
||||
unsigned char block[62];
|
||||
unsigned char *bp;
|
||||
struct dev_mc_list *dmc;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if(retry==0)
|
||||
lp->mc_list_valid = 0;
|
||||
@ -1543,8 +1543,8 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
|
||||
block[0]=netdev_mc_count(dev);
|
||||
bp=block+2;
|
||||
|
||||
netdev_for_each_mc_addr(dmc, dev) {
|
||||
memcpy(bp, dmc->dmi_addr, 6);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
memcpy(bp, ha->addr, 6);
|
||||
bp+=6;
|
||||
}
|
||||
if(mc32_command_nowait(dev, 2, block,
|
||||
|
@ -595,7 +595,7 @@ static void lance_load_multicast (struct net_device *dev)
|
||||
struct lance_private *lp = netdev_priv(dev);
|
||||
volatile struct lance_init_block *ib = lp->init_block;
|
||||
volatile u16 *mcast_table = (u16 *)&ib->filter;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *addrs;
|
||||
u32 crc;
|
||||
|
||||
@ -610,8 +610,8 @@ static void lance_load_multicast (struct net_device *dev)
|
||||
ib->filter [1] = 0;
|
||||
|
||||
/* Add addresses */
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
|
||||
/* multicast address? */
|
||||
if (!(*addrs & 1))
|
||||
|
@ -909,11 +909,11 @@ static void __cp_set_rx_mode (struct net_device *dev)
|
||||
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0xffffffff;
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
rx_mode = AcceptBroadcast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
|
||||
|
||||
mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
|
||||
rx_mode |= AcceptMulticast;
|
||||
|
@ -2502,11 +2502,11 @@ static void __set_rx_mode (struct net_device *dev)
|
||||
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0xffffffff;
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
rx_mode = AcceptBroadcast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
|
||||
|
||||
mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
|
||||
rx_mode |= AcceptMulticast;
|
||||
|
@ -1542,7 +1542,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
}
|
||||
|
||||
if (!netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned char *cp;
|
||||
struct mc_cmd *cmd;
|
||||
|
||||
@ -1552,10 +1552,10 @@ static void set_multicast_list(struct net_device *dev)
|
||||
cmd->cmd.command = CmdMulticastList;
|
||||
cmd->mc_cnt = cnt * ETH_ALEN;
|
||||
cp = cmd->mc_addrs;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (!cnt--)
|
||||
break;
|
||||
memcpy(cp, dmi->dmi_addr, ETH_ALEN);
|
||||
memcpy(cp, ha->addr, ETH_ALEN);
|
||||
if (i596_debug > 1)
|
||||
DEB(DEB_MULTI,printk(KERN_INFO "%s: Adding address %pM\n",
|
||||
dev->name, cp));
|
||||
|
@ -603,7 +603,7 @@ static void lance_load_multicast (struct net_device *dev)
|
||||
struct lance_private *lp = netdev_priv(dev);
|
||||
volatile struct lance_init_block *ib = lp->init_block;
|
||||
volatile u16 *mcast_table = (u16 *)&ib->filter;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *addrs;
|
||||
u32 crc;
|
||||
|
||||
@ -618,8 +618,8 @@ static void lance_load_multicast (struct net_device *dev)
|
||||
ib->filter [1] = 0;
|
||||
|
||||
/* Add addresses */
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
|
||||
/* multicast address? */
|
||||
if (!(*addrs & 1))
|
||||
|
@ -1377,7 +1377,7 @@ list to the device.
|
||||
*/
|
||||
static void amd8111e_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct amd8111e_priv *lp = netdev_priv(dev);
|
||||
u32 mc_filter[2] ;
|
||||
int bit_num;
|
||||
@ -1408,8 +1408,8 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
|
||||
/* load all the multicast addresses in the logic filter */
|
||||
lp->options |= OPTION_MULTICAST_ENABLE;
|
||||
mc_filter[1] = mc_filter[0] = 0;
|
||||
netdev_for_each_mc_addr(mc_ptr, dev) {
|
||||
bit_num = (ether_crc_le(ETH_ALEN, mc_ptr->dmi_addr) >> 26) & 0x3f;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
bit_num = (ether_crc_le(ETH_ALEN, ha->addr) >> 26) & 0x3f;
|
||||
mc_filter[bit_num >> 5] |= 1 << (bit_num & 31);
|
||||
}
|
||||
amd8111e_writeq(*(u64*)mc_filter,lp->mmio+ LADRF);
|
||||
|
@ -383,12 +383,12 @@ static void am79c961_setmulticastlist (struct net_device *dev)
|
||||
} else if (dev->flags & IFF_ALLMULTI) {
|
||||
memset(multi_hash, 0xff, sizeof(multi_hash));
|
||||
} else {
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(multi_hash, 0x00, sizeof(multi_hash));
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
am79c961_mc_hash(dmi->dmi_addr, multi_hash);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
am79c961_mc_hash(ha->addr, multi_hash);
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->chip_lock, flags);
|
||||
|
@ -556,14 +556,14 @@ static int hash_get_index(__u8 *addr)
|
||||
*/
|
||||
static void at91ether_sethashtable(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *curr;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned long mc_filter[2];
|
||||
unsigned int bitnr;
|
||||
|
||||
mc_filter[0] = mc_filter[1] = 0;
|
||||
|
||||
netdev_for_each_mc_addr(curr, dev) {
|
||||
bitnr = hash_get_index(curr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
bitnr = hash_get_index(ha->addr);
|
||||
mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
static void eth_set_mcast_list(struct net_device *dev)
|
||||
{
|
||||
struct port *port = netdev_priv(dev);
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 diffs[ETH_ALEN], *addr;
|
||||
int i;
|
||||
|
||||
@ -748,11 +748,11 @@ static void eth_set_mcast_list(struct net_device *dev)
|
||||
memset(diffs, 0, ETH_ALEN);
|
||||
|
||||
addr = NULL;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (!addr)
|
||||
addr = mclist->dmi_addr; /* first MAC address */
|
||||
addr = ha->addr; /* first MAC address */
|
||||
for (i = 0; i < ETH_ALEN; i++)
|
||||
diffs[i] |= addr[i] ^ mclist->dmi_addr[i];
|
||||
diffs[i] |= addr[i] ^ ha->addr[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < ETH_ALEN; i++) {
|
||||
|
@ -331,16 +331,16 @@ ks8695_init_partial_multicast(struct ks8695_priv *ksp,
|
||||
{
|
||||
u32 low, high;
|
||||
int i;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, ndev) {
|
||||
netdev_for_each_mc_addr(ha, ndev) {
|
||||
/* Ran out of space in chip? */
|
||||
BUG_ON(i == KS8695_NR_ADDRESSES);
|
||||
|
||||
low = (dmi->dmi_addr[2] << 24) | (dmi->dmi_addr[3] << 16) |
|
||||
(dmi->dmi_addr[4] << 8) | (dmi->dmi_addr[5]);
|
||||
high = (dmi->dmi_addr[0] << 8) | (dmi->dmi_addr[1]);
|
||||
low = (ha->addr[2] << 24) | (ha->addr[3] << 16) |
|
||||
(ha->addr[4] << 8) | (ha->addr[5]);
|
||||
high = (ha->addr[0] << 8) | (ha->addr[1]);
|
||||
|
||||
ks8695_writereg(ksp, KS8695_AAL_(i), low);
|
||||
ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high);
|
||||
|
@ -848,12 +848,12 @@ set_rx_mode(struct net_device *dev)
|
||||
memset(mc_filter, 0x00, sizeof(mc_filter));
|
||||
outb(1, ioaddr + RX_MODE); /* Ignore almost all multicasts. */
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(mc_filter, 0, sizeof(mc_filter));
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
unsigned int bit =
|
||||
ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26;
|
||||
ether_crc_le(ETH_ALEN, ha->addr) >> 26;
|
||||
mc_filter[bit >> 3] |= (1 << bit);
|
||||
}
|
||||
outb(0x02, ioaddr + RX_MODE); /* Use normal mode. */
|
||||
|
@ -354,7 +354,7 @@ static void atl1c_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct atl1c_adapter *adapter = netdev_priv(netdev);
|
||||
struct atl1c_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 mac_ctrl_data;
|
||||
u32 hash_value;
|
||||
|
||||
@ -377,8 +377,8 @@ static void atl1c_set_multi(struct net_device *netdev)
|
||||
AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
|
||||
|
||||
/* comoute mc addresses' hash value ,and put it into hash table */
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev) {
|
||||
hash_value = atl1c_hash_mc_addr(hw, mc_ptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
hash_value = atl1c_hash_mc_addr(hw, ha->addr);
|
||||
atl1c_hash_set(hw, hash_value);
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ static void atl1e_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct atl1e_adapter *adapter = netdev_priv(netdev);
|
||||
struct atl1e_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 mac_ctrl_data = 0;
|
||||
u32 hash_value;
|
||||
|
||||
@ -307,8 +307,8 @@ static void atl1e_set_multi(struct net_device *netdev)
|
||||
AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
|
||||
|
||||
/* comoute mc addresses' hash value ,and put it into hash table */
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev) {
|
||||
hash_value = atl1e_hash_mc_addr(hw, mc_ptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
hash_value = atl1e_hash_mc_addr(hw, ha->addr);
|
||||
atl1e_hash_set(hw, hash_value);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ static void atl2_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct atl2_adapter *adapter = netdev_priv(netdev);
|
||||
struct atl2_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 rctl;
|
||||
u32 hash_value;
|
||||
|
||||
@ -157,8 +157,8 @@ static void atl2_set_multi(struct net_device *netdev)
|
||||
ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
|
||||
|
||||
/* comoute mc addresses' hash value ,and put it into hash table */
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev) {
|
||||
hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
hash_value = atl2_hash_mc_addr(hw, ha->addr);
|
||||
atl2_hash_set(hw, hash_value);
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ static void atlx_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct atlx_adapter *adapter = netdev_priv(netdev);
|
||||
struct atlx_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 rctl;
|
||||
u32 hash_value;
|
||||
|
||||
@ -144,8 +144,8 @@ static void atlx_set_multi(struct net_device *netdev)
|
||||
iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2));
|
||||
|
||||
/* compute mc addresses' hash value ,and put it into hash table */
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev) {
|
||||
hash_value = atlx_hash_mc_addr(hw, mc_ptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
hash_value = atlx_hash_mc_addr(hw, ha->addr);
|
||||
atlx_hash_set(hw, hash_value);
|
||||
}
|
||||
}
|
||||
|
@ -883,11 +883,11 @@ static void set_rx_mode_8012(struct net_device *dev)
|
||||
memset(mc_filter, 0xff, sizeof(mc_filter));
|
||||
new_mode = CMR2h_Normal;
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(mc_filter, 0, sizeof(mc_filter));
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
int filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
int filterbit = ether_crc_le(ETH_ALEN, ha->addr) & 0x3f;
|
||||
mc_filter[filterbit >> 5] |= 1 << (filterbit & 31);
|
||||
}
|
||||
new_mode = CMR2h_Normal;
|
||||
|
@ -957,12 +957,12 @@ static void au1000_multicast_list(struct net_device *dev)
|
||||
aup->mac->control &= ~MAC_PROMISCUOUS;
|
||||
printk(KERN_INFO "%s: Pass all multicast\n", dev->name);
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 mc_filter[2]; /* Multicast hash filter */
|
||||
|
||||
mc_filter[1] = mc_filter[0] = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev)
|
||||
set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26,
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
set_bit(ether_crc(ETH_ALEN, ha->addr)>>26,
|
||||
(long *)mc_filter);
|
||||
aup->mac->multi_hash_high = mc_filter[1];
|
||||
aup->mac->multi_hash_low = mc_filter[0];
|
||||
|
@ -1680,15 +1680,15 @@ static struct net_device_stats *b44_get_stats(struct net_device *dev)
|
||||
|
||||
static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i, num_ents;
|
||||
|
||||
num_ents = min_t(int, netdev_mc_count(dev), B44_MCAST_TABLE_SIZE);
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (i == num_ents)
|
||||
break;
|
||||
__b44_cam_write(bp, mclist->dmi_addr, i++ + 1);
|
||||
__b44_cam_write(bp, ha->addr, i++ + 1);
|
||||
}
|
||||
return i+1;
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ static int bcm_enet_set_mac_address(struct net_device *dev, void *p)
|
||||
static void bcm_enet_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct bcm_enet_priv *priv;
|
||||
struct dev_mc_list *mc_list;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 val;
|
||||
int i;
|
||||
|
||||
@ -631,14 +631,14 @@ static void bcm_enet_set_multicast_list(struct net_device *dev)
|
||||
}
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc_list, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u8 *dmi_addr;
|
||||
u32 tmp;
|
||||
|
||||
if (i == 3)
|
||||
break;
|
||||
/* update perfect match registers */
|
||||
dmi_addr = mc_list->dmi_addr;
|
||||
dmi_addr = ha->addr;
|
||||
tmp = (dmi_addr[2] << 24) | (dmi_addr[3] << 16) |
|
||||
(dmi_addr[4] << 8) | dmi_addr[5];
|
||||
enet_writel(priv, tmp, ENET_PML_REG(i + 1));
|
||||
|
@ -1159,13 +1159,13 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
|
||||
req->interface_id = if_id;
|
||||
if (netdev) {
|
||||
int i;
|
||||
struct dev_mc_list *mc;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
req->num_mac = cpu_to_le16(netdev_mc_count(netdev));
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc, netdev)
|
||||
memcpy(req->mac[i].byte, mc->dmi_addr, ETH_ALEN);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
memcpy(req->mac[i].byte, ha->addr, ETH_ALEN);
|
||||
} else {
|
||||
req->promiscuous = 1;
|
||||
}
|
||||
|
@ -812,14 +812,14 @@ static void bfin_mac_timeout(struct net_device *dev)
|
||||
static void bfin_mac_multicast_hash(struct net_device *dev)
|
||||
{
|
||||
u32 emac_hashhi, emac_hashlo;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *addrs;
|
||||
u32 crc;
|
||||
|
||||
emac_hashhi = emac_hashlo = 0;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
|
||||
/* skip non-multicast addresses */
|
||||
if (!(*addrs & 1))
|
||||
|
@ -971,7 +971,7 @@ bmac_remove_multi(struct net_device *dev,
|
||||
*/
|
||||
static void bmac_set_multicast(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct bmac_data *bp = netdev_priv(dev);
|
||||
int num_addrs = netdev_mc_count(dev);
|
||||
unsigned short rx_cfg;
|
||||
@ -1000,8 +1000,8 @@ static void bmac_set_multicast(struct net_device *dev)
|
||||
rx_cfg = bmac_rx_on(dev, 0, 0);
|
||||
XXDEBUG(("bmac: multi disabled, rx_cfg=%#08x\n", rx_cfg));
|
||||
} else {
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
bmac_addhash(bp, dmi->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
bmac_addhash(bp, ha->addr);
|
||||
bmac_update_hash_table_mask(dev, bp);
|
||||
rx_cfg = bmac_rx_on(dev, 1, 0);
|
||||
XXDEBUG(("bmac: multi enabled, rx_cfg=%#08x\n", rx_cfg));
|
||||
@ -1015,7 +1015,7 @@ static void bmac_set_multicast(struct net_device *dev)
|
||||
|
||||
static void bmac_set_multicast(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *addrs;
|
||||
int i;
|
||||
unsigned short rx_cfg;
|
||||
@ -1039,8 +1039,8 @@ static void bmac_set_multicast(struct net_device *dev)
|
||||
|
||||
for(i = 0; i < 4; i++) hash_table[i] = 0;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
|
||||
if(!(*addrs & 1))
|
||||
continue;
|
||||
|
@ -3544,7 +3544,6 @@ bnx2_set_rx_mode(struct net_device *dev)
|
||||
}
|
||||
else {
|
||||
/* Accept one or more multicast(s). */
|
||||
struct dev_mc_list *mclist;
|
||||
u32 mc_filter[NUM_MC_HASH_REGISTERS];
|
||||
u32 regidx;
|
||||
u32 bit;
|
||||
@ -3552,8 +3551,8 @@ bnx2_set_rx_mode(struct net_device *dev)
|
||||
|
||||
memset(mc_filter, 0, 4 * NUM_MC_HASH_REGISTERS);
|
||||
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
crc = ether_crc_le(ETH_ALEN, mclist->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
crc = ether_crc_le(ETH_ALEN, ha->addr);
|
||||
bit = crc & 0xff;
|
||||
regidx = (bit & 0xe0) >> 5;
|
||||
bit &= 0x1f;
|
||||
|
@ -11496,21 +11496,21 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
|
||||
else { /* some multicasts */
|
||||
if (CHIP_IS_E1(bp)) {
|
||||
int i, old, offset;
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct mac_configuration_cmd *config =
|
||||
bnx2x_sp(bp, mcast_config);
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
config->config_table[i].
|
||||
cam_entry.msb_mac_addr =
|
||||
swab16(*(u16 *)&mclist->dmi_addr[0]);
|
||||
swab16(*(u16 *)&ha->addr[0]);
|
||||
config->config_table[i].
|
||||
cam_entry.middle_mac_addr =
|
||||
swab16(*(u16 *)&mclist->dmi_addr[2]);
|
||||
swab16(*(u16 *)&ha->addr[2]);
|
||||
config->config_table[i].
|
||||
cam_entry.lsb_mac_addr =
|
||||
swab16(*(u16 *)&mclist->dmi_addr[4]);
|
||||
swab16(*(u16 *)&ha->addr[4]);
|
||||
config->config_table[i].cam_entry.flags =
|
||||
cpu_to_le16(port);
|
||||
config->config_table[i].
|
||||
@ -11564,18 +11564,18 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
|
||||
0);
|
||||
} else { /* E1H */
|
||||
/* Accept one or more multicasts */
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 mc_filter[MC_HASH_SIZE];
|
||||
u32 crc, bit, regidx;
|
||||
int i;
|
||||
|
||||
memset(mc_filter, 0, 4 * MC_HASH_SIZE);
|
||||
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n",
|
||||
mclist->dmi_addr);
|
||||
ha->addr);
|
||||
|
||||
crc = crc32c_le(0, mclist->dmi_addr, ETH_ALEN);
|
||||
crc = crc32c_le(0, ha->addr, ETH_ALEN);
|
||||
bit = (crc >> 24) & 0xff;
|
||||
regidx = bit >> 5;
|
||||
bit &= 0x1f;
|
||||
|
@ -761,32 +761,6 @@ static int bond_check_dev_link(struct bonding *bond,
|
||||
|
||||
/*----------------------------- Multicast list ------------------------------*/
|
||||
|
||||
/*
|
||||
* Returns 0 if dmi1 and dmi2 are the same, non-0 otherwise
|
||||
*/
|
||||
static inline int bond_is_dmi_same(const struct dev_mc_list *dmi1,
|
||||
const struct dev_mc_list *dmi2)
|
||||
{
|
||||
return memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0 &&
|
||||
dmi1->dmi_addrlen == dmi2->dmi_addrlen;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns dmi entry if found, NULL otherwise
|
||||
*/
|
||||
static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi,
|
||||
struct dev_mc_list *mc_list)
|
||||
{
|
||||
struct dev_mc_list *idmi;
|
||||
|
||||
for (idmi = mc_list; idmi; idmi = idmi->next) {
|
||||
if (bond_is_dmi_same(dmi, idmi))
|
||||
return idmi;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Push the promiscuity flag down to appropriate slaves
|
||||
*/
|
||||
@ -839,18 +813,18 @@ static int bond_set_allmulti(struct bonding *bond, int inc)
|
||||
* Add a Multicast address to slaves
|
||||
* according to mode
|
||||
*/
|
||||
static void bond_mc_add(struct bonding *bond, void *addr, int alen)
|
||||
static void bond_mc_add(struct bonding *bond, void *addr)
|
||||
{
|
||||
if (USES_PRIMARY(bond->params.mode)) {
|
||||
/* write lock already acquired */
|
||||
if (bond->curr_active_slave)
|
||||
dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0);
|
||||
dev_mc_add(bond->curr_active_slave->dev, addr);
|
||||
} else {
|
||||
struct slave *slave;
|
||||
int i;
|
||||
|
||||
bond_for_each_slave(bond, slave, i)
|
||||
dev_mc_add(slave->dev, addr, alen, 0);
|
||||
dev_mc_add(slave->dev, addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,18 +832,17 @@ static void bond_mc_add(struct bonding *bond, void *addr, int alen)
|
||||
* Remove a multicast address from slave
|
||||
* according to mode
|
||||
*/
|
||||
static void bond_mc_delete(struct bonding *bond, void *addr, int alen)
|
||||
static void bond_mc_del(struct bonding *bond, void *addr)
|
||||
{
|
||||
if (USES_PRIMARY(bond->params.mode)) {
|
||||
/* write lock already acquired */
|
||||
if (bond->curr_active_slave)
|
||||
dev_mc_delete(bond->curr_active_slave->dev, addr,
|
||||
alen, 0);
|
||||
dev_mc_del(bond->curr_active_slave->dev, addr);
|
||||
} else {
|
||||
struct slave *slave;
|
||||
int i;
|
||||
bond_for_each_slave(bond, slave, i) {
|
||||
dev_mc_delete(slave->dev, addr, alen, 0);
|
||||
dev_mc_del(slave->dev, addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -895,50 +868,6 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
/*
|
||||
* Totally destroys the mc_list in bond
|
||||
*/
|
||||
static void bond_mc_list_destroy(struct bonding *bond)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
|
||||
dmi = bond->mc_list;
|
||||
while (dmi) {
|
||||
bond->mc_list = dmi->next;
|
||||
kfree(dmi);
|
||||
dmi = bond->mc_list;
|
||||
}
|
||||
|
||||
bond->mc_list = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy all the Multicast addresses from src to the bonding device dst
|
||||
*/
|
||||
static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond,
|
||||
gfp_t gfp_flag)
|
||||
{
|
||||
struct dev_mc_list *dmi, *new_dmi;
|
||||
|
||||
for (dmi = mc_list; dmi; dmi = dmi->next) {
|
||||
new_dmi = kmalloc(sizeof(struct dev_mc_list), gfp_flag);
|
||||
|
||||
if (!new_dmi) {
|
||||
/* FIXME: Potential memory leak !!! */
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
new_dmi->next = bond->mc_list;
|
||||
bond->mc_list = new_dmi;
|
||||
new_dmi->dmi_addrlen = dmi->dmi_addrlen;
|
||||
memcpy(new_dmi->dmi_addr, dmi->dmi_addr, dmi->dmi_addrlen);
|
||||
new_dmi->dmi_users = dmi->dmi_users;
|
||||
new_dmi->dmi_gusers = dmi->dmi_gusers;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* flush all members of flush->mc_list from device dev->mc_list
|
||||
*/
|
||||
@ -946,16 +875,16 @@ static void bond_mc_list_flush(struct net_device *bond_dev,
|
||||
struct net_device *slave_dev)
|
||||
{
|
||||
struct bonding *bond = netdev_priv(bond_dev);
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next)
|
||||
dev_mc_delete(slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
|
||||
netdev_for_each_mc_addr(ha, bond_dev)
|
||||
dev_mc_del(slave_dev, ha->addr);
|
||||
|
||||
if (bond->params.mode == BOND_MODE_8023AD) {
|
||||
/* del lacpdu mc addr from mc list */
|
||||
u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
|
||||
|
||||
dev_mc_delete(slave_dev, lacpdu_multicast, ETH_ALEN, 0);
|
||||
dev_mc_del(slave_dev, lacpdu_multicast);
|
||||
}
|
||||
}
|
||||
|
||||
@ -969,7 +898,7 @@ static void bond_mc_list_flush(struct net_device *bond_dev,
|
||||
static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
|
||||
struct slave *old_active)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if (!USES_PRIMARY(bond->params.mode))
|
||||
/* nothing to do - mc list is already up-to-date on
|
||||
@ -984,9 +913,8 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
|
||||
if (bond->dev->flags & IFF_ALLMULTI)
|
||||
dev_set_allmulti(old_active->dev, -1);
|
||||
|
||||
for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next)
|
||||
dev_mc_delete(old_active->dev, dmi->dmi_addr,
|
||||
dmi->dmi_addrlen, 0);
|
||||
netdev_for_each_mc_addr(ha, bond->dev)
|
||||
dev_mc_del(old_active->dev, ha->addr);
|
||||
}
|
||||
|
||||
if (new_active) {
|
||||
@ -997,9 +925,8 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
|
||||
if (bond->dev->flags & IFF_ALLMULTI)
|
||||
dev_set_allmulti(new_active->dev, 1);
|
||||
|
||||
for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next)
|
||||
dev_mc_add(new_active->dev, dmi->dmi_addr,
|
||||
dmi->dmi_addrlen, 0);
|
||||
netdev_for_each_mc_addr(ha, bond->dev)
|
||||
dev_mc_add(new_active->dev, ha->addr);
|
||||
bond_resend_igmp_join_requests(bond);
|
||||
}
|
||||
}
|
||||
@ -1406,7 +1333,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
|
||||
struct bonding *bond = netdev_priv(bond_dev);
|
||||
const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
|
||||
struct slave *new_slave = NULL;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct sockaddr addr;
|
||||
int link_reporting;
|
||||
int old_features = bond_dev->features;
|
||||
@ -1492,7 +1419,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
|
||||
|
||||
/* Flush unicast and multicast addresses */
|
||||
dev_uc_flush(bond_dev);
|
||||
dev_addr_discard(bond_dev);
|
||||
dev_mc_flush(bond_dev);
|
||||
|
||||
if (slave_dev->type != ARPHRD_ETHER)
|
||||
bond_setup_by_slave(bond_dev, slave_dev);
|
||||
@ -1601,9 +1528,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
|
||||
|
||||
netif_addr_lock_bh(bond_dev);
|
||||
/* upload master's mc_list to new slave */
|
||||
for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next)
|
||||
dev_mc_add(slave_dev, dmi->dmi_addr,
|
||||
dmi->dmi_addrlen, 0);
|
||||
netdev_for_each_mc_addr(ha, bond_dev)
|
||||
dev_mc_add(slave_dev, ha->addr);
|
||||
netif_addr_unlock_bh(bond_dev);
|
||||
}
|
||||
|
||||
@ -1611,7 +1537,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
|
||||
/* add lacpdu mc addr to mc list */
|
||||
u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
|
||||
|
||||
dev_mc_add(slave_dev, lacpdu_multicast, ETH_ALEN, 0);
|
||||
dev_mc_add(slave_dev, lacpdu_multicast);
|
||||
}
|
||||
|
||||
bond_add_vlans_on_slave(bond, slave_dev);
|
||||
@ -3913,10 +3839,24 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool bond_addr_in_mc_list(unsigned char *addr,
|
||||
struct netdev_hw_addr_list *list,
|
||||
int addrlen)
|
||||
{
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
netdev_hw_addr_list_for_each(ha, list)
|
||||
if (!memcmp(ha->addr, addr, addrlen))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void bond_set_multicast_list(struct net_device *bond_dev)
|
||||
{
|
||||
struct bonding *bond = netdev_priv(bond_dev);
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
bool found;
|
||||
|
||||
/*
|
||||
* Do promisc before checking multicast_mode
|
||||
@ -3951,20 +3891,25 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
|
||||
bond->flags = bond_dev->flags;
|
||||
|
||||
/* looking for addresses to add to slaves' mc list */
|
||||
for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
|
||||
if (!bond_mc_list_find_dmi(dmi, bond->mc_list))
|
||||
bond_mc_add(bond, dmi->dmi_addr, dmi->dmi_addrlen);
|
||||
netdev_for_each_mc_addr(ha, bond_dev) {
|
||||
found = bond_addr_in_mc_list(ha->addr, &bond->mc_list,
|
||||
bond_dev->addr_len);
|
||||
if (!found)
|
||||
bond_mc_add(bond, ha->addr);
|
||||
}
|
||||
|
||||
/* looking for addresses to delete from slaves' list */
|
||||
for (dmi = bond->mc_list; dmi; dmi = dmi->next) {
|
||||
if (!bond_mc_list_find_dmi(dmi, bond_dev->mc_list))
|
||||
bond_mc_delete(bond, dmi->dmi_addr, dmi->dmi_addrlen);
|
||||
netdev_hw_addr_list_for_each(ha, &bond->mc_list) {
|
||||
found = bond_addr_in_mc_list(ha->addr, &bond_dev->mc,
|
||||
bond_dev->addr_len);
|
||||
if (!found)
|
||||
bond_mc_del(bond, ha->addr);
|
||||
}
|
||||
|
||||
/* save master's multicast list */
|
||||
bond_mc_list_destroy(bond);
|
||||
bond_mc_list_copy(bond_dev->mc_list, bond, GFP_ATOMIC);
|
||||
__hw_addr_flush(&bond->mc_list);
|
||||
__hw_addr_add_multiple(&bond->mc_list, &bond_dev->mc,
|
||||
bond_dev->addr_len, NETDEV_HW_ADDR_T_MULTICAST);
|
||||
|
||||
read_unlock(&bond->lock);
|
||||
}
|
||||
@ -4534,9 +4479,7 @@ static void bond_uninit(struct net_device *bond_dev)
|
||||
if (bond->wq)
|
||||
destroy_workqueue(bond->wq);
|
||||
|
||||
netif_addr_lock_bh(bond_dev);
|
||||
bond_mc_list_destroy(bond);
|
||||
netif_addr_unlock_bh(bond_dev);
|
||||
__hw_addr_flush(&bond->mc_list);
|
||||
}
|
||||
|
||||
/*------------------------- Module initialization ---------------------------*/
|
||||
@ -4908,6 +4851,8 @@ static int bond_init(struct net_device *bond_dev)
|
||||
list_add_tail(&bond->bond_list, &bn->dev_list);
|
||||
|
||||
bond_prepare_sysfs_group(bond);
|
||||
|
||||
__hw_addr_init(&bond->mc_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ struct bonding {
|
||||
char proc_file_name[IFNAMSIZ];
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
struct list_head bond_list;
|
||||
struct dev_mc_list *mc_list;
|
||||
struct netdev_hw_addr_list mc_list;
|
||||
int (*xmit_hash_policy)(struct sk_buff *, int);
|
||||
__be32 master_ip;
|
||||
u16 flags;
|
||||
|
@ -2957,20 +2957,20 @@ static void cas_process_mc_list(struct cas *cp)
|
||||
{
|
||||
u16 hash_table[16];
|
||||
u32 crc;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i = 1;
|
||||
|
||||
memset(hash_table, 0, sizeof(hash_table));
|
||||
netdev_for_each_mc_addr(dmi, cp->dev) {
|
||||
netdev_for_each_mc_addr(ha, cp->dev) {
|
||||
if (i <= CAS_MC_EXACT_MATCH_SIZE) {
|
||||
/* use the alternate mac address registers for the
|
||||
* first 15 multicast addresses
|
||||
*/
|
||||
writel((dmi->dmi_addr[4] << 8) | dmi->dmi_addr[5],
|
||||
writel((ha->addr[4] << 8) | ha->addr[5],
|
||||
cp->regs + REG_MAC_ADDRN(i*3 + 0));
|
||||
writel((dmi->dmi_addr[2] << 8) | dmi->dmi_addr[3],
|
||||
writel((ha->addr[2] << 8) | ha->addr[3],
|
||||
cp->regs + REG_MAC_ADDRN(i*3 + 1));
|
||||
writel((dmi->dmi_addr[0] << 8) | dmi->dmi_addr[1],
|
||||
writel((ha->addr[0] << 8) | ha->addr[1],
|
||||
cp->regs + REG_MAC_ADDRN(i*3 + 2));
|
||||
i++;
|
||||
}
|
||||
@ -2978,7 +2978,7 @@ static void cas_process_mc_list(struct cas *cp)
|
||||
/* use hw hash table for the next series of
|
||||
* multicast addresses
|
||||
*/
|
||||
crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr);
|
||||
crc = ether_crc_le(ETH_ALEN, ha->addr);
|
||||
crc >>= 24;
|
||||
hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
|
||||
}
|
||||
|
@ -376,12 +376,13 @@ static int pm3393_set_rx_mode(struct cmac *cmac, struct t1_rx_mode *rm)
|
||||
rx_mode |= SUNI1x10GEXP_BITMSK_RXXG_MHASH_EN;
|
||||
} else if (t1_rx_mode_mc_cnt(rm)) {
|
||||
/* Accept one or more multicast(s). */
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int bit;
|
||||
u16 mc_filter[4] = { 0, };
|
||||
|
||||
netdev_for_each_mc_addr(dmi, t1_get_netdev(rm)) {
|
||||
bit = (ether_crc(ETH_ALEN, dmi->dmi_addr) >> 23) & 0x3f; /* bit[23:28] */
|
||||
netdev_for_each_mc_addr(ha, t1_get_netdev(rm)) {
|
||||
/* bit[23:28] */
|
||||
bit = (ether_crc(ETH_ALEN, ha->addr) >> 23) & 0x3f;
|
||||
mc_filter[bit >> 4] |= 1 << (bit & 0xf);
|
||||
}
|
||||
pmwrite(cmac, SUNI1x10GEXP_REG_RXXG_MULTICAST_HASH_LOW, mc_filter[0]);
|
||||
|
@ -328,7 +328,7 @@ static int cpmac_config(struct net_device *dev, struct ifmap *map)
|
||||
|
||||
static void cpmac_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *iter;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 tmp;
|
||||
u32 mbp, bit, hash[2] = { 0, };
|
||||
struct cpmac_priv *priv = netdev_priv(dev);
|
||||
@ -348,19 +348,19 @@ static void cpmac_set_multicast_list(struct net_device *dev)
|
||||
* cpmac uses some strange mac address hashing
|
||||
* (not crc32)
|
||||
*/
|
||||
netdev_for_each_mc_addr(iter, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
bit = 0;
|
||||
tmp = iter->dmi_addr[0];
|
||||
tmp = ha->addr[0];
|
||||
bit ^= (tmp >> 2) ^ (tmp << 4);
|
||||
tmp = iter->dmi_addr[1];
|
||||
tmp = ha->addr[1];
|
||||
bit ^= (tmp >> 4) ^ (tmp << 2);
|
||||
tmp = iter->dmi_addr[2];
|
||||
tmp = ha->addr[2];
|
||||
bit ^= (tmp >> 6) ^ tmp;
|
||||
tmp = iter->dmi_addr[3];
|
||||
tmp = ha->addr[3];
|
||||
bit ^= (tmp >> 2) ^ (tmp << 4);
|
||||
tmp = iter->dmi_addr[4];
|
||||
tmp = ha->addr[4];
|
||||
bit ^= (tmp >> 4) ^ (tmp << 2);
|
||||
tmp = iter->dmi_addr[5];
|
||||
tmp = ha->addr[5];
|
||||
bit ^= (tmp >> 6) ^ tmp;
|
||||
bit &= 0x3f;
|
||||
hash[bit / 32] |= 1 << (bit % 32);
|
||||
|
@ -1596,16 +1596,16 @@ set_multicast_list(struct net_device *dev)
|
||||
} else {
|
||||
/* MC mode, receive normal and MC packets */
|
||||
char hash_ix;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *baddr;
|
||||
|
||||
lo_bits = 0x00000000ul;
|
||||
hi_bits = 0x00000000ul;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
/* Calculate the hash index for the GA registers */
|
||||
|
||||
hash_ix = 0;
|
||||
baddr = dmi->dmi_addr;
|
||||
baddr = ha->addr;
|
||||
hash_ix ^= (*baddr) & 0x3f;
|
||||
hash_ix ^= ((*baddr) >> 6) & 0x03;
|
||||
++baddr;
|
||||
|
@ -311,16 +311,16 @@ int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev)
|
||||
if (dev->flags & IFF_ALLMULTI)
|
||||
hash_lo = hash_hi = 0xffffffff;
|
||||
else {
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int exact_addr_idx = mac->nucast;
|
||||
|
||||
hash_lo = hash_hi = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
if (exact_addr_idx < EXACT_ADDR_FILTERS)
|
||||
set_addr_filter(mac, exact_addr_idx++,
|
||||
dmi->dmi_addr);
|
||||
ha->addr);
|
||||
else {
|
||||
int hash = hash_hw_addr(dmi->dmi_addr);
|
||||
int hash = hash_hw_addr(ha->addr);
|
||||
|
||||
if (hash < 32)
|
||||
hash_lo |= (1 << hash);
|
||||
|
@ -952,13 +952,14 @@ static void emac_dev_mcast_set(struct net_device *ndev)
|
||||
emac_add_mcast(priv, EMAC_ALL_MULTI_SET, NULL);
|
||||
}
|
||||
if (!netdev_mc_empty(ndev)) {
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST);
|
||||
emac_add_mcast(priv, EMAC_ALL_MULTI_CLR, NULL);
|
||||
/* program multicast address list into EMAC hardware */
|
||||
netdev_for_each_mc_addr(mc_ptr, ndev) {
|
||||
netdev_for_each_mc_addr(ha, ndev) {
|
||||
emac_add_mcast(priv, EMAC_MULTICAST_ADD,
|
||||
(u8 *) mc_ptr->dmi_addr);
|
||||
(u8 *) ha->addr);
|
||||
}
|
||||
} else {
|
||||
mbp_enable = (mbp_enable & ~EMAC_MBP_RXMCAST);
|
||||
|
@ -940,7 +940,7 @@ static void lance_load_multicast(struct net_device *dev)
|
||||
{
|
||||
struct lance_private *lp = netdev_priv(dev);
|
||||
volatile u16 *ib = (volatile u16 *)dev->mem_start;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *addrs;
|
||||
u32 crc;
|
||||
|
||||
@ -959,8 +959,8 @@ static void lance_load_multicast(struct net_device *dev)
|
||||
*lib_ptr(ib, filter[3], lp->type) = 0;
|
||||
|
||||
/* Add addresses */
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
|
||||
/* multicast address? */
|
||||
if (!(*addrs & 1))
|
||||
|
@ -2195,7 +2195,7 @@ static void dfx_ctl_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
DFX_board_t *bp = netdev_priv(dev);
|
||||
int i; /* used as index in for loop */
|
||||
struct dev_mc_list *dmi; /* ptr to multicast addr entry */
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
/* Enable LLC frame promiscuous mode, if necessary */
|
||||
|
||||
@ -2241,9 +2241,9 @@ static void dfx_ctl_set_multicast_list(struct net_device *dev)
|
||||
/* Copy addresses to multicast address table, then update adapter CAM */
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
memcpy(&bp->mc_table[i++ * FDDI_K_ALEN],
|
||||
dmi->dmi_addr, FDDI_K_ALEN);
|
||||
ha->addr, FDDI_K_ALEN);
|
||||
|
||||
if (dfx_ctl_update_cam(bp) != DFX_K_SUCCESS)
|
||||
{
|
||||
|
@ -1272,7 +1272,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
static void SetMulticastFilter(struct net_device *dev)
|
||||
{
|
||||
struct depca_private *lp = netdev_priv(dev);
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *addrs;
|
||||
int i, j, bit, byte;
|
||||
u16 hashcode;
|
||||
@ -1287,8 +1287,8 @@ static void SetMulticastFilter(struct net_device *dev)
|
||||
lp->init_block.mcast_table[i] = 0;
|
||||
}
|
||||
/* Add multicast addresses */
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
if ((*addrs & 0x01) == 1) { /* multicast address? */
|
||||
crc = ether_crc(ETH_ALEN, addrs);
|
||||
hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */
|
||||
|
@ -1132,14 +1132,14 @@ set_multicast (struct net_device *dev)
|
||||
/* Receive broadcast and multicast frames */
|
||||
rx_mode = ReceiveBroadcast | ReceiveMulticast | ReceiveUnicast;
|
||||
} else if (!netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
/* Receive broadcast frames and multicast frames filtering
|
||||
by Hashtable */
|
||||
rx_mode =
|
||||
ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
int bit, index = 0;
|
||||
int crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr);
|
||||
int crc = ether_crc_le(ETH_ALEN, ha->addr);
|
||||
/* The inverted high significant 6 bits of CRC are
|
||||
used as an index to hashtable */
|
||||
for (bit = 0; bit < 6; bit++)
|
||||
|
@ -724,7 +724,7 @@ static void
|
||||
dm9000_hash_table(struct net_device *dev)
|
||||
{
|
||||
board_info_t *db = netdev_priv(dev);
|
||||
struct dev_mc_list *mcptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i, oft;
|
||||
u32 hash_val;
|
||||
u16 hash_table[4];
|
||||
@ -752,8 +752,8 @@ dm9000_hash_table(struct net_device *dev)
|
||||
rcr |= RCR_ALL;
|
||||
|
||||
/* the multicast address in Hash Table : 64 bits */
|
||||
netdev_for_each_mc_addr(mcptr, dev) {
|
||||
hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
hash_val = ether_crc_le(6, ha->addr) & 0x3f;
|
||||
hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16);
|
||||
}
|
||||
|
||||
|
@ -1545,16 +1545,16 @@ static int e100_hw_init(struct nic *nic)
|
||||
static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *netdev = nic->netdev;
|
||||
struct dev_mc_list *list;
|
||||
struct netdev_hw_addr *ha;
|
||||
u16 i, count = min(netdev_mc_count(netdev), E100_MAX_MULTICAST_ADDRS);
|
||||
|
||||
cb->command = cpu_to_le16(cb_multi);
|
||||
cb->u.multi.count = cpu_to_le16(count * ETH_ALEN);
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(list, netdev) {
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
if (i == count)
|
||||
break;
|
||||
memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &list->dmi_addr,
|
||||
memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr,
|
||||
ETH_ALEN);
|
||||
}
|
||||
}
|
||||
|
@ -2101,7 +2101,6 @@ static void e1000_set_rx_mode(struct net_device *netdev)
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct netdev_hw_addr *ha;
|
||||
bool use_uc = false;
|
||||
struct dev_addr_list *mc_ptr;
|
||||
u32 rctl;
|
||||
u32 hash_value;
|
||||
int i, rar_entries = E1000_RAR_ENTRIES;
|
||||
@ -2161,17 +2160,17 @@ static void e1000_set_rx_mode(struct net_device *netdev)
|
||||
|
||||
WARN_ON(i == rar_entries);
|
||||
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev) {
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
if (i == rar_entries) {
|
||||
/* load any remaining addresses into the hash table */
|
||||
u32 hash_reg, hash_bit, mta;
|
||||
hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr);
|
||||
hash_value = e1000_hash_mc_addr(hw, ha->addr);
|
||||
hash_reg = (hash_value >> 5) & 0x7F;
|
||||
hash_bit = hash_value & 0x1F;
|
||||
mta = (1 << hash_bit);
|
||||
mcarray[hash_reg] |= mta;
|
||||
} else {
|
||||
e1000_rar_set(hw, mc_ptr->da_addr, i++);
|
||||
e1000_rar_set(hw, ha->addr, i++);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2567,7 +2567,7 @@ static void e1000_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct e1000_adapter *adapter = netdev_priv(netdev);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 *mta_list;
|
||||
u32 rctl;
|
||||
int i;
|
||||
@ -2599,9 +2599,8 @@ static void e1000_set_multi(struct net_device *netdev)
|
||||
|
||||
/* prepare a packed array of only addresses. */
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev)
|
||||
memcpy(mta_list + (i++ * ETH_ALEN),
|
||||
mc_ptr->dmi_addr, ETH_ALEN);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
|
||||
|
||||
e1000_update_mc_addr_list(hw, mta_list, i);
|
||||
kfree(mta_list);
|
||||
|
@ -1287,7 +1287,7 @@ set_multicast_list(struct net_device *dev)
|
||||
struct eepro_local *lp = netdev_priv(dev);
|
||||
short ioaddr = dev->base_addr;
|
||||
unsigned short mode;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int mc_count = netdev_mc_count(dev);
|
||||
|
||||
if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || mc_count > 63)
|
||||
@ -1332,8 +1332,8 @@ set_multicast_list(struct net_device *dev)
|
||||
outw(0, ioaddr + IO_PORT);
|
||||
outw(6 * (mc_count + 1), ioaddr + IO_PORT);
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
eaddrs = (unsigned short *) dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
eaddrs = (unsigned short *) ha->addr;
|
||||
outw(*eaddrs++, ioaddr + IO_PORT);
|
||||
outw(*eaddrs++, ioaddr + IO_PORT);
|
||||
outw(*eaddrs++, ioaddr + IO_PORT);
|
||||
|
@ -1576,7 +1576,7 @@ static void eexp_hw_init586(struct net_device *dev)
|
||||
|
||||
static void eexp_setup_filter(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned short ioaddr = dev->base_addr;
|
||||
int count = netdev_mc_count(dev);
|
||||
int i;
|
||||
@ -1589,8 +1589,8 @@ static void eexp_setup_filter(struct net_device *dev)
|
||||
outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR);
|
||||
outw(6*count, ioaddr+SHADOW(CONF_NR_MULTICAST));
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
unsigned short *data = (unsigned short *) dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
unsigned short *data = (unsigned short *) ha->addr;
|
||||
|
||||
if (i == count)
|
||||
break;
|
||||
|
@ -1966,7 +1966,7 @@ static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
|
||||
static void ehea_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct ehea_port *port = netdev_priv(dev);
|
||||
struct dev_mc_list *k_mcl_entry;
|
||||
struct netdev_hw_addr *ha;
|
||||
int ret;
|
||||
|
||||
if (dev->flags & IFF_PROMISC) {
|
||||
@ -1997,8 +1997,8 @@ static void ehea_set_multicast_list(struct net_device *dev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
netdev_for_each_mc_addr(k_mcl_entry, dev)
|
||||
ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
ehea_add_multicast_entry(port, ha->addr);
|
||||
|
||||
}
|
||||
out:
|
||||
|
@ -822,7 +822,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr)
|
||||
static void enic_set_multicast_list(struct net_device *netdev)
|
||||
{
|
||||
struct enic *enic = netdev_priv(netdev);
|
||||
struct dev_mc_list *list;
|
||||
struct netdev_hw_addr *ha;
|
||||
int directed = 1;
|
||||
int multicast = (netdev->flags & IFF_MULTICAST) ? 1 : 0;
|
||||
int broadcast = (netdev->flags & IFF_BROADCAST) ? 1 : 0;
|
||||
@ -852,10 +852,10 @@ static void enic_set_multicast_list(struct net_device *netdev)
|
||||
*/
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(list, netdev) {
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
if (i == mc_count)
|
||||
break;
|
||||
memcpy(mc_addr[i++], list->dmi_addr, ETH_ALEN);
|
||||
memcpy(mc_addr[i++], ha->addr, ETH_ALEN);
|
||||
}
|
||||
|
||||
for (i = 0; i < enic->mc_count; i++) {
|
||||
|
@ -1400,12 +1400,12 @@ static void set_rx_mode(struct net_device *dev)
|
||||
outl(0x0004, ioaddr + RxCtrl);
|
||||
return;
|
||||
} else { /* Never executed, for now. */
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(mc_filter, 0, sizeof(mc_filter));
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
unsigned int bit_nr =
|
||||
ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f;
|
||||
ether_crc_le(ETH_ALEN, ha->addr) & 0x3f;
|
||||
mc_filter[bit_nr >> 3] |= (1 << bit_nr);
|
||||
}
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ static void ethoc_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct ethoc *priv = netdev_priv(dev);
|
||||
u32 mode = ethoc_read(priv, MODER);
|
||||
struct dev_mc_list *mc;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 hash[2] = { 0, 0 };
|
||||
|
||||
/* set loopback mode if requested */
|
||||
@ -783,8 +783,8 @@ static void ethoc_set_multicast_list(struct net_device *dev)
|
||||
hash[0] = 0xffffffff;
|
||||
hash[1] = 0xffffffff;
|
||||
} else {
|
||||
netdev_for_each_mc_addr(mc, dev) {
|
||||
u32 crc = ether_crc(ETH_ALEN, mc->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u32 crc = ether_crc(ETH_ALEN, ha->addr);
|
||||
int bit = (crc >> 26) & 0x3f;
|
||||
hash[bit >> 5] |= 1 << (bit & 0x1f);
|
||||
}
|
||||
|
@ -1169,7 +1169,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
static void SetMulticastFilter(struct net_device *dev)
|
||||
{
|
||||
struct ewrk3_private *lp = netdev_priv(dev);
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
u_long iobase = dev->base_addr;
|
||||
int i;
|
||||
char *addrs, bit, byte;
|
||||
@ -1213,8 +1213,8 @@ static void SetMulticastFilter(struct net_device *dev)
|
||||
}
|
||||
|
||||
/* Update table */
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
if ((*addrs & 0x01) == 1) { /* multicast address? */
|
||||
crc = ether_crc_le(ETH_ALEN, addrs);
|
||||
hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */
|
||||
|
@ -1792,12 +1792,12 @@ static void __set_rx_mode(struct net_device *dev)
|
||||
memset(mc_filter, 0xff, sizeof(mc_filter));
|
||||
rx_mode = CR_W_AB | CR_W_AM;
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(mc_filter, 0, sizeof(mc_filter));
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
unsigned int bit;
|
||||
bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F;
|
||||
bit = (ether_crc(ETH_ALEN, ha->addr) >> 26) ^ 0x3F;
|
||||
mc_filter[bit >> 5] |= (1 << bit);
|
||||
}
|
||||
rx_mode = CR_W_AB | CR_W_AM;
|
||||
|
@ -954,7 +954,7 @@ fec_enet_close(struct net_device *dev)
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(dev);
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned int i, bit, data, crc, tmp;
|
||||
unsigned char hash;
|
||||
|
||||
@ -984,16 +984,16 @@ static void set_multicast_list(struct net_device *dev)
|
||||
writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
|
||||
writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
/* Only support group multicast for now */
|
||||
if (!(dmi->dmi_addr[0] & 1))
|
||||
if (!(ha->addr[0] & 1))
|
||||
continue;
|
||||
|
||||
/* calculate crc32 value of mac address */
|
||||
crc = 0xffffffff;
|
||||
|
||||
for (i = 0; i < dmi->dmi_addrlen; i++) {
|
||||
data = dmi->dmi_addr[i];
|
||||
for (i = 0; i < dev->addr_len; i++) {
|
||||
data = ha->addr[i];
|
||||
for (bit = 0; bit < 8; bit++, data >>= 1) {
|
||||
crc = (crc >> 1) ^
|
||||
(((crc ^ data) & 1) ? CRC32_POLY : 0);
|
||||
|
@ -574,12 +574,12 @@ static void mpc52xx_fec_set_multicast_list(struct net_device *dev)
|
||||
out_be32(&fec->gaddr2, 0xffffffff);
|
||||
} else {
|
||||
u32 crc;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 gaddr1 = 0x00000000;
|
||||
u32 gaddr2 = 0x00000000;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
crc = ether_crc_le(6, dmi->dmi_addr) >> 26;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
crc = ether_crc_le(6, ha->addr) >> 26;
|
||||
if (crc >= 32)
|
||||
gaddr1 |= 1 << (crc-32);
|
||||
else
|
||||
|
@ -3103,12 +3103,14 @@ static void nv_set_multicast(struct net_device *dev)
|
||||
if (dev->flags & IFF_ALLMULTI) {
|
||||
alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0;
|
||||
} else {
|
||||
struct dev_mc_list *walk;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
netdev_for_each_mc_addr(walk, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
unsigned char *addr = ha->addr;
|
||||
u32 a, b;
|
||||
a = le32_to_cpu(*(__le32 *) walk->dmi_addr);
|
||||
b = le16_to_cpu(*(__le16 *) (&walk->dmi_addr[4]));
|
||||
|
||||
a = le32_to_cpu(*(__le32 *) addr);
|
||||
b = le16_to_cpu(*(__le16 *) (&addr[4]));
|
||||
alwaysOn[0] &= a;
|
||||
alwaysOff[0] &= ~a;
|
||||
alwaysOn[1] &= b;
|
||||
|
@ -231,12 +231,12 @@ static void set_multicast_finish(struct net_device *dev)
|
||||
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *pmc;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if ((dev->flags & IFF_PROMISC) == 0) {
|
||||
set_multicast_start(dev);
|
||||
netdev_for_each_mc_addr(pmc, dev)
|
||||
set_multicast_one(dev, pmc->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
set_multicast_one(dev, ha->addr);
|
||||
set_multicast_finish(dev);
|
||||
} else
|
||||
set_promiscuous_mode(dev);
|
||||
|
@ -232,12 +232,12 @@ static void set_multicast_finish(struct net_device *dev)
|
||||
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *pmc;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if ((dev->flags & IFF_PROMISC) == 0) {
|
||||
set_multicast_start(dev);
|
||||
netdev_for_each_mc_addr(pmc, dev)
|
||||
set_multicast_one(dev, pmc->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
set_multicast_one(dev, ha->addr);
|
||||
set_multicast_finish(dev);
|
||||
} else
|
||||
set_promiscuous_mode(dev);
|
||||
|
@ -224,12 +224,12 @@ static void set_multicast_finish(struct net_device *dev)
|
||||
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *pmc;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if ((dev->flags & IFF_PROMISC) == 0) {
|
||||
set_multicast_start(dev);
|
||||
netdev_for_each_mc_addr(pmc, dev)
|
||||
set_multicast_one(dev, pmc->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
set_multicast_one(dev, ha->addr);
|
||||
set_multicast_finish(dev);
|
||||
} else
|
||||
set_promiscuous_mode(dev);
|
||||
|
@ -2797,7 +2797,7 @@ static void adjust_link(struct net_device *dev)
|
||||
* whenever dev->flags is changed */
|
||||
static void gfar_set_multi(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct gfar_private *priv = netdev_priv(dev);
|
||||
struct gfar __iomem *regs = priv->gfargrp[0].regs;
|
||||
u32 tempval;
|
||||
@ -2870,13 +2870,12 @@ static void gfar_set_multi(struct net_device *dev)
|
||||
return;
|
||||
|
||||
/* Parse the list, and set the appropriate bits */
|
||||
netdev_for_each_mc_addr(mc_ptr, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (idx < em_num) {
|
||||
gfar_set_mac_for_addr(dev, idx,
|
||||
mc_ptr->dmi_addr);
|
||||
gfar_set_mac_for_addr(dev, idx, ha->addr);
|
||||
idx++;
|
||||
} else
|
||||
gfar_set_hash_for_addr(dev, mc_ptr->dmi_addr);
|
||||
gfar_set_hash_for_addr(dev, ha->addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -988,7 +988,7 @@ static u32 greth_hash_get_index(__u8 *addr)
|
||||
|
||||
static void greth_set_hash_filter(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *curr;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct greth_private *greth = netdev_priv(dev);
|
||||
struct greth_regs *regs = (struct greth_regs *) greth->regs;
|
||||
u32 mc_filter[2];
|
||||
@ -996,8 +996,8 @@ static void greth_set_hash_filter(struct net_device *dev)
|
||||
|
||||
mc_filter[0] = mc_filter[1] = 0;
|
||||
|
||||
netdev_for_each_mc_addr(curr, dev) {
|
||||
bitnr = greth_hash_get_index(curr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
bitnr = greth_hash_get_index(ha->addr);
|
||||
mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
|
||||
}
|
||||
|
||||
|
@ -1858,12 +1858,12 @@ static void set_rx_mode(struct net_device *dev)
|
||||
/* Too many to match, or accept all multicasts. */
|
||||
writew(0x000B, ioaddr + AddrMode);
|
||||
} else if (!netdev_mc_empty(dev)) { /* Must use the CAM filter. */
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i = 0;
|
||||
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
writel(*(u32*)(mclist->dmi_addr), ioaddr + 0x100 + i*8);
|
||||
writel(0x20000 | (*(u16*)&mclist->dmi_addr[4]),
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
writel(*(u32 *)(ha->addr), ioaddr + 0x100 + i*8);
|
||||
writel(0x20000 | (*(u16 *)&ha->addr[4]),
|
||||
ioaddr + 0x104 + i*8);
|
||||
i++;
|
||||
}
|
||||
|
@ -2100,15 +2100,15 @@ static void hp100_set_multicast_list(struct net_device *dev)
|
||||
} else {
|
||||
int i, idx;
|
||||
u_char *addrs;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(&lp->hash_bytes, 0x00, 8);
|
||||
#ifdef HP100_DEBUG
|
||||
printk("hp100: %s: computing hash filter - mc_count = %i\n",
|
||||
dev->name, netdev_mc_count(dev));
|
||||
#endif
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
addrs = ha->addr;
|
||||
if ((*addrs & 0x01) == 0x01) { /* multicast address? */
|
||||
#ifdef HP100_DEBUG
|
||||
printk("hp100: %s: multicast = %pM, ",
|
||||
|
@ -388,18 +388,19 @@ static void emac_hash_mc(struct emac_instance *dev)
|
||||
const int regs = EMAC_XAHT_REGS(dev);
|
||||
u32 *gaht_base = emac_gaht_base(dev);
|
||||
u32 gaht_temp[regs];
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i;
|
||||
|
||||
DBG(dev, "hash_mc %d" NL, netdev_mc_count(dev->ndev));
|
||||
|
||||
memset(gaht_temp, 0, sizeof (gaht_temp));
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev->ndev) {
|
||||
netdev_for_each_mc_addr(ha, dev->ndev) {
|
||||
int slot, reg, mask;
|
||||
DBG2(dev, "mc %pM" NL, dmi->dmi_addr);
|
||||
DBG2(dev, "mc %pM" NL, ha->addr);
|
||||
|
||||
slot = EMAC_XAHT_CRC_TO_SLOT(dev, ether_crc(ETH_ALEN, dmi->dmi_addr));
|
||||
slot = EMAC_XAHT_CRC_TO_SLOT(dev,
|
||||
ether_crc(ETH_ALEN, ha->addr));
|
||||
reg = EMAC_XAHT_SLOT_TO_REG(dev, slot);
|
||||
mask = EMAC_XAHT_SLOT_TO_MASK(dev, slot);
|
||||
|
||||
@ -1176,7 +1177,7 @@ static int emac_open(struct net_device *ndev)
|
||||
netif_carrier_on(dev->ndev);
|
||||
|
||||
/* Required for Pause packet support in EMAC */
|
||||
dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);
|
||||
dev_mc_add_global(ndev, default_mcast_addr);
|
||||
|
||||
emac_configure(dev);
|
||||
mal_poll_add(dev->mal, &dev->commac);
|
||||
|
@ -385,7 +385,7 @@ static void InitBoard(struct net_device *dev)
|
||||
int camcnt;
|
||||
camentry_t cams[16];
|
||||
u32 cammask;
|
||||
struct dev_mc_list *mcptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u16 rcrval;
|
||||
|
||||
/* reset the SONIC */
|
||||
@ -420,8 +420,8 @@ static void InitBoard(struct net_device *dev)
|
||||
/* start putting the multicast addresses into the CAM list. Stop if
|
||||
it is full. */
|
||||
|
||||
netdev_for_each_mc_addr(mcptr, dev) {
|
||||
putcam(cams, &camcnt, mcptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
putcam(cams, &camcnt, ha->addr);
|
||||
if (camcnt == 16)
|
||||
break;
|
||||
}
|
||||
@ -479,7 +479,7 @@ static void InitBoard(struct net_device *dev)
|
||||
/* if still multicast addresses left or ALLMULTI is set, set the multicast
|
||||
enable bit */
|
||||
|
||||
if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
|
||||
if ((dev->flags & IFF_ALLMULTI) || netdev_mc_count(dev) > camcnt)
|
||||
rcrval |= RCREG_AMC;
|
||||
|
||||
/* promiscous mode ? */
|
||||
|
@ -1072,7 +1072,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
|
||||
ibmveth_error_printk("h_multicast_ctrl rc=%ld when entering promisc mode\n", lpar_rc);
|
||||
}
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
/* clear the filter table & disable filtering */
|
||||
lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
|
||||
IbmVethMcastEnableRecv |
|
||||
@ -1083,10 +1083,10 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
|
||||
ibmveth_error_printk("h_multicast_ctrl rc=%ld when attempting to clear filter table\n", lpar_rc);
|
||||
}
|
||||
/* add the addresses to the filter table */
|
||||
netdev_for_each_mc_addr(mclist, netdev) {
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
// add the multicast address to the filter table
|
||||
unsigned long mcast_addr = 0;
|
||||
memcpy(((char *)&mcast_addr)+2, mclist->dmi_addr, 6);
|
||||
memcpy(((char *)&mcast_addr)+2, ha->addr, 6);
|
||||
lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
|
||||
IbmVethMcastAddFilter,
|
||||
mcast_addr);
|
||||
|
@ -2864,7 +2864,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
|
||||
{
|
||||
struct igb_adapter *adapter = netdev_priv(netdev);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 *mta_list;
|
||||
int i;
|
||||
|
||||
@ -2881,8 +2881,8 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
|
||||
|
||||
/* The shared function expects a packed array of only addresses. */
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev)
|
||||
memcpy(mta_list + (i++ * ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
|
||||
|
||||
igb_update_mc_addr_list(hw, mta_list, i);
|
||||
kfree(mta_list);
|
||||
|
@ -1399,7 +1399,7 @@ static void igbvf_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct igbvf_adapter *adapter = netdev_priv(netdev);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 *mta_list = NULL;
|
||||
int i;
|
||||
|
||||
@ -1414,8 +1414,8 @@ static void igbvf_set_multi(struct net_device *netdev)
|
||||
|
||||
/* prepare a packed array of only addresses. */
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev)
|
||||
memcpy(mta_list + (i++ * ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
|
||||
|
||||
hw->mac.ops.update_mc_addr_list(hw, mta_list, i, 0, 0);
|
||||
kfree(mta_list);
|
||||
|
@ -1664,7 +1664,7 @@ static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
|
||||
static void ioc3_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct ioc3_private *ip = netdev_priv(dev);
|
||||
struct ioc3 *ioc3 = ip->regs;
|
||||
u64 ehar = 0;
|
||||
@ -1688,8 +1688,8 @@ static void ioc3_set_multicast_list(struct net_device *dev)
|
||||
ip->ehar_h = 0xffffffff;
|
||||
ip->ehar_l = 0xffffffff;
|
||||
} else {
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
char *addr = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
char *addr = ha->addr;
|
||||
|
||||
if (!(*addr & 1))
|
||||
continue;
|
||||
|
@ -569,7 +569,7 @@ static int ipg_config_autoneg(struct net_device *dev)
|
||||
static void ipg_nic_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
void __iomem *ioaddr = ipg_ioaddr(dev);
|
||||
struct dev_mc_list *mc_list_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned int hashindex;
|
||||
u32 hashtable[2];
|
||||
u8 receivemode;
|
||||
@ -608,9 +608,9 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
|
||||
hashtable[1] = 0x00000000;
|
||||
|
||||
/* Cycle through all multicast addresses to filter. */
|
||||
netdev_for_each_mc_addr(mc_list_ptr, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
/* Calculate CRC result for each multicast address. */
|
||||
hashindex = crc32_le(0xffffffff, mc_list_ptr->dmi_addr,
|
||||
hashindex = crc32_le(0xffffffff, ha->addr,
|
||||
ETH_ALEN);
|
||||
|
||||
/* Use only the least significant 6 bits. */
|
||||
|
@ -961,15 +961,15 @@ static void veth_set_multicast_list(struct net_device *dev)
|
||||
(netdev_mc_count(dev) > VETH_MAX_MCAST)) {
|
||||
port->promiscuous = 1;
|
||||
} else {
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
port->promiscuous = 0;
|
||||
|
||||
/* Update table */
|
||||
port->num_mcast = 0;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
u8 *addr = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u8 *addr = ha->addr;
|
||||
u64 xaddr = 0;
|
||||
|
||||
if (addr[0] & 0x01) {/* multicast address? */
|
||||
|
@ -1058,7 +1058,7 @@ ixgb_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct ixgb_adapter *adapter = netdev_priv(netdev);
|
||||
struct ixgb_hw *hw = &adapter->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 rctl;
|
||||
int i;
|
||||
|
||||
@ -1089,9 +1089,9 @@ ixgb_set_multi(struct net_device *netdev)
|
||||
IXGB_WRITE_REG(hw, RCTL, rctl);
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev)
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
memcpy(&mta[i++ * IXGB_ETH_LENGTH_OF_ADDRESS],
|
||||
mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS);
|
||||
ha->addr, IXGB_ETH_LENGTH_OF_ADDRESS);
|
||||
|
||||
ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
|
||||
}
|
||||
|
@ -1494,7 +1494,7 @@ static void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr)
|
||||
s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw,
|
||||
struct net_device *netdev)
|
||||
{
|
||||
struct dev_addr_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 i;
|
||||
|
||||
/*
|
||||
@ -1510,9 +1510,9 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw,
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MTA(i), 0);
|
||||
|
||||
/* Add the new addresses */
|
||||
netdev_for_each_mc_addr(dmi, netdev) {
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
hw_dbg(hw, " Adding the multicast addresses:\n");
|
||||
ixgbe_set_mta(hw, dmi->dmi_addr);
|
||||
ixgbe_set_mta(hw, ha->addr);
|
||||
}
|
||||
|
||||
/* Enable mta */
|
||||
|
@ -259,7 +259,7 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
|
||||
static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
|
||||
struct net_device *netdev)
|
||||
{
|
||||
struct dev_addr_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
|
||||
u16 *vector_list = (u16 *)&msgbuf[1];
|
||||
@ -281,10 +281,10 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
|
||||
msgbuf[0] |= cnt << IXGBE_VT_MSGINFO_SHIFT;
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, netdev) {
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
if (i == cnt)
|
||||
break;
|
||||
vector_list[i++] = ixgbevf_mta_vector(hw, dmi->dmi_addr);
|
||||
vector_list[i++] = ixgbevf_mta_vector(hw, ha->addr);
|
||||
}
|
||||
|
||||
mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);
|
||||
|
@ -2009,12 +2009,12 @@ jme_set_multi(struct net_device *netdev)
|
||||
} else if (netdev->flags & IFF_ALLMULTI) {
|
||||
jme->reg_rxmcs |= RXMCS_ALLMULFRAME;
|
||||
} else if (netdev->flags & IFF_MULTICAST) {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
int bit_nr;
|
||||
|
||||
jme->reg_rxmcs |= RXMCS_MULFRAME | RXMCS_MULFILTERED;
|
||||
netdev_for_each_mc_addr(mclist, netdev) {
|
||||
bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3F;
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
bit_nr = ether_crc(ETH_ALEN, ha->addr) & 0x3F;
|
||||
mc_hash[bit_nr >> 5] |= 1 << (bit_nr & 0x1F);
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ static void korina_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct korina_private *lp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 recognise = ETH_ARC_AB; /* always accept broadcasts */
|
||||
int i;
|
||||
|
||||
@ -502,8 +502,8 @@ static void korina_multicast_list(struct net_device *dev)
|
||||
for (i = 0; i < 4; i++)
|
||||
hash_table[i] = 0;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
char *addrs = dmi->dmi_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
char *addrs = ha->addr;
|
||||
|
||||
if (!(*addrs & 1))
|
||||
continue;
|
||||
|
@ -956,13 +956,13 @@ static void ks8851_set_rx_mode(struct net_device *dev)
|
||||
rxctrl.rxcr1 = (RXCR1_RXME | RXCR1_RXAE |
|
||||
RXCR1_RXPAFMA | RXCR1_RXMAFMA);
|
||||
} else if (dev->flags & IFF_MULTICAST && !netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *mcptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 crc;
|
||||
|
||||
/* accept some multicast */
|
||||
|
||||
netdev_for_each_mc_addr(mcptr, dev) {
|
||||
crc = ether_crc(ETH_ALEN, mcptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
crc = ether_crc(ETH_ALEN, ha->addr);
|
||||
crc >>= (32 - 6); /* get top six bits */
|
||||
|
||||
rxctrl.mchash[crc >> 4] |= (1 << (crc & 0xf));
|
||||
|
@ -362,7 +362,6 @@ static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 };
|
||||
|
||||
#define MAX_MCAST_LST 32
|
||||
#define HW_MCAST_SIZE 8
|
||||
#define MAC_ADDR_LEN 6
|
||||
|
||||
/**
|
||||
* union ks_tx_hdr - tx header data
|
||||
@ -450,7 +449,7 @@ struct ks_net {
|
||||
u16 promiscuous;
|
||||
u16 all_mcast;
|
||||
u16 mcast_lst_size;
|
||||
u8 mcast_lst[MAX_MCAST_LST][MAC_ADDR_LEN];
|
||||
u8 mcast_lst[MAX_MCAST_LST][ETH_ALEN];
|
||||
u8 mcast_bits[HW_MCAST_SIZE];
|
||||
u8 mac_addr[6];
|
||||
u8 fid;
|
||||
@ -1170,7 +1169,7 @@ static void ks_set_mcast(struct ks_net *ks, u16 mcast)
|
||||
static void ks_set_rx_mode(struct net_device *netdev)
|
||||
{
|
||||
struct ks_net *ks = netdev_priv(netdev);
|
||||
struct dev_mc_list *ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
/* Turn on/off promiscuous mode. */
|
||||
if ((netdev->flags & IFF_PROMISC) == IFF_PROMISC)
|
||||
@ -1187,13 +1186,12 @@ static void ks_set_rx_mode(struct net_device *netdev)
|
||||
if (netdev_mc_count(netdev) <= MAX_MCAST_LST) {
|
||||
int i = 0;
|
||||
|
||||
netdev_for_each_mc_addr(ptr, netdev) {
|
||||
if (!(*ptr->dmi_addr & 1))
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
if (!(*ha->addr & 1))
|
||||
continue;
|
||||
if (i >= MAX_MCAST_LST)
|
||||
break;
|
||||
memcpy(ks->mcast_lst[i++], ptr->dmi_addr,
|
||||
MAC_ADDR_LEN);
|
||||
memcpy(ks->mcast_lst[i++], ha->addr, ETH_ALEN);
|
||||
}
|
||||
ks->mcast_lst_size = (u8)i;
|
||||
ks_set_grpaddr(ks);
|
||||
|
@ -5763,7 +5763,7 @@ static void netdev_set_rx_mode(struct net_device *dev)
|
||||
struct dev_priv *priv = netdev_priv(dev);
|
||||
struct dev_info *hw_priv = priv->adapter;
|
||||
struct ksz_hw *hw = &hw_priv->hw;
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
int multicast = (dev->flags & IFF_ALLMULTI);
|
||||
|
||||
dev_set_promiscuous(dev, priv, hw, (dev->flags & IFF_PROMISC));
|
||||
@ -5780,7 +5780,7 @@ static void netdev_set_rx_mode(struct net_device *dev)
|
||||
int i = 0;
|
||||
|
||||
/* List too big to support so turn on all multicast mode. */
|
||||
if (dev->mc_count > MAX_MULTICAST_LIST) {
|
||||
if (netdev_mc_count(dev) > MAX_MULTICAST_LIST) {
|
||||
if (MAX_MULTICAST_LIST != hw->multi_list_size) {
|
||||
hw->multi_list_size = MAX_MULTICAST_LIST;
|
||||
++hw->all_multi;
|
||||
@ -5789,13 +5789,12 @@ static void netdev_set_rx_mode(struct net_device *dev)
|
||||
return;
|
||||
}
|
||||
|
||||
netdev_for_each_mc_addr(mc_ptr, dev) {
|
||||
if (!(*mc_ptr->dmi_addr & 1))
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (!(*ha->addr & 1))
|
||||
continue;
|
||||
if (i >= MAX_MULTICAST_LIST)
|
||||
break;
|
||||
memcpy(hw->multi_list[i++], mc_ptr->dmi_addr,
|
||||
MAC_ADDR_LEN);
|
||||
memcpy(hw->multi_list[i++], ha->addr, MAC_ADDR_LEN);
|
||||
}
|
||||
hw->multi_list_size = (u8) i;
|
||||
hw_set_grp_addr(hw);
|
||||
|
@ -1388,7 +1388,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
}
|
||||
|
||||
if (!netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned char *cp;
|
||||
struct mc_cmd *cmd;
|
||||
|
||||
@ -1396,10 +1396,10 @@ static void set_multicast_list(struct net_device *dev)
|
||||
cmd->cmd.command = SWAP16(CmdMulticastList);
|
||||
cmd->mc_cnt = SWAP16(netdev_mc_count(dev) * 6);
|
||||
cp = cmd->mc_addrs;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
if (!cnt--)
|
||||
break;
|
||||
memcpy(cp, dmi->dmi_addr, 6);
|
||||
memcpy(cp, ha->addr, 6);
|
||||
if (i596_debug > 1)
|
||||
DEB(DEB_MULTI,
|
||||
printk(KERN_DEBUG
|
||||
|
@ -905,10 +905,10 @@ static struct net_device_stats *__ei_get_stats(struct net_device *dev)
|
||||
|
||||
static inline void make_mc_bits(u8 *bits, struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
u32 crc = ether_crc(ETH_ALEN, dmi->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u32 crc = ether_crc(ETH_ALEN, ha->addr);
|
||||
/*
|
||||
* The 8390 uses the 6 most significant bits of the
|
||||
* CRC to index the multicast table.
|
||||
|
@ -250,20 +250,20 @@ static void temac_set_multicast_list(struct net_device *ndev)
|
||||
temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK);
|
||||
dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
|
||||
} else if (!netdev_mc_empty(ndev)) {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mclist, ndev) {
|
||||
netdev_for_each_mc_addr(ha, ndev) {
|
||||
if (i >= MULTICAST_CAM_TABLE_NUM)
|
||||
break;
|
||||
multi_addr_msw = ((mclist->dmi_addr[3] << 24) |
|
||||
(mclist->dmi_addr[2] << 16) |
|
||||
(mclist->dmi_addr[1] << 8) |
|
||||
(mclist->dmi_addr[0]));
|
||||
multi_addr_msw = ((ha->addr[3] << 24) |
|
||||
(ha->addr[2] << 16) |
|
||||
(ha->addr[1] << 8) |
|
||||
(ha->addr[0]));
|
||||
temac_indirect_out32(lp, XTE_MAW0_OFFSET,
|
||||
multi_addr_msw);
|
||||
multi_addr_lsw = ((mclist->dmi_addr[5] << 8) |
|
||||
(mclist->dmi_addr[4]) | (i << 16));
|
||||
multi_addr_lsw = ((ha->addr[5] << 8) |
|
||||
(ha->addr[4]) | (i << 16));
|
||||
temac_indirect_out32(lp, XTE_MAW1_OFFSET,
|
||||
multi_addr_lsw);
|
||||
i++;
|
||||
|
@ -1256,7 +1256,7 @@ static void set_multicast_list(struct net_device *dev) {
|
||||
dev->name, netdev_mc_count(dev));
|
||||
|
||||
if (!netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *cp;
|
||||
cmd = kmalloc(sizeof(struct i596_cmd) + 2 +
|
||||
netdev_mc_count(dev) * 6, GFP_ATOMIC);
|
||||
@ -1267,8 +1267,8 @@ static void set_multicast_list(struct net_device *dev) {
|
||||
cmd->command = CmdMulticastList;
|
||||
*((unsigned short *) (cmd + 1)) = netdev_mc_count(dev) * 6;
|
||||
cp = ((char *)(cmd + 1))+2;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
memcpy(cp, dmi->dmi_addr, 6);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
memcpy(cp, ha->addr, 6);
|
||||
cp += 6;
|
||||
}
|
||||
if (i596_debug & LOG_SRCDST)
|
||||
|
@ -882,15 +882,15 @@ static int hash_get_index(__u8 *addr)
|
||||
*/
|
||||
static void macb_sethashtable(struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *curr;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned long mc_filter[2];
|
||||
unsigned int bitnr;
|
||||
struct macb *bp = netdev_priv(dev);
|
||||
|
||||
mc_filter[0] = mc_filter[1] = 0;
|
||||
|
||||
netdev_for_each_mc_addr(curr, dev) {
|
||||
bitnr = hash_get_index(curr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
bitnr = hash_get_index(ha->addr);
|
||||
mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ static void mace_set_multicast(struct net_device *dev)
|
||||
mp->maccc |= PROM;
|
||||
} else {
|
||||
unsigned char multicast_filter[8];
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if (dev->flags & IFF_ALLMULTI) {
|
||||
for (i = 0; i < 8; i++)
|
||||
@ -606,8 +606,8 @@ static void mace_set_multicast(struct net_device *dev)
|
||||
} else {
|
||||
for (i = 0; i < 8; i++)
|
||||
multicast_filter[i] = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
crc = ether_crc_le(6, dmi->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
crc = ether_crc_le(6, ha->addr);
|
||||
i = crc >> 26; /* bit number in multicast_filter */
|
||||
multicast_filter[i >> 3] |= 1 << (i & 7);
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ static void mace_set_multicast(struct net_device *dev)
|
||||
mb->maccc |= PROM;
|
||||
} else {
|
||||
unsigned char multicast_filter[8];
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if (dev->flags & IFF_ALLMULTI) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
@ -517,8 +517,8 @@ static void mace_set_multicast(struct net_device *dev)
|
||||
} else {
|
||||
for (i = 0; i < 8; i++)
|
||||
multicast_filter[i] = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
crc = ether_crc_le(6, dmi->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
crc = ether_crc_le(6, ha->addr);
|
||||
/* bit number in multicast_filter */
|
||||
i = crc >> 26;
|
||||
multicast_filter[i >> 3] |= 1 << (i & 7);
|
||||
|
@ -168,7 +168,7 @@ static void mlx4_en_clear_list(struct net_device *dev)
|
||||
static void mlx4_en_cache_mclist(struct net_device *dev)
|
||||
{
|
||||
struct mlx4_en_priv *priv = netdev_priv(dev);
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
char *mc_addrs;
|
||||
int mc_addrs_cnt = netdev_mc_count(dev);
|
||||
int i;
|
||||
@ -179,8 +179,8 @@ static void mlx4_en_cache_mclist(struct net_device *dev)
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev)
|
||||
memcpy(mc_addrs + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
memcpy(mc_addrs + i++ * ETH_ALEN, ha->addr, ETH_ALEN);
|
||||
priv->mc_addrs = mc_addrs;
|
||||
priv->mc_addrs_cnt = mc_addrs_cnt;
|
||||
}
|
||||
|
@ -1769,7 +1769,7 @@ static void mv643xx_eth_program_multicast_filter(struct net_device *dev)
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
u32 *mc_spec;
|
||||
u32 *mc_other;
|
||||
struct dev_addr_list *addr;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i;
|
||||
|
||||
if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) {
|
||||
@ -1794,8 +1794,8 @@ oom:
|
||||
memset(mc_spec, 0, 0x100);
|
||||
memset(mc_other, 0, 0x100);
|
||||
|
||||
netdev_for_each_mc_addr(addr, dev) {
|
||||
u8 *a = addr->da_addr;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u8 *a = ha->addr;
|
||||
u32 *table;
|
||||
int entry;
|
||||
|
||||
|
@ -3001,7 +3001,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct myri10ge_priv *mgp = netdev_priv(dev);
|
||||
struct myri10ge_cmd cmd;
|
||||
struct dev_mc_list *mc_list;
|
||||
struct netdev_hw_addr *ha;
|
||||
__be32 data[2] = { 0, 0 };
|
||||
int err;
|
||||
|
||||
@ -3038,8 +3038,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
|
||||
}
|
||||
|
||||
/* Walk the multicast list, and add each address */
|
||||
netdev_for_each_mc_addr(mc_list, dev) {
|
||||
memcpy(data, &mc_list->dmi_addr, 6);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
memcpy(data, &ha->addr, 6);
|
||||
cmd.data0 = ntohl(data[0]);
|
||||
cmd.data1 = ntohl(data[1]);
|
||||
err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP,
|
||||
@ -3047,7 +3047,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
|
||||
|
||||
if (err != 0) {
|
||||
netdev_err(dev, "Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n",
|
||||
err, mc_list->dmi_addr);
|
||||
err, ha->addr);
|
||||
goto abort;
|
||||
}
|
||||
}
|
||||
|
@ -2493,12 +2493,12 @@ static void __set_rx_mode(struct net_device *dev)
|
||||
rx_mode = RxFilterEnable | AcceptBroadcast
|
||||
| AcceptAllMulticast | AcceptMyPhys;
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
int i;
|
||||
|
||||
memset(mc_filter, 0, sizeof(mc_filter));
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
int b = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 23) & 0x1ff;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
int b = (ether_crc(ETH_ALEN, ha->addr) >> 23) & 0x1ff;
|
||||
mc_filter[b/8] |= (1 << (b & 0x07));
|
||||
}
|
||||
rx_mode = RxFilterEnable | AcceptBroadcast
|
||||
|
@ -537,7 +537,7 @@ netxen_nic_set_mcast_addr(struct netxen_adapter *adapter,
|
||||
void netxen_p2_nic_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(netdev);
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 null_addr[6];
|
||||
int i;
|
||||
|
||||
@ -571,8 +571,8 @@ void netxen_p2_nic_set_multi(struct net_device *netdev)
|
||||
netxen_nic_enable_mcast_filter(adapter);
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev)
|
||||
netxen_nic_set_mcast_addr(adapter, i++, mc_ptr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
netxen_nic_set_mcast_addr(adapter, i++, ha->addr);
|
||||
|
||||
/* Clear out remaining addresses */
|
||||
while (i < adapter->max_mc_count)
|
||||
@ -680,7 +680,7 @@ static int nx_p3_nic_add_mac(struct netxen_adapter *adapter,
|
||||
void netxen_p3_nic_set_multi(struct net_device *netdev)
|
||||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(netdev);
|
||||
struct dev_mc_list *mc_ptr;
|
||||
struct netdev_hw_addr *ha;
|
||||
u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
u32 mode = VPORT_MISS_MODE_DROP;
|
||||
LIST_HEAD(del_list);
|
||||
@ -707,8 +707,8 @@ void netxen_p3_nic_set_multi(struct net_device *netdev)
|
||||
}
|
||||
|
||||
if (!netdev_mc_empty(netdev)) {
|
||||
netdev_for_each_mc_addr(mc_ptr, netdev)
|
||||
nx_p3_nic_add_mac(adapter, mc_ptr->dmi_addr, &del_list);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
nx_p3_nic_add_mac(adapter, ha->addr, &del_list);
|
||||
}
|
||||
|
||||
send_fw_cmd:
|
||||
|
@ -596,7 +596,7 @@ static int init586(struct net_device *dev)
|
||||
struct iasetup_cmd_struct __iomem *ias_cmd;
|
||||
struct tdr_cmd_struct __iomem *tdr_cmd;
|
||||
struct mcsetup_cmd_struct __iomem *mc_cmd;
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
int num_addrs = netdev_mc_count(dev);
|
||||
|
||||
ptr = p->scb + 1;
|
||||
@ -725,8 +725,8 @@ static int init586(struct net_device *dev)
|
||||
writew(num_addrs * 6, &mc_cmd->mc_cnt);
|
||||
|
||||
i = 0;
|
||||
netdev_for_each_mc_addr(dmi, dev)
|
||||
memcpy_toio(mc_cmd->mc_list[i++], dmi->dmi_addr, 6);
|
||||
netdev_for_each_mc_addr(ha, dev)
|
||||
memcpy_toio(mc_cmd->mc_list[i++], ha->addr, 6);
|
||||
|
||||
writew(make16(mc_cmd), &p->scb->cbl_offset);
|
||||
writeb(CUC_START, &p->scb->cmd_cuc);
|
||||
|
@ -6313,7 +6313,6 @@ static void niu_set_rx_mode(struct net_device *dev)
|
||||
{
|
||||
struct niu *np = netdev_priv(dev);
|
||||
int i, alt_cnt, err;
|
||||
struct dev_addr_list *addr;
|
||||
struct netdev_hw_addr *ha;
|
||||
unsigned long flags;
|
||||
u16 hash[16] = { 0, };
|
||||
@ -6365,8 +6364,8 @@ static void niu_set_rx_mode(struct net_device *dev)
|
||||
for (i = 0; i < 16; i++)
|
||||
hash[i] = 0xffff;
|
||||
} else if (!netdev_mc_empty(dev)) {
|
||||
netdev_for_each_mc_addr(addr, dev) {
|
||||
u32 crc = ether_crc_le(ETH_ALEN, addr->da_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u32 crc = ether_crc_le(ETH_ALEN, ha->addr);
|
||||
|
||||
crc >>= 24;
|
||||
hash[crc >> 4] |= (1 << (15 - (crc & 0xf)));
|
||||
|
@ -474,7 +474,7 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
|
||||
unsigned int cam_mode = 1; /* 1 - Accept on CAM match */
|
||||
unsigned int multicast_mode = 1; /* 1 - Reject all multicast. */
|
||||
struct octeon_mgmt_cam_state cam_state;
|
||||
struct dev_addr_list *list;
|
||||
struct netdev_hw_addr *ha;
|
||||
struct list_head *pos;
|
||||
int available_cam_entries;
|
||||
|
||||
@ -510,8 +510,8 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
|
||||
}
|
||||
}
|
||||
if (multicast_mode == 0) {
|
||||
netdev_for_each_mc_addr(list, netdev)
|
||||
octeon_mgmt_cam_state_add(&cam_state, list->da_addr);
|
||||
netdev_for_each_mc_addr(ha, netdev)
|
||||
octeon_mgmt_cam_state_add(&cam_state, ha->addr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1813,12 +1813,12 @@ static void netdrv_set_rx_mode(struct net_device *dev)
|
||||
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0xffffffff;
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0;
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
|
||||
|
||||
mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
|
||||
}
|
||||
|
@ -1623,11 +1623,11 @@ static struct net_device_stats *get_stats(struct net_device *dev)
|
||||
|
||||
static inline void make_mc_bits(u8 *bits, struct net_device *dev)
|
||||
{
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
u32 crc;
|
||||
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
crc = ether_crc(ETH_ALEN, dmi->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
crc = ether_crc(ETH_ALEN, ha->addr);
|
||||
/*
|
||||
* The 8390 uses the 6 most significant bits of the
|
||||
* CRC to index the multicast table.
|
||||
|
@ -1196,11 +1196,11 @@ static void set_rx_mode(struct net_device *dev)
|
||||
memset(mc_filter, 0x00, sizeof(mc_filter));
|
||||
outb(1, ioaddr + RX_MODE); /* Ignore almost all multicasts. */
|
||||
} else {
|
||||
struct dev_mc_list *mclist;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
memset(mc_filter, 0, sizeof(mc_filter));
|
||||
netdev_for_each_mc_addr(mclist, dev) {
|
||||
unsigned int bit = ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26;
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
unsigned int bit = ether_crc_le(ETH_ALEN, ha->addr) >> 26;
|
||||
mc_filter[bit >> 3] |= (1 << (bit & 7));
|
||||
}
|
||||
outb(2, ioaddr + RX_MODE); /* Use normal mode. */
|
||||
|
@ -1475,7 +1475,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
mace_private *lp = netdev_priv(dev);
|
||||
int adr[ETHER_ADDR_LEN] = {0}; /* Ethernet address */
|
||||
struct dev_mc_list *dmi;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
#ifdef PCMCIA_DEBUG
|
||||
{
|
||||
@ -1495,8 +1495,8 @@ static void set_multicast_list(struct net_device *dev)
|
||||
if (num_addrs > 0) {
|
||||
/* Calculate multicast logical address filter */
|
||||
memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN);
|
||||
netdev_for_each_mc_addr(dmi, dev) {
|
||||
memcpy(adr, dmi->dmi_addr, ETHER_ADDR_LEN);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
memcpy(adr, ha->addr, ETHER_ADDR_LEN);
|
||||
BuildLAF(lp->multicast_ladrf, adr);
|
||||
}
|
||||
}
|
||||
|
@ -1616,12 +1616,12 @@ static void set_rx_mode(struct net_device *dev)
|
||||
rx_cfg_setting = RxStripCRC | RxEnable | RxAllMulti;
|
||||
else {
|
||||
if (!netdev_mc_empty(dev)) {
|
||||
struct dev_mc_list *mc_addr;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
netdev_for_each_mc_addr(mc_addr, dev) {
|
||||
u_int position = ether_crc(6, mc_addr->dmi_addr);
|
||||
netdev_for_each_mc_addr(ha, dev) {
|
||||
u_int position = ether_crc(6, ha->addr);
|
||||
#ifndef final_version /* Verify multicast address. */
|
||||
if ((mc_addr->dmi_addr[0] & 1) == 0)
|
||||
if ((ha->addr[0] & 1) == 0)
|
||||
continue;
|
||||
#endif
|
||||
multicast_table[position >> 29] |= 1 << ((position >> 26) & 7);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user