1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
3 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Copyright 2016-2017 NXP
7 #ifndef _FSL_DPSECI_CMD_H
8 #define _FSL_DPSECI_CMD_H
11 #define DPSECI_VER_MAJOR 5
12 #define DPSECI_VER_MINOR 3
14 /* Command versioning */
15 #define DPSECI_CMD_BASE_VERSION 1
16 #define DPSECI_CMD_BASE_VERSION_V2 2
17 #define DPSECI_CMD_BASE_VERSION_V3 3
18 #define DPSECI_CMD_ID_OFFSET 4
20 #define DPSECI_CMD_V1(id) \
21 ((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION)
22 #define DPSECI_CMD_V2(id) \
23 ((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION_V2)
24 #define DPSECI_CMD_V3(id) \
25 ((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION_V3)
28 #define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800)
29 #define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809)
30 #define DPSECI_CMDID_CREATE DPSECI_CMD_V3(0x909)
31 #define DPSECI_CMDID_DESTROY DPSECI_CMD_V1(0x989)
32 #define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09)
34 #define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002)
35 #define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003)
36 #define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004)
37 #define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005)
38 #define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006)
40 #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
41 #define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
42 #define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
43 #define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V2(0x198)
44 #define DPSECI_CMDID_GET_SEC_COUNTERS DPSECI_CMD_V1(0x199)
45 #define DPSECI_CMDID_SET_OPR DPSECI_CMD_V1(0x19A)
46 #define DPSECI_CMDID_GET_OPR DPSECI_CMD_V1(0x19B)
47 #define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170)
48 #define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171)
50 /* Macros for accessing command fields smaller than 1byte */
51 #define DPSECI_MASK(field) \
52 GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
53 DPSECI_##field##_SHIFT)
54 #define dpseci_set_field(var, field, val) \
55 ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
56 #define dpseci_get_field(var, field) \
57 (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
60 struct dpseci_cmd_open {
64 struct dpseci_cmd_create {
65 uint8_t priorities[8];
66 uint8_t num_tx_queues;
67 uint8_t num_rx_queues;
71 uint8_t priorities2[8];
74 struct dpseci_cmd_destroy {
78 #define DPSECI_ENABLE_SHIFT 0
79 #define DPSECI_ENABLE_SIZE 1
81 struct dpseci_rsp_is_enabled {
82 /* only the first LSB */
86 struct dpseci_rsp_get_attr {
89 uint8_t num_tx_queues;
90 uint8_t num_rx_queues;
95 #define DPSECI_DEST_TYPE_SHIFT 0
96 #define DPSECI_DEST_TYPE_SIZE 4
98 #define DPSECI_ORDER_PRESERVATION_SHIFT 0
99 #define DPSECI_ORDER_PRESERVATION_SIZE 1
101 struct dpseci_cmd_set_rx_queue {
103 uint8_t dest_priority;
105 /* from LSB: dest_type:4 */
111 uint8_t order_preservation_en;
114 struct dpseci_cmd_get_queue {
119 struct dpseci_rsp_get_rx_queue {
121 uint8_t dest_priority;
123 /* from LSB: dest_type:4 */
129 uint8_t order_preservation_en;
133 struct dpseci_rsp_get_tx_queue {
139 struct dpseci_rsp_get_sec_attr {
146 uint8_t zuc_auth_acc_num;
147 uint8_t zuc_enc_acc_num;
149 uint8_t snow_f8_acc_num;
150 uint8_t snow_f9_acc_num;
154 uint8_t kasumi_acc_num;
158 uint8_t arc4_acc_num;
161 uint8_t ccha_acc_num;
162 uint8_t ptha_acc_num;
165 struct dpseci_rsp_get_sec_counters {
166 uint64_t dequeued_requests;
167 uint64_t ob_enc_requests;
168 uint64_t ib_dec_requests;
169 uint64_t ob_enc_bytes;
170 uint64_t ob_prot_bytes;
171 uint64_t ib_dec_bytes;
172 uint64_t ib_valid_bytes;
175 struct dpseci_rsp_get_api_version {
180 struct dpseci_cmd_set_opr {
192 struct dpseci_cmd_get_opr {
197 #define DPSECI_RIP_SHIFT 0
198 #define DPSECI_RIP_SIZE 1
199 #define DPSECI_OPR_ENABLE_SHIFT 1
200 #define DPSECI_OPR_ENABLE_SIZE 1
201 #define DPSECI_TSEQ_NLIS_SHIFT 0
202 #define DPSECI_TSEQ_NLIS_SIZE 1
203 #define DPSECI_HSEQ_NLIS_SHIFT 0
204 #define DPSECI_HSEQ_NLIS_SIZE 1
206 struct dpseci_rsp_get_opr {
208 /* from LSB: rip:1 enable:1 */
237 #define DPSECI_DEST_TYPE_SHIFT 0
238 #define DPSECI_DEST_TYPE_SIZE 4
239 #define DPSECI_CG_UNITS_SHIFT 4
240 #define DPSECI_CG_UNITS_SIZE 2
242 struct dpseci_cmd_set_congestion_notification {
244 uint16_t notification_mode;
245 uint8_t dest_priority;
246 /* from LSB: dest_type: 4 units:2 */
248 uint64_t message_iova;
249 uint64_t message_ctx;
250 uint32_t threshold_entry;
251 uint32_t threshold_exit;
255 #endif /* _FSL_DPSECI_CMD_H */