Lines Matching refs:pgcache
92 static inline struct pgcache *nicvf_alloc_page(struct nicvf *nic, in nicvf_alloc_page()
97 struct pgcache *pgcache, *next; in nicvf_alloc_page() local
100 pgcache = &rbdr->pgcache[rbdr->pgidx]; in nicvf_alloc_page()
101 page = pgcache->page; in nicvf_alloc_page()
111 if (ref_count == pgcache->ref_count) in nicvf_alloc_page()
112 pgcache->ref_count--; in nicvf_alloc_page()
135 pgcache->page = page; in nicvf_alloc_page()
136 pgcache->dma_addr = 0; in nicvf_alloc_page()
137 pgcache->ref_count = 0; in nicvf_alloc_page()
150 if (!pgcache->ref_count) { in nicvf_alloc_page()
151 pgcache->ref_count = XDP_PAGE_REFCNT_REFILL; in nicvf_alloc_page()
166 next = &rbdr->pgcache[rbdr->pgidx]; in nicvf_alloc_page()
171 return pgcache; in nicvf_alloc_page()
178 struct pgcache *pgcache = NULL; in nicvf_alloc_rcv_buffer() local
193 pgcache = nicvf_alloc_page(nic, rbdr, gfp); in nicvf_alloc_rcv_buffer()
194 if (!pgcache && !nic->rb_page) { in nicvf_alloc_rcv_buffer()
206 if (pgcache) in nicvf_alloc_rcv_buffer()
207 nic->rb_page = pgcache->page; in nicvf_alloc_rcv_buffer()
209 if (rbdr->is_xdp && pgcache && pgcache->dma_addr) { in nicvf_alloc_rcv_buffer()
210 *rbuf = pgcache->dma_addr; in nicvf_alloc_rcv_buffer()
223 if (pgcache) in nicvf_alloc_rcv_buffer()
224 pgcache->dma_addr = *rbuf + XDP_PACKET_HEADROOM; in nicvf_alloc_rcv_buffer()
291 rbdr->pgcache = kcalloc(rbdr->pgcnt, sizeof(*rbdr->pgcache), in nicvf_init_rbdr()
293 if (!rbdr->pgcache) in nicvf_init_rbdr()
322 struct pgcache *pgcache; in nicvf_free_rbdr() local
362 pgcache = &rbdr->pgcache[head]; in nicvf_free_rbdr()
363 if (pgcache->page && page_ref_count(pgcache->page) != 0) { in nicvf_free_rbdr()
365 page_ref_sub(pgcache->page, in nicvf_free_rbdr()
366 pgcache->ref_count - 1); in nicvf_free_rbdr()
368 put_page(pgcache->page); in nicvf_free_rbdr()