|
@@ -707,18 +707,28 @@ int ib_find_pkey(struct ib_device *device,
|
|
{
|
|
{
|
|
int ret, i;
|
|
int ret, i;
|
|
u16 tmp_pkey;
|
|
u16 tmp_pkey;
|
|
|
|
+ int partial_ix = -1;
|
|
|
|
|
|
for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) {
|
|
for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) {
|
|
ret = ib_query_pkey(device, port_num, i, &tmp_pkey);
|
|
ret = ib_query_pkey(device, port_num, i, &tmp_pkey);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
-
|
|
|
|
if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) {
|
|
if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) {
|
|
- *index = i;
|
|
|
|
- return 0;
|
|
|
|
|
|
+ /* if there is full-member pkey take it.*/
|
|
|
|
+ if (tmp_pkey & 0x8000) {
|
|
|
|
+ *index = i;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ if (partial_ix < 0)
|
|
|
|
+ partial_ix = i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*no full-member, if exists take the limited*/
|
|
|
|
+ if (partial_ix >= 0) {
|
|
|
|
+ *index = partial_ix;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
return -ENOENT;
|
|
return -ENOENT;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(ib_find_pkey);
|
|
EXPORT_SYMBOL(ib_find_pkey);
|