bpf: remove unused static inlines
Subsystems (6)
Jakub Kicinski
maintainerPATCH 1/1 bpf: remove unused static inlines
Remove two dead stubs, sk_msg_clear_meta() was never used, use of xskq_cons_is_full() got replaced by xsk_tx_writeable() in v5.10.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- include/linux/bpf.h | 10 ---------- include/linux/skmsg.h | 5 ----- net/xdp/xsk_queue.h | 7 ------- 3 files changed, 22 deletions(-)
include/linux/bpf.h +0 -10
@@ -1875,11 +1875,6 @@ static inline int bpf_obj_get_user(const char __user *pathname, int flags)return -EOPNOTSUPP ; } -static inline bool dev_map_can_have_prog (struct bpf_map *map) -{ -return false; -} -static inline void __dev_flush (void ) { }
@@ -1943,11 +1938,6 @@ static inline int cpu_map_generic_redirect(struct bpf_cpu_map_entry *rcpu,return -EOPNOTSUPP ; } -static inline bool cpu_map_prog_allowed (struct bpf_map *map) -{ -return false; -} -static inline struct bpf_prog *bpf_prog_get_type_path (const char *name,enum bpf_prog_type type) {
include/linux/skmsg.h +0 -5
@@ -171,11 +171,6 @@ static inline u32 sk_msg_iter_dist(u32 start, u32 end)#define sk_msg_iter_next (msg, which) \ sk_msg_iter_var_next(msg->sg.which) -static inline void sk_msg_clear_meta (struct sk_msg *msg) -{ - memset(&msg->sg, 0, offsetofend(struct sk_msg_sg, copy)); -} -static inline void sk_msg_init (struct sk_msg *msg) {BUILD_BUG_ON (ARRAY_SIZE (msg->sg.data) -1 !=NR_MSG_FRAG_IDS );
net/xdp/xsk_queue.h +0 -7
@@ -304,13 +304,6 @@ static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) q->cached_cons += cnt; } -static inline bool xskq_cons_is_full (struct xsk_queue *q) -{ -/* No barriers needed since data is not accessed */ -return READ_ONCE (q->ring->producer) -READ_ONCE (q->ring->consumer) == - q->nentries; -} -static inline u32 xskq_cons_present_entries (struct xsk_queue *q) {/* No barriers needed since data is not accessed */
Signature · 1 line
2.34.1
Quoted 6 lines · Jakub Kicinski
Remove two dead stubs,
sk_msg_clear_meta()was never used, use ofxskq_cons_is_full()got replaced byxsk_tx_writeable()in v5.10.Signed-off-by Jakub Kicinski <[email protected]>---
Alexei Starovoitov
AppliedQuoted 10 lines · John Fastabend
Quoted 6 lines · Jakub Kicinski
Remove two dead stubs,
sk_msg_clear_meta()was never used, use ofxskq_cons_is_full()got replaced byxsk_tx_writeable()in v5.10.Signed-off-by Jakub Kicinski <[email protected]>---
Acked-by John Fastabend <[email protected]>
Applied.
How did you find them?
Jakub Kicinski
maintainerQuoted 7 lines · On Wed, 26 Jan 2022 21:22:03 -0800 Alexei Starovoitov wrote:
Quoted 6 lines · John Fastabend
Quoted 4 lines · Jakub Kicinski
Remove two dead stubs,
sk_msg_clear_meta()was never used, use ofxskq_cons_is_full()got replaced byxsk_tx_writeable()in v5.10.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Jakub Kicinski <[email protected]>---
Acked-by John Fastabend <[email protected]>Applied.
How did you find them?
regex and some bash:
for f in $(sed -n '/static inline [^(]*$/N;s@static inline.*[^_a-z0-9A-Z]\([_a-z0-9A-Z]*\)([a-z_].*@\1@p' $(find include/ -type f) ); do cnt=$(git grep $f | wc -l); [ $cnt -le 1 ] && echo $f >> single; done
takes too long to run to put it in a CI directly, unfortunately, more intelligence would be needed. Luckily there isn't that many instances throughout netdev and bpf so perhaps not even worth the hassle.