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 12 DEFINE_STATIC_CALL_NULL(bulk, libeth_xdp_return_buff_bulk); 13 14 /** 15 * libeth_tx_complete_any - perform Tx completion for one SQE of any type 16 * @sqe: Tx buffer to complete 17 * @cp: polling params 18 * 19 * Can be used to complete both regular and XDP SQEs, for example when 20 * destroying queues. 21 * When libeth_xdp is not loaded, XDPSQEs won't be handled. 22 */ 23 void libeth_tx_complete_any(struct libeth_sqe *sqe, struct libeth_cq_pp *cp) 24 { 25 if (sqe->type >= __LIBETH_SQE_XDP_START) 26 __libeth_xdp_complete_tx(sqe, cp, static_call(bulk)); 27 else 28 libeth_tx_complete(sqe, cp); 29 } 30 EXPORT_SYMBOL_GPL(libeth_tx_complete_any); 31 32 /* Module */ 33 34 void libeth_attach_xdp(const struct libeth_xdp_ops *ops) 35 { 36 static_call_update(bulk, ops ? ops->bulk : NULL); 37 } 38 EXPORT_SYMBOL_GPL(libeth_attach_xdp); 39