From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BECE19D880; Mon, 7 Jul 2025 15:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751902874; cv=none; b=OW/N+S1W5xxJe+G8y9IUmCS/VFAh+0JZlOub1yvwOu39odsR/F3RkOX7Y5SkqrQSTpnAXhldeZsj5vkw19Qr0TNxFYnamoETLWRX/aX69CQiaQwa1JD0tr+tgoT44O92J1neu3q5rh2Bbtt0e3MzyO4kK4KM6Ya9nQstZ+r6RiU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751902874; c=relaxed/simple; bh=ePOPubuWj17eRi0sYt5gn5zhUwG2cej8IddcFeCTXXM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XiW1zpPZ79fdmWeKdpD7l3GF9ecn58+dtUsi47wup8zQV/fnzDLjfSoZhWB9vI5tQqLuGBYVZ3YaIFDkb6cEeB2/pZTjUXn5PiYX1ZrkwD4kiVArRio1LaSbra2wvou6aiYLxqSTwpNVuOvu8n/kXZzLOmcXcVfdge9ErB3MUNc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Yr0XVWux; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Yr0XVWux" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1751902869; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=q3RrQWA0hl2m0Jg5mJm6780LOhvTRsObdRFSzyTIGtE=; b=Yr0XVWuxfD334RtnfP0rxbc+BWxrdqSYqtRltclNSQJe/WG7/ZAUAZLPOgQonXSIf4O+zi wPVs1mBAUazhpSsbztZiS7Vy3GfvHYgBMk2/BCsd/u0L258ep/8V8if24dVPYCtugI+bqE 7JRo1lDd8eyvUhNFvmxoanDff6hGxyk= From: Tao Chen To: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, mattbobrowski@google.com, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, kuniyu@amazon.com, willemb@google.com, jakub@cloudflare.com, pablo@netfilter.org, kadlec@netfilter.org, hawk@kernel.org Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-trace-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Tao Chen Subject: [PATCH bpf-next 0/6] Move attach_type into bpf_link Date: Mon, 7 Jul 2025 23:39:10 +0800 Message-ID: <20250707153916.802802-1-chen.dylane@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Andrii suggested moving the attach_type into bpf_link, the previous discussion is as follows: https://lore.kernel.org/bpf/CAEf4BzY7TZRjxpCJM-+LYgEqe23YFj5Uv3isb7gat2-HU4OSng@mail.gmail.com patch1 add attach_type in bpf_link, and pass it to bpf_link_init, which will init the attach_type field. patch2-6 remove the attach_type in struct bpf_xx_link, update the info with bpf_link attach_type. There are some functions finally call bpf_link_init but do not have bpf_attr from user or do not need to init attach_type from user like bpf_raw_tracepoint_open, now use prog->expected_attach_type to init attach_type. bpf_struct_ops_map_update_elem bpf_raw_tracepoint_open bpf_struct_ops_test_run Feedback of any kind is welcome, thanks. Tao Chen (6): bpf: Add attach_type in bpf_link bpf: Remove attach_type in bpf_cgroup_link bpf: Remove attach_type in bpf_sockmap_link bpf: Remove location field in tcx_link bpf: Remove attach_type in bpf_netns_link bpf: Remove attach_type in bpf_tracing_link include/linux/bpf-cgroup.h | 1 - include/linux/bpf.h | 18 +++++++++------ include/net/tcx.h | 1 - kernel/bpf/bpf_iter.c | 3 ++- kernel/bpf/bpf_struct_ops.c | 5 +++-- kernel/bpf/cgroup.c | 17 +++++++-------- kernel/bpf/net_namespace.c | 8 +++---- kernel/bpf/syscall.c | 40 ++++++++++++++++++++-------------- kernel/bpf/tcx.c | 16 +++++++------- kernel/bpf/trampoline.c | 10 +++++---- kernel/trace/bpf_trace.c | 4 ++-- net/bpf/bpf_dummy_struct_ops.c | 3 ++- net/core/dev.c | 3 ++- net/core/sock_map.c | 13 +++++------ net/netfilter/nf_bpf_link.c | 3 ++- 15 files changed, 79 insertions(+), 66 deletions(-) -- 2.48.1