Thread (11 messages) flat view 11 messages, 2 authors, 2025-07-09
STALE403d

Revision v2 of 2 in this series.

Revisions (2)
  1. v2 current
  2. v3 [diff vs current]

[PATCH bpf-next v2 7/7] netkit: Remove location field in netkit_link

From: Tao Chen <hidden>
Date: 2025-07-08 08:25:13
Also in: bpf, linux-trace-kernel, lkml, netfilter-devel
Subsystem: bpf [netkit] (bpf-programmable network device), networking drivers, the rest · Maintainers: Daniel Borkmann, Nikolay Aleksandrov, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Use attach_type in bpf_link to replace the location field, and
remove location field in netkit_link.

Signed-off-by: Tao Chen <redacted>
---
 drivers/net/netkit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c
index 5928c99eac7..492be60f2e7 100644
--- a/drivers/net/netkit.c
+++ b/drivers/net/netkit.c
@@ -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);
 }
-- 
2.48.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help