xref: /dpdk/drivers/net/bnxt/tf_ulp/ulp_sc_mgr_tfc.c (revision ca827d42ad72f90d045716e688b539e53e31a7cc)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2021 Broadcom
3  * All rights reserved.
4  */
5 
6 #include <rte_common.h>
7 #include <rte_cycles.h>
8 #include <rte_malloc.h>
9 #include <rte_log.h>
10 #include <rte_alarm.h>
11 #include "bnxt.h"
12 #include "bnxt_ulp.h"
13 #include "bnxt_ulp_utils.h"
14 #include "bnxt_ulp_tfc.h"
15 #include "bnxt_tf_common.h"
16 #include "ulp_sc_mgr.h"
17 #include "ulp_flow_db.h"
18 #include "ulp_template_db_enum.h"
19 #include "ulp_template_struct.h"
20 #include "tfc.h"
21 #include "tfc_debug.h"
22 #include "tfc_action_handle.h"
23 
24 static int32_t
25 ulp_sc_tfc_stats_cache_update(struct tfc *tfcp,
26 			      int dir,
27 			      uint64_t *host_address,
28 			      uint64_t handle,
29 			      uint16_t *words,
30 			      struct tfc_mpc_batch_info_t *batch_info,
31 			      bool reset)
32 {
33 	struct tfc_cmm_info cmm_info;
34 	struct tfc_cmm_clr cmm_clr;
35 	int rc;
36 
37 	cmm_info.dir = dir;
38 	cmm_info.rsubtype = CFA_RSUBTYPE_CMM_ACT;
39 	cmm_info.act_handle = handle;
40 	cmm_clr.clr = reset;
41 
42 	if (reset) {
43 		cmm_clr.offset_in_byte = 0;
44 		cmm_clr.sz_in_byte = 16;
45 	}
46 
47 	rc = tfc_act_get(tfcp,
48 			 batch_info,
49 			 &cmm_info,
50 			 &cmm_clr,
51 			 host_address,
52 			 words);
53 
54 	return rc;
55 }
56 
57 
58 const struct bnxt_ulp_sc_core_ops ulp_sc_tfc_core_ops = {
59 	.ulp_stats_cache_update = ulp_sc_tfc_stats_cache_update
60 };
61