xref: /linux/drivers/net/ethernet/intel/libeth/xsk.c (revision 40e846d122df9b299e700ec86d01ef647fc0b09f)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (C) 2025 Intel Corporation */
3 
4 #define DEFAULT_SYMBOL_NAMESPACE	"LIBETH_XDP"
5 
6 #include <linux/export.h>
7 
8 #include <net/libeth/xsk.h>
9 
10 #include "priv.h"
11 
12 /* ``XDP_TX`` bulking */
13 
14 void __cold libeth_xsk_tx_return_bulk(const struct libeth_xdp_tx_frame *bq,
15 				      u32 count)
16 {
17 	for (u32 i = 0; i < count; i++)
18 		libeth_xsk_buff_free_slow(bq[i].xsk);
19 }
20 
21 /* XSk TMO */
22 
23 const struct xsk_tx_metadata_ops libeth_xsktmo_slow = {
24 	.tmo_request_checksum		= libeth_xsktmo_req_csum,
25 };
26 
27 /* Rx polling path */
28 
29 /**
30  * libeth_xsk_buff_free_slow - free an XSk Rx buffer
31  * @xdp: buffer to free
32  *
33  * Slowpath version of xsk_buff_free() to be used on exceptions, cleanups etc.
34  * to avoid unwanted inlining.
35  */
36 void libeth_xsk_buff_free_slow(struct libeth_xdp_buff *xdp)
37 {
38 	xsk_buff_free(&xdp->base);
39 }
40 EXPORT_SYMBOL_GPL(libeth_xsk_buff_free_slow);
41