From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 EB4C01E3772 for ; Mon, 7 Jul 2025 15:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751902980; cv=none; b=NDPjnA4drhQvUgUSKwJo/1GRDu/iv5yKFo6aJAXyEFe4UIVYQvaDs8QZI53zApNoSKlGY4oQfhLrl4w4Zuaua5b+MfcUC/+8zHSH0JfW9D+0mwvbthrNzepWKFvtfGSNjCeCFABiCNZccIbJaAY4zubep8IaxTcC1WGwrC7kcNg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751902980; c=relaxed/simple; bh=S/4ysQBNXSNRLbsTxzjmiKYVJK4WRI1JFEgfz8Ho5Ko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sVd5LwN1dYA1oOPqCnAvaKKq1PmCp/lVgZl/XsaCIt2wlXsOFVyrGYZ6ELURnicEg7dEeHVmF9t79xXI0qvrh2koaCF1WYK5rS3jq0ZcyC+/toRYS+t5k0bdxIi612zVOe0aN9PT94sCGc/DQoEyI5nSyjE0jpmSfYgD/qHZPUc= 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=prnlWopf; arc=none smtp.client-ip=95.215.58.186 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="prnlWopf" 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=1751902976; 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: in-reply-to:in-reply-to:references:references; bh=hMuwkXar/JP+QSBlJ36t2NR92ukOZdEZlTj2WN/ipWk=; b=prnlWopfbPFs0WcYB8DKcdKMLHc64MMiSWU8vg9rgUdSS8p1FKrEy+y8e6cUNwd/b8KaXP MTv30VV0ryuMXnYl7eQ1uvv24sH6SIYAo64c1X4aseGj1aKxttGjN9mcEExXcIP1G4ckZo m6dy6mAeT9z1Q31WGFOOEalRBXbX6Og= 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 5/6] bpf: Remove attach_type in bpf_netns_link Date: Mon, 7 Jul 2025 23:39:15 +0800 Message-ID: <20250707153916.802802-6-chen.dylane@linux.dev> In-Reply-To: <20250707153916.802802-1-chen.dylane@linux.dev> References: <20250707153916.802802-1-chen.dylane@linux.dev> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Use attach_type in bpf_link, and remove it in bpf_netns_link. Signed-off-by: Tao Chen --- kernel/bpf/net_namespace.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/net_namespace.c b/kernel/bpf/net_namespace.c index 63702c86275..6d27bd97c95 100644 --- a/kernel/bpf/net_namespace.c +++ b/kernel/bpf/net_namespace.c @@ -11,7 +11,6 @@ struct bpf_netns_link { struct bpf_link link; - enum bpf_attach_type type; enum netns_bpf_attach_type netns_type; /* We don't hold a ref to net in order to auto-detach the link @@ -216,7 +215,7 @@ static int bpf_netns_link_fill_info(const struct bpf_link *link, mutex_unlock(&netns_bpf_mutex); info->netns.netns_ino = inum; - info->netns.attach_type = net_link->type; + info->netns.attach_type = link->attach_type; return 0; } @@ -230,7 +229,7 @@ static void bpf_netns_link_show_fdinfo(const struct bpf_link *link, "netns_ino:\t%u\n" "attach_type:\t%u\n", info.netns.netns_ino, - info.netns.attach_type); + link->attach_type); } static const struct bpf_link_ops bpf_netns_link_ops = { @@ -503,7 +502,6 @@ int netns_bpf_link_create(const union bpf_attr *attr, struct bpf_prog *prog) bpf_link_init(&net_link->link, BPF_LINK_TYPE_NETNS, &bpf_netns_link_ops, prog, type); net_link->net = net; - net_link->type = type; net_link->netns_type = netns_type; err = bpf_link_prime(&net_link->link, &link_primer); -- 2.48.1