Lines Matching refs:link
35 struct bpf_prog *old, struct bpf_link *link,
132 struct sk_psock_link *link, in sock_map_add_link() argument
135 link->link_raw = link_raw; in sock_map_add_link()
136 link->map = map; in sock_map_add_link()
138 list_add_tail(&link->list, &psock->link); in sock_map_add_link()
146 struct sk_psock_link *link, *tmp; in sock_map_del_link() local
149 list_for_each_entry_safe(link, tmp, &psock->link, list) { in sock_map_del_link()
150 if (link->link_raw == link_raw) { in sock_map_del_link()
151 struct bpf_map *map = link->map; in sock_map_del_link()
160 list_del(&link->list); in sock_map_del_link()
161 sk_psock_free_link(link); in sock_map_del_link()
474 struct sk_psock_link *link; in sock_map_update_common() local
485 link = sk_psock_init_link(); in sock_map_update_common()
486 if (!link) in sock_map_update_common()
506 sock_map_add_link(psock, link, map, &stab->sks[idx]); in sock_map_update_common()
517 sk_psock_free_link(link); in sock_map_update_common()
998 struct sk_psock_link *link; in sock_hash_update_common() local
1006 link = sk_psock_init_link(); in sock_hash_update_common()
1007 if (!link) in sock_hash_update_common()
1036 sock_map_add_link(psock, link, map, elem_new); in sock_hash_update_common()
1052 sk_psock_free_link(link); in sock_hash_update_common()
1525 struct bpf_prog *old, struct bpf_link *link, in sock_map_prog_update() argument
1539 if ((!link || prog) && *plink) in sock_map_prog_update()
1548 if (link) in sock_map_prog_update()
1549 *plink = link; in sock_map_prog_update()
1604 static void sock_map_unlink(struct sock *sk, struct sk_psock_link *link) in sock_map_unlink() argument
1606 switch (link->map->map_type) { in sock_map_unlink()
1608 return sock_map_delete_from_link(link->map, sk, in sock_map_unlink()
1609 link->link_raw); in sock_map_unlink()
1611 return sock_hash_delete_from_link(link->map, sk, in sock_map_unlink()
1612 link->link_raw); in sock_map_unlink()
1620 struct sk_psock_link *link; in sock_map_remove_links() local
1622 while ((link = sk_psock_link_pop(psock))) { in sock_map_remove_links()
1623 sock_map_unlink(sk, link); in sock_map_remove_links()
1624 sk_psock_free_link(link); in sock_map_remove_links()
1710 struct bpf_link link; member
1714 static void sock_map_link_release(struct bpf_link *link) in sock_map_link_release() argument
1716 struct sockmap_link *sockmap_link = container_of(link, struct sockmap_link, link); in sock_map_link_release()
1722 WARN_ON_ONCE(sock_map_prog_update(sockmap_link->map, NULL, link->prog, link, in sock_map_link_release()
1723 link->attach_type)); in sock_map_link_release()
1731 static int sock_map_link_detach(struct bpf_link *link) in sock_map_link_detach() argument
1733 sock_map_link_release(link); in sock_map_link_detach()
1737 static void sock_map_link_dealloc(struct bpf_link *link) in sock_map_link_dealloc() argument
1739 kfree(link); in sock_map_link_dealloc()
1746 static int sock_map_link_update_prog(struct bpf_link *link, in sock_map_link_update_prog() argument
1750 const struct sockmap_link *sockmap_link = container_of(link, struct sockmap_link, link); in sock_map_link_update_prog()
1758 if (old && link->prog != old) { in sock_map_link_update_prog()
1763 if (link->prog->type != prog->type || in sock_map_link_update_prog()
1764 link->prog->expected_attach_type != prog->expected_attach_type) { in sock_map_link_update_prog()
1774 link->attach_type); in sock_map_link_update_prog()
1779 if (link != *plink) { in sock_map_link_update_prog()
1793 old_link_prog = xchg(&link->prog, prog); in sock_map_link_update_prog()
1812 static int sock_map_link_fill_info(const struct bpf_link *link, in sock_map_link_fill_info() argument
1815 const struct sockmap_link *sockmap_link = container_of(link, struct sockmap_link, link); in sock_map_link_fill_info()
1819 info->sockmap.attach_type = link->attach_type; in sock_map_link_fill_info()
1823 static void sock_map_link_show_fdinfo(const struct bpf_link *link, in sock_map_link_show_fdinfo() argument
1826 const struct sockmap_link *sockmap_link = container_of(link, struct sockmap_link, link); in sock_map_link_show_fdinfo()
1830 seq_printf(seq, "attach_type:\t%u\n", link->attach_type); in sock_map_link_show_fdinfo()
1868 bpf_link_init(&sockmap_link->link, BPF_LINK_TYPE_SOCKMAP, &sock_map_link_ops, prog, in sock_map_link_create()
1872 ret = bpf_link_prime(&sockmap_link->link, &link_primer); in sock_map_link_create()
1879 ret = sock_map_prog_update(map, prog, NULL, &sockmap_link->link, attach_type); in sock_map_link_create()