Commit 3499e87e authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

ethtool: reduce stack usage with clang

clang inlines the dev_ethtool() more aggressively than gcc does, leading
to a larger amount of used stack space:

net/core/ethtool.c:2536:24: error: stack frame size of 1216 bytes in function 'dev_ethtool' [-Werror,-Wframe-larger-than=]

Marking the sub-functions that require the most stack space as
noinline_for_stack gives us reasonable behavior on all compilers.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b89869da
...@@ -2319,9 +2319,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr) ...@@ -2319,9 +2319,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr)
return ret; return ret;
} }
static int ethtool_get_per_queue_coalesce(struct net_device *dev, static noinline_for_stack int
void __user *useraddr, ethtool_get_per_queue_coalesce(struct net_device *dev,
struct ethtool_per_queue_op *per_queue_opt) void __user *useraddr,
struct ethtool_per_queue_op *per_queue_opt)
{ {
u32 bit; u32 bit;
int ret; int ret;
...@@ -2349,9 +2350,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev, ...@@ -2349,9 +2350,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev,
return 0; return 0;
} }
static int ethtool_set_per_queue_coalesce(struct net_device *dev, static noinline_for_stack int
void __user *useraddr, ethtool_set_per_queue_coalesce(struct net_device *dev,
struct ethtool_per_queue_op *per_queue_opt) void __user *useraddr,
struct ethtool_per_queue_op *per_queue_opt)
{ {
u32 bit; u32 bit;
int i, ret = 0; int i, ret = 0;
...@@ -2405,7 +2407,7 @@ static int ethtool_set_per_queue_coalesce(struct net_device *dev, ...@@ -2405,7 +2407,7 @@ static int ethtool_set_per_queue_coalesce(struct net_device *dev,
return ret; return ret;
} }
static int ethtool_set_per_queue(struct net_device *dev, static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev,
void __user *useraddr, u32 sub_cmd) void __user *useraddr, u32 sub_cmd)
{ {
struct ethtool_per_queue_op per_queue_opt; struct ethtool_per_queue_op per_queue_opt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment