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 1
14 /* Command versioning */
15 #define DPSECI_CMD_BASE_VERSION 1
16 #define DPSECI_CMD_BASE_VERSION_V2 2
17 #define DPSECI_CMD_ID_OFFSET 4
19 #define DPSECI_CMD_V1(id) \
20 ((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION)
21 #define DPSECI_CMD_V2(id) \
22 ((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION_V2)
25 #define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800)
26 #define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809)
27 #define DPSECI_CMDID_CREATE DPSECI_CMD_V2(0x909)
28 #define DPSECI_CMDID_DESTROY DPSECI_CMD_V1(0x989)
29 #define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09)
31 #define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002)
32 #define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003)
33 #define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004)
34 #define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005)
35 #define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006)
37 #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
38 #define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
39 #define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
40 #define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V1(0x198)
41 #define DPSECI_CMDID_GET_SEC_COUNTERS DPSECI_CMD_V1(0x199)
43 #define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170)
44 #define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171)
46 /* Macros for accessing command fields smaller than 1byte */
47 #define DPSECI_MASK(field) \
48 GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
49 DPSECI_##field##_SHIFT)
50 #define dpseci_set_field(var, field, val) \
51 ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
52 #define dpseci_get_field(var, field) \
53 (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
56 struct dpseci_cmd_open {
60 struct dpseci_cmd_create {
61 uint8_t priorities[8];
62 uint8_t num_tx_queues;
63 uint8_t num_rx_queues;
68 struct dpseci_cmd_destroy {
72 #define DPSECI_ENABLE_SHIFT 0
73 #define DPSECI_ENABLE_SIZE 1
75 struct dpseci_rsp_is_enabled {
76 /* only the first LSB */
80 struct dpseci_rsp_get_attr {
83 uint8_t num_tx_queues;
84 uint8_t num_rx_queues;
89 #define DPSECI_DEST_TYPE_SHIFT 0
90 #define DPSECI_DEST_TYPE_SIZE 4
92 #define DPSECI_ORDER_PRESERVATION_SHIFT 0
93 #define DPSECI_ORDER_PRESERVATION_SIZE 1
95 struct dpseci_cmd_set_rx_queue {
97 uint8_t dest_priority;
99 /* from LSB: dest_type:4 */
105 uint8_t order_preservation_en;
108 struct dpseci_cmd_get_queue {
113 struct dpseci_rsp_get_rx_queue {
115 uint8_t dest_priority;
117 /* from LSB: dest_type:4 */
123 uint8_t order_preservation_en;
127 struct dpseci_rsp_get_tx_queue {
133 struct dpseci_rsp_get_sec_attr {
140 uint8_t zuc_auth_acc_num;
141 uint8_t zuc_enc_acc_num;
143 uint8_t snow_f8_acc_num;
144 uint8_t snow_f9_acc_num;
148 uint8_t kasumi_acc_num;
152 uint8_t arc4_acc_num;
157 struct dpseci_rsp_get_sec_counters {
158 uint64_t dequeued_requests;
159 uint64_t ob_enc_requests;
160 uint64_t ib_dec_requests;
161 uint64_t ob_enc_bytes;
162 uint64_t ob_prot_bytes;
163 uint64_t ib_dec_bytes;
164 uint64_t ib_valid_bytes;
167 struct dpseci_rsp_get_api_version {
172 #define DPSECI_DEST_TYPE_SHIFT 0
173 #define DPSECI_DEST_TYPE_SIZE 4
174 #define DPSECI_CG_UNITS_SHIFT 4
175 #define DPSECI_CG_UNITS_SIZE 2
177 struct dpseci_cmd_set_congestion_notification {
179 uint16_t notification_mode;
180 uint8_t dest_priority;
181 /* from LSB: dest_type: 4 units:2 */
183 uint64_t message_iova;
184 uint64_t message_ctx;
185 uint32_t threshold_entry;
186 uint32_t threshold_exit;
190 #endif /* _FSL_DPSECI_CMD_H */