Lines Matching full:gs

126 static sa_family_t geneve_get_sk_family(struct geneve_sock *gs)  in geneve_get_sk_family()  argument
128 return gs->sock->sk->sk_family; in geneve_get_sk_family()
131 static struct geneve_dev *geneve_lookup(struct geneve_sock *gs, in geneve_lookup() argument
140 vni_list_head = &gs->vni_list[hash]; in geneve_lookup()
150 static struct geneve_dev *geneve6_lookup(struct geneve_sock *gs, in geneve6_lookup() argument
159 vni_list_head = &gs->vni_list[hash]; in geneve6_lookup()
174 static struct geneve_dev *geneve_lookup_skb(struct geneve_sock *gs, in geneve_lookup_skb() argument
180 if (geneve_get_sk_family(gs) == AF_INET) { in geneve_lookup_skb()
186 if (gs->collect_md) { in geneve_lookup_skb()
194 return geneve_lookup(gs, addr, vni); in geneve_lookup_skb()
196 } else if (geneve_get_sk_family(gs) == AF_INET6) { in geneve_lookup_skb()
203 if (gs->collect_md) { in geneve_lookup_skb()
211 return geneve6_lookup(gs, addr6, vni); in geneve_lookup_skb()
218 static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, in geneve_rx() argument
227 if (ip_tunnel_collect_metadata() || gs->collect_md) { in geneve_rx()
234 tun_dst = udp_tun_rx_dst(skb, geneve_get_sk_family(gs), flags, in geneve_rx()
295 if (geneve_get_sk_family(gs) == AF_INET) in geneve_rx()
304 if (geneve_get_sk_family(gs) == AF_INET) in geneve_rx()
365 struct geneve_sock *gs; in geneve_udp_encap_recv() local
378 gs = rcu_dereference_sk_user_data(sk); in geneve_udp_encap_recv()
379 if (!gs) in geneve_udp_encap_recv()
382 geneve = geneve_lookup_skb(gs, skb); in geneve_udp_encap_recv()
401 geneve_rx(geneve, gs, skb); in geneve_udp_encap_recv()
414 struct geneve_sock *gs; in geneve_udp_encap_err_lookup() local
428 gs = rcu_dereference_sk_user_data(sk); in geneve_udp_encap_err_lookup()
429 if (!gs) in geneve_udp_encap_err_lookup()
432 if (geneve_get_sk_family(gs) == AF_INET) { in geneve_udp_encap_err_lookup()
436 if (!gs->collect_md) { in geneve_udp_encap_err_lookup()
441 return geneve_lookup(gs, addr4, vni) ? 0 : -ENOENT; in geneve_udp_encap_err_lookup()
445 if (geneve_get_sk_family(gs) == AF_INET6) { in geneve_udp_encap_err_lookup()
451 if (!gs->collect_md) { in geneve_udp_encap_err_lookup()
456 return geneve6_lookup(gs, addr6, vni) ? 0 : -ENOENT; in geneve_udp_encap_err_lookup()
588 struct geneve_sock *gs; in geneve_socket_create() local
593 gs = kzalloc(sizeof(*gs), GFP_KERNEL); in geneve_socket_create()
594 if (!gs) in geneve_socket_create()
599 kfree(gs); in geneve_socket_create()
603 gs->sock = sock; in geneve_socket_create()
604 gs->refcnt = 1; in geneve_socket_create()
606 INIT_HLIST_HEAD(&gs->vni_list[h]); in geneve_socket_create()
609 udp_tunnel_notify_add_rx_port(gs->sock, UDP_TUNNEL_TYPE_GENEVE); in geneve_socket_create()
613 tunnel_cfg.sk_user_data = gs; in geneve_socket_create()
621 list_add(&gs->list, &gn->sock_list); in geneve_socket_create()
622 return gs; in geneve_socket_create()
625 static void __geneve_sock_release(struct geneve_sock *gs) in __geneve_sock_release() argument
627 if (!gs || --gs->refcnt) in __geneve_sock_release()
630 list_del(&gs->list); in __geneve_sock_release()
631 udp_tunnel_notify_del_rx_port(gs->sock, UDP_TUNNEL_TYPE_GENEVE); in __geneve_sock_release()
632 udp_tunnel_sock_release(gs->sock); in __geneve_sock_release()
633 kfree_rcu(gs, rcu); in __geneve_sock_release()
658 struct geneve_sock *gs; in geneve_find_sock() local
660 list_for_each_entry(gs, &gn->sock_list, list) { in geneve_find_sock()
661 if (inet_sk(gs->sock->sk)->inet_sport == dst_port && in geneve_find_sock()
662 geneve_get_sk_family(gs) == family) { in geneve_find_sock()
663 return gs; in geneve_find_sock()
674 struct geneve_sock *gs; in geneve_sock_add() local
678 gs = geneve_find_sock(gn, ipv6 ? AF_INET6 : AF_INET, geneve->cfg.info.key.tp_dst); in geneve_sock_add()
679 if (gs) { in geneve_sock_add()
680 gs->refcnt++; in geneve_sock_add()
684 gs = geneve_socket_create(net, geneve->cfg.info.key.tp_dst, ipv6, in geneve_sock_add()
686 if (IS_ERR(gs)) in geneve_sock_add()
687 return PTR_ERR(gs); in geneve_sock_add()
690 gs->collect_md = geneve->cfg.collect_md; in geneve_sock_add()
693 rcu_assign_pointer(geneve->sock6, gs); in geneve_sock_add()
698 rcu_assign_pointer(geneve->sock4, gs); in geneve_sock_add()
705 hlist_add_head_rcu(&node->hlist, &gs->vni_list[hash]); in geneve_sock_add()
1171 struct geneve_sock *gs; in geneve_offload_rx_ports() local
1174 list_for_each_entry_rcu(gs, &gn->sock_list, list) { in geneve_offload_rx_ports()
1176 udp_tunnel_push_rx_port(dev, gs->sock, in geneve_offload_rx_ports()
1179 udp_tunnel_drop_rx_port(dev, gs->sock, in geneve_offload_rx_ports()