aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/cache.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-04-23 09:58:18 -0400
committerDoug Ledford <dledford@redhat.com>2018-04-23 17:28:18 -0400
commit22c01ee4b8a8c000c490dfc479e175404e64167b (patch)
treec1401a2ef285d8b70381b81bf4a187057e7bc3a8 /drivers/infiniband/core/cache.c
parenta66ed149b0da5b97fa7486ee2bcd00f3f9df5442 (diff)
IB/core: Fix to avoid deleting IPv6 look alike default GIDs
When IPv6 link local address is removed, if it matches with the default GID, default GID(s)s gets removed which may not be a desired behavior. This behavior is introduced by refactor work in Fixes tag. When IPv6 link address is removed, removing its equivalent RoCEv2 GID which exactly matches with default RoCEv2 GID, is right thing to do. However achieving it correctly requires lot more changes, likely in roce_gid_mgmt.c and core/cache.c. This should be done as independent patch. Therefore, this patch preserves behavior of not deleteing default GIDs. This is done by providing explicit hint to consider default GID property using mask and default_gid; similar to add_gid(). Fixes: 598ff6bae68 ("IB/core: Refactor GID modify code for RoCE") Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/cache.c')
-rw-r--r--drivers/infiniband/core/cache.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 92ec845f9c40..8e6a4f05f3ea 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -424,8 +424,10 @@ int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
424 return ret; 424 return ret;
425} 425}
426 426
427int ib_cache_gid_del(struct ib_device *ib_dev, u8 port, 427static int
428 union ib_gid *gid, struct ib_gid_attr *attr) 428_ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
429 union ib_gid *gid, struct ib_gid_attr *attr,
430 bool default_gid)
429{ 431{
430 struct ib_gid_table *table; 432 struct ib_gid_table *table;
431 int ret = 0; 433 int ret = 0;
@@ -435,9 +437,10 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
435 437
436 mutex_lock(&table->lock); 438 mutex_lock(&table->lock);
437 439
438 ix = find_gid(table, gid, attr, false, 440 ix = find_gid(table, gid, attr, default_gid,
439 GID_ATTR_FIND_MASK_GID | 441 GID_ATTR_FIND_MASK_GID |
440 GID_ATTR_FIND_MASK_GID_TYPE | 442 GID_ATTR_FIND_MASK_GID_TYPE |
443 GID_ATTR_FIND_MASK_DEFAULT |
441 GID_ATTR_FIND_MASK_NETDEV, 444 GID_ATTR_FIND_MASK_NETDEV,
442 NULL); 445 NULL);
443 if (ix < 0) { 446 if (ix < 0) {
@@ -456,6 +459,12 @@ out_unlock:
456 return ret; 459 return ret;
457} 460}
458 461
462int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
463 union ib_gid *gid, struct ib_gid_attr *attr)
464{
465 return _ib_cache_gid_del(ib_dev, port, gid, attr, false);
466}
467
459int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, 468int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
460 struct net_device *ndev) 469 struct net_device *ndev)
461{ 470{
@@ -756,7 +765,7 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
756 __ib_cache_gid_add(ib_dev, port, &gid, 765 __ib_cache_gid_add(ib_dev, port, &gid,
757 &gid_attr, mask, true); 766 &gid_attr, mask, true);
758 } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) { 767 } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
759 ib_cache_gid_del(ib_dev, port, &gid, &gid_attr); 768 _ib_cache_gid_del(ib_dev, port, &gid, &gid_attr, true);
760 } 769 }
761 } 770 }
762} 771}