Commit a5e7c10a authored by Mike Rapoport's avatar Mike Rapoport Committed by Stephen Hemminger

vxlan: introduce vxlan_fdb_find_rdst

which will be reused by vxlan_fdb_delete
Signed-off-by: default avatarMike Rapoport <mike.rapoport@ravellosystems.com>
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
parent afbd8bae
...@@ -388,21 +388,34 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, ...@@ -388,21 +388,34 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
return f; return f;
} }
/* Add/update destinations for multicast */ /* caller should hold vxlan->hash_lock */
static int vxlan_fdb_append(struct vxlan_fdb *f, static struct vxlan_rdst *vxlan_fdb_find_rdst(struct vxlan_fdb *f,
__be32 ip, __be16 port, __u32 vni, __u32 ifindex) __be32 ip, __be16 port,
__u32 vni, __u32 ifindex)
{ {
struct vxlan_rdst *rd; struct vxlan_rdst *rd;
/* protected by vxlan->hash_lock */
list_for_each_entry(rd, &f->remotes, list) { list_for_each_entry(rd, &f->remotes, list) {
if (rd->remote_ip == ip && if (rd->remote_ip == ip &&
rd->remote_port == port && rd->remote_port == port &&
rd->remote_vni == vni && rd->remote_vni == vni &&
rd->remote_ifindex == ifindex) rd->remote_ifindex == ifindex)
return 0; return rd;
} }
return NULL;
}
/* Add/update destinations for multicast */
static int vxlan_fdb_append(struct vxlan_fdb *f,
__be32 ip, __be16 port, __u32 vni, __u32 ifindex)
{
struct vxlan_rdst *rd;
rd = vxlan_fdb_find_rdst(f, ip, port, vni, ifindex);
if (rd)
return 0;
rd = kmalloc(sizeof(*rd), GFP_ATOMIC); rd = kmalloc(sizeof(*rd), GFP_ATOMIC);
if (rd == NULL) if (rd == NULL)
return -ENOBUFS; return -ENOBUFS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment