diff mbox

[net-next] ixgb: relax stack usage of 768 Byte

Message ID 1316208897-4557-1-git-send-email-hagen@jauu.net
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Hagen Paul Pfeifer Sept. 16, 2011, 9:34 p.m. UTC
ixgb_set_multi() will push (128 * 6) byte on the stack to set the
multicast filter. Fix this by allocate the scratch buffer on the heap.

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgb/ixgb_main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Comments

Kirsher, Jeffrey T Sept. 16, 2011, 11:08 p.m. UTC | #1
On Fri, 2011-09-16 at 14:34 -0700, Hagen Paul Pfeifer wrote:
> ixgb_set_multi() will push (128 * 6) byte on the stack to set the
> multicast filter. Fix this by allocate the scratch buffer on the heap.
> 
> Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgb/ixgb_main.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-) 

Thanks Hagen! I have added the patch to my queue of ixgbe patches.
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index c8b9c90..4d23007 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -1095,8 +1095,10 @@  ixgb_set_multi(struct net_device *netdev)
 		rctl |= IXGB_RCTL_MPE;
 		IXGB_WRITE_REG(hw, RCTL, rctl);
 	} else {
-		u8 mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES *
-			    IXGB_ETH_LENGTH_OF_ADDRESS];
+		u8 *mta = kmalloc(IXGB_MAX_NUM_MULTICAST_ADDRESSES *
+				IXGB_ETH_LENGTH_OF_ADDRESS, GFP_ATOMIC);
+		if (!mta)
+			return;
 
 		IXGB_WRITE_REG(hw, RCTL, rctl);
 
@@ -1106,6 +1108,8 @@  ixgb_set_multi(struct net_device *netdev)
 			       ha->addr, IXGB_ETH_LENGTH_OF_ADDRESS);
 
 		ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
+
+		kfree(mta);
 	}
 
 	if (netdev->features & NETIF_F_HW_VLAN_RX)