IB/core: Expose and rename ib_find_cached_gid_by_port cache API
authorMatan Barak <matanb@mellanox.com>
Thu, 15 Oct 2015 15:38:46 +0000 (18:38 +0300)
committerDoug Ledford <dledford@redhat.com>
Thu, 22 Oct 2015 03:48:17 +0000 (23:48 -0400)
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>
drivers/infiniband/core/cache.c
drivers/infiniband/core/core_priv.h
drivers/infiniband/core/device.c
include/rdma/ib_cache.h

index 5c054072ef2008d2222665538d95745c82d91bb9..639a7266bfafc89d5bd85e9295db7978fdcafef7 100644 (file)
@@ -409,10 +409,10 @@ static int ib_cache_gid_find(struct ib_device *ib_dev,
                                        mask, port, index);
 }
 
-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)
+int ib_find_cached_gid_by_port(struct ib_device *ib_dev,
+                              const union ib_gid *gid,
+                              u8 port, struct net_device *ndev,
+                              u16 *index)
 {
        int local_index;
        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,
 
        return -ENOENT;
 }
+EXPORT_SYMBOL(ib_find_cached_gid_by_port);
 
 static struct ib_gid_table *alloc_gid_table(int sz)
 {
index 70bb36ebb03b8e91ff2cf89445b0a8f52329e591..0df82b1f84c1280d74bb60647a8de24a103c18c7 100644 (file)
@@ -65,11 +65,6 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter,
                              roce_netdev_callback cb,
                              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 {
        IB_CACHE_GID_DEFAULT_MODE_SET,
        IB_CACHE_GID_DEFAULT_MODE_DELETE
index f22ce487fd3a8be6ead305eee8e1b6e30cc1b7de..179e8134d57fc13b425254d5162006f9fc201879 100644 (file)
@@ -838,8 +838,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
 
        for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) {
                if (rdma_cap_roce_gid_table(device, port)) {
-                       if (!ib_cache_gid_find_by_port(device, gid, port,
-                                                      ndev, index)) {
+                       if (!ib_find_cached_gid_by_port(device, gid, port,
+                                                       ndev, index)) {
                                *port_num = port;
                                return 0;
                        }
index dcc9bed9b69aa800897fa2b6ce742c69f24ccc66..679d7ca6a3eeef82e8a6fc7abddc0eb55e3949ec 100644 (file)
@@ -74,6 +74,25 @@ int ib_find_cached_gid(struct ib_device *device,
                       u8               *port_num,
                       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
  * @device: The device to query.