|
@@ -911,6 +911,26 @@ int ib_get_cached_pkey(struct ib_device *device,
|
|
|
}
|
|
|
EXPORT_SYMBOL(ib_get_cached_pkey);
|
|
|
|
|
|
+int ib_get_cached_subnet_prefix(struct ib_device *device,
|
|
|
+ u8 port_num,
|
|
|
+ u64 *sn_pfx)
|
|
|
+{
|
|
|
+ unsigned long flags;
|
|
|
+ int p;
|
|
|
+
|
|
|
+ if (port_num < rdma_start_port(device) ||
|
|
|
+ port_num > rdma_end_port(device))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ p = port_num - rdma_start_port(device);
|
|
|
+ read_lock_irqsave(&device->cache.lock, flags);
|
|
|
+ *sn_pfx = device->cache.ports[p].subnet_prefix;
|
|
|
+ read_unlock_irqrestore(&device->cache.lock, flags);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(ib_get_cached_subnet_prefix);
|
|
|
+
|
|
|
int ib_find_cached_pkey(struct ib_device *device,
|
|
|
u8 port_num,
|
|
|
u16 pkey,
|
|
@@ -1108,6 +1128,8 @@ static void ib_cache_update(struct ib_device *device,
|
|
|
device->cache.ports[port - rdma_start_port(device)].port_state =
|
|
|
tprops->state;
|
|
|
|
|
|
+ device->cache.ports[port - rdma_start_port(device)].subnet_prefix =
|
|
|
+ tprops->subnet_prefix;
|
|
|
write_unlock_irq(&device->cache.lock);
|
|
|
|
|
|
kfree(gid_cache);
|