]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netkit: Remove location field in netkit_link
authorTao Chen <chen.dylane@linux.dev>
Thu, 10 Jul 2025 03:20:38 +0000 (11:20 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 11 Jul 2025 18:01:09 +0000 (11:01 -0700)
Use attach_type in bpf_link to replace the location field, and
remove location field in netkit_link.

Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20250710032038.888700-8-chen.dylane@linux.dev
drivers/net/netkit.c

index 5928c99eac73d9f506e32660bed4e8b2e2bfb1eb..492be60f2e70f758b1da678f0a97817a83dd0a41 100644 (file)
@@ -32,7 +32,6 @@ struct netkit {
 struct netkit_link {
        struct bpf_link link;
        struct net_device *dev;
-       u32 location;
 };
 
 static __always_inline int
@@ -733,8 +732,8 @@ static void netkit_link_fdinfo(const struct bpf_link *link, struct seq_file *seq
 
        seq_printf(seq, "ifindex:\t%u\n", ifindex);
        seq_printf(seq, "attach_type:\t%u (%s)\n",
-                  nkl->location,
-                  nkl->location == BPF_NETKIT_PRIMARY ? "primary" : "peer");
+                  link->attach_type,
+                  link->attach_type == BPF_NETKIT_PRIMARY ? "primary" : "peer");
 }
 
 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,
        rtnl_unlock();
 
        info->netkit.ifindex = ifindex;
-       info->netkit.attach_type = nkl->location;
+       info->netkit.attach_type = link->attach_type;
        return 0;
 }
 
@@ -776,7 +775,6 @@ static int netkit_link_init(struct netkit_link *nkl,
 {
        bpf_link_init(&nkl->link, BPF_LINK_TYPE_NETKIT,
                      &netkit_link_lops, prog, attr->link_create.attach_type);
-       nkl->location = attr->link_create.attach_type;
        nkl->dev = dev;
        return bpf_link_prime(&nkl->link, link_primer);
 }