• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/net/wireless/iwmc3200wifi/

Lines Matching defs:iwm

40  * iwm Tx theory of operation:
72 #include "iwm.h"
101 static bool iwm_tx_credit_ok(struct iwm_priv *iwm, int id, int nb)
105 if (npages <= iwm_tx_credit_get(&iwm->tx_credit, id))
108 set_bit(id, &iwm->tx_credit.full_pools_map);
110 IWM_DBG_TX(iwm, DBG, "LINK: stop txq[%d], available credit: %d\n",
112 iwm_tx_credit_get(&iwm->tx_credit, id));
117 void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages)
126 pool = &iwm->tx_credit.pools[id];
127 spool = &iwm->tx_credit.spools[pool->sid];
130 IWM_DBG_TX(iwm, DBG, "Free %d pages for pool[%d]\n", freed_pages, id);
133 IWM_DBG_TX(iwm, DBG, "No pages are freed by UMAC\n");
147 IWM_DBG_TX(iwm, DBG, "Pool[%d] pages alloc: %d, total_freed: %d, "
151 if (test_bit(id, &iwm->tx_credit.full_pools_map) &&
153 clear_bit(id, &iwm->tx_credit.full_pools_map);
157 IWM_DBG_TX(iwm, DBG, "LINK: start txq[%d], available "
159 iwm_tx_credit_get(&iwm->tx_credit, id));
160 queue_work(iwm->txq[queue].wq, &iwm->txq[queue].worker);
164 static void iwm_tx_credit_dec(struct iwm_priv *iwm, int id, int alloc_pages)
170 IWM_DBG_TX(iwm, DBG, "Allocate %d pages for pool[%d]\n",
175 pool = &iwm->tx_credit.pools[id];
176 spool = &iwm->tx_credit.spools[pool->sid];
187 IWM_DBG_TX(iwm, DBG, "Pool[%d] pages alloc: %d, total_freed: %d, "
192 int iwm_tx_credit_alloc(struct iwm_priv *iwm, int id, int nb)
197 spin_lock(&iwm->tx_credit.lock);
199 if (!iwm_tx_credit_ok(iwm, id, nb)) {
200 IWM_DBG_TX(iwm, DBG, "No credit avaliable for pool[%d]\n", id);
205 iwm_tx_credit_dec(iwm, id, npages);
208 spin_unlock(&iwm->tx_credit.lock);
248 void iwm_tx_credit_init_pools(struct iwm_priv *iwm,
253 spin_lock(&iwm->tx_credit.lock);
255 iwm->tx_credit.pool_nr = le16_to_cpu(alive->page_grp_count);
256 iwm->tx_credit.full_pools_map = 0;
257 memset(&iwm->tx_credit.spools[0], 0, sizeof(struct spool_entry));
259 IWM_DBG_TX(iwm, DBG, "Pools number is %d\n", iwm->tx_credit.pool_nr);
261 for (i = 0; i < iwm->tx_credit.pool_nr; i++) {
264 iwm->tx_credit.pools[i].id = GET_VAL32(page_grp_state,
266 iwm->tx_credit.pools[i].sid = GET_VAL32(page_grp_state,
268 iwm->tx_credit.pools[i].min_pages = GET_VAL32(page_grp_state,
270 iwm->tx_credit.pools[i].max_pages = GET_VAL32(page_grp_state,
272 iwm->tx_credit.pools[i].alloc_pages = 0;
273 iwm->tx_credit.pools[i].total_freed_pages = 0;
275 sid = iwm->tx_credit.pools[i].sid;
276 pool_pages = iwm->tx_credit.pools[i].min_pages;
278 if (iwm->tx_credit.spools[sid].max_pages == 0) {
279 iwm->tx_credit.spools[sid].id = sid;
280 iwm->tx_credit.spools[sid].max_pages =
283 iwm->tx_credit.spools[sid].alloc_pages = 0;
286 iwm->tx_credit.spools[sid].alloc_pages += pool_pages;
288 IWM_DBG_TX(iwm, DBG, "Pool idx: %d, id: %d, sid: %d, capacity "
291 i, iwm->tx_credit.pools[i].id,
292 iwm->tx_credit.pools[i].sid,
293 iwm->tx_credit.pools[i].min_pages,
294 iwm->tx_credit.pools[i].max_pages,
295 iwm->tx_credit.pools[i].alloc_pages,
296 iwm->tx_credit.pools[i].total_freed_pages,
297 iwm->tx_credit.spools[sid].alloc_pages);
300 spin_unlock(&iwm->tx_credit.lock);
305 static __le16 iwm_tx_build_packet(struct iwm_priv *iwm, struct sk_buff *skb,
326 umac_cmd.seq_num = cpu_to_le16(iwm_alloc_wifi_cmd_seq(iwm));
328 iwm_build_udma_wifi_hdr(iwm, &hdr->hw_hdr, &udma_cmd);
329 iwm_build_umac_hdr(iwm, &hdr->sw_hdr, &umac_cmd);
336 static int iwm_tx_send_concat_packets(struct iwm_priv *iwm,
344 IWM_DBG_TX(iwm, DBG, "Send concatenated Tx: queue %d, %d bytes\n",
348 iwm_udma_wifi_hdr_set_eop(iwm, txq->concat_ptr, 1);
350 trace_iwm_tx_packets(iwm, txq->concat_buf, txq->concat_count);
351 ret = iwm_bus_send_chunk(iwm, txq->concat_buf, txq->concat_count);
361 struct iwm_priv *iwm;
370 iwm = container_of(txq, struct iwm_priv, txq[txq->id]);
374 while (!test_bit(pool_id, &iwm->tx_credit.full_pools_map) &&
382 sta_info = &iwm->sta_table[tx_info->sta];
384 IWM_ERR(iwm, "Trying to send a frame to unknown STA\n");
401 IWM_DBG_TX(iwm, DBG, "%dx%d stopped\n",
413 IWM_DBG_TX(iwm, DBG, "Tx frame on queue %d: skb: 0x%p, sta: "
418 iwm_tx_send_concat_packets(iwm, txq);
420 ret = iwm_tx_credit_alloc(iwm, pool_id, cmdlen);
422 IWM_DBG_TX(iwm, DBG, "not enough tx_credit for queue "
434 iwm_tx_build_packet(iwm, skb, pool_id, txq->concat_ptr);
442 iwm_tx_send_concat_packets(iwm, txq);
444 if (__netif_subqueue_stopped(iwm_to_ndev(iwm), txq->id) &&
445 !test_bit(pool_id, &iwm->tx_credit.full_pools_map) &&
447 IWM_DBG_TX(iwm, DBG, "LINK: start netif_subqueue[%d]", txq->id);
448 netif_wake_subqueue(iwm_to_ndev(iwm), txq->id);
454 struct iwm_priv *iwm = ndev_to_iwm(netdev);
455 struct wireless_dev *wdev = iwm_to_wdev(iwm);
464 if (!test_bit(IWM_STATUS_ASSOCIATED, &iwm->status)) {
465 IWM_DBG_TX(iwm, DBG, "LINK: stop netif_all_queues: "
474 txq = &iwm->txq[queue];
479 IWM_DBG_TX(iwm, DBG, "LINK: stop netif_subqueue[%d]\n", queue);
485 iwm->bssid, 0);
487 IWM_ERR(iwm, "build wifi header failed\n");
494 sta_info = &iwm->sta_table[sta_id];
501 IWM_ERR(iwm, "STA %pM not found in sta_table, Tx ignored\n",
515 spin_lock_bh(&iwm->txq[queue].lock);
516 skb_queue_tail(&iwm->txq[queue].queue, skb);
517 spin_unlock_bh(&iwm->txq[queue].lock);
519 queue_work(iwm->txq[queue].wq, &iwm->txq[queue].worker);