mirror of https://gitee.com/openkylin/linux.git
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: 598ff6bae6
("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>
This commit is contained in:
parent
a66ed149b0
commit
22c01ee4b8
|
@ -424,8 +424,10 @@ int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
|
static int
|
||||||
union ib_gid *gid, struct ib_gid_attr *attr)
|
_ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
|
||||||
|
union ib_gid *gid, struct ib_gid_attr *attr,
|
||||||
|
bool default_gid)
|
||||||
{
|
{
|
||||||
struct ib_gid_table *table;
|
struct ib_gid_table *table;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -435,9 +437,10 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
|
||||||
|
|
||||||
mutex_lock(&table->lock);
|
mutex_lock(&table->lock);
|
||||||
|
|
||||||
ix = find_gid(table, gid, attr, false,
|
ix = find_gid(table, gid, attr, default_gid,
|
||||||
GID_ATTR_FIND_MASK_GID |
|
GID_ATTR_FIND_MASK_GID |
|
||||||
GID_ATTR_FIND_MASK_GID_TYPE |
|
GID_ATTR_FIND_MASK_GID_TYPE |
|
||||||
|
GID_ATTR_FIND_MASK_DEFAULT |
|
||||||
GID_ATTR_FIND_MASK_NETDEV,
|
GID_ATTR_FIND_MASK_NETDEV,
|
||||||
NULL);
|
NULL);
|
||||||
if (ix < 0) {
|
if (ix < 0) {
|
||||||
|
@ -456,6 +459,12 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
|
||||||
|
union ib_gid *gid, struct ib_gid_attr *attr)
|
||||||
|
{
|
||||||
|
return _ib_cache_gid_del(ib_dev, port, gid, attr, false);
|
||||||
|
}
|
||||||
|
|
||||||
int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
|
int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
|
||||||
struct net_device *ndev)
|
struct net_device *ndev)
|
||||||
{
|
{
|
||||||
|
@ -756,7 +765,7 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
|
||||||
__ib_cache_gid_add(ib_dev, port, &gid,
|
__ib_cache_gid_add(ib_dev, port, &gid,
|
||||||
&gid_attr, mask, true);
|
&gid_attr, mask, true);
|
||||||
} else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
|
} else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
|
||||||
ib_cache_gid_del(ib_dev, port, &gid, &gid_attr);
|
_ib_cache_gid_del(ib_dev, port, &gid, &gid_attr, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue