Commit d300ec52 authored by Matan Barak's avatar Matan Barak Committed by Doug Ledford

IB/core: Expose and rename ib_find_cached_gid_by_port cache API

Sometime consumers might want to search for a GID in a specific port.
For example, when a WC arrives and we want to search the GID
that matches that port - it's better to search only the relevant
port.
Exposing and renaming ib_cache_gid_find_by_port in order to match
the naming convention of the module.
Signed-off-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 55ee3ab2
...@@ -409,7 +409,7 @@ static int ib_cache_gid_find(struct ib_device *ib_dev, ...@@ -409,7 +409,7 @@ static int ib_cache_gid_find(struct ib_device *ib_dev,
mask, port, index); mask, port, index);
} }
int ib_cache_gid_find_by_port(struct ib_device *ib_dev, int ib_find_cached_gid_by_port(struct ib_device *ib_dev,
const union ib_gid *gid, const union ib_gid *gid,
u8 port, struct net_device *ndev, u8 port, struct net_device *ndev,
u16 *index) u16 *index)
...@@ -438,6 +438,7 @@ int ib_cache_gid_find_by_port(struct ib_device *ib_dev, ...@@ -438,6 +438,7 @@ int ib_cache_gid_find_by_port(struct ib_device *ib_dev,
return -ENOENT; return -ENOENT;
} }
EXPORT_SYMBOL(ib_find_cached_gid_by_port);
static struct ib_gid_table *alloc_gid_table(int sz) static struct ib_gid_table *alloc_gid_table(int sz)
{ {
......
...@@ -65,11 +65,6 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter, ...@@ -65,11 +65,6 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter,
roce_netdev_callback cb, roce_netdev_callback cb,
void *cookie); void *cookie);
int ib_cache_gid_find_by_port(struct ib_device *ib_dev,
const union ib_gid *gid,
u8 port, struct net_device *ndev,
u16 *index);
enum ib_cache_gid_default_mode { enum ib_cache_gid_default_mode {
IB_CACHE_GID_DEFAULT_MODE_SET, IB_CACHE_GID_DEFAULT_MODE_SET,
IB_CACHE_GID_DEFAULT_MODE_DELETE IB_CACHE_GID_DEFAULT_MODE_DELETE
......
...@@ -838,7 +838,7 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, ...@@ -838,7 +838,7 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) {
if (rdma_cap_roce_gid_table(device, port)) { if (rdma_cap_roce_gid_table(device, port)) {
if (!ib_cache_gid_find_by_port(device, gid, port, if (!ib_find_cached_gid_by_port(device, gid, port,
ndev, index)) { ndev, index)) {
*port_num = port; *port_num = port;
return 0; return 0;
......
...@@ -74,6 +74,25 @@ int ib_find_cached_gid(struct ib_device *device, ...@@ -74,6 +74,25 @@ int ib_find_cached_gid(struct ib_device *device,
u8 *port_num, u8 *port_num,
u16 *index); u16 *index);
/**
* ib_find_cached_gid_by_port - Returns the GID table index where a specified
* GID value occurs
* @device: The device to query.
* @gid: The GID value to search for.
* @port_num: The port number of the device where the GID value sould be
* searched.
* @ndev: In RoCE, the net device of the device. Null means ignore.
* @index: The index into the cached GID table where the GID was found. This
* parameter may be NULL.
*
* ib_find_cached_gid() searches for the specified GID value in
* the local software cache.
*/
int ib_find_cached_gid_by_port(struct ib_device *device,
const union ib_gid *gid,
u8 port_num,
struct net_device *ndev,
u16 *index);
/** /**
* ib_get_cached_pkey - Returns a cached PKey table entry * ib_get_cached_pkey - Returns a cached PKey table entry
* @device: The device to query. * @device: The device to query.
......
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