common/sfc_efx/base: fix indication of MAE encap support
[dpdk.git] / drivers / common / sfc_efx / sfc_efx_mcdi.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019-2021 Xilinx, Inc.
4  * Copyright(c) 2016-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_EFX_MCDI_H
11 #define _SFC_EFX_MCDI_H
12
13 #include <stdint.h>
14
15 #include <rte_spinlock.h>
16
17 #include "efsys.h"
18 #include "efx.h"
19
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 enum sfc_efx_mcdi_state {
26         SFC_EFX_MCDI_UNINITIALIZED = 0,
27         SFC_EFX_MCDI_INITIALIZED,
28         SFC_EFX_MCDI_BUSY,
29         SFC_EFX_MCDI_COMPLETED,
30         SFC_EFX_MCDI_DEAD,
31
32         SFC_EFX_MCDI_NSTATES
33 };
34
35 typedef int (sfc_efx_mcdi_dma_alloc_cb)(void *cookie, const char *name,
36                                           size_t len, efsys_mem_t *esmp);
37
38 typedef void (sfc_efx_mcdi_dma_free_cb)(void *cookie, efsys_mem_t *esmp);
39
40 typedef void (sfc_efx_mcdi_sched_restart_cb)(void *cookie);
41
42 typedef void (sfc_efx_mcdi_mgmt_evq_poll_cb)(void *cookie);
43
44 struct sfc_efx_mcdi_ops {
45         sfc_efx_mcdi_dma_alloc_cb       *dma_alloc;
46         sfc_efx_mcdi_dma_free_cb        *dma_free;
47         sfc_efx_mcdi_sched_restart_cb   *sched_restart;
48         sfc_efx_mcdi_mgmt_evq_poll_cb   *mgmt_evq_poll;
49 };
50
51 struct sfc_efx_mcdi {
52         rte_spinlock_t                  lock;
53         const struct sfc_efx_mcdi_ops   *ops;
54         void                            *ops_cookie;
55         efx_nic_t                       *nic;
56         efsys_mem_t                     mem;
57         enum sfc_efx_mcdi_state         state;
58         efx_mcdi_transport_t            transport;
59         uint32_t                        logtype;
60         uint32_t                        proxy_handle;
61         efx_rc_t                        proxy_result;
62         const char                      *log_prefix;
63 };
64
65 __rte_internal
66 int sfc_efx_mcdi_init(struct sfc_efx_mcdi *mcdi,
67                       uint32_t logtype, const char *log_prefix,
68                       efx_nic_t *nic,
69                       const struct sfc_efx_mcdi_ops *ops, void *ops_cookie);
70 __rte_internal
71 void sfc_efx_mcdi_fini(struct sfc_efx_mcdi *mcdi);
72
73 #ifdef __cplusplus
74 }
75 #endif
76
77 #endif  /* _SFC_EFX_MCDI_H */