Lines Matching refs:gs
124 static sa_family_t geneve_get_sk_family(struct geneve_sock *gs) in geneve_get_sk_family() argument
126 return gs->sock->sk->sk_family; in geneve_get_sk_family()
129 static struct geneve_dev *geneve_lookup(struct geneve_sock *gs, in geneve_lookup() argument
138 vni_list_head = &gs->vni_list[hash]; in geneve_lookup()
148 static struct geneve_dev *geneve6_lookup(struct geneve_sock *gs, in geneve6_lookup() argument
157 vni_list_head = &gs->vni_list[hash]; in geneve6_lookup()
172 static struct geneve_dev *geneve_lookup_skb(struct geneve_sock *gs, in geneve_lookup_skb() argument
178 if (geneve_get_sk_family(gs) == AF_INET) { in geneve_lookup_skb()
184 if (gs->collect_md) { in geneve_lookup_skb()
192 return geneve_lookup(gs, addr, vni); in geneve_lookup_skb()
194 } else if (geneve_get_sk_family(gs) == AF_INET6) { in geneve_lookup_skb()
201 if (gs->collect_md) { in geneve_lookup_skb()
209 return geneve6_lookup(gs, addr6, vni); in geneve_lookup_skb()
216 static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, in geneve_rx() argument
225 if (ip_tunnel_collect_metadata() || gs->collect_md) { in geneve_rx()
231 tun_dst = udp_tun_rx_dst(skb, geneve_get_sk_family(gs), flags, in geneve_rx()
269 if (geneve_get_sk_family(gs) == AF_INET) in geneve_rx()
278 if (geneve_get_sk_family(gs) == AF_INET) in geneve_rx()
346 struct geneve_sock *gs; in geneve_udp_encap_recv() local
361 gs = rcu_dereference_sk_user_data(sk); in geneve_udp_encap_recv()
362 if (!gs) in geneve_udp_encap_recv()
365 geneve = geneve_lookup_skb(gs, skb); in geneve_udp_encap_recv()
377 geneve_rx(geneve, gs, skb); in geneve_udp_encap_recv()
390 struct geneve_sock *gs; in geneve_udp_encap_err_lookup() local
404 gs = rcu_dereference_sk_user_data(sk); in geneve_udp_encap_err_lookup()
405 if (!gs) in geneve_udp_encap_err_lookup()
408 if (geneve_get_sk_family(gs) == AF_INET) { in geneve_udp_encap_err_lookup()
412 if (!gs->collect_md) { in geneve_udp_encap_err_lookup()
417 return geneve_lookup(gs, addr4, vni) ? 0 : -ENOENT; in geneve_udp_encap_err_lookup()
421 if (geneve_get_sk_family(gs) == AF_INET6) { in geneve_udp_encap_err_lookup()
427 if (!gs->collect_md) { in geneve_udp_encap_err_lookup()
432 return geneve6_lookup(gs, addr6, vni) ? 0 : -ENOENT; in geneve_udp_encap_err_lookup()
567 struct geneve_sock *gs; in geneve_socket_create() local
572 gs = kzalloc(sizeof(*gs), GFP_KERNEL); in geneve_socket_create()
573 if (!gs) in geneve_socket_create()
578 kfree(gs); in geneve_socket_create()
582 gs->sock = sock; in geneve_socket_create()
583 gs->refcnt = 1; in geneve_socket_create()
585 INIT_HLIST_HEAD(&gs->vni_list[h]); in geneve_socket_create()
588 udp_tunnel_notify_add_rx_port(gs->sock, UDP_TUNNEL_TYPE_GENEVE); in geneve_socket_create()
592 tunnel_cfg.sk_user_data = gs; in geneve_socket_create()
600 list_add(&gs->list, &gn->sock_list); in geneve_socket_create()
601 return gs; in geneve_socket_create()
604 static void __geneve_sock_release(struct geneve_sock *gs) in __geneve_sock_release() argument
606 if (!gs || --gs->refcnt) in __geneve_sock_release()
609 list_del(&gs->list); in __geneve_sock_release()
610 udp_tunnel_notify_del_rx_port(gs->sock, UDP_TUNNEL_TYPE_GENEVE); in __geneve_sock_release()
611 udp_tunnel_sock_release(gs->sock); in __geneve_sock_release()
612 kfree_rcu(gs, rcu); in __geneve_sock_release()
637 struct geneve_sock *gs; in geneve_find_sock() local
639 list_for_each_entry(gs, &gn->sock_list, list) { in geneve_find_sock()
640 if (inet_sk(gs->sock->sk)->inet_sport == dst_port && in geneve_find_sock()
641 geneve_get_sk_family(gs) == family) { in geneve_find_sock()
642 return gs; in geneve_find_sock()
653 struct geneve_sock *gs; in geneve_sock_add() local
657 gs = geneve_find_sock(gn, ipv6 ? AF_INET6 : AF_INET, geneve->cfg.info.key.tp_dst); in geneve_sock_add()
658 if (gs) { in geneve_sock_add()
659 gs->refcnt++; in geneve_sock_add()
663 gs = geneve_socket_create(net, geneve->cfg.info.key.tp_dst, ipv6, in geneve_sock_add()
665 if (IS_ERR(gs)) in geneve_sock_add()
666 return PTR_ERR(gs); in geneve_sock_add()
669 gs->collect_md = geneve->cfg.collect_md; in geneve_sock_add()
672 rcu_assign_pointer(geneve->sock6, gs); in geneve_sock_add()
677 rcu_assign_pointer(geneve->sock4, gs); in geneve_sock_add()
684 hlist_add_head_rcu(&node->hlist, &gs->vni_list[hash]); in geneve_sock_add()
1196 struct geneve_sock *gs; in geneve_offload_rx_ports() local
1199 list_for_each_entry_rcu(gs, &gn->sock_list, list) { in geneve_offload_rx_ports()
1201 udp_tunnel_push_rx_port(dev, gs->sock, in geneve_offload_rx_ports()
1204 udp_tunnel_drop_rx_port(dev, gs->sock, in geneve_offload_rx_ports()