Skip to content

Commit

Permalink
bpf, tcx: Get rid of tcx_link_const
Browse files Browse the repository at this point in the history
Small clean up to get rid of the extra tcx_link_const() and only retain
the tcx_link().

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20231023185015.21152-1-daniel@iogearbox.net
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
  • Loading branch information
borkmann authored and Martin KaFai Lau committed Oct 23, 2023
1 parent 69a1917 commit b63dadd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions include/net/tcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,11 @@ static inline struct tcx_entry *tcx_entry(struct bpf_mprog_entry *entry)
return container_of(bundle, struct tcx_entry, bundle);
}

static inline struct tcx_link *tcx_link(struct bpf_link *link)
static inline struct tcx_link *tcx_link(const struct bpf_link *link)
{
return container_of(link, struct tcx_link, link);
}

static inline const struct tcx_link *tcx_link_const(const struct bpf_link *link)
{
return tcx_link((struct bpf_link *)link);
}

void tcx_inc(void);
void tcx_dec(void);

Expand Down
4 changes: 2 additions & 2 deletions kernel/bpf/tcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static void tcx_link_dealloc(struct bpf_link *link)

static void tcx_link_fdinfo(const struct bpf_link *link, struct seq_file *seq)
{
const struct tcx_link *tcx = tcx_link_const(link);
const struct tcx_link *tcx = tcx_link(link);
u32 ifindex = 0;

rtnl_lock();
Expand All @@ -267,7 +267,7 @@ static void tcx_link_fdinfo(const struct bpf_link *link, struct seq_file *seq)
static int tcx_link_fill_info(const struct bpf_link *link,
struct bpf_link_info *info)
{
const struct tcx_link *tcx = tcx_link_const(link);
const struct tcx_link *tcx = tcx_link(link);
u32 ifindex = 0;

rtnl_lock();
Expand Down

0 comments on commit b63dadd

Please sign in to comment.