2018-01-08 13:35:35 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2017-03-16 12:41:08 +00:00
|
|
|
*
|
2021-03-11 10:00:40 +00:00
|
|
|
* Copyright(c) 2019-2021 Xilinx, Inc.
|
2020-03-30 10:27:26 +00:00
|
|
|
* Copyright(c) 2016-2019 Solarflare Communications Inc.
|
2016-11-29 16:19:23 +00:00
|
|
|
*
|
|
|
|
* This software was jointly developed between OKTET Labs (under contract
|
|
|
|
* for Solarflare) and Solarflare Communications, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SFC_TX_H
|
|
|
|
#define _SFC_TX_H
|
|
|
|
|
|
|
|
#include <rte_mbuf.h>
|
2021-01-29 16:48:19 +00:00
|
|
|
#include <ethdev_driver.h>
|
2016-11-29 16:19:23 +00:00
|
|
|
|
|
|
|
#include "efx.h"
|
|
|
|
|
2017-03-20 10:15:14 +00:00
|
|
|
#include "sfc_dp_tx.h"
|
|
|
|
|
2016-11-29 16:19:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct sfc_adapter;
|
2016-11-29 16:19:25 +00:00
|
|
|
struct sfc_evq;
|
|
|
|
|
2017-03-20 10:15:14 +00:00
|
|
|
/**
|
|
|
|
* Software Tx descriptor information associated with hardware Tx
|
|
|
|
* descriptor.
|
|
|
|
*/
|
|
|
|
struct sfc_efx_tx_sw_desc {
|
2016-11-29 16:19:25 +00:00
|
|
|
struct rte_mbuf *mbuf;
|
2016-12-15 12:51:23 +00:00
|
|
|
uint8_t *tsoh; /* Buffer to store TSO header */
|
2016-11-29 16:19:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum sfc_txq_state_bit {
|
|
|
|
SFC_TXQ_INITIALIZED_BIT = 0,
|
|
|
|
#define SFC_TXQ_INITIALIZED (1 << SFC_TXQ_INITIALIZED_BIT)
|
2016-11-29 16:19:26 +00:00
|
|
|
SFC_TXQ_STARTED_BIT,
|
|
|
|
#define SFC_TXQ_STARTED (1 << SFC_TXQ_STARTED_BIT)
|
|
|
|
SFC_TXQ_FLUSHING_BIT,
|
|
|
|
#define SFC_TXQ_FLUSHING (1 << SFC_TXQ_FLUSHING_BIT)
|
|
|
|
SFC_TXQ_FLUSHED_BIT,
|
|
|
|
#define SFC_TXQ_FLUSHED (1 << SFC_TXQ_FLUSHED_BIT)
|
2017-05-27 07:55:33 +00:00
|
|
|
SFC_TXQ_FLUSH_FAILED_BIT,
|
|
|
|
#define SFC_TXQ_FLUSH_FAILED (1 << SFC_TXQ_FLUSH_FAILED_BIT)
|
2016-11-29 16:19:25 +00:00
|
|
|
};
|
|
|
|
|
2017-03-20 10:15:14 +00:00
|
|
|
/**
|
2019-02-07 12:17:43 +00:00
|
|
|
* Transmit queue control primary process-only information.
|
|
|
|
* Not used on datapath.
|
2017-03-20 10:15:14 +00:00
|
|
|
*/
|
2016-11-29 16:19:25 +00:00
|
|
|
struct sfc_txq {
|
2017-03-20 10:15:14 +00:00
|
|
|
unsigned int hw_index;
|
|
|
|
struct sfc_evq *evq;
|
|
|
|
efsys_mem_t mem;
|
|
|
|
efx_txq_t *common;
|
2016-11-29 16:19:25 +00:00
|
|
|
};
|
|
|
|
|
2017-03-20 10:15:14 +00:00
|
|
|
struct sfc_txq *sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Transmit queue information used on libefx-based data path.
|
|
|
|
* Allocated on the socket specified on the queue setup.
|
|
|
|
*/
|
|
|
|
struct sfc_efx_txq {
|
|
|
|
struct sfc_evq *evq;
|
|
|
|
struct sfc_efx_tx_sw_desc *sw_ring;
|
|
|
|
unsigned int ptr_mask;
|
|
|
|
efx_desc_t *pend_desc;
|
|
|
|
efx_txq_t *common;
|
|
|
|
unsigned int added;
|
|
|
|
unsigned int pending;
|
|
|
|
unsigned int completed;
|
2018-01-09 20:24:53 +00:00
|
|
|
unsigned int max_fill_level;
|
2017-03-20 10:15:14 +00:00
|
|
|
unsigned int free_thresh;
|
|
|
|
uint16_t hw_vlan_tci;
|
|
|
|
uint16_t dma_desc_size_max;
|
|
|
|
|
|
|
|
unsigned int hw_index;
|
|
|
|
unsigned int flags;
|
|
|
|
#define SFC_EFX_TXQ_FLAG_STARTED 0x1
|
|
|
|
#define SFC_EFX_TXQ_FLAG_RUNNING 0x2
|
|
|
|
|
|
|
|
/* Datapath transmit queue anchor */
|
|
|
|
struct sfc_dp_txq dp;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct sfc_efx_txq *
|
|
|
|
sfc_efx_txq_by_dp_txq(struct sfc_dp_txq *dp_txq)
|
|
|
|
{
|
|
|
|
return container_of(dp_txq, struct sfc_efx_txq, dp);
|
2016-11-29 16:19:25 +00:00
|
|
|
}
|
2016-11-29 16:19:23 +00:00
|
|
|
|
|
|
|
struct sfc_txq_info {
|
2019-02-07 12:17:36 +00:00
|
|
|
unsigned int state;
|
2016-11-29 16:19:25 +00:00
|
|
|
unsigned int entries;
|
2019-02-07 12:17:37 +00:00
|
|
|
struct sfc_dp_txq *dp;
|
2016-12-15 12:51:14 +00:00
|
|
|
boolean_t deferred_start;
|
|
|
|
boolean_t deferred_started;
|
2019-02-07 12:17:28 +00:00
|
|
|
unsigned int free_thresh;
|
|
|
|
uint64_t offloads;
|
2016-11-29 16:19:23 +00:00
|
|
|
};
|
|
|
|
|
2019-02-07 12:17:36 +00:00
|
|
|
struct sfc_txq_info *sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq);
|
|
|
|
|
2017-03-31 10:22:20 +00:00
|
|
|
int sfc_tx_configure(struct sfc_adapter *sa);
|
|
|
|
void sfc_tx_close(struct sfc_adapter *sa);
|
2016-11-29 16:19:23 +00:00
|
|
|
|
2016-11-29 16:19:25 +00:00
|
|
|
int sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
|
|
|
|
uint16_t nb_tx_desc, unsigned int socket_id,
|
|
|
|
const struct rte_eth_txconf *tx_conf);
|
|
|
|
void sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index);
|
|
|
|
|
2019-02-07 12:17:36 +00:00
|
|
|
void sfc_tx_qflush_done(struct sfc_txq_info *txq_info);
|
2016-11-29 16:19:26 +00:00
|
|
|
int sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index);
|
|
|
|
void sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index);
|
|
|
|
int sfc_tx_start(struct sfc_adapter *sa);
|
|
|
|
void sfc_tx_stop(struct sfc_adapter *sa);
|
|
|
|
|
2018-01-18 09:44:30 +00:00
|
|
|
uint64_t sfc_tx_get_dev_offload_caps(struct sfc_adapter *sa);
|
2018-01-18 09:44:31 +00:00
|
|
|
uint64_t sfc_tx_get_queue_offload_caps(struct sfc_adapter *sa);
|
2018-01-18 09:44:30 +00:00
|
|
|
|
2016-12-15 12:51:23 +00:00
|
|
|
/* From 'sfc_tso.c' */
|
2017-03-20 10:15:14 +00:00
|
|
|
int sfc_efx_tso_alloc_tsoh_objs(struct sfc_efx_tx_sw_desc *sw_ring,
|
|
|
|
unsigned int txq_entries,
|
|
|
|
unsigned int socket_id);
|
|
|
|
void sfc_efx_tso_free_tsoh_objs(struct sfc_efx_tx_sw_desc *sw_ring,
|
|
|
|
unsigned int txq_entries);
|
|
|
|
int sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
|
|
|
|
struct rte_mbuf **in_seg, size_t *in_off, efx_desc_t **pend,
|
|
|
|
unsigned int *pkt_descs, size_t *pkt_len);
|
2016-12-15 12:51:23 +00:00
|
|
|
|
2016-11-29 16:19:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _SFC_TX_H */
|