Skip to content

Commit 7c116e0

Browse files
arndbdavem330
authored andcommitted
qed: reduce maximum stack frame size
clang warns about an overly large stack frame in one function when it decides to inline all __qed_get_vport_*() functions into __qed_get_vport_stats(): drivers/net/ethernet/qlogic/qed/qed_l2.c:1889:13: error: stack frame size of 1128 bytes in function '_qed_get_vport_stats' [-Werror,-Wframe-larger-than=] Use a noinline_for_stack annotation to prevent clang from inlining these, which keeps the maximum stack usage at around half of that in the worst case, similar to what we get with gcc. Fixes: 86622ee ("qed: Move statistics to L2 code") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 81cd17a commit 7c116e0

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

drivers/net/ethernet/qlogic/qed/qed_l2.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,10 +1631,9 @@ static void __qed_get_vport_pstats_addrlen(struct qed_hwfn *p_hwfn,
16311631
}
16321632
}
16331633

1634-
static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn,
1635-
struct qed_ptt *p_ptt,
1636-
struct qed_eth_stats *p_stats,
1637-
u16 statistics_bin)
1634+
static noinline_for_stack void
1635+
__qed_get_vport_pstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
1636+
struct qed_eth_stats *p_stats, u16 statistics_bin)
16381637
{
16391638
struct eth_pstorm_per_queue_stat pstats;
16401639
u32 pstats_addr = 0, pstats_len = 0;
@@ -1661,10 +1660,9 @@ static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn,
16611660
HILO_64_REGPAIR(pstats.error_drop_pkts);
16621661
}
16631662

1664-
static void __qed_get_vport_tstats(struct qed_hwfn *p_hwfn,
1665-
struct qed_ptt *p_ptt,
1666-
struct qed_eth_stats *p_stats,
1667-
u16 statistics_bin)
1663+
static noinline_for_stack void
1664+
__qed_get_vport_tstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
1665+
struct qed_eth_stats *p_stats, u16 statistics_bin)
16681666
{
16691667
struct tstorm_per_port_stat tstats;
16701668
u32 tstats_addr, tstats_len;
@@ -1709,10 +1707,9 @@ static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn,
17091707
}
17101708
}
17111709

1712-
static void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn,
1713-
struct qed_ptt *p_ptt,
1714-
struct qed_eth_stats *p_stats,
1715-
u16 statistics_bin)
1710+
static noinline_for_stack
1711+
void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
1712+
struct qed_eth_stats *p_stats, u16 statistics_bin)
17161713
{
17171714
struct eth_ustorm_per_queue_stat ustats;
17181715
u32 ustats_addr = 0, ustats_len = 0;
@@ -1751,10 +1748,9 @@ static void __qed_get_vport_mstats_addrlen(struct qed_hwfn *p_hwfn,
17511748
}
17521749
}
17531750

1754-
static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn,
1755-
struct qed_ptt *p_ptt,
1756-
struct qed_eth_stats *p_stats,
1757-
u16 statistics_bin)
1751+
static noinline_for_stack void
1752+
__qed_get_vport_mstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
1753+
struct qed_eth_stats *p_stats, u16 statistics_bin)
17581754
{
17591755
struct eth_mstorm_per_queue_stat mstats;
17601756
u32 mstats_addr = 0, mstats_len = 0;
@@ -1780,9 +1776,9 @@ static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn,
17801776
HILO_64_REGPAIR(mstats.tpa_coalesced_bytes);
17811777
}
17821778

1783-
static void __qed_get_vport_port_stats(struct qed_hwfn *p_hwfn,
1784-
struct qed_ptt *p_ptt,
1785-
struct qed_eth_stats *p_stats)
1779+
static noinline_for_stack void
1780+
__qed_get_vport_port_stats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
1781+
struct qed_eth_stats *p_stats)
17861782
{
17871783
struct qed_eth_stats_common *p_common = &p_stats->common;
17881784
struct port_stats port_stats;

0 commit comments

Comments
 (0)