Lines Matching refs:geneve
50 struct geneve_dev *geneve; member
142 if (eq_tun_id_and_vni((u8 *)&node->geneve->cfg.info.key.tun_id, vni) && in geneve_lookup()
143 addr == node->geneve->cfg.info.key.u.ipv4.dst) in geneve_lookup()
144 return node->geneve; in geneve_lookup()
161 if (eq_tun_id_and_vni((u8 *)&node->geneve->cfg.info.key.tun_id, vni) && in geneve6_lookup()
162 ipv6_addr_equal(&addr6, &node->geneve->cfg.info.key.u.ipv6.dst)) in geneve6_lookup()
163 return node->geneve; in geneve6_lookup()
218 static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, in geneve_rx() argument
237 geneve->dev->stats.rx_dropped++; in geneve_rx()
249 geneve->dev->stats.rx_frame_errors++; in geneve_rx()
250 geneve->dev->stats.rx_errors++; in geneve_rx()
260 skb->protocol = eth_type_trans(skb, geneve->dev); in geneve_rx()
265 geneve->dev->dev_addr)) { in geneve_rx()
266 geneve->dev->stats.rx_errors++; in geneve_rx()
271 skb->dev = geneve->dev; in geneve_rx()
284 DEV_STATS_INC(geneve->dev, rx_length_errors); in geneve_rx()
285 DEV_STATS_INC(geneve->dev, rx_errors); in geneve_rx()
313 ++geneve->dev->stats.rx_frame_errors; in geneve_rx()
314 ++geneve->dev->stats.rx_errors; in geneve_rx()
320 err = gro_cells_receive(&geneve->gro_cells, skb); in geneve_rx()
322 dev_sw_netstats_rx_add(geneve->dev, len); in geneve_rx()
333 struct geneve_dev *geneve = netdev_priv(dev); in geneve_init() local
340 err = gro_cells_init(&geneve->gro_cells, dev); in geneve_init()
346 err = dst_cache_init(&geneve->cfg.info.dst_cache, GFP_KERNEL); in geneve_init()
349 gro_cells_destroy(&geneve->gro_cells); in geneve_init()
358 struct geneve_dev *geneve = netdev_priv(dev); in geneve_uninit() local
360 dst_cache_destroy(&geneve->cfg.info.dst_cache); in geneve_uninit()
361 gro_cells_destroy(&geneve->gro_cells); in geneve_uninit()
369 struct geneve_dev *geneve; in geneve_udp_encap_recv() local
387 geneve = geneve_lookup_skb(gs, skb); in geneve_udp_encap_recv()
388 if (!geneve) in geneve_udp_encap_recv()
393 if (unlikely((!geneve->cfg.inner_proto_inherit && in geneve_udp_encap_recv()
395 geneve->dev->stats.rx_dropped++; in geneve_udp_encap_recv()
401 !net_eq(geneve->net, dev_net(geneve->dev)))) { in geneve_udp_encap_recv()
402 geneve->dev->stats.rx_dropped++; in geneve_udp_encap_recv()
406 geneve_rx(geneve, gs, skb); in geneve_udp_encap_recv()
641 static void geneve_sock_release(struct geneve_dev *geneve) in geneve_sock_release() argument
643 struct geneve_sock *gs4 = rtnl_dereference(geneve->sock4); in geneve_sock_release()
645 struct geneve_sock *gs6 = rtnl_dereference(geneve->sock6); in geneve_sock_release()
647 rcu_assign_pointer(geneve->sock6, NULL); in geneve_sock_release()
650 rcu_assign_pointer(geneve->sock4, NULL); in geneve_sock_release()
674 static int geneve_sock_add(struct geneve_dev *geneve, bool ipv6) in geneve_sock_add() argument
676 struct net *net = geneve->net; in geneve_sock_add()
683 gs = geneve_find_sock(gn, ipv6 ? AF_INET6 : AF_INET, geneve->cfg.info.key.tp_dst); in geneve_sock_add()
689 gs = geneve_socket_create(net, geneve->cfg.info.key.tp_dst, ipv6, in geneve_sock_add()
690 geneve->cfg.use_udp6_rx_checksums); in geneve_sock_add()
695 gs->collect_md = geneve->cfg.collect_md; in geneve_sock_add()
698 rcu_assign_pointer(geneve->sock6, gs); in geneve_sock_add()
699 node = &geneve->hlist6; in geneve_sock_add()
703 rcu_assign_pointer(geneve->sock4, gs); in geneve_sock_add()
704 node = &geneve->hlist4; in geneve_sock_add()
706 node->geneve = geneve; in geneve_sock_add()
708 tunnel_id_to_vni(geneve->cfg.info.key.tun_id, vni); in geneve_sock_add()
716 struct geneve_dev *geneve = netdev_priv(dev); in geneve_open() local
717 bool metadata = geneve->cfg.collect_md; in geneve_open()
721 ipv6 = geneve->cfg.info.mode & IP_TUNNEL_INFO_IPV6 || metadata; in geneve_open()
725 ret = geneve_sock_add(geneve, true); in geneve_open()
731 ret = geneve_sock_add(geneve, false); in geneve_open()
733 geneve_sock_release(geneve); in geneve_open()
740 struct geneve_dev *geneve = netdev_priv(dev); in geneve_stop() local
742 hlist_del_init_rcu(&geneve->hlist4.hlist); in geneve_stop()
744 hlist_del_init_rcu(&geneve->hlist6.hlist); in geneve_stop()
746 geneve_sock_release(geneve); in geneve_stop()
811 struct geneve_dev *geneve = netdev_priv(dev); in geneve_get_v4_rt() local
829 if ((tos == 1) && !geneve->cfg.collect_md) { in geneve_get_v4_rt()
843 rt = ip_route_output_key(geneve->net, fl4); in geneve_get_v4_rt()
867 struct geneve_dev *geneve = netdev_priv(dev); in geneve_get_v6_dst() local
884 if ((prio == 1) && !geneve->cfg.collect_md) { in geneve_get_v6_dst()
896 dst = ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, fl6, in geneve_get_v6_dst()
915 struct geneve_dev *geneve, in geneve_xmit_skb() argument
918 bool inner_proto_inherit = geneve->cfg.inner_proto_inherit; in geneve_xmit_skb()
919 bool xnet = !net_eq(geneve->net, dev_net(geneve->dev)); in geneve_xmit_skb()
920 struct geneve_sock *gs4 = rcu_dereference(geneve->sock4); in geneve_xmit_skb()
933 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); in geneve_xmit_skb()
935 geneve->cfg.info.key.tp_dst, sport, &full_tos); in geneve_xmit_skb()
967 skb->protocol = eth_type_trans(skb, geneve->dev); in geneve_xmit_skb()
973 if (geneve->cfg.collect_md) { in geneve_xmit_skb()
980 if (geneve->cfg.ttl_inherit) in geneve_xmit_skb()
986 if (geneve->cfg.df == GENEVE_DF_SET) { in geneve_xmit_skb()
988 } else if (geneve->cfg.df == GENEVE_DF_INHERIT) { in geneve_xmit_skb()
1008 tos, ttl, df, sport, geneve->cfg.info.key.tp_dst, in geneve_xmit_skb()
1009 !net_eq(geneve->net, dev_net(geneve->dev)), in geneve_xmit_skb()
1016 struct geneve_dev *geneve, in geneve6_xmit_skb() argument
1019 bool inner_proto_inherit = geneve->cfg.inner_proto_inherit; in geneve6_xmit_skb()
1020 bool xnet = !net_eq(geneve->net, dev_net(geneve->dev)); in geneve6_xmit_skb()
1021 struct geneve_sock *gs6 = rcu_dereference(geneve->sock6); in geneve6_xmit_skb()
1032 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); in geneve6_xmit_skb()
1034 geneve->cfg.info.key.tp_dst, sport); in geneve6_xmit_skb()
1065 skb->protocol = eth_type_trans(skb, geneve->dev); in geneve6_xmit_skb()
1071 if (geneve->cfg.collect_md) { in geneve6_xmit_skb()
1077 if (geneve->cfg.ttl_inherit) in geneve6_xmit_skb()
1090 info->key.label, sport, geneve->cfg.info.key.tp_dst, in geneve6_xmit_skb()
1098 struct geneve_dev *geneve = netdev_priv(dev); in geneve_xmit() local
1102 if (geneve->cfg.collect_md) { in geneve_xmit()
1111 info = &geneve->cfg.info; in geneve_xmit()
1117 err = geneve6_xmit_skb(skb, dev, geneve, info); in geneve_xmit()
1120 err = geneve_xmit_skb(skb, dev, geneve, info); in geneve_xmit()
1152 struct geneve_dev *geneve = netdev_priv(dev); in geneve_fill_metadata_dst() local
1159 struct geneve_sock *gs4 = rcu_dereference(geneve->sock4); in geneve_fill_metadata_dst()
1160 sport = udp_flow_src_port(geneve->net, skb, in geneve_fill_metadata_dst()
1164 geneve->cfg.info.key.tp_dst, sport, NULL); in geneve_fill_metadata_dst()
1175 struct geneve_sock *gs6 = rcu_dereference(geneve->sock6); in geneve_fill_metadata_dst()
1176 sport = udp_flow_src_port(geneve->net, skb, in geneve_fill_metadata_dst()
1180 geneve->cfg.info.key.tp_dst, sport); in geneve_fill_metadata_dst()
1192 info->key.tp_dst = geneve->cfg.info.key.tp_dst; in geneve_fill_metadata_dst()
1352 struct geneve_dev *geneve, *t = NULL; in geneve_find_dev() local
1356 list_for_each_entry(geneve, &gn->geneve_list, next) { in geneve_find_dev()
1357 if (info->key.tp_dst == geneve->cfg.info.key.tp_dst) { in geneve_find_dev()
1358 *tun_collect_md = geneve->cfg.collect_md; in geneve_find_dev()
1361 if (info->key.tun_id == geneve->cfg.info.key.tun_id && in geneve_find_dev()
1362 info->key.tp_dst == geneve->cfg.info.key.tp_dst && in geneve_find_dev()
1363 !memcmp(&info->key.u, &geneve->cfg.info.key.u, sizeof(info->key.u))) in geneve_find_dev()
1364 t = geneve; in geneve_find_dev()
1390 struct geneve_dev *t, *geneve = netdev_priv(dev); in geneve_configure() local
1401 geneve->net = net; in geneve_configure()
1402 geneve->dev = dev; in geneve_configure()
1433 dst_cache_reset(&geneve->cfg.info.dst_cache); in geneve_configure()
1434 memcpy(&geneve->cfg, cfg, sizeof(*cfg)); in geneve_configure()
1436 if (geneve->cfg.inner_proto_inherit) { in geneve_configure()
1448 list_add(&geneve->next, &gn->geneve_list); in geneve_configure()
1635 struct geneve_dev *geneve = netdev_priv(dev); in geneve_link_config() local
1646 struct rtable *rt = ip_route_output_key(geneve->net, &fl4); in geneve_link_config()
1661 rt = rt6_lookup(geneve->net, &info->key.u.ipv6.dst, NULL, 0, in geneve_link_config()
1716 static void geneve_quiesce(struct geneve_dev *geneve, struct geneve_sock **gs4, in geneve_quiesce() argument
1719 *gs4 = rtnl_dereference(geneve->sock4); in geneve_quiesce()
1720 rcu_assign_pointer(geneve->sock4, NULL); in geneve_quiesce()
1724 *gs6 = rtnl_dereference(geneve->sock6); in geneve_quiesce()
1725 rcu_assign_pointer(geneve->sock6, NULL); in geneve_quiesce()
1735 static void geneve_unquiesce(struct geneve_dev *geneve, struct geneve_sock *gs4, in geneve_unquiesce() argument
1738 rcu_assign_pointer(geneve->sock4, gs4); in geneve_unquiesce()
1742 rcu_assign_pointer(geneve->sock6, gs6); in geneve_unquiesce()
1753 struct geneve_dev *geneve = netdev_priv(dev); in geneve_changelink() local
1761 if (geneve->cfg.collect_md) in geneve_changelink()
1765 memcpy(&cfg, &geneve->cfg, sizeof(cfg)); in geneve_changelink()
1770 if (!geneve_dst_addr_equal(&geneve->cfg.info, &cfg.info)) { in geneve_changelink()
1775 geneve_quiesce(geneve, &gs4, &gs6); in geneve_changelink()
1776 memcpy(&geneve->cfg, &cfg, sizeof(cfg)); in geneve_changelink()
1777 geneve_unquiesce(geneve, gs4, gs6); in geneve_changelink()
1784 struct geneve_dev *geneve = netdev_priv(dev); in geneve_dellink() local
1786 list_del(&geneve->next); in geneve_dellink()
1810 struct geneve_dev *geneve = netdev_priv(dev); in geneve_fill_info() local
1811 struct ip_tunnel_info *info = &geneve->cfg.info; in geneve_fill_info()
1812 bool ttl_inherit = geneve->cfg.ttl_inherit; in geneve_fill_info()
1813 bool metadata = geneve->cfg.collect_md; in geneve_fill_info()
1846 if (nla_put_u8(skb, IFLA_GENEVE_DF, geneve->cfg.df)) in geneve_fill_info()
1857 !geneve->cfg.use_udp6_rx_checksums)) in geneve_fill_info()
1864 if (geneve->cfg.inner_proto_inherit && in geneve_fill_info()
1963 struct geneve_dev *geneve, *next; in geneve_destroy_tunnels() local
1972 list_for_each_entry_safe(geneve, next, &gn->geneve_list, next) { in geneve_destroy_tunnels()
1976 if (!net_eq(dev_net(geneve->dev), net)) in geneve_destroy_tunnels()
1977 unregister_netdevice_queue(geneve->dev, head); in geneve_destroy_tunnels()