1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019-2021 Xilinx, Inc.
4 * Copyright(c) 2016-2019 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
14 #include <ethdev_driver.h>
18 #include "sfc_dp_tx.h"
28 * Software Tx descriptor information associated with hardware Tx
31 struct sfc_efx_tx_sw_desc {
32 struct rte_mbuf *mbuf;
33 uint8_t *tsoh; /* Buffer to store TSO header */
36 enum sfc_txq_state_bit {
37 SFC_TXQ_INITIALIZED_BIT = 0,
38 #define SFC_TXQ_INITIALIZED (1 << SFC_TXQ_INITIALIZED_BIT)
40 #define SFC_TXQ_STARTED (1 << SFC_TXQ_STARTED_BIT)
42 #define SFC_TXQ_FLUSHING (1 << SFC_TXQ_FLUSHING_BIT)
44 #define SFC_TXQ_FLUSHED (1 << SFC_TXQ_FLUSHED_BIT)
45 SFC_TXQ_FLUSH_FAILED_BIT,
46 #define SFC_TXQ_FLUSH_FAILED (1 << SFC_TXQ_FLUSH_FAILED_BIT)
50 * Transmit queue control primary process-only information.
51 * Not used on datapath.
54 unsigned int hw_index;
60 struct sfc_txq *sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq);
61 struct sfc_txq_info *sfc_txq_info_by_ethdev_qid(struct sfc_adapter_shared *sas,
62 sfc_ethdev_qid_t ethdev_qid);
64 * Transmit queue information used on libefx-based data path.
65 * Allocated on the socket specified on the queue setup.
69 struct sfc_efx_tx_sw_desc *sw_ring;
70 unsigned int ptr_mask;
71 efx_desc_t *pend_desc;
75 unsigned int completed;
76 unsigned int max_fill_level;
77 unsigned int free_thresh;
79 uint16_t dma_desc_size_max;
81 unsigned int hw_index;
83 #define SFC_EFX_TXQ_FLAG_STARTED 0x1
84 #define SFC_EFX_TXQ_FLAG_RUNNING 0x2
86 /* Datapath transmit queue anchor */
90 static inline struct sfc_efx_txq *
91 sfc_efx_txq_by_dp_txq(struct sfc_dp_txq *dp_txq)
93 return container_of(dp_txq, struct sfc_efx_txq, dp);
99 struct sfc_dp_txq *dp;
100 boolean_t deferred_start;
101 boolean_t deferred_started;
102 unsigned int free_thresh;
106 struct sfc_txq_info *sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq);
108 int sfc_tx_configure(struct sfc_adapter *sa);
109 void sfc_tx_close(struct sfc_adapter *sa);
111 int sfc_tx_qinit_info(struct sfc_adapter *sa, sfc_sw_index_t sw_index);
112 int sfc_tx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,
113 uint16_t nb_tx_desc, unsigned int socket_id,
114 const struct rte_eth_txconf *tx_conf);
115 void sfc_tx_qfini(struct sfc_adapter *sa, sfc_sw_index_t sw_index);
117 void sfc_tx_qflush_done(struct sfc_txq_info *txq_info);
118 int sfc_tx_qstart(struct sfc_adapter *sa, sfc_sw_index_t sw_index);
119 void sfc_tx_qstop(struct sfc_adapter *sa, sfc_sw_index_t sw_index);
120 int sfc_tx_start(struct sfc_adapter *sa);
121 void sfc_tx_stop(struct sfc_adapter *sa);
123 uint64_t sfc_tx_get_dev_offload_caps(struct sfc_adapter *sa);
124 uint64_t sfc_tx_get_queue_offload_caps(struct sfc_adapter *sa);
126 /* From 'sfc_tso.c' */
127 int sfc_efx_tso_alloc_tsoh_objs(struct sfc_efx_tx_sw_desc *sw_ring,
128 unsigned int txq_entries,
129 unsigned int socket_id);
130 void sfc_efx_tso_free_tsoh_objs(struct sfc_efx_tx_sw_desc *sw_ring,
131 unsigned int txq_entries);
132 int sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
133 struct rte_mbuf **in_seg, size_t *in_off, efx_desc_t **pend,
134 unsigned int *pkt_descs, size_t *pkt_len);
139 #endif /* _SFC_TX_H */