Lines Matching refs:fl
240 * @fl: the Free List
247 static inline unsigned int fl_cap(const struct sge_fl *fl)
249 return fl->size - FL_PER_EQ_UNIT;
255 * @fl: the Free List
262 const struct sge_fl *fl)
266 return fl->avail - fl->pend_cred <= s->fl_starve_thres;
466 * @fl: the SGE Free List to free buffers from
473 static void free_rx_bufs(struct adapter *adapter, struct sge_fl *fl, int n)
476 struct rx_sw_desc *sdesc = &fl->sdesc[fl->cidx];
484 if (++fl->cidx == fl->size)
485 fl->cidx = 0;
486 fl->avail--;
493 * @fl: the SGE Free List
503 static void unmap_rx_buf(struct adapter *adapter, struct sge_fl *fl)
505 struct rx_sw_desc *sdesc = &fl->sdesc[fl->cidx];
512 if (++fl->cidx == fl->size)
513 fl->cidx = 0;
514 fl->avail--;
520 * @fl: the Free List whose doorbell should be rung ...
525 static inline void ring_fl_db(struct adapter *adapter, struct sge_fl *fl)
533 if (fl->pend_cred >= FL_PER_EQ_UNIT) {
535 val |= PIDX_V(fl->pend_cred / FL_PER_EQ_UNIT);
537 val |= PIDX_T5_V(fl->pend_cred / FL_PER_EQ_UNIT);
548 if (unlikely(fl->bar2_addr == NULL)) {
551 QID_V(fl->cntxt_id) | val);
553 writel(val | QID_V(fl->bar2_qid),
554 fl->bar2_addr + SGE_UDB_KDOORBELL);
561 fl->pend_cred %= FL_PER_EQ_UNIT;
593 * @fl: the Free List ring to refill
604 static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl,
610 unsigned int cred = fl->avail;
611 __be64 *d = &fl->desc[fl->pidx];
612 struct rx_sw_desc *sdesc = &fl->sdesc[fl->pidx];
619 BUG_ON(fl->avail + n > fl->size - FL_PER_EQ_UNIT);
640 fl->large_alloc_failed++;
666 fl->avail++;
667 if (++fl->pidx == fl->size) {
668 fl->pidx = 0;
669 sdesc = fl->sdesc;
670 d = fl->desc;
679 fl->alloc_failed++;
695 fl->avail++;
696 if (++fl->pidx == fl->size) {
697 fl->pidx = 0;
698 sdesc = fl->sdesc;
699 d = fl->desc;
709 cred = fl->avail - cred;
710 fl->pend_cred += cred;
711 ring_fl_db(adapter, fl);
713 if (unlikely(fl_starving(adapter, fl))) {
715 set_bit(fl->cntxt_id, adapter->sge.starving_fl);
725 static inline void __refill_fl(struct adapter *adapter, struct sge_fl *fl)
727 refill_fl(adapter, fl,
728 min((unsigned int)MAX_RX_REFILL, fl_cap(fl) - fl->avail),
1694 * @fl: the SGE Free List
1711 static void restore_rx_bufs(const struct pkt_gl *gl, struct sge_fl *fl,
1717 if (fl->cidx == 0)
1718 fl->cidx = fl->size - 1;
1720 fl->cidx--;
1721 sdesc = &fl->sdesc[fl->cidx];
1724 fl->avail++;
1796 free_rx_bufs(rspq->adapter, &rxq->fl,
1809 BUG_ON(rxq->fl.avail == 0);
1810 sdesc = &rxq->fl.sdesc[rxq->fl.cidx];
1818 unmap_rx_buf(rspq->adapter, &rxq->fl);
1842 restore_rx_bufs(&gl, &rxq->fl, frag);
1872 fl_cap(&rxq->fl) - rxq->fl.avail >= 2*FL_PER_EQ_UNIT)
1873 __refill_fl(rspq->adapter, &rxq->fl);
2085 struct sge_fl *fl = s->egr_map[id];
2091 * Since we are accessing fl without a lock there's a
2096 if (fl_starving(adapter, fl)) {
2099 rxq = container_of(fl, struct sge_eth_rxq, fl);
2101 fl->starving++;
2201 * @fl: pointer to the new rxq's Free List to be filled in
2207 struct sge_fl *fl, rspq_handler_t hnd)
2272 if (fl) {
2283 if (fl->size < s->fl_starve_thres - 1 + 2 * FL_PER_EQ_UNIT)
2284 fl->size = s->fl_starve_thres - 1 + 2 * FL_PER_EQ_UNIT;
2285 fl->size = roundup(fl->size, FL_PER_EQ_UNIT);
2286 fl->desc = alloc_ring(adapter->pdev_dev, fl->size,
2288 &fl->addr, &fl->sdesc, s->stat_len);
2289 if (!fl->desc) {
2299 flsz = (fl->size / FL_PER_EQ_UNIT +
2331 cmd.fl0addr = cpu_to_be64(fl->addr);
2359 rspq->offset = fl ? 0 : -1;
2361 if (fl) {
2362 fl->cntxt_id = be16_to_cpu(rpl.fl0id);
2363 fl->avail = 0;
2364 fl->pend_cred = 0;
2365 fl->pidx = 0;
2366 fl->cidx = 0;
2367 fl->alloc_failed = 0;
2368 fl->large_alloc_failed = 0;
2369 fl->starving = 0;
2374 fl->bar2_addr = bar2_address(adapter,
2375 fl->cntxt_id,
2377 &fl->bar2_qid);
2379 refill_fl(adapter, fl, fl_cap(fl), GFP_KERNEL);
2394 if (fl && fl->desc) {
2395 kfree(fl->sdesc);
2396 fl->sdesc = NULL;
2398 fl->desc, fl->addr);
2399 fl->desc = NULL;
2531 struct sge_fl *fl)
2534 unsigned int flid = fl ? fl->cntxt_id : 0xffff;
2546 if (fl) {
2547 free_rx_bufs(adapter, fl, fl->avail);
2549 fl->size * sizeof(*fl->desc) + s->stat_len,
2550 fl->desc, fl->addr);
2551 kfree(fl->sdesc);
2552 fl->sdesc = NULL;
2553 fl->cntxt_id = 0;
2554 fl->desc = NULL;
2575 free_rspq_fl(adapter, &rxq->rspq, &rxq->fl);