Skip to content

Commit

Permalink
Merge branch 'tsnep-xdp-fixes'
Browse files Browse the repository at this point in the history
Gerhard Engleder says:

====================
tsnep: XDP fixes

Found two driver specific problems during XDP and XSK testing.
====================

Link: https://lore.kernel.org/r/20240123200918.61219-1-gerhard@engleder-embedded.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Paolo Abeni committed Jan 25, 2024
2 parents 5da4597 + 9a91c05 commit 0a5bd0f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions drivers/net/ethernet/engleder/tsnep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ static int tsnep_rx_poll(struct tsnep_rx *rx, struct napi_struct *napi,

xdp_prepare_buff(&xdp, page_address(entry->page),
XDP_PACKET_HEADROOM + TSNEP_RX_INLINE_METADATA_SIZE,
length, false);
length - ETH_FCS_LEN, false);

consume = tsnep_xdp_run_prog(rx, prog, &xdp,
&xdp_status, tx_nq, tx);
Expand Down Expand Up @@ -1568,7 +1568,7 @@ static int tsnep_rx_poll_zc(struct tsnep_rx *rx, struct napi_struct *napi,
prefetch(entry->xdp->data);
length = __le32_to_cpu(entry->desc_wb->properties) &
TSNEP_DESC_LENGTH_MASK;
xsk_buff_set_size(entry->xdp, length);
xsk_buff_set_size(entry->xdp, length - ETH_FCS_LEN);
xsk_buff_dma_sync_for_cpu(entry->xdp, rx->xsk_pool);

/* RX metadata with timestamps is in front of actual data,
Expand Down Expand Up @@ -1762,6 +1762,19 @@ static void tsnep_rx_reopen_xsk(struct tsnep_rx *rx)
allocated--;
}
}

/* set need wakeup flag immediately if ring is not filled completely,
* first polling would be too late as need wakeup signalisation would
* be delayed for an indefinite time
*/
if (xsk_uses_need_wakeup(rx->xsk_pool)) {
int desc_available = tsnep_rx_desc_available(rx);

if (desc_available)
xsk_set_rx_need_wakeup(rx->xsk_pool);
else
xsk_clear_rx_need_wakeup(rx->xsk_pool);
}
}

static bool tsnep_pending(struct tsnep_queue *queue)
Expand Down

0 comments on commit 0a5bd0f

Please sign in to comment.