1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
3 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Copyright 2017-2018 NXP
11 #define DPSECI_VER_MAJOR 5
12 #define DPSECI_VER_MINOR 3
14 #define DPSECI_VER(maj, min) (((maj) << 16) | (min))
15 #define DPSECI_VERSION DPSECI_VER(DPSECI_VER_MAJOR, DPSECI_VER_MINOR)
17 /* Command versioning */
18 #define DPSECI_CMD_BASE_VERSION 1
19 #define DPSECI_CMD_BASE_VERSION_V2 2
20 #define DPSECI_CMD_ID_OFFSET 4
22 #define DPSECI_CMD_V1(id) (((id) << DPSECI_CMD_ID_OFFSET) | \
23 DPSECI_CMD_BASE_VERSION)
25 #define DPSECI_CMD_V2(id) (((id) << DPSECI_CMD_ID_OFFSET) | \
26 DPSECI_CMD_BASE_VERSION_V2)
29 #define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800)
30 #define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809)
31 #define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09)
33 #define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002)
34 #define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003)
35 #define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004)
36 #define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005)
37 #define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006)
39 #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
40 #define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
41 #define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
42 #define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V2(0x198)
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 1 byte */
47 #define DPSECI_MASK(field) \
48 GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
49 DPSECI_##field##_SHIFT)
51 #define dpseci_set_field(var, field, val) \
52 ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
54 #define dpseci_get_field(var, field) \
55 (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
57 struct dpseci_cmd_open
{
61 #define DPSECI_ENABLE_SHIFT 0
62 #define DPSECI_ENABLE_SIZE 1
64 struct dpseci_rsp_is_enabled
{
68 struct dpseci_rsp_get_attributes
{
77 #define DPSECI_DEST_TYPE_SHIFT 0
78 #define DPSECI_DEST_TYPE_SIZE 4
80 #define DPSECI_ORDER_PRESERVATION_SHIFT 0
81 #define DPSECI_ORDER_PRESERVATION_SIZE 1
83 struct dpseci_cmd_queue
{
94 u8 order_preservation_en
;
97 struct dpseci_rsp_get_tx_queue
{
103 struct dpseci_rsp_get_sec_attr
{
129 struct dpseci_rsp_get_api_version
{
134 #define DPSECI_CGN_DEST_TYPE_SHIFT 0
135 #define DPSECI_CGN_DEST_TYPE_SIZE 4
136 #define DPSECI_CGN_UNITS_SHIFT 4
137 #define DPSECI_CGN_UNITS_SIZE 2
139 struct dpseci_cmd_congestion_notification
{
141 __le16 notification_mode
;
146 __le32 threshold_entry
;
147 __le32 threshold_exit
;
150 #endif /* _DPSECI_CMD_H_ */