Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328541
b: refs/heads/master
c: 73aaa74
h: refs/heads/master
i:
  328539: f28718c
v: v3
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Oct 1, 2012
1 parent 0dfe7a6 commit 77524ac
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff7166c447df23a61e4f51bf748319dc6728dc74
refs/heads/master: 73aaa7418f8069103ca56fc620b3cd16c5a37d6e
32 changes: 32 additions & 0 deletions trunk/drivers/infiniband/core/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,38 @@ int ib_find_cached_pkey(struct ib_device *device,
}
EXPORT_SYMBOL(ib_find_cached_pkey);

int ib_find_exact_cached_pkey(struct ib_device *device,
u8 port_num,
u16 pkey,
u16 *index)
{
struct ib_pkey_cache *cache;
unsigned long flags;
int i;
int ret = -ENOENT;

if (port_num < start_port(device) || port_num > end_port(device))
return -EINVAL;

read_lock_irqsave(&device->cache.lock, flags);

cache = device->cache.pkey_cache[port_num - start_port(device)];

*index = -1;

for (i = 0; i < cache->table_len; ++i)
if (cache->table[i] == pkey) {
*index = i;
ret = 0;
break;
}

read_unlock_irqrestore(&device->cache.lock, flags);

return ret;
}
EXPORT_SYMBOL(ib_find_exact_cached_pkey);

int ib_get_cached_lmc(struct ib_device *device,
u8 port_num,
u8 *lmc)
Expand Down
16 changes: 16 additions & 0 deletions trunk/include/rdma/ib_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ int ib_find_cached_pkey(struct ib_device *device,
u16 pkey,
u16 *index);

/**
* ib_find_exact_cached_pkey - Returns the PKey table index where a specified
* PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit)
* @device: The device to query.
* @port_num: The port number of the device to search for the PKey.
* @pkey: The PKey value to search for.
* @index: The index into the cached PKey table where the PKey was found.
*
* ib_find_exact_cached_pkey() searches the specified PKey table in
* the local software cache.
*/
int ib_find_exact_cached_pkey(struct ib_device *device,
u8 port_num,
u16 pkey,
u16 *index);

/**
* ib_get_cached_lmc - Returns a cached lmc table entry
* @device: The device to query.
Expand Down

0 comments on commit 77524ac

Please sign in to comment.