Support packets in flight
[samplevnf.git] / VNFs / DPPD-PROX / cqm.h
1 /*
2 // Copyright (c) 2010-2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef _CQM_H_
18 #define _CQM_H_
19
20 #include <inttypes.h>
21 #include <stdio.h>
22
23 #define PROX_MAX_CACHE_SET      16
24
25 struct rdt_features {
26         uint8_t rdtm_supported;
27         uint8_t rdta_supported;
28         uint8_t cmt_supported;
29         uint8_t mbm_tot_supported;
30         uint8_t mbm_loc_supported;
31         uint8_t l3_cat_supported;
32         uint8_t l2_cat_supported;
33         uint8_t mba_supported;
34         uint32_t rdtm_max_rmid;
35         uint32_t cmt_max_rmid;
36         uint32_t cat_max_rmid;
37         uint32_t mba_max_rmid;
38         uint32_t cat_num_ways;
39         uint32_t upscaling_factor;
40         uint32_t event_types;
41 };
42
43 struct prox_cache_set_cfg {
44         uint32_t mask;
45         uint32_t lcore_id;
46         int32_t socket_id;
47 };
48
49 int rdt_is_supported(void);
50 int cmt_is_supported(void);
51 int cat_is_supported(void);
52 int mbm_is_supported(void);
53 int mba_is_supported(void);
54
55 int rdt_get_features(struct rdt_features* feat);
56
57 int cqm_assoc(uint8_t lcore_id, uint64_t rmid);
58 int cqm_assoc_read(uint8_t lcore_id, uint64_t *rmid);
59
60 void rdt_init_stat_core(uint8_t lcore_id);
61
62 int cmt_read_ctr(uint64_t* ret, uint64_t rmid, uint8_t lcore_id);
63 int mbm_read_tot_bdw(uint64_t* ret, uint64_t rmid, uint8_t lcore_id);
64 int mbm_read_loc_bdw(uint64_t* ret, uint64_t rmid, uint8_t lcore_id);
65 void read_rdt_info(void);
66 extern struct prox_cache_set_cfg prox_cache_set_cfg[PROX_MAX_CACHE_SET];
67 int cat_log_init(uint8_t lcore_id);
68 int cat_set_class_mask(uint8_t lcore_id,  uint32_t set, uint32_t mask);
69 int cat_get_class_mask(uint8_t lcore_id, uint32_t set, uint32_t *mask);
70 void cat_reset_cache(uint32_t lcore_id);
71 int cat_get_num_ways(void);
72
73 #endif /* _CQM_H_ */