Skip to content

Commit 33f69f7

Browse files
Tao Chenanakryiko
authored andcommitted
bpf: Remove attach_type in sockmap_link
Use attach_type in bpf_link, and remove it in sockmap_link. Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 9b8d543 commit 33f69f7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

net/core/sock_map.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,6 @@ EXPORT_SYMBOL_GPL(sock_map_close);
17091709
struct sockmap_link {
17101710
struct bpf_link link;
17111711
struct bpf_map *map;
1712-
enum bpf_attach_type attach_type;
17131712
};
17141713

17151714
static void sock_map_link_release(struct bpf_link *link)
@@ -1721,7 +1720,7 @@ static void sock_map_link_release(struct bpf_link *link)
17211720
goto out;
17221721

17231722
WARN_ON_ONCE(sock_map_prog_update(sockmap_link->map, NULL, link->prog, link,
1724-
sockmap_link->attach_type));
1723+
link->attach_type));
17251724

17261725
bpf_map_put_with_uref(sockmap_link->map);
17271726
sockmap_link->map = NULL;
@@ -1772,7 +1771,7 @@ static int sock_map_link_update_prog(struct bpf_link *link,
17721771
}
17731772

17741773
ret = sock_map_prog_link_lookup(sockmap_link->map, &pprog, &plink,
1775-
sockmap_link->attach_type);
1774+
link->attach_type);
17761775
if (ret)
17771776
goto out;
17781777

@@ -1817,7 +1816,7 @@ static int sock_map_link_fill_info(const struct bpf_link *link,
18171816
u32 map_id = sock_map_link_get_map_id(sockmap_link);
18181817

18191818
info->sockmap.map_id = map_id;
1820-
info->sockmap.attach_type = sockmap_link->attach_type;
1819+
info->sockmap.attach_type = link->attach_type;
18211820
return 0;
18221821
}
18231822

@@ -1828,7 +1827,7 @@ static void sock_map_link_show_fdinfo(const struct bpf_link *link,
18281827
u32 map_id = sock_map_link_get_map_id(sockmap_link);
18291828

18301829
seq_printf(seq, "map_id:\t%u\n", map_id);
1831-
seq_printf(seq, "attach_type:\t%u\n", sockmap_link->attach_type);
1830+
seq_printf(seq, "attach_type:\t%u\n", link->attach_type);
18321831
}
18331832

18341833
static const struct bpf_link_ops sock_map_link_ops = {
@@ -1869,7 +1868,6 @@ int sock_map_link_create(const union bpf_attr *attr, struct bpf_prog *prog)
18691868
bpf_link_init(&sockmap_link->link, BPF_LINK_TYPE_SOCKMAP, &sock_map_link_ops, prog,
18701869
attach_type);
18711870
sockmap_link->map = map;
1872-
sockmap_link->attach_type = attach_type;
18731871

18741872
ret = bpf_link_prime(&sockmap_link->link, &link_primer);
18751873
if (ret) {

0 commit comments

Comments
 (0)