File: tx.c

package info (click to toggle)
linux 6.17.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,734,900 kB
  • sloc: ansic: 26,684,436; asm: 271,195; sh: 147,406; python: 75,980; makefile: 57,306; perl: 36,943; xml: 19,562; cpp: 5,899; yacc: 4,909; lex: 2,943; awk: 1,556; sed: 29; ruby: 25
file content (41 lines) | stat: -rw-r--r-- 1,111 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2025 Intel Corporation */

#define DEFAULT_SYMBOL_NAMESPACE	"LIBETH"

#include <net/libeth/xdp.h>

#include "priv.h"

/* Tx buffer completion */

DEFINE_STATIC_CALL_NULL(bulk, libeth_xdp_return_buff_bulk);
DEFINE_STATIC_CALL_NULL(xsk, libeth_xsk_buff_free_slow);

/**
 * libeth_tx_complete_any - perform Tx completion for one SQE of any type
 * @sqe: Tx buffer to complete
 * @cp: polling params
 *
 * Can be used to complete both regular and XDP SQEs, for example when
 * destroying queues.
 * When libeth_xdp is not loaded, XDPSQEs won't be handled.
 */
void libeth_tx_complete_any(struct libeth_sqe *sqe, struct libeth_cq_pp *cp)
{
	if (sqe->type >= __LIBETH_SQE_XDP_START)
		__libeth_xdp_complete_tx(sqe, cp, static_call(bulk),
					 static_call(xsk));
	else
		libeth_tx_complete(sqe, cp);
}
EXPORT_SYMBOL_GPL(libeth_tx_complete_any);

/* Module */

void libeth_attach_xdp(const struct libeth_xdp_ops *ops)
{
	static_call_update(bulk, ops ? ops->bulk : NULL);
	static_call_update(xsk, ops ? ops->xsk : NULL);
}
EXPORT_SYMBOL_GPL(libeth_attach_xdp);