diff options
author | Matan Barak <matanb@mellanox.com> | 2015-10-15 11:38:46 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-10-21 23:48:17 -0400 |
commit | d300ec528b799ca87935b3667f5563f397f00f85 (patch) | |
tree | 731294d458a5a6f2717277497892271b3903d2de | |
parent | 55ee3ab2e49a9ead850722ef47698243dd226d16 (diff) |
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: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/core/cache.c | 9 | ||||
-rw-r--r-- | drivers/infiniband/core/core_priv.h | 5 | ||||
-rw-r--r-- | drivers/infiniband/core/device.c | 4 | ||||
-rw-r--r-- | include/rdma/ib_cache.h | 19 |
4 files changed, 26 insertions, 11 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 5c054072ef20..639a7266bfaf 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c | |||
@@ -409,10 +409,10 @@ static int ib_cache_gid_find(struct ib_device *ib_dev, | |||
409 | mask, port, index); | 409 | mask, port, index); |
410 | } | 410 | } |
411 | 411 | ||
412 | int ib_cache_gid_find_by_port(struct ib_device *ib_dev, | 412 | int ib_find_cached_gid_by_port(struct ib_device *ib_dev, |
413 | const union ib_gid *gid, | 413 | const union ib_gid *gid, |
414 | u8 port, struct net_device *ndev, | 414 | u8 port, struct net_device *ndev, |
415 | u16 *index) | 415 | u16 *index) |
416 | { | 416 | { |
417 | int local_index; | 417 | int local_index; |
418 | struct ib_gid_table **ports_table = ib_dev->cache.gid_cache; | 418 | struct ib_gid_table **ports_table = ib_dev->cache.gid_cache; |
@@ -438,6 +438,7 @@ int ib_cache_gid_find_by_port(struct ib_device *ib_dev, | |||
438 | 438 | ||
439 | return -ENOENT; | 439 | return -ENOENT; |
440 | } | 440 | } |
441 | EXPORT_SYMBOL(ib_find_cached_gid_by_port); | ||
441 | 442 | ||
442 | static struct ib_gid_table *alloc_gid_table(int sz) | 443 | static struct ib_gid_table *alloc_gid_table(int sz) |
443 | { | 444 | { |
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 70bb36ebb03b..0df82b1f84c1 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h | |||
@@ -65,11 +65,6 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter, | |||
65 | roce_netdev_callback cb, | 65 | roce_netdev_callback cb, |
66 | void *cookie); | 66 | void *cookie); |
67 | 67 | ||
68 | int ib_cache_gid_find_by_port(struct ib_device *ib_dev, | ||
69 | const union ib_gid *gid, | ||
70 | u8 port, struct net_device *ndev, | ||
71 | u16 *index); | ||
72 | |||
73 | enum ib_cache_gid_default_mode { | 68 | enum ib_cache_gid_default_mode { |
74 | IB_CACHE_GID_DEFAULT_MODE_SET, | 69 | IB_CACHE_GID_DEFAULT_MODE_SET, |
75 | IB_CACHE_GID_DEFAULT_MODE_DELETE | 70 | IB_CACHE_GID_DEFAULT_MODE_DELETE |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index f22ce487fd3a..179e8134d57f 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
@@ -838,8 +838,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, | |||
838 | 838 | ||
839 | for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { | 839 | for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { |
840 | if (rdma_cap_roce_gid_table(device, port)) { | 840 | if (rdma_cap_roce_gid_table(device, port)) { |
841 | if (!ib_cache_gid_find_by_port(device, gid, port, | 841 | if (!ib_find_cached_gid_by_port(device, gid, port, |
842 | ndev, index)) { | 842 | ndev, index)) { |
843 | *port_num = port; | 843 | *port_num = port; |
844 | return 0; | 844 | return 0; |
845 | } | 845 | } |
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h index dcc9bed9b69a..679d7ca6a3ee 100644 --- a/include/rdma/ib_cache.h +++ b/include/rdma/ib_cache.h | |||
@@ -75,6 +75,25 @@ int ib_find_cached_gid(struct ib_device *device, | |||
75 | u16 *index); | 75 | u16 *index); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * ib_find_cached_gid_by_port - Returns the GID table index where a specified | ||
79 | * GID value occurs | ||
80 | * @device: The device to query. | ||
81 | * @gid: The GID value to search for. | ||
82 | * @port_num: The port number of the device where the GID value sould be | ||
83 | * searched. | ||
84 | * @ndev: In RoCE, the net device of the device. Null means ignore. | ||
85 | * @index: The index into the cached GID table where the GID was found. This | ||
86 | * parameter may be NULL. | ||
87 | * | ||
88 | * ib_find_cached_gid() searches for the specified GID value in | ||
89 | * the local software cache. | ||
90 | */ | ||
91 | int ib_find_cached_gid_by_port(struct ib_device *device, | ||
92 | const union ib_gid *gid, | ||
93 | u8 port_num, | ||
94 | struct net_device *ndev, | ||
95 | u16 *index); | ||
96 | /** | ||
78 | * ib_get_cached_pkey - Returns a cached PKey table entry | 97 | * ib_get_cached_pkey - Returns a cached PKey table entry |
79 | * @device: The device to query. | 98 | * @device: The device to query. |
80 | * @port_num: The port number of the device to query. | 99 | * @port_num: The port number of the device to query. |