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),
1691 * @fl: the SGE Free List
1708 static void restore_rx_bufs(const struct pkt_gl *gl, struct sge_fl *fl,
1714 if (fl->cidx == 0)
1715 fl->cidx = fl->size - 1;
1717 fl->cidx--;
1718 sdesc = &fl->sdesc[fl->cidx];
1721 fl->avail++;
1793 free_rx_bufs(rspq->adapter, &rxq->fl,
1806 BUG_ON(rxq->fl.avail == 0);
1807 sdesc = &rxq->fl.sdesc[rxq->fl.cidx];
1815 unmap_rx_buf(rspq->adapter, &rxq->fl);
1839 restore_rx_bufs(&gl, &rxq->fl, frag);
1869 fl_cap(&rxq->fl) - rxq->fl.avail >= 2*FL_PER_EQ_UNIT)
1870 __refill_fl(rspq->adapter, &rxq->fl);
2082 struct sge_fl *fl = s->egr_map[id];
2088 * Since we are accessing fl without a lock there's a
2093 if (fl_starving(adapter, fl)) {
2096 rxq = container_of(fl, struct sge_eth_rxq, fl);
2098 fl->starving++;
2198 * @fl: pointer to the new rxq's Free List to be filled in
2204 struct sge_fl *fl, rspq_handler_t hnd)
2269 if (fl) {
2280 if (fl->size < s->fl_starve_thres - 1 + 2 * FL_PER_EQ_UNIT)
2281 fl->size = s->fl_starve_thres - 1 + 2 * FL_PER_EQ_UNIT;
2282 fl->size = roundup(fl->size, FL_PER_EQ_UNIT);
2283 fl->desc = alloc_ring(adapter->pdev_dev, fl->size,
2285 &fl->addr, &fl->sdesc, s->stat_len);
2286 if (!fl->desc) {
2296 flsz = (fl->size / FL_PER_EQ_UNIT +
2328 cmd.fl0addr = cpu_to_be64(fl->addr);
2356 rspq->offset = fl ? 0 : -1;
2358 if (fl) {
2359 fl->cntxt_id = be16_to_cpu(rpl.fl0id);
2360 fl->avail = 0;
2361 fl->pend_cred = 0;
2362 fl->pidx = 0;
2363 fl->cidx = 0;
2364 fl->alloc_failed = 0;
2365 fl->large_alloc_failed = 0;
2366 fl->starving = 0;
2371 fl->bar2_addr = bar2_address(adapter,
2372 fl->cntxt_id,
2374 &fl->bar2_qid);
2376 refill_fl(adapter, fl, fl_cap(fl), GFP_KERNEL);
2391 if (fl && fl->desc) {
2392 kfree(fl->sdesc);
2393 fl->sdesc = NULL;
2395 fl->desc, fl->addr);
2396 fl->desc = NULL;
2528 struct sge_fl *fl)
2531 unsigned int flid = fl ? fl->cntxt_id : 0xffff;
2543 if (fl) {
2544 free_rx_bufs(adapter, fl, fl->avail);
2546 fl->size * sizeof(*fl->desc) + s->stat_len,
2547 fl->desc, fl->addr);
2548 kfree(fl->sdesc);
2549 fl->sdesc = NULL;
2550 fl->cntxt_id = 0;
2551 fl->desc = NULL;
2572 free_rspq_fl(adapter, &rxq->rspq, &rxq->fl);