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>
29 /* Number of supported RxQs with different mbuf memory pools */
30 #define SFC_REPR_PROXY_NB_RXQ_MIN (1)
31 #define SFC_REPR_PROXY_NB_RXQ_MAX (1)
33 /* One TxQ is required and sufficient for port representors support */
34 #define SFC_REPR_PROXY_NB_TXQ_MIN (1)
35 #define SFC_REPR_PROXY_NB_TXQ_MAX (1)
37 #define SFC_REPR_PROXY_RX_DESC_COUNT 256
38 #define SFC_REPR_PROXY_RXQ_REFILL_LEVEL (SFC_REPR_PROXY_RX_DESC_COUNT / 4)
39 #define SFC_REPR_PROXY_RX_BURST 32
41 #define SFC_REPR_PROXY_TX_DESC_COUNT 256
42 #define SFC_REPR_PROXY_TXQ_FREE_THRESH (SFC_REPR_PROXY_TX_DESC_COUNT / 4)
43 #define SFC_REPR_PROXY_TX_BURST 32
45 struct sfc_repr_proxy_rxq {
46 struct rte_ring *ring;
47 struct rte_mempool *mb_pool;
50 struct sfc_repr_proxy_txq {
51 struct rte_ring *ring;
54 struct sfc_repr_proxy_filter {
56 * 2 filters are required to match all incoming traffic, unknown
57 * unicast and unknown multicast.
59 efx_filter_spec_t specs[2];
62 struct sfc_repr_proxy_port {
63 TAILQ_ENTRY(sfc_repr_proxy_port) entries;
66 efx_mport_id_t egress_mport;
67 struct sfc_repr_proxy_rxq rxq[SFC_REPR_RXQ_MAX];
68 struct sfc_repr_proxy_txq txq[SFC_REPR_TXQ_MAX];
69 struct sfc_mae_rule *mae_rule;
74 struct sfc_repr_proxy_dp_rxq {
75 struct rte_mempool *mp;
76 unsigned int ref_count;
78 sfc_sw_index_t sw_index;
81 struct sfc_repr_proxy_dp_txq {
82 eth_tx_burst_t pkt_burst;
83 struct sfc_dp_txq *dp;
85 unsigned int available;
86 unsigned int transmitted;
87 struct rte_mbuf *tx_pkts[SFC_REPR_PROXY_TX_BURST];
89 sfc_sw_index_t sw_index;
92 enum sfc_repr_proxy_mbox_op {
93 SFC_REPR_PROXY_MBOX_ADD_PORT,
94 SFC_REPR_PROXY_MBOX_DEL_PORT,
95 SFC_REPR_PROXY_MBOX_START_PORT,
96 SFC_REPR_PROXY_MBOX_STOP_PORT,
99 struct sfc_repr_proxy_mbox {
100 struct sfc_repr_proxy_port *port;
101 enum sfc_repr_proxy_mbox_op op;
107 TAILQ_HEAD(sfc_repr_proxy_ports, sfc_repr_proxy_port);
109 struct sfc_repr_proxy {
110 uint32_t service_core_id;
112 efx_mport_id_t mport_alias;
113 struct sfc_repr_proxy_ports ports;
115 struct sfc_repr_proxy_dp_rxq dp_rxq[SFC_REPR_PROXY_NB_RXQ_MAX];
116 struct sfc_repr_proxy_dp_txq dp_txq[SFC_REPR_PROXY_NB_TXQ_MAX];
117 struct sfc_repr_proxy_filter mport_filter;
119 struct sfc_repr_proxy_mbox mbox;
125 int sfc_repr_proxy_attach(struct sfc_adapter *sa);
126 void sfc_repr_proxy_pre_detach(struct sfc_adapter *sa);
127 void sfc_repr_proxy_detach(struct sfc_adapter *sa);
128 int sfc_repr_proxy_txq_init(struct sfc_adapter *sa);
129 void sfc_repr_proxy_txq_fini(struct sfc_adapter *sa);
130 int sfc_repr_proxy_start(struct sfc_adapter *sa);
131 void sfc_repr_proxy_stop(struct sfc_adapter *sa);
136 #endif /* _SFC_REPR_PROXY_H */