From nobody Tue Oct 7 20:00:44 2025 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 6FB1F1E230E for ; Mon, 7 Jul 2025 15:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751902937; cv=none; b=EXcq91p0o9XgbeNJRwhcmTSGR78XbimNgGwSLy7gWyuMNGP/aCifFni7h6zyDVeRaxQqTPyh4y5B19uD22xz1ADcjWPmWjYcFwxSd89IfnmVlG31qZDV4dZrE25VXvMsNPCH32TX2PHv0f0EFIJbxTXMV+xUJHiBCWPaHlDvdF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751902937; c=relaxed/simple; bh=ugVudOCH1QUE1lgwU5uFhMmaWqGYLvdAJPoGrIVsNCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cYOoVZBLUh3/7O8aDuFOEjmTiQFw9v9EMRbOLUZqt7KqU50UVsnwp9BHKy+bsjXh/lvyhYL/UcR5Cl2hoMQp48hMlbKo0S5To4+Bl7NKe3IEZvPs39WI8DgEfAaEYmClHDmgEpP5G+7D23Xt/yVvqGKI3IriygTpn1lLloMrEq4= 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=ZbREFHhr; arc=none smtp.client-ip=91.218.175.181 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="ZbREFHhr" 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=1751902932; 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=tMHqMHAxGD1r4fmMDbndGO/4sTwGSp8V807ueJrjmno=; b=ZbREFHhrpkqPz5ufEJ3r8iCI4F5m3Y3LBHfZVE6dnnKBVBdaW9qtEZbR8Kh5mMztKbWyA/ Nhn7gqSlZ38NrFbGXZiAUEUMCEoZIVGwelWLFHrKi1F5yFYasIkU0Dg7achKngBC8zOzVE hil14RyrtW3P5AjsREoEBnXA20zRytQ= 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 3/6] bpf: Remove attach_type in bpf_sockmap_link Date: Mon, 7 Jul 2025 23:39:13 +0800 Message-ID: <20250707153916.802802-4-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use attach_type in bpf_link, and remove it in bpf_sockmap_link. Signed-off-by: Tao Chen --- net/core/sock_map.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/core/sock_map.c b/net/core/sock_map.c index fbe9a33ddf1..5947b38e4f8 100644 --- a/net/core/sock_map.c +++ b/net/core/sock_map.c @@ -1709,7 +1709,6 @@ EXPORT_SYMBOL_GPL(sock_map_close); struct sockmap_link { struct bpf_link link; struct bpf_map *map; - enum bpf_attach_type attach_type; }; =20 static void sock_map_link_release(struct bpf_link *link) @@ -1721,7 +1720,7 @@ static void sock_map_link_release(struct bpf_link *li= nk) goto out; =20 WARN_ON_ONCE(sock_map_prog_update(sockmap_link->map, NULL, link->prog, li= nk, - sockmap_link->attach_type)); + link->attach_type)); =20 bpf_map_put_with_uref(sockmap_link->map); sockmap_link->map =3D NULL; @@ -1772,7 +1771,7 @@ static int sock_map_link_update_prog(struct bpf_link = *link, } =20 ret =3D sock_map_prog_link_lookup(sockmap_link->map, &pprog, &plink, - sockmap_link->attach_type); + link->attach_type); if (ret) goto out; =20 @@ -1817,7 +1816,7 @@ static int sock_map_link_fill_info(const struct bpf_l= ink *link, u32 map_id =3D sock_map_link_get_map_id(sockmap_link); =20 info->sockmap.map_id =3D map_id; - info->sockmap.attach_type =3D sockmap_link->attach_type; + info->sockmap.attach_type =3D link->attach_type; return 0; } =20 @@ -1828,7 +1827,7 @@ static void sock_map_link_show_fdinfo(const struct bp= f_link *link, u32 map_id =3D sock_map_link_get_map_id(sockmap_link); =20 seq_printf(seq, "map_id:\t%u\n", map_id); - seq_printf(seq, "attach_type:\t%u\n", sockmap_link->attach_type); + seq_printf(seq, "attach_type:\t%u\n", link->attach_type); } =20 static const struct bpf_link_ops sock_map_link_ops =3D { @@ -1869,7 +1868,6 @@ int sock_map_link_create(const union bpf_attr *attr, = struct bpf_prog *prog) bpf_link_init(&sockmap_link->link, BPF_LINK_TYPE_SOCKMAP, &sock_map_link_= ops, prog, attach_type); sockmap_link->map =3D map; - sockmap_link->attach_type =3D attach_type; =20 ret =3D bpf_link_prime(&sockmap_link->link, &link_primer); if (ret) { --=20 2.48.1