These functions are called in case of port changes or device resets etc.
Signed-off-by: Goldwyn Rodrigues <[email protected]>
---
drivers/infiniband/core/cache.c | 26 ++++++++++++++++++++++++++
include/rdma/ib_cache.h | 15 +++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 67252ad..532d442 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -397,6 +397,19 @@ static void ib_cache_pkey_free(struct ib_pkey_cache *cache)
kfree(cache);
}
+int ib_cache_pkey_drop(struct ib_cache *cache, u8 port_num)
+{
+ struct ib_pkey_cache *pc;
+ unsigned long flags;
+
+ write_lock_irqsave(&cache->lock, flags);
+ pc = cache->pkey_cache[port_num - cache->start_port];
+ memset(pc->valid_bm, 0, BITS_TO_LONGS(pc->table_len));
+ write_unlock_irqrestore(&cache->lock, flags);
+ return 0;
+}
+EXPORT_SYMBOL(ib_cache_pkey_drop);
+
static struct ib_gid_cache *ib_cache_gid_alloc(int size)
{
struct ib_gid_cache *gc;
@@ -419,6 +432,19 @@ static void ib_cache_gid_free(struct ib_gid_cache *cache)
kfree(cache);
}
+int ib_cache_gid_drop(struct ib_cache *cache, u8 port_num)
+{
+ struct ib_gid_cache *gc;
+ unsigned long flags;
+
+ write_lock_irqsave(&cache->lock, flags);
+ gc = cache->gid_cache[port_num - cache->start_port];
+ memset(gc->valid_bm, 0, BITS_TO_LONGS(gc->table_len));
+ write_unlock_irqrestore(&cache->lock, flags);
+ return 0;
+}
+EXPORT_SYMBOL(ib_cache_gid_drop);
+
int ib_cache_init(struct ib_cache *cache,
struct ib_device *device)
{
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h
index a5d7c7d..8a23663 100644
--- a/include/rdma/ib_cache.h
+++ b/include/rdma/ib_cache.h
@@ -138,4 +138,19 @@ int ib_cache_init(struct ib_cache *cache,
* @cache: The cache to free
*/
void ib_cache_free(struct ib_cache *cache);
+
+/**
+ * ib_cache_pkey_drop - drop the pkey cache entry associated with port
+ * @cache: The cache to free
+ * @port_num: port number entry in the cache
+ */
+int ib_cache_pkey_drop(struct ib_cache *cache, u8 port_num);
+
+
+/**
+ * ib_cache_gid_drop - drop the gid cache entry associated with port
+ * @cache: The cache to free
+ * @port_num: port number entry in the cache
+ */
+int ib_cache_gid_drop(struct ib_cache *cache, u8 port_num);
#endif /* _IB_CACHE_H */
--
1.7.6
--
Goldwyn
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html