2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
6 #ifndef __METADATA_COLLISION_H__
7 #define __METADATA_COLLISION_H__
10 * @brief Metadata map structure
13 struct ocf_metadata_list_info
{
14 ocf_cache_line_t prev_col
;
15 /*!< Previous cache line in collision list */
16 ocf_cache_line_t next_col
;
17 /*!< Next cache line in collision list*/
18 ocf_cache_line_t partition_prev
;
19 /*!< Previous cache line in the same partition*/
20 ocf_cache_line_t partition_next
;
21 /*!< Next cache line in the same partition*/
22 ocf_part_id_t partition_id
: 8;
23 /*!< ID of partition where is assigned this cache line*/
24 } __attribute__((packed
));
27 * @brief Metadata map structure
30 struct ocf_metadata_map
{
32 /*!< Core line addres on cache mapped by this strcture */
35 /*!< ID of core where is assigned this cache line*/
38 /*!< Entry status structure e.g. valid, dirty...*/
39 } __attribute__((packed
));
41 static inline ocf_cache_line_t
ocf_metadata_map_lg2phy(
42 struct ocf_cache
*cache
, ocf_cache_line_t coll_idx
)
44 return cache
->metadata
.iface
.layout_iface
->lg2phy(cache
,
48 static inline ocf_cache_line_t
ocf_metadata_map_phy2lg(
49 struct ocf_cache
*cache
, ocf_cache_line_t cache_line
)
51 return cache
->metadata
.iface
.layout_iface
->phy2lg(cache
,
55 static inline void ocf_metadata_set_collision_info(
56 struct ocf_cache
*cache
, ocf_cache_line_t line
,
57 ocf_cache_line_t next
, ocf_cache_line_t prev
)
59 cache
->metadata
.iface
.set_collision_info(cache
, line
, next
, prev
);
62 static inline void ocf_metadata_get_collision_info(
63 struct ocf_cache
*cache
, ocf_cache_line_t line
,
64 ocf_cache_line_t
*next
, ocf_cache_line_t
*prev
)
66 cache
->metadata
.iface
.get_collision_info(cache
, line
, next
, prev
);
69 static inline void ocf_metadata_set_collision_next(
70 struct ocf_cache
*cache
, ocf_cache_line_t line
,
71 ocf_cache_line_t next
)
73 cache
->metadata
.iface
.set_collision_next(cache
, line
, next
);
76 static inline void ocf_metadata_set_collision_prev(
77 struct ocf_cache
*cache
, ocf_cache_line_t line
,
78 ocf_cache_line_t prev
)
80 cache
->metadata
.iface
.set_collision_prev(cache
, line
, prev
);
83 static inline ocf_cache_line_t
ocf_metadata_get_collision_next(
84 struct ocf_cache
*cache
, ocf_cache_line_t line
)
86 return cache
->metadata
.iface
.get_collision_next(cache
, line
);
89 static inline ocf_cache_line_t
ocf_metadata_get_collision_prev(
90 struct ocf_cache
*cache
, ocf_cache_line_t line
)
92 return cache
->metadata
.iface
.get_collision_prev(cache
, line
);
95 void ocf_metadata_add_to_collision(struct ocf_cache
*cache
,
96 ocf_core_id_t core_id
, uint64_t core_line
,
97 ocf_cache_line_t hash
, ocf_cache_line_t cache_line
);
99 void ocf_metadata_remove_from_collision(struct ocf_cache
*cache
,
100 ocf_cache_line_t line
, ocf_part_id_t part_id
);
102 #endif /* METADATA_COLLISION_H_ */