Skip to content

Commit 95b6759

Browse files
arndbdavem330
authored andcommitted
net: qed: reduce stack usage for TLV processing
clang gets a bit confused by the code in the qed_mfw_process_tlv_req and ends up spilling registers to the stack hundreds of times. When sanitizers are enabled, this can end up blowing the stack warning limit: drivers/net/ethernet/qlogic/qed/qed_mng_tlv.c:1244:5: error: stack frame size (1824) exceeds limit (1280) in 'qed_mfw_process_tlv_req' [-Werror,-Wframe-larger-than] Apparently the problem is the complexity of qed_mfw_update_tlvs() after inlining, and marking the four main branches of that function as noinline_for_stack makes this problem completely go away, the stack usage goes down to 100 bytes. Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Alexander Lobakin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b993ea4 commit 95b6759

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int qed_mfw_get_tlv_group(u8 tlv_type, u8 *tlv_group)
242242
}
243243

244244
/* Returns size of the data buffer or, -1 in case TLV data is not available. */
245-
static int
245+
static noinline_for_stack int
246246
qed_mfw_get_gen_tlv_value(struct qed_drv_tlv_hdr *p_tlv,
247247
struct qed_mfw_tlv_generic *p_drv_buf,
248248
struct qed_tlv_parsed_buf *p_buf)
@@ -304,7 +304,7 @@ qed_mfw_get_gen_tlv_value(struct qed_drv_tlv_hdr *p_tlv,
304304
return -1;
305305
}
306306

307-
static int
307+
static noinline_for_stack int
308308
qed_mfw_get_eth_tlv_value(struct qed_drv_tlv_hdr *p_tlv,
309309
struct qed_mfw_tlv_eth *p_drv_buf,
310310
struct qed_tlv_parsed_buf *p_buf)
@@ -438,7 +438,7 @@ qed_mfw_get_tlv_time_value(struct qed_mfw_tlv_time *p_time,
438438
return QED_MFW_TLV_TIME_SIZE;
439439
}
440440

441-
static int
441+
static noinline_for_stack int
442442
qed_mfw_get_fcoe_tlv_value(struct qed_drv_tlv_hdr *p_tlv,
443443
struct qed_mfw_tlv_fcoe *p_drv_buf,
444444
struct qed_tlv_parsed_buf *p_buf)
@@ -1073,7 +1073,7 @@ qed_mfw_get_fcoe_tlv_value(struct qed_drv_tlv_hdr *p_tlv,
10731073
return -1;
10741074
}
10751075

1076-
static int
1076+
static noinline_for_stack int
10771077
qed_mfw_get_iscsi_tlv_value(struct qed_drv_tlv_hdr *p_tlv,
10781078
struct qed_mfw_tlv_iscsi *p_drv_buf,
10791079
struct qed_tlv_parsed_buf *p_buf)

0 commit comments

Comments
 (0)