static int lbs_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd, struct net_device *dev, int nr_addrs) { int i = nr_addrs; struct netdev_hw_addr *ha; int cnt; if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST)) return nr_addrs; netif_addr_lock_bh(dev); cnt = netdev_mc_count(dev); netdev_for_each_mc_addr(ha, dev) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) if (mac_in_list(cmd->maclist, nr_addrs, ha->addr)) { #else if (mac_in_list(cmd->maclist, nr_addrs, ha->dmi_addr)) { #endif lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) ha->addr); #else ha->dmi_addr); #endif cnt--; continue; } if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE) break; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) memcpy(&cmd->maclist[6*i], ha->addr, ETH_ALEN); #else memcpy(&cmd->maclist[6*i], ha->dmi_addr, ETH_ALEN); #endif lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) ha->addr); #else ha->dmi_addr); #endif i++; cnt--; } netif_addr_unlock_bh(dev); if (cnt) return -EOVERFLOW; return i; }
static int lbs_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd, struct net_device *dev, int nr_addrs) { int i = nr_addrs; struct netdev_hw_addr *ha; int cnt; if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST)) return nr_addrs; netif_addr_lock_bh(dev); cnt = netdev_mc_count(dev); netdev_for_each_mc_addr(ha, dev) { if (mac_in_list(cmd->maclist, nr_addrs, mc_addr(ha))) { lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, mc_addr(ha)); cnt--; continue; } if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE) break; memcpy(&cmd->maclist[6*i], mc_addr(ha), ETH_ALEN); lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, mc_addr(ha)); i++; cnt--; } netif_addr_unlock_bh(dev); if (cnt) return -EOVERFLOW; return i; }
static int lbs_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd, struct net_device *dev, int nr_addrs) { int i = nr_addrs; struct dev_mc_list *mc_list; if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST)) return nr_addrs; netif_addr_lock_bh(dev); for (mc_list = dev->mc_list; mc_list; mc_list = mc_list->next) { if (mac_in_list(cmd->maclist, nr_addrs, mc_list->dmi_addr)) { lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, mc_list->dmi_addr); continue; } if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE) break; memcpy(&cmd->maclist[6*i], mc_list->dmi_addr, ETH_ALEN); lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, mc_list->dmi_addr); i++; } netif_addr_unlock_bh(dev); if (mc_list) return -EOVERFLOW; return i; }