xref: /dpdk/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.h (revision 6d160d770974ff1e212dd8a18646b15823256240)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2023 Broadcom
3  * All rights reserved.
4  */
5 
6 #ifndef _ULP_HA_MGR_H_
7 #define _ULP_HA_MGR_H_
8 
9 #include "bnxt_ulp.h"
10 
11 #define ULP_HA_IF_TBL_IDX 10
12 #define ULP_HA_CLIENT_CNT_IF_TBL_IDX 9
13 
14 enum ulp_ha_mgr_state {
15 	ULP_HA_STATE_INIT,
16 	ULP_HA_STATE_PRIM_RUN,
17 	ULP_HA_STATE_PRIM_SEC_RUN,
18 	ULP_HA_STATE_SEC_TIMER_COPY,
19 	ULP_HA_PRIM_CLOSE
20 };
21 
22 enum ulp_ha_mgr_app_type {
23 	ULP_HA_APP_TYPE_NONE,
24 	ULP_HA_APP_TYPE_PRIM,
25 	ULP_HA_APP_TYPE_SEC
26 };
27 
28 enum ulp_ha_mgr_region {
29 	ULP_HA_REGION_LOW,
30 	ULP_HA_REGION_HI
31 };
32 
33 struct bnxt_ulp_ha_mgr_info {
34 	enum ulp_ha_mgr_app_type app_type;
35 	enum ulp_ha_mgr_region region;
36 	uint32_t flags;
37 	pthread_mutex_t ha_lock;
38 };
39 
40 bool
41 ulp_ha_mgr_is_enabled(struct bnxt_ulp_context *ulp_ctx);
42 
43 int32_t
44 ulp_ha_mgr_enable(struct bnxt_ulp_context *ulp_ctx);
45 
46 int32_t
47 ulp_ha_mgr_init(struct bnxt_ulp_context *ulp_ctx);
48 
49 void
50 ulp_ha_mgr_deinit(struct bnxt_ulp_context *ulp_ctx);
51 
52 int32_t
53 ulp_ha_mgr_app_type_get(struct bnxt_ulp_context *ulp_ctx,
54 			enum ulp_ha_mgr_app_type *app_type);
55 
56 int32_t
57 ulp_ha_mgr_state_get(struct bnxt_ulp_context *ulp_ctx,
58 		     enum ulp_ha_mgr_state *state);
59 
60 int32_t
61 ulp_ha_mgr_open(struct bnxt_ulp_context *ulp_ctx);
62 
63 int32_t
64 ulp_ha_mgr_close(struct bnxt_ulp_context *ulp_ctx);
65 
66 int32_t
67 ulp_ha_mgr_region_get(struct bnxt_ulp_context *ulp_ctx,
68 		      enum ulp_ha_mgr_region *region);
69 #endif /* _ULP_HA_MGR_H_*/
70