Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0-only
2/* Copyright (C) 2025 Intel Corporation */
3
4#define DEFAULT_SYMBOL_NAMESPACE "LIBETH"
5
6#include <net/libeth/xdp.h>
7
8#include "priv.h"
9
10/* Tx buffer completion */
11
12DEFINE_STATIC_CALL_NULL(bulk, libeth_xdp_return_buff_bulk);
13DEFINE_STATIC_CALL_NULL(xsk, libeth_xsk_buff_free_slow);
14
15/**
16 * libeth_tx_complete_any - perform Tx completion for one SQE of any type
17 * @sqe: Tx buffer to complete
18 * @cp: polling params
19 *
20 * Can be used to complete both regular and XDP SQEs, for example when
21 * destroying queues.
22 * When libeth_xdp is not loaded, XDPSQEs won't be handled.
23 */
24void libeth_tx_complete_any(struct libeth_sqe *sqe, struct libeth_cq_pp *cp)
25{
26 if (sqe->type >= __LIBETH_SQE_XDP_START)
27 __libeth_xdp_complete_tx(sqe, cp, static_call(bulk),
28 static_call(xsk));
29 else
30 libeth_tx_complete(sqe, cp);
31}
32EXPORT_SYMBOL_GPL(libeth_tx_complete_any);
33
34/* Module */
35
36void libeth_attach_xdp(const struct libeth_xdp_ops *ops)
37{
38 static_call_update(bulk, ops ? ops->bulk : NULL);
39 static_call_update(xsk, ops ? ops->xsk : NULL);
40}
41EXPORT_SYMBOL_GPL(libeth_attach_xdp);