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

Subsystems: intel ethernet drivers, networking drivers, the rest

STALE5509d

2 messages, 2 authors, 2011-09-16 · open the first message on its own page

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

From: Hagen Paul Pfeifer <hidden>
Date: 2011-09-16 21:35:16

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 <redacted>
Cc: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/ixgb/ixgb_main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
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)
-- 
1.7.5.4

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

From: Jeff Kirsher <hidden>
Date: 2011-09-16 23:09:06

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 <redacted>
Cc: Jeff Kirsher <redacted>
---
 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help