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_IS_ENABLED DPSECI_CMD_V1(0x006)
38 #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
39 #define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
40 #define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
41 #define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V2(0x198)
42 #define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170)
43 #define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171)
45 /* Macros for accessing command fields smaller than 1 byte */
46 #define DPSECI_MASK(field) \
47 GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
48 DPSECI_##field##_SHIFT)
50 #define dpseci_set_field(var, field, val) \
51 ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
53 #define dpseci_get_field(var, field) \
54 (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
56 struct dpseci_cmd_open
{
60 #define DPSECI_ENABLE_SHIFT 0
61 #define DPSECI_ENABLE_SIZE 1
63 struct dpseci_rsp_is_enabled
{
67 struct dpseci_rsp_get_attributes
{
76 #define DPSECI_DEST_TYPE_SHIFT 0
77 #define DPSECI_DEST_TYPE_SIZE 4
79 #define DPSECI_ORDER_PRESERVATION_SHIFT 0
80 #define DPSECI_ORDER_PRESERVATION_SIZE 1
82 struct dpseci_cmd_queue
{
93 u8 order_preservation_en
;
96 struct dpseci_rsp_get_tx_queue
{
102 struct dpseci_rsp_get_sec_attr
{
128 struct dpseci_rsp_get_api_version
{
133 #define DPSECI_CGN_DEST_TYPE_SHIFT 0
134 #define DPSECI_CGN_DEST_TYPE_SIZE 4
135 #define DPSECI_CGN_UNITS_SHIFT 4
136 #define DPSECI_CGN_UNITS_SIZE 2
138 struct dpseci_cmd_congestion_notification
{
140 __le16 notification_mode
;
145 __le32 threshold_entry
;
146 __le32 threshold_exit
;
149 #endif /* _DPSECI_CMD_H_ */