Lines Matching refs:vs
68 static inline bool vxlan_collect_metadata(struct vxlan_sock *vs) in vxlan_collect_metadata() argument
70 return vs->flags & VXLAN_F_COLLECT_METADATA || in vxlan_collect_metadata()
128 struct vxlan_sock *vs; in vxlan_find_sock() local
132 hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { in vxlan_find_sock()
133 if (inet_sk(vs->sock->sk)->inet_sport == port && in vxlan_find_sock()
134 vxlan_get_sk_family(vs) == family && in vxlan_find_sock()
135 vs->flags == flags && in vxlan_find_sock()
136 vs->sock->sk->sk_bound_dev_if == ifindex) in vxlan_find_sock()
137 return vs; in vxlan_find_sock()
142 static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs, in vxlan_vs_find_vni() argument
150 if (vs->flags & VXLAN_F_COLLECT_METADATA && in vxlan_vs_find_vni()
151 !(vs->flags & VXLAN_F_VNIFILTER)) in vxlan_vs_find_vni()
154 hlist_for_each_entry_rcu(node, vni_head(vs, vni), hlist) { in vxlan_vs_find_vni()
187 struct vxlan_sock *vs; in vxlan_find_vni() local
189 vs = vxlan_find_sock(net, family, port, flags, ifindex); in vxlan_find_vni()
190 if (!vs) in vxlan_find_vni()
193 return vxlan_vs_find_vni(vs, ifindex, vni, NULL); in vxlan_find_vni()
708 struct vxlan_sock *vs = rcu_dereference_sk_user_data(sk); in vxlan_gro_receive() local
724 if ((flags & VXLAN_HF_RCO) && (vs->flags & VXLAN_F_REMCSUM_RX)) { in vxlan_gro_receive()
727 !!(vs->flags & in vxlan_gro_receive()
1472 static bool __vxlan_sock_release_prep(struct vxlan_sock *vs) in __vxlan_sock_release_prep() argument
1476 if (!vs) in __vxlan_sock_release_prep()
1478 if (!refcount_dec_and_test(&vs->refcnt)) in __vxlan_sock_release_prep()
1481 vn = net_generic(sock_net(vs->sock->sk), vxlan_net_id); in __vxlan_sock_release_prep()
1483 hlist_del_rcu(&vs->hlist); in __vxlan_sock_release_prep()
1484 udp_tunnel_notify_del_rx_port(vs->sock, in __vxlan_sock_release_prep()
1485 (vs->flags & VXLAN_F_GPE) ? in __vxlan_sock_release_prep()
1605 struct vxlan_sock *vs, in vxlan_set_mac() argument
1620 if (vxlan_get_sk_family(vs) == AF_INET) { in vxlan_set_mac()
1637 static bool vxlan_ecn_decapsulate(struct vxlan_sock *vs, void *oiph, in vxlan_ecn_decapsulate() argument
1642 if (vxlan_get_sk_family(vs) == AF_INET) in vxlan_ecn_decapsulate()
1650 if (vxlan_get_sk_family(vs) == AF_INET) in vxlan_ecn_decapsulate()
1666 struct vxlan_sock *vs; in vxlan_rcv() local
1691 vs = rcu_dereference_sk_user_data(sk); in vxlan_rcv()
1692 if (!vs) in vxlan_rcv()
1697 vxlan = vxlan_vs_find_vni(vs, skb->dev->ifindex, vni, &vninode); in vxlan_rcv()
1704 if (vs->flags & VXLAN_F_GPE) { in vxlan_rcv()
1705 if (!vxlan_parse_gpe_hdr(&unparsed, &protocol, skb, vs->flags)) in vxlan_rcv()
1714 if (vs->flags & VXLAN_F_REMCSUM_RX) in vxlan_rcv()
1715 if (unlikely(!vxlan_remcsum(&unparsed, skb, vs->flags))) in vxlan_rcv()
1718 if (vxlan_collect_metadata(vs)) { in vxlan_rcv()
1721 tun_dst = udp_tun_rx_dst(skb, vxlan_get_sk_family(vs), TUNNEL_KEY, in vxlan_rcv()
1734 if (vs->flags & VXLAN_F_GBP) in vxlan_rcv()
1735 vxlan_parse_gbp_hdr(&unparsed, skb, vs->flags, md); in vxlan_rcv()
1753 if (!vxlan_set_mac(vxlan, vs, skb, vni)) in vxlan_rcv()
1764 if (!vxlan_ecn_decapsulate(vs, oiph, skb)) { in vxlan_rcv()
1800 struct vxlan_sock *vs; in vxlan_err_lookup() local
1812 vs = rcu_dereference_sk_user_data(sk); in vxlan_err_lookup()
1813 if (!vs) in vxlan_err_lookup()
1817 vxlan = vxlan_vs_find_vni(vs, skb->dev->ifindex, vni, NULL); in vxlan_err_lookup()
2898 static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan, in vxlan_vs_add_dev() argument
2906 hlist_add_head_rcu(&node->hlist, vni_head(vs, vni)); in vxlan_vs_add_dev()
3136 struct vxlan_sock *vs; in vxlan_offload_rx_ports() local
3143 hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) { in vxlan_offload_rx_ports()
3146 if (vs->flags & VXLAN_F_GPE) in vxlan_offload_rx_ports()
3152 udp_tunnel_push_rx_port(dev, vs->sock, type); in vxlan_offload_rx_ports()
3154 udp_tunnel_drop_rx_port(dev, vs->sock, type); in vxlan_offload_rx_ports()
3385 struct vxlan_sock *vs; in vxlan_socket_create() local
3390 vs = kzalloc(sizeof(*vs), GFP_KERNEL); in vxlan_socket_create()
3391 if (!vs) in vxlan_socket_create()
3395 INIT_HLIST_HEAD(&vs->vni_list[h]); in vxlan_socket_create()
3399 kfree(vs); in vxlan_socket_create()
3403 vs->sock = sock; in vxlan_socket_create()
3404 refcount_set(&vs->refcnt, 1); in vxlan_socket_create()
3405 vs->flags = (flags & VXLAN_F_RCV_FLAGS); in vxlan_socket_create()
3408 hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); in vxlan_socket_create()
3410 (vs->flags & VXLAN_F_GPE) ? in vxlan_socket_create()
3417 tunnel_cfg.sk_user_data = vs; in vxlan_socket_create()
3427 return vs; in vxlan_socket_create()
3434 struct vxlan_sock *vs = NULL; in __vxlan_sock_add() local
3444 vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET, in __vxlan_sock_add()
3447 if (vs && !refcount_inc_not_zero(&vs->refcnt)) { in __vxlan_sock_add()
3453 if (!vs) in __vxlan_sock_add()
3454 vs = vxlan_socket_create(vxlan->net, ipv6, in __vxlan_sock_add()
3457 if (IS_ERR(vs)) in __vxlan_sock_add()
3458 return PTR_ERR(vs); in __vxlan_sock_add()
3461 rcu_assign_pointer(vxlan->vn6_sock, vs); in __vxlan_sock_add()
3466 rcu_assign_pointer(vxlan->vn4_sock, vs); in __vxlan_sock_add()
3471 vxlan_vs_add_vnigrp(vxlan, vs, ipv6); in __vxlan_sock_add()
3473 vxlan_vs_add_dev(vs, vxlan, node); in __vxlan_sock_add()