Lines Matching refs:cache

77 	struct ib_gid_cache *cache;
84 read_lock_irqsave(&device->cache.lock, flags);
86 cache = device->cache.gid_cache[port_num - start_port(device)];
88 if (index < 0 || index >= cache->table_len)
91 *gid = cache->table[index];
93 read_unlock_irqrestore(&device->cache.lock, flags);
104 struct ib_gid_cache *cache;
113 read_lock_irqsave(&device->cache.lock, flags);
116 cache = device->cache.gid_cache[p];
117 for (i = 0; i < cache->table_len; ++i) {
118 if (!memcmp(gid, &cache->table[i], sizeof *gid)) {
128 read_unlock_irqrestore(&device->cache.lock, flags);
139 struct ib_pkey_cache *cache;
146 read_lock_irqsave(&device->cache.lock, flags);
148 cache = device->cache.pkey_cache[port_num - start_port(device)];
150 if (index < 0 || index >= cache->table_len)
153 *pkey = cache->table[index];
155 read_unlock_irqrestore(&device->cache.lock, flags);
166 struct ib_pkey_cache *cache;
175 read_lock_irqsave(&device->cache.lock, flags);
177 cache = device->cache.pkey_cache[port_num - start_port(device)];
181 for (i = 0; i < cache->table_len; ++i)
182 if ((cache->table[i] & 0x7fff) == (pkey & 0x7fff)) {
183 if (cache->table[i] & 0x8000) {
196 read_unlock_irqrestore(&device->cache.lock, flags);
207 struct ib_pkey_cache *cache;
215 read_lock_irqsave(&device->cache.lock, flags);
217 cache = device->cache.pkey_cache[port_num - start_port(device)];
221 for (i = 0; i < cache->table_len; ++i)
222 if (cache->table[i] == pkey) {
228 read_unlock_irqrestore(&device->cache.lock, flags);
244 read_lock_irqsave(&device->cache.lock, flags);
245 *lmc = device->cache.lmc_cache[port_num - start_port(device)];
246 read_unlock_irqrestore(&device->cache.lock, flags);
304 write_lock_irq(&device->cache.lock);
306 old_pkey_cache = device->cache.pkey_cache[port - start_port(device)];
307 old_gid_cache = device->cache.gid_cache [port - start_port(device)];
309 device->cache.pkey_cache[port - start_port(device)] = pkey_cache;
310 device->cache.gid_cache [port - start_port(device)] = gid_cache;
312 device->cache.lmc_cache[port - start_port(device)] = tprops->lmc;
314 write_unlock_irq(&device->cache.lock);
362 rwlock_init(&device->cache.lock);
364 device->cache.pkey_cache =
365 kmalloc(sizeof *device->cache.pkey_cache *
367 device->cache.gid_cache =
368 kmalloc(sizeof *device->cache.gid_cache *
371 device->cache.lmc_cache = kmalloc(sizeof *device->cache.lmc_cache *
376 if (!device->cache.pkey_cache || !device->cache.gid_cache ||
377 !device->cache.lmc_cache) {
378 printk(KERN_WARNING "Couldn't allocate cache "
384 device->cache.pkey_cache[p] = NULL;
385 device->cache.gid_cache [p] = NULL;
389 INIT_IB_EVENT_HANDLER(&device->cache.event_handler,
391 if (ib_register_event_handler(&device->cache.event_handler))
398 kfree(device->cache.pkey_cache[p]);
399 kfree(device->cache.gid_cache[p]);
403 kfree(device->cache.pkey_cache);
404 kfree(device->cache.gid_cache);
405 kfree(device->cache.lmc_cache);
412 ib_unregister_event_handler(&device->cache.event_handler);
416 kfree(device->cache.pkey_cache[p]);
417 kfree(device->cache.gid_cache[p]);
420 kfree(device->cache.pkey_cache);
421 kfree(device->cache.gid_cache);
422 kfree(device->cache.lmc_cache);
426 .name = "cache",