Skip to content

Commit 4254873

Browse files
Tao Chenanakryiko
authored andcommitted
netkit: Remove location field in netkit_link
Use attach_type in bpf_link to replace the location field, and remove location field in netkit_link. Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 6b3c64b commit 4254873

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/net/netkit.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ struct netkit {
3232
struct netkit_link {
3333
struct bpf_link link;
3434
struct net_device *dev;
35-
u32 location;
3635
};
3736

3837
static __always_inline int
@@ -733,8 +732,8 @@ static void netkit_link_fdinfo(const struct bpf_link *link, struct seq_file *seq
733732

734733
seq_printf(seq, "ifindex:\t%u\n", ifindex);
735734
seq_printf(seq, "attach_type:\t%u (%s)\n",
736-
nkl->location,
737-
nkl->location == BPF_NETKIT_PRIMARY ? "primary" : "peer");
735+
link->attach_type,
736+
link->attach_type == BPF_NETKIT_PRIMARY ? "primary" : "peer");
738737
}
739738

740739
static int netkit_link_fill_info(const struct bpf_link *link,
@@ -749,7 +748,7 @@ static int netkit_link_fill_info(const struct bpf_link *link,
749748
rtnl_unlock();
750749

751750
info->netkit.ifindex = ifindex;
752-
info->netkit.attach_type = nkl->location;
751+
info->netkit.attach_type = link->attach_type;
753752
return 0;
754753
}
755754

@@ -776,7 +775,6 @@ static int netkit_link_init(struct netkit_link *nkl,
776775
{
777776
bpf_link_init(&nkl->link, BPF_LINK_TYPE_NETKIT,
778777
&netkit_link_lops, prog, attr->link_create.attach_type);
779-
nkl->location = attr->link_create.attach_type;
780778
nkl->dev = dev;
781779
return bpf_link_prime(&nkl->link, link_primer);
782780
}

0 commit comments

Comments
 (0)