1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019-2021 Xilinx, Inc.
4 * Copyright(c) 2019 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
10 #ifndef _SFC_REPR_PROXY_H
11 #define _SFC_REPR_PROXY_H
16 #include <rte_mempool.h>
27 /* Number of supported RxQs with different mbuf memory pools */
28 #define SFC_REPR_PROXY_NB_RXQ_MIN (1)
29 #define SFC_REPR_PROXY_NB_RXQ_MAX (1)
31 /* One TxQ is required and sufficient for port representors support */
32 #define SFC_REPR_PROXY_NB_TXQ_MIN (1)
33 #define SFC_REPR_PROXY_NB_TXQ_MAX (1)
35 #define SFC_REPR_PROXY_RX_DESC_COUNT 256
36 #define SFC_REPR_PROXY_RXQ_REFILL_LEVEL (SFC_REPR_PROXY_RX_DESC_COUNT / 4)
37 #define SFC_REPR_PROXY_RX_BURST 32
39 #define SFC_REPR_PROXY_TX_DESC_COUNT 256
40 #define SFC_REPR_PROXY_TXQ_FREE_THRESH (SFC_REPR_PROXY_TX_DESC_COUNT / 4)
41 #define SFC_REPR_PROXY_TX_BURST 32
43 struct sfc_repr_proxy_rxq {
44 struct rte_ring *ring;
45 struct rte_mempool *mb_pool;
48 struct sfc_repr_proxy_txq {
49 struct rte_ring *ring;
52 struct sfc_repr_proxy_port {
53 TAILQ_ENTRY(sfc_repr_proxy_port) entries;
56 efx_mport_id_t egress_mport;
57 struct sfc_repr_proxy_rxq rxq[SFC_REPR_RXQ_MAX];
58 struct sfc_repr_proxy_txq txq[SFC_REPR_TXQ_MAX];
61 struct sfc_repr_proxy_dp_rxq {
62 struct rte_mempool *mp;
63 unsigned int ref_count;
65 sfc_sw_index_t sw_index;
68 struct sfc_repr_proxy_dp_txq {
69 sfc_sw_index_t sw_index;
72 enum sfc_repr_proxy_mbox_op {
73 SFC_REPR_PROXY_MBOX_ADD_PORT,
74 SFC_REPR_PROXY_MBOX_DEL_PORT,
77 struct sfc_repr_proxy_mbox {
78 struct sfc_repr_proxy_port *port;
79 enum sfc_repr_proxy_mbox_op op;
85 TAILQ_HEAD(sfc_repr_proxy_ports, sfc_repr_proxy_port);
87 struct sfc_repr_proxy {
88 uint32_t service_core_id;
90 efx_mport_id_t mport_alias;
91 struct sfc_repr_proxy_ports ports;
93 struct sfc_repr_proxy_dp_rxq dp_rxq[SFC_REPR_PROXY_NB_RXQ_MAX];
94 struct sfc_repr_proxy_dp_txq dp_txq[SFC_REPR_PROXY_NB_TXQ_MAX];
96 struct sfc_repr_proxy_mbox mbox;
101 int sfc_repr_proxy_attach(struct sfc_adapter *sa);
102 void sfc_repr_proxy_pre_detach(struct sfc_adapter *sa);
103 void sfc_repr_proxy_detach(struct sfc_adapter *sa);
104 int sfc_repr_proxy_txq_init(struct sfc_adapter *sa);
105 void sfc_repr_proxy_txq_fini(struct sfc_adapter *sa);
106 int sfc_repr_proxy_start(struct sfc_adapter *sa);
107 void sfc_repr_proxy_stop(struct sfc_adapter *sa);
112 #endif /* _SFC_REPR_PROXY_H */