18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/****************************************************************************
38c2ecf20Sopenharmony_ci * Driver for Solarflare network controllers and boards
48c2ecf20Sopenharmony_ci * Copyright 2018 Solarflare Communications Inc.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
78c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License version 2 as published
88c2ecf20Sopenharmony_ci * by the Free Software Foundation, incorporated herein by reference.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef EFX_TX_COMMON_H
128c2ecf20Sopenharmony_ci#define EFX_TX_COMMON_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciint efx_probe_tx_queue(struct efx_tx_queue *tx_queue);
158c2ecf20Sopenharmony_civoid efx_init_tx_queue(struct efx_tx_queue *tx_queue);
168c2ecf20Sopenharmony_civoid efx_fini_tx_queue(struct efx_tx_queue *tx_queue);
178c2ecf20Sopenharmony_civoid efx_remove_tx_queue(struct efx_tx_queue *tx_queue);
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_civoid efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
208c2ecf20Sopenharmony_ci			struct efx_tx_buffer *buffer,
218c2ecf20Sopenharmony_ci			unsigned int *pkts_compl,
228c2ecf20Sopenharmony_ci			unsigned int *bytes_compl);
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic inline bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer)
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	return buffer->len || (buffer->flags & EFX_TX_BUF_OPTION);
278c2ecf20Sopenharmony_ci}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_civoid efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue);
308c2ecf20Sopenharmony_civoid efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_civoid efx_enqueue_unwind(struct efx_tx_queue *tx_queue,
338c2ecf20Sopenharmony_ci			unsigned int insert_count);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistruct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue,
368c2ecf20Sopenharmony_ci				       dma_addr_t dma_addr, size_t len);
378c2ecf20Sopenharmony_ciint efx_tx_tso_header_length(struct sk_buff *skb);
388c2ecf20Sopenharmony_ciint efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
398c2ecf20Sopenharmony_ci		    unsigned int segment_count);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciunsigned int efx_tx_max_skb_descs(struct efx_nic *efx);
428c2ecf20Sopenharmony_ciint efx_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciextern bool efx_separate_tx_channels;
458c2ecf20Sopenharmony_ci#endif
46