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.
13 #include <ethdev_driver.h>
28 SFC_EVQ_UNINITIALIZED = 0,
37 SFC_EVQ_TYPE_MGMT = 0,
45 /* Used on datapath */
47 const efx_ev_callbacks_t *callbacks;
48 unsigned int read_ptr;
49 unsigned int read_ptr_primed;
52 struct sfc_dp_rxq *dp_rxq;
53 struct sfc_dp_txq *dp_txq;
55 /* Not used on datapath */
56 struct sfc_adapter *sa;
57 unsigned int evq_index;
58 enum sfc_evq_state init_state;
59 enum sfc_evq_type type;
64 * Functions below define event queue to transmit/receive queue and vice
66 * Own event queue is allocated for management, each Rx and each Tx queue.
67 * Zero event queue is used for management events.
68 * Rx event queues from 1 to RxQ number follow management event queue.
69 * Tx event queues follow Rx event queues.
72 static inline sfc_ethdev_qid_t
73 sfc_ethdev_rx_qid_by_rxq_sw_index(__rte_unused struct sfc_adapter_shared *sas,
74 sfc_sw_index_t rxq_sw_index)
76 /* Only ethdev queues are present for now */
80 static inline sfc_sw_index_t
81 sfc_rxq_sw_index_by_ethdev_rx_qid(__rte_unused struct sfc_adapter_shared *sas,
82 sfc_ethdev_qid_t ethdev_qid)
84 /* Only ethdev queues are present for now */
88 static inline sfc_sw_index_t
89 sfc_evq_sw_index_by_rxq_sw_index(__rte_unused struct sfc_adapter *sa,
90 sfc_sw_index_t rxq_sw_index)
92 return 1 + rxq_sw_index;
95 static inline sfc_ethdev_qid_t
96 sfc_ethdev_tx_qid_by_txq_sw_index(__rte_unused struct sfc_adapter_shared *sas,
97 sfc_sw_index_t txq_sw_index)
99 /* Only ethdev queues are present for now */
103 static inline sfc_sw_index_t
104 sfc_txq_sw_index_by_ethdev_tx_qid(__rte_unused struct sfc_adapter_shared *sas,
105 sfc_ethdev_qid_t ethdev_qid)
107 /* Only ethdev queues are present for now */
111 static inline sfc_sw_index_t
112 sfc_evq_sw_index_by_txq_sw_index(struct sfc_adapter *sa,
113 sfc_sw_index_t txq_sw_index)
115 return 1 + sa->eth_dev->data->nb_rx_queues + txq_sw_index;
118 int sfc_ev_attach(struct sfc_adapter *sa);
119 void sfc_ev_detach(struct sfc_adapter *sa);
120 int sfc_ev_start(struct sfc_adapter *sa);
121 void sfc_ev_stop(struct sfc_adapter *sa);
123 int sfc_ev_qinit(struct sfc_adapter *sa,
124 enum sfc_evq_type type, unsigned int type_index,
125 unsigned int entries, int socket_id, struct sfc_evq **evqp);
126 void sfc_ev_qfini(struct sfc_evq *evq);
127 int sfc_ev_qstart(struct sfc_evq *evq, unsigned int hw_index);
128 void sfc_ev_qstop(struct sfc_evq *evq);
130 int sfc_ev_qprime(struct sfc_evq *evq);
131 void sfc_ev_qpoll(struct sfc_evq *evq);
133 void sfc_ev_mgmt_qpoll(struct sfc_adapter *sa);
138 #endif /* _SFC_EV_H_ */