Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22bedad3 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

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: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a748ee24
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;
+4 −5
Original line number Diff line number Diff line
@@ -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)) {
+5 −5
Original line number Diff line number Diff line
@@ -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);
+4 −3
Original line number Diff line number Diff line
@@ -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);
+4 −3
Original line number Diff line number Diff line
@@ -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();
Loading