net/sfc: add representor proxy port API
[dpdk.git] / drivers / net / sfc / sfc_repr_proxy.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019-2021 Xilinx, Inc.
4  * Copyright(c) 2019 Solarflare Communications Inc.
5  *
6  * This software was jointly developed between OKTET Labs (under contract
7  * for Solarflare) and Solarflare Communications, Inc.
8  */
9
10 #ifndef _SFC_REPR_PROXY_H
11 #define _SFC_REPR_PROXY_H
12
13 #include <stdint.h>
14
15 #include "efx.h"
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /* Number of supported RxQs with different mbuf memory pools */
22 #define SFC_REPR_PROXY_NB_RXQ_MIN       (1)
23 #define SFC_REPR_PROXY_NB_RXQ_MAX       (1)
24
25 /* One TxQ is required and sufficient for port representors support */
26 #define SFC_REPR_PROXY_NB_TXQ_MIN       (1)
27 #define SFC_REPR_PROXY_NB_TXQ_MAX       (1)
28
29 struct sfc_repr_proxy_port {
30         TAILQ_ENTRY(sfc_repr_proxy_port)        entries;
31         uint16_t                                repr_id;
32         uint16_t                                rte_port_id;
33         efx_mport_id_t                          egress_mport;
34 };
35
36 enum sfc_repr_proxy_mbox_op {
37         SFC_REPR_PROXY_MBOX_ADD_PORT,
38         SFC_REPR_PROXY_MBOX_DEL_PORT,
39 };
40
41 struct sfc_repr_proxy_mbox {
42         struct sfc_repr_proxy_port      *port;
43         enum sfc_repr_proxy_mbox_op     op;
44
45         bool                            write_marker;
46         bool                            ack;
47 };
48
49 TAILQ_HEAD(sfc_repr_proxy_ports, sfc_repr_proxy_port);
50
51 struct sfc_repr_proxy {
52         uint32_t                        service_core_id;
53         uint32_t                        service_id;
54         efx_mport_id_t                  mport_alias;
55         struct sfc_repr_proxy_ports     ports;
56         bool                            started;
57
58         struct sfc_repr_proxy_mbox      mbox;
59 };
60
61 struct sfc_adapter;
62
63 int sfc_repr_proxy_attach(struct sfc_adapter *sa);
64 void sfc_repr_proxy_pre_detach(struct sfc_adapter *sa);
65 void sfc_repr_proxy_detach(struct sfc_adapter *sa);
66 int sfc_repr_proxy_start(struct sfc_adapter *sa);
67 void sfc_repr_proxy_stop(struct sfc_adapter *sa);
68
69 #ifdef __cplusplus
70 }
71 #endif
72 #endif  /* _SFC_REPR_PROXY_H */