Skip to content

Commit

Permalink
Reduce extern parameters size to 64 bytes (#4880)
Browse files Browse the repository at this point in the history
eBPF has, currently, a stack limit of 512 bytes.
In a scenario where we have declared one instance of
struct p4tc_ext_bpf_params, another of struct p4tc_ext_bpf_val and one of
struct p4tc_table_entry_act_bpf we have already 420 bytes of stack usage.
With a few extra stack variables it's possible to see how the limit will
be easily exceeded. To avoid exceeding this limit so trivially, reduce the
size of the parameters in the extern structs. As of now, we don't have a
use case that would require more than 64 bytes.

Signed-off-by: Victor Nogueira <[email protected]>
  • Loading branch information
vbnogueira authored Aug 27, 2024
1 parent 8beb35c commit 65e6610
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backends/tc/runtime/pna.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ struct p4tc_ext_bpf_params {
u32 tbl_id;
u32 index;
u32 flags;
u8 in_params[128]; /* extern specific params if any */
u8 in_params[64]; /* extern specific params if any */
};

struct p4tc_ext_bpf_val {
u32 ext_id;
u32 index_id;
u32 verdict;
u8 out_params[128]; /* specific values if any */
u8 out_params[64]; /* specific values if any */
};

/* Equivalent to PNA indirect counters */
Expand Down

0 comments on commit 65e6610

Please sign in to comment.