Lines Matching refs:cache

48 /* TX policy cache implementation					*/
216 static int tx_policy_find(struct tx_policy_cache *cache,
220 * the cache.
225 list_for_each_entry(it, &cache->used, link) {
227 return it - cache->cache;
230 list_for_each_entry(it, &cache->free, link) {
232 return it - cache->cache;
237 static inline void tx_policy_use(struct tx_policy_cache *cache,
241 list_move(&entry->link, &cache->used);
244 static inline int tx_policy_release(struct tx_policy_cache *cache,
249 list_move(&entry->link, &cache->free);
256 struct tx_policy_cache *cache = &priv->tx_policy_cache;
260 spin_lock_bh(&cache->lock);
261 locked = list_empty(&cache->free);
264 entry = &cache->cache[idx];
270 list_move(&entry->link, &cache->free);
278 spin_unlock_bh(&cache->lock);
282 /* External TX policy cache API */
286 struct tx_policy_cache *cache = &priv->tx_policy_cache;
289 memset(cache, 0, sizeof(*cache));
291 spin_lock_init(&cache->lock);
292 INIT_LIST_HEAD(&cache->used);
293 INIT_LIST_HEAD(&cache->free);
296 list_add(&cache->cache[i].link, &cache->free);
304 struct tx_policy_cache *cache = &priv->tx_policy_cache;
309 spin_lock_bh(&cache->lock);
310 if (WARN_ON_ONCE(list_empty(&cache->free))) {
311 spin_unlock_bh(&cache->lock);
314 idx = tx_policy_find(cache, &wanted);
324 entry = list_entry(cache->free.prev,
327 idx = entry - cache->cache;
331 tx_policy_use(cache, &cache->cache[idx]);
332 if (list_empty(&cache->free)) {
336 spin_unlock_bh(&cache->lock);
343 struct tx_policy_cache *cache = &priv->tx_policy_cache;
345 spin_lock_bh(&cache->lock);
346 locked = list_empty(&cache->free);
347 usage = tx_policy_release(cache, &cache->cache[idx]);
352 spin_unlock_bh(&cache->lock);
357 struct tx_policy_cache *cache = &priv->tx_policy_cache;
362 spin_lock_bh(&cache->lock);
366 struct tx_policy *src = &cache->cache[i].policy;
382 spin_unlock_bh(&cache->lock);