int (*query_port)(struct ib_device *device,
u8 port_num,
struct ib_port_attr *port_attr);
- int (*query_gid)(struct ib_device *device,
+ int (*query_gid_chunk)(struct ib_device *device,
u8 port_num, int index,
- union ib_gid *gid);
- int (*query_pkey)(struct ib_device *device,
- u8 port_num, u16 index, u16 *pkey);
+ union ib_gid gid[8]);
+ int (*query_pkey_chunk)(struct ib_device *device,
+ u8 port_num, u16 index, u16 pkey[32]);
int (*modify_device)(struct ib_device *device,
int device_modify_mask,
struct ib_device_modify *device_modify);
int ib_query_port(struct ib_device *device,
u8 port_num, struct ib_port_attr *port_attr);
-int ib_query_gid(struct ib_device *device,
- u8 port_num, int index, union ib_gid *gid);
+int ib_query_gid_chunk(struct ib_device *device,
+ u8 port_num, int index, union ib_gid gid[8]);
-int ib_query_pkey(struct ib_device *device,
- u8 port_num, u16 index, u16 *pkey);
+int ib_query_pkey_chunk(struct ib_device *device,
+ u8 port_num, u16 index, u16 pkey[32]);
int ib_modify_device(struct ib_device *device,
int device_modify_mask,
gid_cache->table_len = tprops->gid_tbl_len;
- for (i = 0; i < pkey_cache->table_len; ++i) {
- ret = ib_query_pkey(device, port, (u16)i, pkey_cache->table + i);
+ for (i = 0; i < pkey_cache->table_len; i+=32) {
+ u16 pkey_chunk[32];
+ int size;
+ ret = ib_query_pkey_chunk(device, port, (u16)i, pkey_chunk);
if (ret) {
- HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_LOW,("ib_query_pkey failed (%d) for %s (index %d)\n",
+ HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_LOW,("ib_query_pkey_chunk failed (%d) for %s (index %d)\n",
ret, device->name, i));
goto err;
}
+ size = min(32, pkey_cache->table_len - i);
+ RtlCopyMemory(pkey_cache->table + i, pkey_chunk, size*sizeof(u16));
}
- for (i = 0; i < gid_cache->table_len; ++i) {
- ret = ib_query_gid(device, port, i, gid_cache->table + i);
+ for (i = 0; i < gid_cache->table_len; i+=8) {
+ union ib_gid gid_chunk[8];
+ int size;
+ ret = ib_query_gid_chunk(device, port, i, gid_chunk);
if (ret) {
- HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_LOW,("ib_query_gid failed (%d) for %s (index %d)\n",
+ HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_LOW,("ib_query_gid_chunk failed (%d) for %s (index %d)\n",
ret, device->name, i));
goto err;
}
+ size = min(8, gid_cache->table_len - i);
+ RtlCopyMemory(gid_cache->table + i, gid_chunk, size*sizeof(union ib_gid));
}
write_lock_irq(&device->cache.lock, &lh);
} mandatory_table[] = {
IB_MANDATORY_FUNC(query_device),
IB_MANDATORY_FUNC(query_port),
- IB_MANDATORY_FUNC(query_pkey),
- IB_MANDATORY_FUNC(query_gid),
+ IB_MANDATORY_FUNC(query_pkey_chunk),
+ IB_MANDATORY_FUNC(query_gid_chunk),
IB_MANDATORY_FUNC(alloc_pd),
IB_MANDATORY_FUNC(dealloc_pd),
IB_MANDATORY_FUNC(create_ah),
/**
- * ib_query_gid - Get GID table entry
+ * ib_query_gid_chunk - Get a chunk of GID table entries
* @device:Device to query
* @port_num:Port number to query
* @index:GID table index to query
- * @gid:Returned GID
+ * @gid:Returned GIDs chunk
*
- * ib_query_gid() fetches the specified GID table entry.
+ * ib_query_gid_chunk() fetches the specified GID table enties chunk.
*/
-int ib_query_gid(struct ib_device *device,
- u8 port_num, int index, union ib_gid *gid)
+int ib_query_gid_chunk(struct ib_device *device,
+ u8 port_num, int index, union ib_gid gid[8])
{
- return device->query_gid(device, port_num, index, gid);
+ return device->query_gid_chunk(device, port_num, index, gid);
}
/**
- * ib_query_pkey - Get P_Key table entry
+ * ib_query_pkey_chunk - Get a chunk of P_Key table entries
* @device:Device to query
* @port_num:Port number to query
* @index:P_Key table index to query
- * @pkey:Returned P_Key
+ * @pkey:Returned P_Keys chunk
*
- * ib_query_pkey() fetches the specified P_Key table entry.
+ * ib_query_pkey_chunk() fetches the specified P_Key table entries chunk.
*/
-int ib_query_pkey(struct ib_device *device,
- u8 port_num, u16 index, u16 *pkey)
+int ib_query_pkey_chunk(struct ib_device *device,
+ u8 port_num, u16 index, u16 pkey[32])
{
- return device->query_pkey(device, port_num, index, pkey);
+ return device->query_pkey_chunk(device, port_num, index, pkey);
}
return err;
}
-int mthca_query_pkey(struct ib_device *ibdev,
- u8 port, u16 index, u16 *pkey)
+int mthca_query_pkey_chunk(struct ib_device *ibdev,
+ u8 port, u16 index, u16 pkey[32])
{
struct ib_smp *in_mad = NULL;
struct ib_smp *out_mad = NULL;
goto out;
}
- *pkey = cl_ntoh16(((__be16 *) out_mad->data)[index % 32]);
+ { // copy the results
+ int i;
+ __be16 *pkey_chunk = (__be16 *)out_mad->data;
+ for (i=0; i<32; ++i)
+ pkey[i] = cl_ntoh16(pkey_chunk[i]);
+ }
out:
kfree(in_mad);
return err;
}
-int mthca_query_gid(struct ib_device *ibdev, u8 port,
- int index, union ib_gid *gid)
+int mthca_query_gid_chunk(struct ib_device *ibdev, u8 port,
+ int index, union ib_gid gid[8])
{
struct ib_smp *in_mad = NULL;
struct ib_smp *out_mad = NULL;
int err = -ENOMEM;
u8 status;
+ __be64 subnet_prefix;
in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
goto out;
}
- memcpy(gid->raw, out_mad->data + 8, 8);
+ memcpy(&subnet_prefix, out_mad->data + 8, 8);
init_query_mad(in_mad);
in_mad->attr_id = IB_SMP_ATTR_GUID_INFO;
goto out;
}
- memcpy(gid->raw + 8, out_mad->data + (index % 8) * 16, 8);
+ { // copy the results
+ int i;
+ __be64 *guid = (__be64 *)out_mad->data;
+ for (i=0; i<8; ++i) {
+ gid[i].global.subnet_prefix = subnet_prefix;
+ gid[i].global.interface_id = guid[i];
+ }
+ }
out:
kfree(in_mad);
dev->ib_dev.query_device = mthca_query_device;
dev->ib_dev.query_port = mthca_query_port;
dev->ib_dev.modify_port = mthca_modify_port;
- dev->ib_dev.query_pkey = mthca_query_pkey;
- dev->ib_dev.query_gid = mthca_query_gid;
+ dev->ib_dev.query_pkey_chunk = mthca_query_pkey_chunk;
+ dev->ib_dev.query_gid_chunk = mthca_query_gid_chunk;
dev->ib_dev.alloc_ucontext = mthca_alloc_ucontext;
dev->ib_dev.dealloc_ucontext = mthca_dealloc_ucontext;
dev->ib_dev.alloc_pd = mthca_alloc_pd;
u8 port, int port_modify_mask,
struct ib_port_modify *props);
-int mthca_query_pkey(struct ib_device *ibdev,
- u8 port, u16 index, u16 *pkey);
+int mthca_query_pkey_chunk(struct ib_device *ibdev,
+ u8 port, u16 index, u16 pkey[32]);
-int mthca_query_gid(struct ib_device *ibdev, u8 port,
- int index, union ib_gid *gid);
+int mthca_query_gid_chunk(struct ib_device *ibdev, u8 port,
+ int index, union ib_gid gid[8]);
struct ib_ucontext *mthca_alloc_ucontext(struct ib_device *ibdev,
ci_umv_buf_t* const p_umv_buf);