Skip to contentSkip to conversation

nfp: bpf: make array exp_mask static, makes object smaller

PATCH Applied Colin King 2 participants 3 messages Oct 7, 2019 – Oct 8, 2019

Subsystems (6)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 nfp: bpf: make array exp_mask static, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array exp_mask on the stack but instead make it static. Makes the object code smaller by 224 bytes.

Before:
text data bss dec hex filename
77832 2290 0 80122 138fa ethernet/netronome/nfp/bpf/jit.o

After:
text data bss dec hex filename
77544 2354 0 79898 1381a ethernet/netronome/nfp/bpf/jit.o

(gcc version 9.2.1, amd64)

---
 drivers/net/ethernet/netronome/nfp/bpf/jit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/bpf/jit.c +1 -1
index 5afcb3c4c2ef..c80bb83c8ac9 100644
@@ -3952,7 +3952,7 @@ static void nfp_bpf_opt_neg_add_sub(struct nfp_prog *nfp_prog)
 static void nfp_bpf_opt_ld_mask(struct nfp_prog *nfp_prog)
 {
 	struct nfp_insn_meta *meta1, *meta2;
-	const s32 exp_mask[] = {
+	static const s32 exp_mask[] = {
 		[BPF_B] = 0x000000ffU,
 		[BPF_H] = 0x0000ffffU,
 		[BPF_W] = 0xffffffffU,
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array exp_mask on the stack but instead make it static. Makes the object code smaller by 224 bytes.

Before:
text data bss dec hex filename
77832 2290 0 80122 138fa ethernet/netronome/nfp/bpf/jit.o

Quoted 7 lines

After:
text data bss dec hex filename
77544 2354 0 79898 1381a ethernet/netronome/nfp/bpf/jit.o

(gcc version 9.2.1, amd64)

#2 lore raw
In reply to Colin King
Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array exp_mask on the stack but instead make it static. Makes the object code smaller by 224 bytes.

Before:
text data bss dec hex filename
77832 2290 0 80122 138fa ethernet/netronome/nfp/bpf/jit.o

Quoted 7 lines

After:
text data bss dec hex filename
77544 2354 0 79898 1381a ethernet/netronome/nfp/bpf/jit.o

(gcc version 9.2.1, amd64)

Applied to net-next, thanks.