diff options
author | Mike Rapoport <mike.rapoport@ravellosystems.com> | 2013-06-25 09:01:52 -0400 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2013-06-25 12:31:36 -0400 |
commit | a5e7c10a7ec244f272703f36f339c967efe1fc0d (patch) | |
tree | 43eee04be4e76ae1a8608976bc292e645b18a979 /drivers/net/vxlan.c | |
parent | afbd8bae9c798c5cdbe4439d3a50536b5438247c (diff) |
vxlan: introduce vxlan_fdb_find_rdst
which will be reused by vxlan_fdb_delete
Signed-off-by: Mike Rapoport <mike.rapoport@ravellosystems.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index bdfe46e50c49..306bd94efa89 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -388,21 +388,34 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | |||
388 | return f; | 388 | return f; |
389 | } | 389 | } |
390 | 390 | ||
391 | /* Add/update destinations for multicast */ | 391 | /* caller should hold vxlan->hash_lock */ |
392 | static int vxlan_fdb_append(struct vxlan_fdb *f, | 392 | static struct vxlan_rdst *vxlan_fdb_find_rdst(struct vxlan_fdb *f, |
393 | __be32 ip, __be16 port, __u32 vni, __u32 ifindex) | 393 | __be32 ip, __be16 port, |
394 | __u32 vni, __u32 ifindex) | ||
394 | { | 395 | { |
395 | struct vxlan_rdst *rd; | 396 | struct vxlan_rdst *rd; |
396 | 397 | ||
397 | /* protected by vxlan->hash_lock */ | ||
398 | list_for_each_entry(rd, &f->remotes, list) { | 398 | list_for_each_entry(rd, &f->remotes, list) { |
399 | if (rd->remote_ip == ip && | 399 | if (rd->remote_ip == ip && |
400 | rd->remote_port == port && | 400 | rd->remote_port == port && |
401 | rd->remote_vni == vni && | 401 | rd->remote_vni == vni && |
402 | rd->remote_ifindex == ifindex) | 402 | rd->remote_ifindex == ifindex) |
403 | return 0; | 403 | return rd; |
404 | } | 404 | } |
405 | 405 | ||
406 | return NULL; | ||
407 | } | ||
408 | |||
409 | /* Add/update destinations for multicast */ | ||
410 | static int vxlan_fdb_append(struct vxlan_fdb *f, | ||
411 | __be32 ip, __be16 port, __u32 vni, __u32 ifindex) | ||
412 | { | ||
413 | struct vxlan_rdst *rd; | ||
414 | |||
415 | rd = vxlan_fdb_find_rdst(f, ip, port, vni, ifindex); | ||
416 | if (rd) | ||
417 | return 0; | ||
418 | |||
406 | rd = kmalloc(sizeof(*rd), GFP_ATOMIC); | 419 | rd = kmalloc(sizeof(*rd), GFP_ATOMIC); |
407 | if (rd == NULL) | 420 | if (rd == NULL) |
408 | return -ENOBUFS; | 421 | return -ENOBUFS; |