Lines Matching refs:vxlan

64 	struct vxlan_dev *vxlan;  member
97 static void vxlan_br_mdb_entry_fill(const struct vxlan_dev *vxlan, in vxlan_br_mdb_entry_fill() argument
105 e->ifindex = vxlan->dev->ifindex; in vxlan_br_mdb_entry_fill()
162 static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan, in vxlan_mdb_entry_info_fill() argument
175 vxlan_br_mdb_entry_fill(vxlan, mdb_entry, remote, &e); in vxlan_mdb_entry_info_fill()
191 if (rd->remote_port && rd->remote_port != vxlan->cfg.dst_port && in vxlan_mdb_entry_info_fill()
196 if (rd->remote_vni != vxlan->default_dst.remote_vni && in vxlan_mdb_entry_info_fill()
204 if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && in vxlan_mdb_entry_info_fill()
218 static int vxlan_mdb_entry_fill(const struct vxlan_dev *vxlan, in vxlan_mdb_entry_fill() argument
236 err = vxlan_mdb_entry_info_fill(vxlan, skb, mdb_entry, remote); in vxlan_mdb_entry_fill()
248 static int vxlan_mdb_fill(const struct vxlan_dev *vxlan, struct sk_buff *skb, in vxlan_mdb_fill() argument
260 hlist_for_each_entry(mdb_entry, &vxlan->mdb_list, mdb_node) { in vxlan_mdb_fill()
264 err = vxlan_mdb_entry_fill(vxlan, skb, ctx, mdb_entry); in vxlan_mdb_fill()
280 struct vxlan_dev *vxlan = netdev_priv(dev); in vxlan_mdb_dump() local
300 err = vxlan_mdb_fill(vxlan, skb, ctx); in vxlan_mdb_dump()
304 cb->seq = vxlan->mdb_seq; in vxlan_mdb_dump()
582 if (!__dev_get_by_index(cfg->vxlan->net, cfg->remote_ifindex)) { in vxlan_mdb_config_attrs_init()
606 struct vxlan_dev *vxlan = netdev_priv(dev); in vxlan_mdb_config_init() local
609 cfg->vxlan = vxlan; in vxlan_mdb_config_init()
610 cfg->group.vni = vxlan->default_dst.remote_vni; in vxlan_mdb_config_init()
615 cfg->remote_vni = vxlan->default_dst.remote_vni; in vxlan_mdb_config_init()
616 cfg->remote_port = vxlan->cfg.dst_port; in vxlan_mdb_config_init()
663 vxlan_mdb_entry_lookup(struct vxlan_dev *vxlan, in vxlan_mdb_entry_lookup() argument
666 return rhashtable_lookup_fast(&vxlan->mdb_tbl, group, in vxlan_mdb_entry_lookup()
743 static void vxlan_mdb_remote_fini(struct vxlan_dev *vxlan, in vxlan_mdb_remote_fini() argument
795 sg_cfg.vxlan = cfg->vxlan; in vxlan_mdb_remote_src_fwd_add()
814 vxlan_mdb_remote_src_fwd_del(struct vxlan_dev *vxlan, in vxlan_mdb_remote_src_fwd_del() argument
823 sg_cfg.vxlan = vxlan; in vxlan_mdb_remote_src_fwd_del()
868 static void vxlan_mdb_remote_src_del(struct vxlan_dev *vxlan, in vxlan_mdb_remote_src_del() argument
873 vxlan_mdb_remote_src_fwd_del(vxlan, group, remote, &ent->addr); in vxlan_mdb_remote_src_del()
896 vxlan_mdb_remote_src_del(cfg->vxlan, &cfg->group, remote, ent); in vxlan_mdb_remote_srcs_add()
900 static void vxlan_mdb_remote_srcs_del(struct vxlan_dev *vxlan, in vxlan_mdb_remote_srcs_del() argument
908 vxlan_mdb_remote_src_del(vxlan, group, remote, ent); in vxlan_mdb_remote_srcs_del()
937 vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan, in vxlan_mdb_nlmsg_remote_size() argument
962 if (rd->remote_port && rd->remote_port != vxlan->cfg.dst_port) in vxlan_mdb_nlmsg_remote_size()
965 if (rd->remote_vni != vxlan->default_dst.remote_vni) in vxlan_mdb_nlmsg_remote_size()
971 if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && group->vni) in vxlan_mdb_nlmsg_remote_size()
977 static size_t vxlan_mdb_nlmsg_size(const struct vxlan_dev *vxlan, in vxlan_mdb_nlmsg_size() argument
987 vxlan_mdb_nlmsg_remote_size(vxlan, mdb_entry, remote); in vxlan_mdb_nlmsg_size()
990 static int vxlan_mdb_nlmsg_fill(const struct vxlan_dev *vxlan, in vxlan_mdb_nlmsg_fill() argument
1007 bpm->ifindex = vxlan->dev->ifindex; in vxlan_mdb_nlmsg_fill()
1016 if (vxlan_mdb_entry_info_fill(vxlan, skb, mdb_entry, remote)) in vxlan_mdb_nlmsg_fill()
1030 static void vxlan_mdb_remote_notify(const struct vxlan_dev *vxlan, in vxlan_mdb_remote_notify() argument
1035 struct net *net = dev_net(vxlan->dev); in vxlan_mdb_remote_notify()
1039 skb = nlmsg_new(vxlan_mdb_nlmsg_size(vxlan, mdb_entry, remote), in vxlan_mdb_remote_notify()
1044 err = vxlan_mdb_nlmsg_fill(vxlan, skb, mdb_entry, remote, type); in vxlan_mdb_remote_notify()
1062 struct vxlan_dev *vxlan = cfg->vxlan; in vxlan_mdb_remote_srcs_replace() local
1076 vxlan_mdb_remote_src_del(vxlan, &mdb_entry->key, remote, in vxlan_mdb_remote_srcs_replace()
1094 struct vxlan_dev *vxlan = cfg->vxlan; in vxlan_mdb_remote_replace() local
1109 vxlan_mdb_remote_notify(vxlan, mdb_entry, remote, RTM_NEWMDB); in vxlan_mdb_remote_replace()
1157 vxlan_mdb_remote_notify(cfg->vxlan, mdb_entry, remote, RTM_NEWMDB); in vxlan_mdb_remote_add()
1162 vxlan_mdb_remote_fini(cfg->vxlan, remote); in vxlan_mdb_remote_add()
1168 static void vxlan_mdb_remote_del(struct vxlan_dev *vxlan, in vxlan_mdb_remote_del() argument
1172 vxlan_mdb_remote_notify(vxlan, mdb_entry, remote, RTM_DELMDB); in vxlan_mdb_remote_del()
1174 vxlan_mdb_remote_srcs_del(vxlan, &mdb_entry->key, remote); in vxlan_mdb_remote_del()
1175 vxlan_mdb_remote_fini(vxlan, remote); in vxlan_mdb_remote_del()
1180 vxlan_mdb_entry_get(struct vxlan_dev *vxlan, in vxlan_mdb_entry_get() argument
1186 mdb_entry = vxlan_mdb_entry_lookup(vxlan, group); in vxlan_mdb_entry_get()
1196 hlist_add_head(&mdb_entry->mdb_node, &vxlan->mdb_list); in vxlan_mdb_entry_get()
1198 err = rhashtable_lookup_insert_fast(&vxlan->mdb_tbl, in vxlan_mdb_entry_get()
1204 if (hlist_is_singular_node(&mdb_entry->mdb_node, &vxlan->mdb_list)) in vxlan_mdb_entry_get()
1205 vxlan->cfg.flags |= VXLAN_F_MDB; in vxlan_mdb_entry_get()
1215 static void vxlan_mdb_entry_put(struct vxlan_dev *vxlan, in vxlan_mdb_entry_put() argument
1221 if (hlist_is_singular_node(&mdb_entry->mdb_node, &vxlan->mdb_list)) in vxlan_mdb_entry_put()
1222 vxlan->cfg.flags &= ~VXLAN_F_MDB; in vxlan_mdb_entry_put()
1224 rhashtable_remove_fast(&vxlan->mdb_tbl, &mdb_entry->rhnode, in vxlan_mdb_entry_put()
1233 struct vxlan_dev *vxlan = cfg->vxlan; in __vxlan_mdb_add() local
1237 mdb_entry = vxlan_mdb_entry_get(vxlan, &cfg->group); in __vxlan_mdb_add()
1245 vxlan->mdb_seq++; in __vxlan_mdb_add()
1250 vxlan_mdb_entry_put(vxlan, mdb_entry); in __vxlan_mdb_add()
1257 struct vxlan_dev *vxlan = cfg->vxlan; in __vxlan_mdb_del() local
1261 mdb_entry = vxlan_mdb_entry_lookup(vxlan, &cfg->group); in __vxlan_mdb_del()
1273 vxlan_mdb_remote_del(vxlan, mdb_entry, remote); in __vxlan_mdb_del()
1274 vxlan_mdb_entry_put(vxlan, mdb_entry); in __vxlan_mdb_del()
1276 vxlan->mdb_seq++; in __vxlan_mdb_del()
1329 static int vxlan_mdb_flush_desc_init(struct vxlan_dev *vxlan, in vxlan_mdb_flush_desc_init() argument
1338 if (entry->ifindex && entry->ifindex != vxlan->dev->ifindex) { in vxlan_mdb_flush_desc_init()
1387 static void vxlan_mdb_remotes_flush(struct vxlan_dev *vxlan, in vxlan_mdb_remotes_flush() argument
1415 vxlan_mdb_remote_del(vxlan, mdb_entry, remote); in vxlan_mdb_remotes_flush()
1419 static void vxlan_mdb_flush(struct vxlan_dev *vxlan, in vxlan_mdb_flush() argument
1428 hlist_for_each_entry_safe(mdb_entry, tmp, &vxlan->mdb_list, mdb_node) { in vxlan_mdb_flush()
1432 vxlan_mdb_remotes_flush(vxlan, mdb_entry, desc); in vxlan_mdb_flush()
1434 vxlan_mdb_entry_put(vxlan, mdb_entry); in vxlan_mdb_flush()
1441 struct vxlan_dev *vxlan = netdev_priv(dev); in vxlan_mdb_del_bulk() local
1447 err = vxlan_mdb_flush_desc_init(vxlan, &desc, tb, extack); in vxlan_mdb_del_bulk()
1451 vxlan_mdb_flush(vxlan, &desc); in vxlan_mdb_del_bulk()
1469 struct vxlan_dev *vxlan = netdev_priv(dev); in vxlan_mdb_get_parse() local
1473 group->vni = vxlan->default_dst.remote_vni; in vxlan_mdb_get_parse()
1501 vxlan_mdb_get_reply_alloc(const struct vxlan_dev *vxlan, in vxlan_mdb_get_reply_alloc() argument
1514 nlmsg_size += vxlan_mdb_nlmsg_remote_size(vxlan, mdb_entry, in vxlan_mdb_get_reply_alloc()
1521 vxlan_mdb_get_reply_fill(const struct vxlan_dev *vxlan, in vxlan_mdb_get_reply_fill() argument
1539 bpm->ifindex = vxlan->dev->ifindex; in vxlan_mdb_get_reply_fill()
1552 err = vxlan_mdb_entry_info_fill(vxlan, skb, mdb_entry, remote); in vxlan_mdb_get_reply_fill()
1571 struct vxlan_dev *vxlan = netdev_priv(dev); in vxlan_mdb_get() local
1583 mdb_entry = vxlan_mdb_entry_lookup(vxlan, &group); in vxlan_mdb_get()
1589 skb = vxlan_mdb_get_reply_alloc(vxlan, mdb_entry); in vxlan_mdb_get()
1593 err = vxlan_mdb_get_reply_fill(vxlan, skb, mdb_entry, portid, seq); in vxlan_mdb_get()
1606 struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan, in vxlan_mdb_entry_skb_get() argument
1620 if (!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA)) in vxlan_mdb_entry_skb_get()
1621 src_vni = vxlan->default_dst.remote_vni; in vxlan_mdb_entry_skb_get()
1649 mdb_entry = vxlan_mdb_entry_lookup(vxlan, &group); in vxlan_mdb_entry_skb_get()
1654 mdb_entry = vxlan_mdb_entry_lookup(vxlan, &group); in vxlan_mdb_entry_skb_get()
1682 return vxlan_mdb_entry_lookup(vxlan, &group); in vxlan_mdb_entry_skb_get()
1685 netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan, in vxlan_mdb_xmit() argument
1707 vxlan_xmit_one(skb1, vxlan->dev, src_vni, in vxlan_mdb_xmit()
1712 vxlan_xmit_one(skb, vxlan->dev, src_vni, in vxlan_mdb_xmit()
1725 int vxlan_mdb_init(struct vxlan_dev *vxlan) in vxlan_mdb_init() argument
1729 err = rhashtable_init(&vxlan->mdb_tbl, &vxlan_mdb_rht_params); in vxlan_mdb_init()
1733 INIT_HLIST_HEAD(&vxlan->mdb_list); in vxlan_mdb_init()
1738 void vxlan_mdb_fini(struct vxlan_dev *vxlan) in vxlan_mdb_fini() argument
1742 vxlan_mdb_flush(vxlan, &desc); in vxlan_mdb_fini()
1743 WARN_ON_ONCE(vxlan->cfg.flags & VXLAN_F_MDB); in vxlan_mdb_fini()
1744 rhashtable_free_and_destroy(&vxlan->mdb_tbl, vxlan_mdb_check_empty, in vxlan_mdb_fini()