Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
cs_policy.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __HICN_CS_POLICY_H__
17 #define __HICN_CS_POLICY_H__
18 
19 #include "../hashtb.h"
20 
27 /*
28  * Structure
29  */
30 typedef struct hicn_cs_policy_s
31 {
32  u32 max;
33  u32 count;
34 
35  /* Indexes to hashtable nodes forming CS LRU */
36  u32 head;
37  u32 tail;
38 
40 
41 /* Forward declaration */
42 struct hicn_pit_cs_s;
43 struct hicn_hash_node_s;
44 struct hicn_pcs_entry_s;
45 struct hicn_cs_policy_s;
46 
57 typedef struct hicn_cs_policy_vft_s
58 {
59  void (*hicn_cs_insert) (struct hicn_pit_cs_s *p,
60  struct hicn_hash_node_s *node,
61  struct hicn_pcs_entry_s *pcs,
62  hicn_cs_policy_t *policy);
63 
64  void (*hicn_cs_update) (struct hicn_pit_cs_s *p,
65  struct hicn_hash_node_s *node,
66  struct hicn_pcs_entry_s *pcs,
67  hicn_cs_policy_t *policy);
68 
69  void (*hicn_cs_dequeue) (struct hicn_pit_cs_s *p,
70  struct hicn_hash_node_s *node,
71  struct hicn_pcs_entry_s *pcs,
72  hicn_cs_policy_t *policy);
73 
74  void (*hicn_cs_delete_get) (struct hicn_pit_cs_s *p,
75  hicn_cs_policy_t *policy,
76  struct hicn_hash_node_s **node,
77  struct hicn_pcs_entry_s **pcs,
78  struct hicn_hash_entry_s **hash_entry);
79 
80  int (*hicn_cs_trim) (struct hicn_pit_cs_s *p, u32 *node_list, int sz,
81  hicn_cs_policy_t *policy);
82 
83  int (*hicn_cs_flush) (vlib_main_t *vm, struct hicn_pit_cs_s *p,
84  hicn_cs_policy_t *policy_state);
86 
87 #endif /* // __HICN_POLICY_H__ */
88 
89 /*
90  * fd.io coding-style-patch-verification: ON
91  *
92  * Local Variables: eval: (c-set-style "gnu") End:
93  */
hicn_pcs_entry_s
Definition: pcs.h:128
hicn_pit_cs_s
Definition: pcs.h:143
hicn_cs_policy_vft_t
struct hicn_cs_policy_vft_s hicn_cs_policy_vft_t
Definition of the virtual functin table for a cache policy.
hicn_cs_policy_s
Definition: cs_policy.h:30
hicn_cs_policy_vft_s
Definition of the virtual functin table for a cache policy.
Definition: cs_policy.h:57