Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kernel-patches/bpf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 511d39e950a218e28b0e238c41810ee9ac6f5443
Choose a base ref
..
head repository: kernel-patches/bpf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d60d49202fbe9bda84b9f261757827f1fe55b2eb
Choose a head ref
Showing with 9 additions and 6 deletions.
  1. +9 −1 net/xdp/xsk_buff_pool.c
  2. +0 −5 net/xdp/xsk_queue.h
10 changes: 9 additions & 1 deletion net/xdp/xsk_buff_pool.c
Original file line number Diff line number Diff line change
@@ -656,9 +656,17 @@ EXPORT_SYMBOL(xp_alloc_batch);

bool xp_can_alloc(struct xsk_buff_pool *pool, u32 count)
{
u32 req_count, avail_count;

if (pool->free_list_cnt >= count)
return true;
return xskq_cons_has_entries(pool->fq, count - pool->free_list_cnt);

req_count = count - pool->free_list_cnt;
avail_count = xskq_cons_nb_entries(pool->fq, req_count);
if (!avail_count)
pool->fq->queue_empty_descs++;

return avail_count >= req_count;
}
EXPORT_SYMBOL(xp_can_alloc);

5 changes: 0 additions & 5 deletions net/xdp/xsk_queue.h
Original file line number Diff line number Diff line change
@@ -306,11 +306,6 @@ static inline u32 xskq_cons_nb_entries(struct xsk_queue *q, u32 max)
return entries >= max ? max : entries;
}

static inline bool xskq_cons_has_entries(struct xsk_queue *q, u32 cnt)
{
return xskq_cons_nb_entries(q, cnt) >= cnt;
}

static inline bool xskq_cons_peek_addr_unchecked(struct xsk_queue *q, u64 *addr)
{
if (q->cached_prod == q->cached_cons)