xref: /OK3568_Linux_fs/kernel/drivers/net/ethernet/sfc/tx_common.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /****************************************************************************
3*4882a593Smuzhiyun  * Driver for Solarflare network controllers and boards
4*4882a593Smuzhiyun  * Copyright 2018 Solarflare Communications Inc.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify it
7*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 as published
8*4882a593Smuzhiyun  * by the Free Software Foundation, incorporated herein by reference.
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef EFX_TX_COMMON_H
12*4882a593Smuzhiyun #define EFX_TX_COMMON_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun int efx_probe_tx_queue(struct efx_tx_queue *tx_queue);
15*4882a593Smuzhiyun void efx_init_tx_queue(struct efx_tx_queue *tx_queue);
16*4882a593Smuzhiyun void efx_fini_tx_queue(struct efx_tx_queue *tx_queue);
17*4882a593Smuzhiyun void efx_remove_tx_queue(struct efx_tx_queue *tx_queue);
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
20*4882a593Smuzhiyun 			struct efx_tx_buffer *buffer,
21*4882a593Smuzhiyun 			unsigned int *pkts_compl,
22*4882a593Smuzhiyun 			unsigned int *bytes_compl);
23*4882a593Smuzhiyun 
efx_tx_buffer_in_use(struct efx_tx_buffer * buffer)24*4882a593Smuzhiyun static inline bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer)
25*4882a593Smuzhiyun {
26*4882a593Smuzhiyun 	return buffer->len || (buffer->flags & EFX_TX_BUF_OPTION);
27*4882a593Smuzhiyun }
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue);
30*4882a593Smuzhiyun void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun void efx_enqueue_unwind(struct efx_tx_queue *tx_queue,
33*4882a593Smuzhiyun 			unsigned int insert_count);
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue,
36*4882a593Smuzhiyun 				       dma_addr_t dma_addr, size_t len);
37*4882a593Smuzhiyun int efx_tx_tso_header_length(struct sk_buff *skb);
38*4882a593Smuzhiyun int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
39*4882a593Smuzhiyun 		    unsigned int segment_count);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun unsigned int efx_tx_max_skb_descs(struct efx_nic *efx);
42*4882a593Smuzhiyun int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun extern bool efx_separate_tx_channels;
45*4882a593Smuzhiyun #endif
46