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

Commit 5c15bdec authored by Dan Aloni's avatar Dan Aloni Committed by David S. Miller
Browse files

[VLAN]: Avoid a 4-order allocation.



This patch splits the vlan_group struct into a multi-allocated struct. On
x86_64, the size of the original struct is a little more than 32KB, causing
a 4-order allocation, which is prune to problems caused by buddy-system
external fragmentation conditions.

I couldn't just use vmalloc() because vfree() cannot be called in the
softirq context of the RCU callback.

Signed-off-by: default avatarDan Aloni <da-x@monatomic.org>
Acked-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b5284e5a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -448,8 +448,7 @@ static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
	spin_lock_irqsave(&cp->lock, flags);
	cp->cpcmd &= ~RxVlanOn;
	cpw16(CpCmd, cp->cpcmd);
	if (cp->vlgrp)
		cp->vlgrp->vlan_devices[vid] = NULL;
	vlan_group_set_device(cp->vlgrp, vid, NULL);
	spin_unlock_irqrestore(&cp->lock, flags);
}
#endif /* CP_VLAN_TAG_USED */
+1 −4
Original line number Diff line number Diff line
@@ -2293,10 +2293,7 @@ static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)

	local_irq_save(flags);
	ace_mask_irq(dev);

	if (ap->vlgrp)
		ap->vlgrp->vlan_devices[vid] = NULL;

	vlan_group_set_device(ap->vlgrp, vid, NULL);
	ace_unmask_irq(dev);
	local_irq_restore(flags);
}
+1 −2
Original line number Diff line number Diff line
@@ -1737,8 +1737,7 @@ static void amd8111e_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid
{
	struct amd8111e_priv *lp = netdev_priv(dev);
	spin_lock_irq(&lp->lock);
	if (lp->vlgrp)
		lp->vlgrp->vlan_devices[vid] = NULL;
	vlan_group_set_device(lp->vlgrp, vid, NULL);
	spin_unlock_irq(&lp->lock);
}
#endif
+2 −3
Original line number Diff line number Diff line
@@ -1252,8 +1252,7 @@ static void atl1_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)

	spin_lock_irqsave(&adapter->lock, flags);
	/* atl1_irq_disable(adapter); */
	if (adapter->vlgrp)
		adapter->vlgrp->vlan_devices[vid] = NULL;
	vlan_group_set_device(adapter->vlgrp, vid, NULL);
	/* atl1_irq_enable(adapter); */
	spin_unlock_irqrestore(&adapter->lock, flags);
	/* We don't do Vlan filtering */
@@ -1266,7 +1265,7 @@ static void atl1_restore_vlan(struct atl1_adapter *adapter)
	if (adapter->vlgrp) {
		u16 vid;
		for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
			if (!adapter->vlgrp->vlan_devices[vid])
			if (!vlan_group_get_device(adapter->vlgrp, vid))
				continue;
			atl1_vlan_rx_add_vid(adapter->netdev, vid);
		}
+1 −3
Original line number Diff line number Diff line
@@ -4467,9 +4467,7 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
	struct bnx2 *bp = netdev_priv(dev);

	bnx2_netif_stop(bp);

	if (bp->vlgrp)
		bp->vlgrp->vlan_devices[vid] = NULL;
	vlan_group_set_device(bp->vlgrp, vid, NULL);
	bnx2_set_rx_mode(dev);

	bnx2_netif_start(bp);
Loading