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; }
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, ha->addr)) { lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, ha->addr); cnt--; continue; } if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE) break; memcpy(&cmd->maclist[6*i], ha->addr, ETH_ALEN); lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, ha->addr); i++; cnt--; } netif_addr_unlock_bh(dev); if (cnt) return -EOVERFLOW; return i; }
int lbs_start_iface(struct lbs_private *priv) { struct cmd_ds_802_11_mac_address cmd; int ret; if (priv->power_restore) { ret = priv->power_restore(priv); if (ret) return ret; } cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.action = cpu_to_le16(CMD_ACT_SET); memcpy(cmd.macadd, priv->current_addr, ETH_ALEN); ret = lbs_cmd_with_response(priv, CMD_802_11_MAC_ADDRESS, &cmd); if (ret) { lbs_deb_net("set MAC address failed\n"); goto err; } lbs_update_channel(priv); priv->iface_running = true; return 0; err: if (priv->power_save) priv->power_save(priv); return ret; }