2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
6 #ifndef __CACHE_ENGINE_H_
7 #define __CACHE_ENGINE_H_
9 struct ocf_thread_priv
;
14 #define LOOKUP_MAPPED 8
17 /* modes inherited from user API */
18 ocf_req_cache_mode_wt
= ocf_cache_mode_wt
,
19 ocf_req_cache_mode_wb
= ocf_cache_mode_wb
,
20 ocf_req_cache_mode_wa
= ocf_cache_mode_wa
,
21 ocf_req_cache_mode_pt
= ocf_cache_mode_pt
,
22 ocf_req_cache_mode_wi
= ocf_cache_mode_wi
,
25 ocf_req_cache_mode_fast
,
27 ocf_req_cache_mode_d2c
,
28 /*!< Direct to Core - pass through to core without
29 touching cacheline metadata */
31 ocf_req_cache_mode_max
,
32 } ocf_req_cache_mode_t
;
35 int (*read
)(struct ocf_request
*req
);
37 int (*write
)(struct ocf_request
*req
);
42 ocf_cache_mode_t
ocf_get_effective_cache_mode(ocf_cache_t cache
,
43 ocf_core_t core
, struct ocf_io
*io
);
45 const struct ocf_io_if
*ocf_get_io_if(ocf_req_cache_mode_t cache_mode
);
47 static inline const char *ocf_get_io_iface_name(ocf_cache_mode_t cache_mode
)
49 const struct ocf_io_if
*iface
= ocf_get_io_if(cache_mode
);
51 return iface
? iface
->name
: "Unknown";
54 static inline bool ocf_cache_mode_is_valid(ocf_cache_mode_t mode
)
56 return mode
>= ocf_cache_mode_wt
&& mode
< ocf_cache_mode_max
;
59 void ocf_seq_cutoff_update(ocf_core_t core
, struct ocf_request
*req
);
61 bool ocf_fallback_pt_is_on(ocf_cache_t cache
);
63 bool ocf_seq_cutoff_check(ocf_core_t core
, uint32_t dir
, uint64_t addr
,
66 struct ocf_request
*ocf_engine_pop_req(struct ocf_cache
*cache
,
69 int ocf_engine_hndl_req(struct ocf_request
*req
,
70 ocf_req_cache_mode_t req_cache_mode
);
72 #define OCF_FAST_PATH_YES 7
73 #define OCF_FAST_PATH_NO 13
75 int ocf_engine_hndl_fast_req(struct ocf_request
*req
,
76 ocf_req_cache_mode_t req_cache_mode
);
78 void ocf_engine_hndl_discard_req(struct ocf_request
*req
);
80 void ocf_engine_hndl_ops_req(struct ocf_request
*req
);