• Home
  • Raw
  • Download

Lines Matching refs:q

154 static inline struct sge_qset *fl_to_qset(const struct sge_fl *q, int qidx)  in fl_to_qset()  argument
156 return container_of(q, struct sge_qset, fl[qidx]); in fl_to_qset()
159 static inline struct sge_qset *rspq_to_qset(const struct sge_rspq *q) in rspq_to_qset() argument
161 return container_of(q, struct sge_qset, rspq); in rspq_to_qset()
164 static inline struct sge_qset *txq_to_qset(const struct sge_txq *q, int qidx) in txq_to_qset() argument
166 return container_of(q, struct sge_qset, txq[qidx]); in txq_to_qset()
179 const struct sge_rspq *q, unsigned int credits) in refill_rspq() argument
183 V_RSPQ(q->cntxt_id) | V_CREDITS(credits)); in refill_rspq()
227 static inline void unmap_skb(struct sk_buff *skb, struct sge_txq *q, in unmap_skb() argument
231 struct tx_sw_desc *d = &q->sdesc[cidx]; in unmap_skb()
234 sgp = (struct sg_ent *)&q->desc[cidx].flit[d->sflit]; in unmap_skb()
260 d = cidx + 1 == q->size ? q->sdesc : d + 1; in unmap_skb()
276 static void free_tx_desc(struct adapter *adapter, struct sge_txq *q, in free_tx_desc() argument
281 unsigned int cidx = q->cidx; in free_tx_desc()
284 q->cntxt_id >= FW_TUNNEL_SGEEC_START; in free_tx_desc()
286 d = &q->sdesc[cidx]; in free_tx_desc()
290 unmap_skb(d->skb, q, cidx, pdev); in free_tx_desc()
295 if (++cidx == q->size) { in free_tx_desc()
297 d = q->sdesc; in free_tx_desc()
300 q->cidx = cidx; in free_tx_desc()
313 struct sge_txq *q) in reclaim_completed_tx() argument
315 unsigned int reclaim = q->processed - q->cleaned; in reclaim_completed_tx()
318 free_tx_desc(adapter, q, reclaim); in reclaim_completed_tx()
319 q->cleaned += reclaim; in reclaim_completed_tx()
320 q->in_use -= reclaim; in reclaim_completed_tx()
330 static inline int should_restart_tx(const struct sge_txq *q) in should_restart_tx() argument
332 unsigned int r = q->processed - q->cleaned; in should_restart_tx()
334 return q->in_use - r < (q->size >> 1); in should_restart_tx()
345 static void free_rx_bufs(struct pci_dev *pdev, struct sge_fl *q) in free_rx_bufs() argument
347 unsigned int cidx = q->cidx; in free_rx_bufs()
349 while (q->credits--) { in free_rx_bufs()
350 struct rx_sw_desc *d = &q->sdesc[cidx]; in free_rx_bufs()
353 q->buf_size, PCI_DMA_FROMDEVICE); in free_rx_bufs()
354 if (q->use_pages) { in free_rx_bufs()
362 if (++cidx == q->size) in free_rx_bufs()
366 if (q->pg_chunk.page) { in free_rx_bufs()
367 __free_pages(q->pg_chunk.page, q->order); in free_rx_bufs()
368 q->pg_chunk.page = NULL; in free_rx_bufs()
404 static int alloc_pg_chunk(struct sge_fl *q, struct rx_sw_desc *sd, gfp_t gfp, in alloc_pg_chunk() argument
407 if (!q->pg_chunk.page) { in alloc_pg_chunk()
408 q->pg_chunk.page = alloc_pages(gfp, order); in alloc_pg_chunk()
409 if (unlikely(!q->pg_chunk.page)) in alloc_pg_chunk()
411 q->pg_chunk.va = page_address(q->pg_chunk.page); in alloc_pg_chunk()
412 q->pg_chunk.offset = 0; in alloc_pg_chunk()
414 sd->pg_chunk = q->pg_chunk; in alloc_pg_chunk()
416 q->pg_chunk.offset += q->buf_size; in alloc_pg_chunk()
417 if (q->pg_chunk.offset == (PAGE_SIZE << order)) in alloc_pg_chunk()
418 q->pg_chunk.page = NULL; in alloc_pg_chunk()
420 q->pg_chunk.va += q->buf_size; in alloc_pg_chunk()
421 get_page(q->pg_chunk.page); in alloc_pg_chunk()
437 static int refill_fl(struct adapter *adap, struct sge_fl *q, int n, gfp_t gfp) in refill_fl() argument
440 struct rx_sw_desc *sd = &q->sdesc[q->pidx]; in refill_fl()
441 struct rx_desc *d = &q->desc[q->pidx]; in refill_fl()
447 if (q->use_pages) { in refill_fl()
448 if (unlikely(alloc_pg_chunk(q, sd, gfp, q->order))) { in refill_fl()
449 nomem: q->alloc_failed++; in refill_fl()
454 struct sk_buff *skb = alloc_skb(q->buf_size, gfp); in refill_fl()
463 err = add_one_rx_buf(buf_start, q->buf_size, d, sd, q->gen, in refill_fl()
466 if (!q->use_pages) { in refill_fl()
475 if (++q->pidx == q->size) { in refill_fl()
476 q->pidx = 0; in refill_fl()
477 q->gen ^= 1; in refill_fl()
478 sd = q->sdesc; in refill_fl()
479 d = q->desc; in refill_fl()
481 q->credits++; in refill_fl()
486 t3_write_reg(adap, A_SG_KDOORBELL, V_EGRCNTX(q->cntxt_id)); in refill_fl()
506 static void recycle_rx_buf(struct adapter *adap, struct sge_fl *q, in recycle_rx_buf() argument
509 struct rx_desc *from = &q->desc[idx]; in recycle_rx_buf()
510 struct rx_desc *to = &q->desc[q->pidx]; in recycle_rx_buf()
512 q->sdesc[q->pidx] = q->sdesc[idx]; in recycle_rx_buf()
516 to->len_gen = cpu_to_be32(V_FLD_GEN1(q->gen)); in recycle_rx_buf()
517 to->gen2 = cpu_to_be32(V_FLD_GEN2(q->gen)); in recycle_rx_buf()
518 q->credits++; in recycle_rx_buf()
520 if (++q->pidx == q->size) { in recycle_rx_buf()
521 q->pidx = 0; in recycle_rx_buf()
522 q->gen ^= 1; in recycle_rx_buf()
524 t3_write_reg(adap, A_SG_KDOORBELL, V_EGRCNTX(q->cntxt_id)); in recycle_rx_buf()
574 static void t3_reset_qset(struct sge_qset *q) in t3_reset_qset() argument
576 if (q->adap && in t3_reset_qset()
577 !(q->adap->flags & NAPI_INIT)) { in t3_reset_qset()
578 memset(q, 0, sizeof(*q)); in t3_reset_qset()
582 q->adap = NULL; in t3_reset_qset()
583 memset(&q->rspq, 0, sizeof(q->rspq)); in t3_reset_qset()
584 memset(q->fl, 0, sizeof(struct sge_fl) * SGE_RXQ_PER_SET); in t3_reset_qset()
585 memset(q->txq, 0, sizeof(struct sge_txq) * SGE_TXQ_PER_SET); in t3_reset_qset()
586 q->txq_stopped = 0; in t3_reset_qset()
587 q->tx_reclaim_timer.function = NULL; /* for t3_stop_sge_timers() */ in t3_reset_qset()
588 kfree(q->lro_frag_tbl); in t3_reset_qset()
589 q->lro_nfrags = q->lro_frag_len = 0; in t3_reset_qset()
602 static void t3_free_qset(struct adapter *adapter, struct sge_qset *q) in t3_free_qset() argument
608 if (q->fl[i].desc) { in t3_free_qset()
610 t3_sge_disable_fl(adapter, q->fl[i].cntxt_id); in t3_free_qset()
612 free_rx_bufs(pdev, &q->fl[i]); in t3_free_qset()
613 kfree(q->fl[i].sdesc); in t3_free_qset()
615 q->fl[i].size * in t3_free_qset()
616 sizeof(struct rx_desc), q->fl[i].desc, in t3_free_qset()
617 q->fl[i].phys_addr); in t3_free_qset()
621 if (q->txq[i].desc) { in t3_free_qset()
623 t3_sge_enable_ecntxt(adapter, q->txq[i].cntxt_id, 0); in t3_free_qset()
625 if (q->txq[i].sdesc) { in t3_free_qset()
626 free_tx_desc(adapter, &q->txq[i], in t3_free_qset()
627 q->txq[i].in_use); in t3_free_qset()
628 kfree(q->txq[i].sdesc); in t3_free_qset()
631 q->txq[i].size * in t3_free_qset()
633 q->txq[i].desc, q->txq[i].phys_addr); in t3_free_qset()
634 __skb_queue_purge(&q->txq[i].sendq); in t3_free_qset()
637 if (q->rspq.desc) { in t3_free_qset()
639 t3_sge_disable_rspcntxt(adapter, q->rspq.cntxt_id); in t3_free_qset()
642 q->rspq.size * sizeof(struct rsp_desc), in t3_free_qset()
643 q->rspq.desc, q->rspq.phys_addr); in t3_free_qset()
646 t3_reset_qset(q); in t3_free_qset()
767 struct sge_rspq *q, unsigned int len, in get_packet_pg() argument
773 newskb = skb = q->pg_skb; in get_packet_pg()
791 q->rx_recycle_buf++; in get_packet_pg()
795 if (unlikely(q->rx_recycle_buf || (!skb && fl->credits <= drop_thres))) in get_packet_pg()
925 static inline void check_ring_tx_db(struct adapter *adap, struct sge_txq *q) in check_ring_tx_db() argument
928 clear_bit(TXQ_LAST_PKT_DB, &q->flags); in check_ring_tx_db()
929 if (test_and_set_bit(TXQ_RUNNING, &q->flags) == 0) { in check_ring_tx_db()
930 set_bit(TXQ_LAST_PKT_DB, &q->flags); in check_ring_tx_db()
932 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); in check_ring_tx_db()
937 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); in check_ring_tx_db()
969 const struct sge_txq *q, in write_wr_hdr_sgl() argument
976 struct tx_sw_desc *sd = &q->sdesc[pidx]; in write_wr_hdr_sgl()
1016 if (++pidx == q->size) { in write_wr_hdr_sgl()
1019 d = q->desc; in write_wr_hdr_sgl()
1020 sd = q->sdesc; in write_wr_hdr_sgl()
1058 struct sge_txq *q, unsigned int ndesc, in write_tx_pkt_wr() argument
1063 struct tx_desc *d = &q->desc[pidx]; in write_tx_pkt_wr()
1094 q->sdesc[pidx].skb = NULL; in write_tx_pkt_wr()
1107 V_WR_TID(q->token)); in write_tx_pkt_wr()
1119 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, in write_tx_pkt_wr()
1121 htonl(V_WR_TID(q->token))); in write_tx_pkt_wr()
1125 struct sge_qset *qs, struct sge_txq *q) in t3_stop_tx_queue() argument
1129 q->stops++; in t3_stop_tx_queue()
1147 struct sge_txq *q; in t3_eth_xmit() local
1160 q = &qs->txq[TXQ_ETH]; in t3_eth_xmit()
1163 spin_lock(&q->lock); in t3_eth_xmit()
1164 reclaim_completed_tx(adap, q); in t3_eth_xmit()
1166 credits = q->size - q->in_use; in t3_eth_xmit()
1170 t3_stop_tx_queue(txq, qs, q); in t3_eth_xmit()
1173 dev->name, q->cntxt_id & 7); in t3_eth_xmit()
1174 spin_unlock(&q->lock); in t3_eth_xmit()
1178 q->in_use += ndesc; in t3_eth_xmit()
1179 if (unlikely(credits - ndesc < q->stop_thres)) { in t3_eth_xmit()
1180 t3_stop_tx_queue(txq, qs, q); in t3_eth_xmit()
1182 if (should_restart_tx(q) && in t3_eth_xmit()
1184 q->restarts++; in t3_eth_xmit()
1189 gen = q->gen; in t3_eth_xmit()
1190 q->unacked += ndesc; in t3_eth_xmit()
1191 compl = (q->unacked & 8) << (S_WR_COMPL - 3); in t3_eth_xmit()
1192 q->unacked &= 7; in t3_eth_xmit()
1193 pidx = q->pidx; in t3_eth_xmit()
1194 q->pidx += ndesc; in t3_eth_xmit()
1195 if (q->pidx >= q->size) { in t3_eth_xmit()
1196 q->pidx -= q->size; in t3_eth_xmit()
1197 q->gen ^= 1; in t3_eth_xmit()
1209 spin_unlock(&q->lock); in t3_eth_xmit()
1238 write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl); in t3_eth_xmit()
1239 check_ring_tx_db(adap, q); in t3_eth_xmit()
1293 static inline int check_desc_avail(struct adapter *adap, struct sge_txq *q, in check_desc_avail() argument
1297 if (unlikely(!skb_queue_empty(&q->sendq))) { in check_desc_avail()
1298 addq_exit:__skb_queue_tail(&q->sendq, skb); in check_desc_avail()
1301 if (unlikely(q->size - q->in_use < ndesc)) { in check_desc_avail()
1302 struct sge_qset *qs = txq_to_qset(q, qid); in check_desc_avail()
1307 if (should_restart_tx(q) && in check_desc_avail()
1311 q->stops++; in check_desc_avail()
1325 static inline void reclaim_completed_tx_imm(struct sge_txq *q) in reclaim_completed_tx_imm() argument
1327 unsigned int reclaim = q->processed - q->cleaned; in reclaim_completed_tx_imm()
1329 q->in_use -= reclaim; in reclaim_completed_tx_imm()
1330 q->cleaned += reclaim; in reclaim_completed_tx_imm()
1348 static int ctrl_xmit(struct adapter *adap, struct sge_txq *q, in ctrl_xmit() argument
1361 wrp->wr_lo = htonl(V_WR_TID(q->token)); in ctrl_xmit()
1363 spin_lock(&q->lock); in ctrl_xmit()
1364 again:reclaim_completed_tx_imm(q); in ctrl_xmit()
1366 ret = check_desc_avail(adap, q, skb, 1, TXQ_CTRL); in ctrl_xmit()
1369 spin_unlock(&q->lock); in ctrl_xmit()
1375 write_imm(&q->desc[q->pidx], skb, skb->len, q->gen); in ctrl_xmit()
1377 q->in_use++; in ctrl_xmit()
1378 if (++q->pidx >= q->size) { in ctrl_xmit()
1379 q->pidx = 0; in ctrl_xmit()
1380 q->gen ^= 1; in ctrl_xmit()
1382 spin_unlock(&q->lock); in ctrl_xmit()
1385 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); in ctrl_xmit()
1399 struct sge_txq *q = &qs->txq[TXQ_CTRL]; in restart_ctrlq() local
1401 spin_lock(&q->lock); in restart_ctrlq()
1402 again:reclaim_completed_tx_imm(q); in restart_ctrlq()
1404 while (q->in_use < q->size && in restart_ctrlq()
1405 (skb = __skb_dequeue(&q->sendq)) != NULL) { in restart_ctrlq()
1407 write_imm(&q->desc[q->pidx], skb, skb->len, q->gen); in restart_ctrlq()
1409 if (++q->pidx >= q->size) { in restart_ctrlq()
1410 q->pidx = 0; in restart_ctrlq()
1411 q->gen ^= 1; in restart_ctrlq()
1413 q->in_use++; in restart_ctrlq()
1416 if (!skb_queue_empty(&q->sendq)) { in restart_ctrlq()
1420 if (should_restart_tx(q) && in restart_ctrlq()
1423 q->stops++; in restart_ctrlq()
1426 spin_unlock(&q->lock); in restart_ctrlq()
1429 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); in restart_ctrlq()
1503 struct sge_txq *q, unsigned int pidx, in write_ofld_wr() argument
1509 struct tx_desc *d = &q->desc[pidx]; in write_ofld_wr()
1512 q->sdesc[pidx].skb = NULL; in write_ofld_wr()
1533 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, in write_ofld_wr()
1566 static int ofld_xmit(struct adapter *adap, struct sge_txq *q, in ofld_xmit() argument
1572 spin_lock(&q->lock); in ofld_xmit()
1573 again:reclaim_completed_tx(adap, q); in ofld_xmit()
1575 ret = check_desc_avail(adap, q, skb, ndesc, TXQ_OFLD); in ofld_xmit()
1579 spin_unlock(&q->lock); in ofld_xmit()
1585 gen = q->gen; in ofld_xmit()
1586 q->in_use += ndesc; in ofld_xmit()
1587 pidx = q->pidx; in ofld_xmit()
1588 q->pidx += ndesc; in ofld_xmit()
1589 if (q->pidx >= q->size) { in ofld_xmit()
1590 q->pidx -= q->size; in ofld_xmit()
1591 q->gen ^= 1; in ofld_xmit()
1593 spin_unlock(&q->lock); in ofld_xmit()
1595 write_ofld_wr(adap, skb, q, pidx, gen, ndesc); in ofld_xmit()
1596 check_ring_tx_db(adap, q); in ofld_xmit()
1610 struct sge_txq *q = &qs->txq[TXQ_OFLD]; in restart_offloadq() local
1614 spin_lock(&q->lock); in restart_offloadq()
1615 again:reclaim_completed_tx(adap, q); in restart_offloadq()
1617 while ((skb = skb_peek(&q->sendq)) != NULL) { in restart_offloadq()
1621 if (unlikely(q->size - q->in_use < ndesc)) { in restart_offloadq()
1625 if (should_restart_tx(q) && in restart_offloadq()
1628 q->stops++; in restart_offloadq()
1632 gen = q->gen; in restart_offloadq()
1633 q->in_use += ndesc; in restart_offloadq()
1634 pidx = q->pidx; in restart_offloadq()
1635 q->pidx += ndesc; in restart_offloadq()
1636 if (q->pidx >= q->size) { in restart_offloadq()
1637 q->pidx -= q->size; in restart_offloadq()
1638 q->gen ^= 1; in restart_offloadq()
1640 __skb_unlink(skb, &q->sendq); in restart_offloadq()
1641 spin_unlock(&q->lock); in restart_offloadq()
1643 write_ofld_wr(adap, skb, q, pidx, gen, ndesc); in restart_offloadq()
1644 spin_lock(&q->lock); in restart_offloadq()
1646 spin_unlock(&q->lock); in restart_offloadq()
1649 set_bit(TXQ_RUNNING, &q->flags); in restart_offloadq()
1650 set_bit(TXQ_LAST_PKT_DB, &q->flags); in restart_offloadq()
1654 F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); in restart_offloadq()
1710 static inline void offload_enqueue(struct sge_rspq *q, struct sk_buff *skb) in offload_enqueue() argument
1712 int was_empty = skb_queue_empty(&q->rx_queue); in offload_enqueue()
1714 __skb_queue_tail(&q->rx_queue, skb); in offload_enqueue()
1717 struct sge_qset *qs = rspq_to_qset(q); in offload_enqueue()
1733 struct sge_rspq *q, in deliver_partial_bundle() argument
1737 q->offload_bundles++; in deliver_partial_bundle()
1756 struct sge_rspq *q = &qs->rspq; in ofld_poll() local
1765 spin_lock_irq(&q->lock); in ofld_poll()
1767 skb_queue_splice_init(&q->rx_queue, &queue); in ofld_poll()
1770 spin_unlock_irq(&q->lock); in ofld_poll()
1773 spin_unlock_irq(&q->lock); in ofld_poll()
1785 q->offload_bundles++; in ofld_poll()
1793 spin_lock_irq(&q->lock); in ofld_poll()
1794 skb_queue_splice(&queue, &q->rx_queue); in ofld_poll()
1795 spin_unlock_irq(&q->lock); in ofld_poll()
1797 deliver_partial_bundle(&adapter->tdev, q, skbs, ngathered); in ofld_poll()
2199 const struct sge_rspq *q) in is_new_response() argument
2201 return (r->intr_gen & F_RSPD_GEN2) == q->gen; in is_new_response()
2204 static inline void clear_rspq_bufstate(struct sge_rspq * const q) in clear_rspq_bufstate() argument
2206 q->pg_skb = NULL; in clear_rspq_bufstate()
2207 q->rx_recycle_buf = 0; in clear_rspq_bufstate()
2237 struct sge_rspq *q = &qs->rspq; in process_responses() local
2238 struct rsp_desc *r = &q->desc[q->cidx]; in process_responses()
2244 q->next_holdoff = q->holdoff_tmr; in process_responses()
2246 while (likely(budget_left && is_new_response(r, q))) { in process_responses()
2263 q->async_notif++; in process_responses()
2268 q->next_holdoff = NOMEM_INTR_DELAY; in process_responses()
2269 q->nomem++; in process_responses()
2274 q->imm_data++; in process_responses()
2297 skb = get_packet_pg(adap, fl, q, in process_responses()
2301 q->pg_skb = skb; in process_responses()
2308 q->rx_drops++; in process_responses()
2315 q->pure_rsps++; in process_responses()
2323 if (unlikely(++q->cidx == q->size)) { in process_responses()
2324 q->cidx = 0; in process_responses()
2325 q->gen ^= 1; in process_responses()
2326 r = q->desc; in process_responses()
2330 if (++q->credits >= (q->size / 4)) { in process_responses()
2331 refill_rspq(adap, q, q->credits); in process_responses()
2332 q->credits = 0; in process_responses()
2341 rx_eth(adap, q, skb, ethpad, lro); in process_responses()
2343 q->offload_pkts++; in process_responses()
2347 ngathered = rx_offload(&adap->tdev, q, skb, in process_responses()
2353 clear_rspq_bufstate(q); in process_responses()
2358 deliver_partial_bundle(&adap->tdev, q, offload_skbs, ngathered); in process_responses()
2444 struct sge_rspq *q = &qs->rspq; in process_pure_responses() local
2451 if (unlikely(++q->cidx == q->size)) { in process_pure_responses()
2452 q->cidx = 0; in process_pure_responses()
2453 q->gen ^= 1; in process_pure_responses()
2454 r = q->desc; in process_pure_responses()
2463 q->pure_rsps++; in process_pure_responses()
2464 if (++q->credits >= (q->size / 4)) { in process_pure_responses()
2465 refill_rspq(adap, q, q->credits); in process_pure_responses()
2466 q->credits = 0; in process_pure_responses()
2468 } while (is_new_response(r, q) && is_pure_response(r)); in process_pure_responses()
2477 return is_new_response(r, q); in process_pure_responses()
2495 static inline int handle_responses(struct adapter *adap, struct sge_rspq *q) in handle_responses() argument
2497 struct sge_qset *qs = rspq_to_qset(q); in handle_responses()
2498 struct rsp_desc *r = &q->desc[q->cidx]; in handle_responses()
2500 if (!is_new_response(r, q)) in handle_responses()
2503 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | in handle_responses()
2504 V_NEWTIMER(q->holdoff_tmr) | V_NEWINDEX(q->cidx)); in handle_responses()
2519 struct sge_rspq *q = &qs->rspq; in t3_sge_intr_msix() local
2521 spin_lock(&q->lock); in t3_sge_intr_msix()
2523 q->unhandled_irqs++; in t3_sge_intr_msix()
2524 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | in t3_sge_intr_msix()
2525 V_NEWTIMER(q->next_holdoff) | V_NEWINDEX(q->cidx)); in t3_sge_intr_msix()
2526 spin_unlock(&q->lock); in t3_sge_intr_msix()
2537 struct sge_rspq *q = &qs->rspq; in t3_sge_intr_msix_napi() local
2539 spin_lock(&q->lock); in t3_sge_intr_msix_napi()
2541 if (handle_responses(qs->adap, q) < 0) in t3_sge_intr_msix_napi()
2542 q->unhandled_irqs++; in t3_sge_intr_msix_napi()
2543 spin_unlock(&q->lock); in t3_sge_intr_msix_napi()
2557 struct sge_rspq *q = &adap->sge.qs[0].rspq; in t3_intr_msi() local
2559 spin_lock(&q->lock); in t3_intr_msi()
2562 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | in t3_intr_msi()
2563 V_NEWTIMER(q->next_holdoff) | V_NEWINDEX(q->cidx)); in t3_intr_msi()
2578 q->unhandled_irqs++; in t3_intr_msi()
2580 spin_unlock(&q->lock); in t3_intr_msi()
2586 struct sge_rspq *q = &qs->rspq; in rspq_check_napi() local
2589 is_new_response(&q->desc[q->cidx], q)) { in rspq_check_napi()
2607 struct sge_rspq *q = &adap->sge.qs[0].rspq; in t3_intr_msi_napi() local
2609 spin_lock(&q->lock); in t3_intr_msi_napi()
2615 q->unhandled_irqs++; in t3_intr_msi_napi()
2617 spin_unlock(&q->lock); in t3_intr_msi_napi()
2908 struct sge_qset *q = &adapter->sge.qs[id]; in t3_sge_alloc_qset() local
2909 struct net_lro_mgr *lro_mgr = &q->lro_mgr; in t3_sge_alloc_qset()
2911 init_qset_cntxt(q, id); in t3_sge_alloc_qset()
2912 setup_timer(&q->tx_reclaim_timer, sge_timer_cb, (unsigned long)q); in t3_sge_alloc_qset()
2914 q->fl[0].desc = alloc_ring(adapter->pdev, p->fl_size, in t3_sge_alloc_qset()
2917 &q->fl[0].phys_addr, &q->fl[0].sdesc); in t3_sge_alloc_qset()
2918 if (!q->fl[0].desc) in t3_sge_alloc_qset()
2921 q->fl[1].desc = alloc_ring(adapter->pdev, p->jumbo_size, in t3_sge_alloc_qset()
2924 &q->fl[1].phys_addr, &q->fl[1].sdesc); in t3_sge_alloc_qset()
2925 if (!q->fl[1].desc) in t3_sge_alloc_qset()
2928 q->rspq.desc = alloc_ring(adapter->pdev, p->rspq_size, in t3_sge_alloc_qset()
2930 &q->rspq.phys_addr, NULL); in t3_sge_alloc_qset()
2931 if (!q->rspq.desc) in t3_sge_alloc_qset()
2941 q->txq[i].desc = alloc_ring(adapter->pdev, p->txq_size[i], in t3_sge_alloc_qset()
2943 &q->txq[i].phys_addr, in t3_sge_alloc_qset()
2944 &q->txq[i].sdesc); in t3_sge_alloc_qset()
2945 if (!q->txq[i].desc) in t3_sge_alloc_qset()
2948 q->txq[i].gen = 1; in t3_sge_alloc_qset()
2949 q->txq[i].size = p->txq_size[i]; in t3_sge_alloc_qset()
2950 spin_lock_init(&q->txq[i].lock); in t3_sge_alloc_qset()
2951 skb_queue_head_init(&q->txq[i].sendq); in t3_sge_alloc_qset()
2954 tasklet_init(&q->txq[TXQ_OFLD].qresume_tsk, restart_offloadq, in t3_sge_alloc_qset()
2955 (unsigned long)q); in t3_sge_alloc_qset()
2956 tasklet_init(&q->txq[TXQ_CTRL].qresume_tsk, restart_ctrlq, in t3_sge_alloc_qset()
2957 (unsigned long)q); in t3_sge_alloc_qset()
2959 q->fl[0].gen = q->fl[1].gen = 1; in t3_sge_alloc_qset()
2960 q->fl[0].size = p->fl_size; in t3_sge_alloc_qset()
2961 q->fl[1].size = p->jumbo_size; in t3_sge_alloc_qset()
2963 q->rspq.gen = 1; in t3_sge_alloc_qset()
2964 q->rspq.size = p->rspq_size; in t3_sge_alloc_qset()
2965 spin_lock_init(&q->rspq.lock); in t3_sge_alloc_qset()
2966 skb_queue_head_init(&q->rspq.rx_queue); in t3_sge_alloc_qset()
2968 q->txq[TXQ_ETH].stop_thres = nports * in t3_sge_alloc_qset()
2972 q->fl[0].buf_size = FL0_PG_CHUNK_SIZE; in t3_sge_alloc_qset()
2974 q->fl[0].buf_size = SGE_RX_SM_BUF_SIZE + sizeof(struct cpl_rx_data); in t3_sge_alloc_qset()
2977 q->fl[1].buf_size = FL1_PG_CHUNK_SIZE; in t3_sge_alloc_qset()
2979 q->fl[1].buf_size = is_offload(adapter) ? in t3_sge_alloc_qset()
2984 q->fl[0].use_pages = FL0_PG_CHUNK_SIZE > 0; in t3_sge_alloc_qset()
2985 q->fl[1].use_pages = FL1_PG_CHUNK_SIZE > 0; in t3_sge_alloc_qset()
2986 q->fl[0].order = FL0_PG_ORDER; in t3_sge_alloc_qset()
2987 q->fl[1].order = FL1_PG_ORDER; in t3_sge_alloc_qset()
2989 q->lro_frag_tbl = kcalloc(MAX_FRAME_SIZE / FL1_PG_CHUNK_SIZE + 1, in t3_sge_alloc_qset()
2992 q->lro_nfrags = q->lro_frag_len = 0; in t3_sge_alloc_qset()
2996 ret = t3_sge_init_rspcntxt(adapter, q->rspq.cntxt_id, irq_vec_idx, in t3_sge_alloc_qset()
2997 q->rspq.phys_addr, q->rspq.size, in t3_sge_alloc_qset()
2998 q->fl[0].buf_size, 1, 0); in t3_sge_alloc_qset()
3003 ret = t3_sge_init_flcntxt(adapter, q->fl[i].cntxt_id, 0, in t3_sge_alloc_qset()
3004 q->fl[i].phys_addr, q->fl[i].size, in t3_sge_alloc_qset()
3005 q->fl[i].buf_size, p->cong_thres, 1, in t3_sge_alloc_qset()
3011 ret = t3_sge_init_ecntxt(adapter, q->txq[TXQ_ETH].cntxt_id, USE_GTS, in t3_sge_alloc_qset()
3012 SGE_CNTXT_ETH, id, q->txq[TXQ_ETH].phys_addr, in t3_sge_alloc_qset()
3013 q->txq[TXQ_ETH].size, q->txq[TXQ_ETH].token, in t3_sge_alloc_qset()
3019 ret = t3_sge_init_ecntxt(adapter, q->txq[TXQ_OFLD].cntxt_id, in t3_sge_alloc_qset()
3021 q->txq[TXQ_OFLD].phys_addr, in t3_sge_alloc_qset()
3022 q->txq[TXQ_OFLD].size, 0, 1, 0); in t3_sge_alloc_qset()
3028 ret = t3_sge_init_ecntxt(adapter, q->txq[TXQ_CTRL].cntxt_id, 0, in t3_sge_alloc_qset()
3030 q->txq[TXQ_CTRL].phys_addr, in t3_sge_alloc_qset()
3031 q->txq[TXQ_CTRL].size, in t3_sge_alloc_qset()
3032 q->txq[TXQ_CTRL].token, 1, 0); in t3_sge_alloc_qset()
3039 q->adap = adapter; in t3_sge_alloc_qset()
3040 q->netdev = dev; in t3_sge_alloc_qset()
3041 q->tx_q = netdevq; in t3_sge_alloc_qset()
3042 t3_update_qset_coalesce(q, p); in t3_sge_alloc_qset()
3044 init_lro_mgr(q, lro_mgr); in t3_sge_alloc_qset()
3046 avail = refill_fl(adapter, &q->fl[0], q->fl[0].size, in t3_sge_alloc_qset()
3052 if (avail < q->fl[0].size) in t3_sge_alloc_qset()
3056 avail = refill_fl(adapter, &q->fl[1], q->fl[1].size, in t3_sge_alloc_qset()
3058 if (avail < q->fl[1].size) in t3_sge_alloc_qset()
3061 refill_rspq(adapter, &q->rspq, q->rspq.size - 1); in t3_sge_alloc_qset()
3063 t3_write_reg(adapter, A_SG_GTS, V_RSPQ(q->rspq.cntxt_id) | in t3_sge_alloc_qset()
3064 V_NEWTIMER(q->rspq.holdoff_tmr)); in t3_sge_alloc_qset()
3066 mod_timer(&q->tx_reclaim_timer, jiffies + TX_RECLAIM_PERIOD); in t3_sge_alloc_qset()
3072 t3_free_qset(adapter, q); in t3_sge_alloc_qset()
3087 struct sge_qset *q = &adap->sge.qs[i]; in t3_stop_sge_timers() local
3089 if (q->tx_reclaim_timer.function) in t3_stop_sge_timers()
3090 del_timer_sync(&q->tx_reclaim_timer); in t3_stop_sge_timers()
3205 struct qset_params *q = p->qset + i; in t3_sge_prep() local
3207 q->polling = adap->params.rev > 0; in t3_sge_prep()
3208 q->coalesce_usecs = 5; in t3_sge_prep()
3209 q->rspq_size = 1024; in t3_sge_prep()
3210 q->fl_size = 1024; in t3_sge_prep()
3211 q->jumbo_size = 512; in t3_sge_prep()
3212 q->txq_size[TXQ_ETH] = 1024; in t3_sge_prep()
3213 q->txq_size[TXQ_OFLD] = 1024; in t3_sge_prep()
3214 q->txq_size[TXQ_CTRL] = 256; in t3_sge_prep()
3215 q->cong_thres = 0; in t3_sge_prep()