Lines Matching defs:cache

45 /* TX policy cache implementation					*/
213 static int tx_policy_find(struct tx_policy_cache *cache,
217 * the cache.
222 list_for_each_entry(it, &cache->used, link) {
224 return it - cache->cache;
227 list_for_each_entry(it, &cache->free, link) {
229 return it - cache->cache;
234 static inline void tx_policy_use(struct tx_policy_cache *cache,
238 list_move(&entry->link, &cache->used);
241 static inline int tx_policy_release(struct tx_policy_cache *cache,
246 list_move(&entry->link, &cache->free);
253 struct tx_policy_cache *cache = &priv->tx_policy_cache;
257 spin_lock_bh(&cache->lock);
258 locked = list_empty(&cache->free);
261 entry = &cache->cache[idx];
267 list_move(&entry->link, &cache->free);
275 spin_unlock_bh(&cache->lock);
279 /* External TX policy cache API */
283 struct tx_policy_cache *cache = &priv->tx_policy_cache;
286 memset(cache, 0, sizeof(*cache));
288 spin_lock_init(&cache->lock);
289 INIT_LIST_HEAD(&cache->used);
290 INIT_LIST_HEAD(&cache->free);
293 list_add(&cache->cache[i].link, &cache->free);
301 struct tx_policy_cache *cache = &priv->tx_policy_cache;
306 spin_lock_bh(&cache->lock);
307 if (WARN_ON_ONCE(list_empty(&cache->free))) {
308 spin_unlock_bh(&cache->lock);
311 idx = tx_policy_find(cache, &wanted);
321 entry = list_entry(cache->free.prev,
324 idx = entry - cache->cache;
328 tx_policy_use(cache, &cache->cache[idx]);
329 if (list_empty(&cache->free)) {
333 spin_unlock_bh(&cache->lock);
340 struct tx_policy_cache *cache = &priv->tx_policy_cache;
342 spin_lock_bh(&cache->lock);
343 locked = list_empty(&cache->free);
344 usage = tx_policy_release(cache, &cache->cache[idx]);
349 spin_unlock_bh(&cache->lock);
354 struct tx_policy_cache *cache = &priv->tx_policy_cache;
359 spin_lock_bh(&cache->lock);
363 struct tx_policy *src = &cache->cache[i].policy;
379 spin_unlock_bh(&cache->lock);