summaryrefslogtreecommitdiffstats
path: root/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/dpaa2/mc/fsl_dpni_cmd.h')
-rw-r--r--drivers/net/dpaa2/mc/fsl_dpni_cmd.h1020
1 files changed, 591 insertions, 429 deletions
diff --git a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
index 2ac397cd..1a483329 100644
--- a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
+++ b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
@@ -5,7 +5,7 @@
* BSD LICENSE
*
* Copyright 2013-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP.
+ * Copyright 2016-2017 NXP.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -42,435 +42,597 @@
/* DPNI Version */
#define DPNI_VER_MAJOR 7
-#define DPNI_VER_MINOR 0
+#define DPNI_VER_MINOR 3
+
+#define DPNI_CMD_BASE_VERSION 1
+#define DPNI_CMD_VERSION_2 2
+#define DPNI_CMD_ID_OFFSET 4
+
+#define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION)
+#define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_2)
/* Command IDs */
-#define DPNI_CMDID_OPEN ((0x801 << 4) | (0x1))
-#define DPNI_CMDID_CLOSE ((0x800 << 4) | (0x1))
-#define DPNI_CMDID_CREATE ((0x901 << 4) | (0x1))
-#define DPNI_CMDID_DESTROY ((0x981 << 4) | (0x1))
-#define DPNI_CMDID_GET_API_VERSION ((0xa01 << 4) | (0x1))
-
-#define DPNI_CMDID_ENABLE ((0x002 << 4) | (0x1))
-#define DPNI_CMDID_DISABLE ((0x003 << 4) | (0x1))
-#define DPNI_CMDID_GET_ATTR ((0x004 << 4) | (0x1))
-#define DPNI_CMDID_RESET ((0x005 << 4) | (0x1))
-#define DPNI_CMDID_IS_ENABLED ((0x006 << 4) | (0x1))
-
-#define DPNI_CMDID_SET_POOLS ((0x200 << 4) | (0x1))
-#define DPNI_CMDID_SET_ERRORS_BEHAVIOR ((0x20B << 4) | (0x1))
-
-#define DPNI_CMDID_GET_QDID ((0x210 << 4) | (0x1))
-#define DPNI_CMDID_GET_LINK_STATE ((0x215 << 4) | (0x1))
-#define DPNI_CMDID_SET_MAX_FRAME_LENGTH ((0x216 << 4) | (0x1))
-#define DPNI_CMDID_GET_MAX_FRAME_LENGTH ((0x217 << 4) | (0x1))
-#define DPNI_CMDID_SET_LINK_CFG ((0x21a << 4) | (0x1))
-
-#define DPNI_CMDID_SET_MCAST_PROMISC ((0x220 << 4) | (0x1))
-#define DPNI_CMDID_GET_MCAST_PROMISC ((0x221 << 4) | (0x1))
-#define DPNI_CMDID_SET_UNICAST_PROMISC ((0x222 << 4) | (0x1))
-#define DPNI_CMDID_GET_UNICAST_PROMISC ((0x223 << 4) | (0x1))
-#define DPNI_CMDID_SET_PRIM_MAC ((0x224 << 4) | (0x1))
-#define DPNI_CMDID_GET_PRIM_MAC ((0x225 << 4) | (0x1))
-#define DPNI_CMDID_ADD_MAC_ADDR ((0x226 << 4) | (0x1))
-#define DPNI_CMDID_REMOVE_MAC_ADDR ((0x227 << 4) | (0x1))
-#define DPNI_CMDID_CLR_MAC_FILTERS ((0x228 << 4) | (0x1))
-
-#define DPNI_CMDID_ENABLE_VLAN_FILTER ((0x230 << 4) | (0x1))
-#define DPNI_CMDID_ADD_VLAN_ID ((0x231 << 4) | (0x1))
-#define DPNI_CMDID_REMOVE_VLAN_ID ((0x232 << 4) | (0x1))
-#define DPNI_CMDID_CLR_VLAN_FILTERS ((0x233 << 4) | (0x1))
-
-#define DPNI_CMDID_SET_RX_TC_DIST ((0x235 << 4) | (0x1))
-
-#define DPNI_CMDID_GET_STATISTICS ((0x25D << 4) | (0x1))
-#define DPNI_CMDID_RESET_STATISTICS ((0x25E << 4) | (0x1))
-#define DPNI_CMDID_GET_QUEUE ((0x25F << 4) | (0x1))
-#define DPNI_CMDID_SET_QUEUE ((0x260 << 4) | (0x1))
-#define DPNI_CMDID_GET_TAILDROP ((0x261 << 4) | (0x1))
-#define DPNI_CMDID_SET_TAILDROP ((0x262 << 4) | (0x1))
-
-#define DPNI_CMDID_GET_PORT_MAC_ADDR ((0x263 << 4) | (0x1))
-
-#define DPNI_CMDID_GET_BUFFER_LAYOUT ((0x264 << 4) | (0x1))
-#define DPNI_CMDID_SET_BUFFER_LAYOUT ((0x265 << 4) | (0x1))
-
-#define DPNI_CMDID_SET_CONGESTION_NOTIFICATION ((0x267 << 4) | (0x1))
-#define DPNI_CMDID_GET_CONGESTION_NOTIFICATION ((0x268 << 4) | (0x1))
-#define DPNI_CMDID_GET_OFFLOAD ((0x26B << 4) | (0x1))
-#define DPNI_CMDID_SET_OFFLOAD ((0x26C << 4) | (0x1))
-#define DPNI_CMDID_SET_TX_CONFIRMATION_MODE ((0x266 << 4) | (0x1))
-#define DPNI_CMDID_GET_TX_CONFIRMATION_MODE ((0x26D << 4) | (0x1))
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_OPEN(cmd, dpni_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_CREATE(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, uint32_t, (cfg)->options); \
- MC_CMD_OP(cmd, 0, 32, 8, uint8_t, (cfg)->num_queues); \
- MC_CMD_OP(cmd, 0, 40, 8, uint8_t, (cfg)->num_tcs); \
- MC_CMD_OP(cmd, 0, 48, 8, uint8_t, (cfg)->mac_filter_entries); \
- MC_CMD_OP(cmd, 1, 0, 8, uint8_t, (cfg)->vlan_filter_entries); \
- MC_CMD_OP(cmd, 1, 16, 8, uint8_t, (cfg)->qos_entries); \
- MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->fs_entries); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_POOLS(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \
- MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \
- MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \
- MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \
- MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \
- MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \
- MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \
- MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \
- MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \
- MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \
- MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
- MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \
- MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
- MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \
- MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\
- MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \
- MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
- MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \
- MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
- MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \
- MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
- MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \
- MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\
- MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \
- MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_IS_ENABLED(cmd, en) \
- MC_RSP_OP(cmd, 0, 0, 1, int, en)
-
-/* DPNI_CMD_GET_ATTR is not used, no input parameters */
-
-#define DPNI_RSP_GET_ATTR(cmd, attr) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 32, uint32_t, (attr)->options); \
- MC_RSP_OP(cmd, 0, 32, 8, uint8_t, (attr)->num_queues); \
- MC_RSP_OP(cmd, 0, 40, 8, uint8_t, (attr)->num_tcs); \
- MC_RSP_OP(cmd, 0, 48, 8, uint8_t, (attr)->mac_filter_entries); \
- MC_RSP_OP(cmd, 1, 0, 8, uint8_t, (attr)->vlan_filter_entries); \
- MC_RSP_OP(cmd, 1, 16, 8, uint8_t, (attr)->qos_entries); \
- MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (attr)->fs_entries); \
- MC_RSP_OP(cmd, 2, 0, 8, uint8_t, (attr)->qos_key_size); \
- MC_RSP_OP(cmd, 2, 8, 8, uint8_t, (attr)->fs_key_size); \
- MC_RSP_OP(cmd, 2, 16, 16, uint16_t, (attr)->wriop_version); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \
- MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \
- MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \
-} while (0)
-
-#define DPNI_CMD_GET_BUFFER_LAYOUT(cmd, qtype) \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype)
-
-#define DPNI_RSP_GET_BUFFER_LAYOUT(cmd, layout) \
-do { \
- MC_RSP_OP(cmd, 0, 48, 1, char, (layout)->pass_timestamp); \
- MC_RSP_OP(cmd, 0, 49, 1, char, (layout)->pass_parser_result); \
- MC_RSP_OP(cmd, 0, 50, 1, char, (layout)->pass_frame_status); \
- MC_RSP_OP(cmd, 1, 0, 16, uint16_t, (layout)->private_data_size); \
- MC_RSP_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
- MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
- MC_RSP_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
-} while (0)
-
-#define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, qtype, layout) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
- MC_CMD_OP(cmd, 0, 32, 16, uint16_t, (layout)->options); \
- MC_CMD_OP(cmd, 0, 48, 1, char, (layout)->pass_timestamp); \
- MC_CMD_OP(cmd, 0, 49, 1, char, (layout)->pass_parser_result); \
- MC_CMD_OP(cmd, 0, 50, 1, char, (layout)->pass_frame_status); \
- MC_CMD_OP(cmd, 1, 0, 16, uint16_t, (layout)->private_data_size); \
- MC_CMD_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
- MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
- MC_CMD_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
-} while (0)
-
-#define DPNI_CMD_SET_OFFLOAD(cmd, type, config) \
-do { \
- MC_CMD_OP(cmd, 0, 24, 8, enum dpni_offload, type); \
- MC_CMD_OP(cmd, 0, 32, 32, uint32_t, config); \
-} while (0)
-
-#define DPNI_CMD_GET_OFFLOAD(cmd, type) \
- MC_CMD_OP(cmd, 0, 24, 8, enum dpni_offload, type)
-
-#define DPNI_RSP_GET_OFFLOAD(cmd, config) \
- MC_RSP_OP(cmd, 0, 32, 32, uint32_t, config)
-
-#define DPNI_CMD_GET_QDID(cmd, qtype) \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_QDID(cmd, qdid) \
- MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
-
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_GET_STATISTICS(cmd, page) \
- MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page)
-
-#define DPNI_RSP_GET_STATISTICS(cmd, stat) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->raw.counter[0]); \
- MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->raw.counter[1]); \
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->raw.counter[2]); \
- MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->raw.counter[3]); \
- MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->raw.counter[4]); \
- MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->raw.counter[5]); \
- MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->raw.counter[6]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\
- MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_LINK_STATE(cmd, state) \
-do { \
- MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
- MC_CMD_OP(cmd, 0, 0, 16, uint16_t, max_frame_length)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
- MC_RSP_OP(cmd, 0, 0, 16, uint16_t, max_frame_length)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_MULTICAST_PROMISC(cmd, en) \
- MC_CMD_OP(cmd, 0, 0, 1, int, en)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_MULTICAST_PROMISC(cmd, en) \
- MC_RSP_OP(cmd, 0, 0, 1, int, en)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_UNICAST_PROMISC(cmd, en) \
- MC_CMD_OP(cmd, 0, 0, 1, int, en)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_UNICAST_PROMISC(cmd, en) \
- MC_RSP_OP(cmd, 0, 0, 1, int, en)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
-do { \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
- MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
- MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
- MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
- MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
- MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
-do { \
- MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
- MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
- MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
- MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
- MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
- MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
-} while (0)
-
-#define DPNI_RSP_GET_PORT_MAC_ADDR(cmd, mac_addr) \
-do { \
- MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
- MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
- MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
- MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
- MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
- MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
-do { \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
- MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
- MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
- MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
- MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
- MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
-do { \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
- MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
- MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
- MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
- MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
- MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_CLEAR_MAC_FILTERS(cmd, unicast, multicast) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 1, int, unicast); \
- MC_CMD_OP(cmd, 0, 1, 1, int, multicast); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_ENABLE_VLAN_FILTER(cmd, en) \
- MC_CMD_OP(cmd, 0, 0, 1, int, en)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_ADD_VLAN_ID(cmd, vlan_id) \
- MC_CMD_OP(cmd, 0, 32, 16, uint16_t, vlan_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_REMOVE_VLAN_ID(cmd, vlan_id) \
- MC_CMD_OP(cmd, 0, 32, 16, uint16_t, vlan_id)
-
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_RX_TC_DIST(cmd, tc_id, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 16, uint16_t, cfg->dist_size); \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc_id); \
- MC_CMD_OP(cmd, 0, 24, 4, enum dpni_dist_mode, cfg->dist_mode); \
- MC_CMD_OP(cmd, 0, 28, 4, enum dpni_fs_miss_action, \
- cfg->fs_cfg.miss_action); \
- MC_CMD_OP(cmd, 0, 48, 16, uint16_t, cfg->fs_cfg.default_flow_id); \
- MC_CMD_OP(cmd, 6, 0, 64, uint64_t, cfg->key_cfg_iova); \
-} while (0)
-
-#define DPNI_CMD_GET_QUEUE(cmd, qtype, tc, index) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
-} while (0)
-
-#define DPNI_RSP_GET_QUEUE(cmd, queue, queue_id) \
-do { \
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
- MC_RSP_OP(cmd, 1, 48, 8, uint8_t, (queue)->destination.priority); \
- MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
- MC_RSP_OP(cmd, 1, 62, 1, char, (queue)->flc.stash_control); \
- MC_RSP_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc.value); \
- MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
- MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (queue_id)->fqid); \
- MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue_id)->qdbin); \
-} while (0)
-
-#define DPNI_CMD_SET_QUEUE(cmd, qtype, tc, index, options, queue) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
- MC_CMD_OP(cmd, 0, 24, 8, uint8_t, options); \
- MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
- MC_CMD_OP(cmd, 1, 48, 8, uint8_t, (queue)->destination.priority); \
- MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
- MC_CMD_OP(cmd, 1, 62, 1, char, (queue)->flc.stash_control); \
- MC_CMD_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
- MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc.value); \
- MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_API_VERSION(cmd, major, minor) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
- MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
-} while (0)
-
-#define DPNI_CMD_GET_TAILDROP(cmd, cp, q_type, tc, q_index) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_congestion_point, cp); \
- MC_CMD_OP(cmd, 0, 8, 8, enum dpni_queue_type, q_type); \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc); \
- MC_CMD_OP(cmd, 0, 24, 8, uint8_t, q_index); \
-} while (0)
-
-#define DPNI_RSP_GET_TAILDROP(cmd, taildrop) \
-do { \
- MC_RSP_OP(cmd, 1, 0, 1, char, (taildrop)->enable); \
- MC_RSP_OP(cmd, 1, 16, 8, enum dpni_congestion_unit, \
- (taildrop)->units); \
- MC_RSP_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
-} while (0)
-
-#define DPNI_CMD_SET_TAILDROP(cmd, cp, q_type, tc, q_index, taildrop) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_congestion_point, cp); \
- MC_CMD_OP(cmd, 0, 8, 8, enum dpni_queue_type, q_type); \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc); \
- MC_CMD_OP(cmd, 0, 24, 8, uint8_t, q_index); \
- MC_CMD_OP(cmd, 1, 0, 1, char, (taildrop)->enable); \
- MC_CMD_OP(cmd, 1, 16, 8, enum dpni_congestion_unit, \
- (taildrop)->units); \
- MC_CMD_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
-} while (0)
-
-#define DPNI_CMD_SET_TX_CONFIRMATION_MODE(cmd, mode) \
- MC_CMD_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
-
-#define DPNI_RSP_GET_TX_CONFIRMATION_MODE(cmd, mode) \
- MC_RSP_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
-
-#define DPNI_CMD_SET_CONGESTION_NOTIFICATION(cmd, qtype, tc, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
- MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
- MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->notification_mode); \
- MC_CMD_OP(cmd, 1, 48, 8, uint8_t, (cfg)->dest_cfg.priority); \
- MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
- MC_CMD_OP(cmd, 1, 60, 2, enum dpni_congestion_unit, (cfg)->units); \
- MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (cfg)->message_iova); \
- MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (cfg)->message_ctx); \
- MC_CMD_OP(cmd, 4, 0, 32, uint32_t, (cfg)->threshold_entry); \
- MC_CMD_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
-} while (0)
-
-#define DPNI_CMD_GET_CONGESTION_NOTIFICATION(cmd, qtype, tc) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
-} while (0)
-
-#define DPNI_RSP_GET_CONGESTION_NOTIFICATION(cmd, cfg) \
-do { \
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
- MC_RSP_OP(cmd, 1, 0, 16, uint16_t, (cfg)->notification_mode); \
- MC_RSP_OP(cmd, 1, 48, 8, uint8_t, (cfg)->dest_cfg.priority); \
- MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
- MC_RSP_OP(cmd, 1, 60, 2, enum dpni_congestion_unit, (cfg)->units); \
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (cfg)->message_iova); \
- MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (cfg)->message_ctx); \
- MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (cfg)->threshold_entry); \
- MC_RSP_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
-} while (0)
+#define DPNI_CMDID_OPEN DPNI_CMD(0x801)
+#define DPNI_CMDID_CLOSE DPNI_CMD(0x800)
+#define DPNI_CMDID_CREATE DPNI_CMD(0x901)
+#define DPNI_CMDID_DESTROY DPNI_CMD(0x981)
+#define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01)
+
+#define DPNI_CMDID_ENABLE DPNI_CMD(0x002)
+#define DPNI_CMDID_DISABLE DPNI_CMD(0x003)
+#define DPNI_CMDID_GET_ATTR DPNI_CMD_V2(0x004)
+#define DPNI_CMDID_RESET DPNI_CMD(0x005)
+#define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006)
+
+#define DPNI_CMDID_SET_IRQ_ENABLE DPNI_CMD(0x012)
+#define DPNI_CMDID_GET_IRQ_ENABLE DPNI_CMD(0x013)
+#define DPNI_CMDID_SET_IRQ_MASK DPNI_CMD(0x014)
+#define DPNI_CMDID_GET_IRQ_MASK DPNI_CMD(0x015)
+#define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016)
+#define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017)
+
+#define DPNI_CMDID_SET_POOLS DPNI_CMD_V2(0x200)
+#define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B)
+
+#define DPNI_CMDID_GET_QDID DPNI_CMD(0x210)
+#define DPNI_CMDID_GET_SP_INFO DPNI_CMD(0x211)
+#define DPNI_CMDID_GET_TX_DATA_OFFSET DPNI_CMD(0x212)
+#define DPNI_CMDID_GET_LINK_STATE DPNI_CMD(0x215)
+#define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216)
+#define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217)
+#define DPNI_CMDID_SET_LINK_CFG DPNI_CMD(0x21A)
+#define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V2(0x21B)
+
+#define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220)
+#define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221)
+#define DPNI_CMDID_SET_UNICAST_PROMISC DPNI_CMD(0x222)
+#define DPNI_CMDID_GET_UNICAST_PROMISC DPNI_CMD(0x223)
+#define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224)
+#define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225)
+#define DPNI_CMDID_ADD_MAC_ADDR DPNI_CMD(0x226)
+#define DPNI_CMDID_REMOVE_MAC_ADDR DPNI_CMD(0x227)
+#define DPNI_CMDID_CLR_MAC_FILTERS DPNI_CMD(0x228)
+
+#define DPNI_CMDID_ENABLE_VLAN_FILTER DPNI_CMD(0x230)
+#define DPNI_CMDID_ADD_VLAN_ID DPNI_CMD(0x231)
+#define DPNI_CMDID_REMOVE_VLAN_ID DPNI_CMD(0x232)
+#define DPNI_CMDID_CLR_VLAN_FILTERS DPNI_CMD(0x233)
+
+#define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD_V2(0x235)
+
+#define DPNI_CMDID_GET_STATISTICS DPNI_CMD_V2(0x25D)
+#define DPNI_CMDID_RESET_STATISTICS DPNI_CMD(0x25E)
+#define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F)
+#define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260)
+#define DPNI_CMDID_GET_TAILDROP DPNI_CMD_V2(0x261)
+#define DPNI_CMDID_SET_TAILDROP DPNI_CMD_V2(0x262)
+
+#define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263)
+
+#define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD(0x264)
+#define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD(0x265)
+
+#define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD(0x267)
+#define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD(0x268)
+#define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD_V2(0x269)
+#define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD_V2(0x26A)
+#define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B)
+#define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C)
+#define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266)
+#define DPNI_CMDID_GET_TX_CONFIRMATION_MODE DPNI_CMD(0x26D)
+
+/* Macros for accessing command fields smaller than 1byte */
+#define DPNI_MASK(field) \
+ GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
+ DPNI_##field##_SHIFT)
+#define dpni_set_field(var, field, val) \
+ ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
+#define dpni_get_field(var, field) \
+ (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
+
+#pragma pack(push, 1)
+struct dpni_cmd_open {
+ uint32_t dpni_id;
+};
+
+struct dpni_cmd_create {
+ uint32_t options;
+ uint8_t num_queues;
+ uint8_t num_tcs;
+ uint8_t mac_filter_entries;
+ uint8_t pad1;
+ uint8_t vlan_filter_entries;
+ uint8_t pad2;
+ uint8_t qos_entries;
+ uint8_t pad3;
+ uint16_t fs_entries;
+};
+
+struct dpni_cmd_destroy {
+ uint32_t dpsw_id;
+};
+
+#define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
+
+struct dpni_cmd_pool {
+ uint16_t dpbp_id;
+ uint8_t priority_mask;
+ uint8_t pad;
+};
+
+struct dpni_cmd_set_pools {
+ uint8_t num_dpbp;
+ uint8_t backup_pool_mask;
+ uint16_t pad;
+ struct dpni_cmd_pool pool[8];
+ uint16_t buffer_size[8];
+};
+
+/* The enable indication is always the least significant bit */
+#define DPNI_ENABLE_SHIFT 0
+#define DPNI_ENABLE_SIZE 1
+
+struct dpni_rsp_is_enabled {
+ uint8_t enabled;
+};
+
+struct dpni_cmd_set_irq_enable {
+ uint8_t enable;
+ uint8_t pad[3];
+ uint8_t irq_index;
+};
+
+struct dpni_cmd_get_irq_enable {
+ uint32_t pad;
+ uint8_t irq_index;
+};
+
+struct dpni_rsp_get_irq_enable {
+ uint8_t enabled;
+};
+
+struct dpni_cmd_set_irq_mask {
+ uint32_t mask;
+ uint8_t irq_index;
+};
+
+struct dpni_cmd_get_irq_mask {
+ uint32_t pad;
+ uint8_t irq_index;
+};
+
+struct dpni_rsp_get_irq_mask {
+ uint32_t mask;
+};
+
+struct dpni_cmd_get_irq_status {
+ uint32_t status;
+ uint8_t irq_index;
+};
+
+struct dpni_rsp_get_irq_status {
+ uint32_t status;
+};
+
+struct dpni_cmd_clear_irq_status {
+ uint32_t status;
+ uint8_t irq_index;
+};
+
+struct dpni_rsp_get_attr {
+ /* response word 0 */
+ uint32_t options;
+ uint8_t num_queues;
+ uint8_t num_rx_tcs;
+ uint8_t mac_filter_entries;
+ uint8_t num_tx_tcs;
+ /* response word 1 */
+ uint8_t vlan_filter_entries;
+ uint8_t pad1;
+ uint8_t qos_entries;
+ uint8_t pad2;
+ uint16_t fs_entries;
+ uint16_t pad3;
+ /* response word 2 */
+ uint8_t qos_key_size;
+ uint8_t fs_key_size;
+ uint16_t wriop_version;
+};
+
+#define DPNI_ERROR_ACTION_SHIFT 0
+#define DPNI_ERROR_ACTION_SIZE 4
+#define DPNI_FRAME_ANN_SHIFT 4
+#define DPNI_FRAME_ANN_SIZE 1
+
+struct dpni_cmd_set_errors_behavior {
+ uint32_t errors;
+ /* from least significant bit: error_action:4, set_frame_annotation:1 */
+ uint8_t flags;
+};
+
+/* There are 3 separate commands for configuring Rx, Tx and Tx confirmation
+ * buffer layouts, but they all share the same parameters.
+ * If one of the functions changes, below structure needs to be split.
+ */
+#define DPNI_PASS_TS_SHIFT 0
+#define DPNI_PASS_TS_SIZE 1
+#define DPNI_PASS_PR_SHIFT 1
+#define DPNI_PASS_PR_SIZE 1
+#define DPNI_PASS_FS_SHIFT 2
+#define DPNI_PASS_FS_SIZE 1
+
+struct dpni_cmd_get_buffer_layout {
+ uint8_t qtype;
+};
+
+struct dpni_rsp_get_buffer_layout {
+ /* response word 0 */
+ uint8_t pad0[6];
+ /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
+ uint8_t flags;
+ uint8_t pad1;
+ /* response word 1 */
+ uint16_t private_data_size;
+ uint16_t data_align;
+ uint16_t head_room;
+ uint16_t tail_room;
+};
+
+struct dpni_cmd_set_buffer_layout {
+ /* cmd word 0 */
+ uint8_t qtype;
+ uint8_t pad0[3];
+ uint16_t options;
+ /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
+ uint8_t flags;
+ uint8_t pad1;
+ /* cmd word 1 */
+ uint16_t private_data_size;
+ uint16_t data_align;
+ uint16_t head_room;
+ uint16_t tail_room;
+};
+
+struct dpni_cmd_set_offload {
+ uint8_t pad[3];
+ uint8_t dpni_offload;
+ uint32_t config;
+};
+
+struct dpni_cmd_get_offload {
+ uint8_t pad[3];
+ uint8_t dpni_offload;
+};
+
+struct dpni_rsp_get_offload {
+ uint32_t pad;
+ uint32_t config;
+};
+
+struct dpni_cmd_get_qdid {
+ uint8_t qtype;
+};
+
+struct dpni_rsp_get_qdid {
+ uint16_t qdid;
+};
+
+struct dpni_rsp_get_sp_info {
+ uint16_t spids[2];
+};
+
+struct dpni_rsp_get_tx_data_offset {
+ uint16_t data_offset;
+};
+
+struct dpni_cmd_get_statistics {
+ uint8_t page_number;
+ uint8_t param;
+};
+
+struct dpni_rsp_get_statistics {
+ uint64_t counter[7];
+};
+
+struct dpni_cmd_set_link_cfg {
+ uint64_t pad0;
+ uint32_t rate;
+ uint32_t pad1;
+ uint64_t options;
+};
+
+#define DPNI_LINK_STATE_SHIFT 0
+#define DPNI_LINK_STATE_SIZE 1
+
+struct dpni_rsp_get_link_state {
+ uint32_t pad0;
+ /* from LSB: up:1 */
+ uint8_t flags;
+ uint8_t pad1[3];
+ uint32_t rate;
+ uint32_t pad2;
+ uint64_t options;
+};
+
+struct dpni_cmd_set_max_frame_length {
+ uint16_t max_frame_length;
+};
+
+struct dpni_rsp_get_max_frame_length {
+ uint16_t max_frame_length;
+};
+
+struct dpni_cmd_set_multicast_promisc {
+ uint8_t enable;
+};
+
+struct dpni_rsp_get_multicast_promisc {
+ uint8_t enabled;
+};
+
+struct dpni_cmd_set_unicast_promisc {
+ uint8_t enable;
+};
+
+struct dpni_rsp_get_unicast_promisc {
+ uint8_t enabled;
+};
+
+struct dpni_cmd_set_primary_mac_addr {
+ uint16_t pad;
+ uint8_t mac_addr[6];
+};
+
+struct dpni_rsp_get_primary_mac_addr {
+ uint16_t pad;
+ uint8_t mac_addr[6];
+};
+
+struct dpni_rsp_get_port_mac_addr {
+ uint16_t pad;
+ uint8_t mac_addr[6];
+};
+
+struct dpni_cmd_add_mac_addr {
+ uint16_t pad;
+ uint8_t mac_addr[6];
+};
+
+struct dpni_cmd_remove_mac_addr {
+ uint16_t pad;
+ uint8_t mac_addr[6];
+};
+
+#define DPNI_UNICAST_FILTERS_SHIFT 0
+#define DPNI_UNICAST_FILTERS_SIZE 1
+#define DPNI_MULTICAST_FILTERS_SHIFT 1
+#define DPNI_MULTICAST_FILTERS_SIZE 1
+
+struct dpni_cmd_clear_mac_filters {
+ /* from LSB: unicast:1, multicast:1 */
+ uint8_t flags;
+};
+
+struct dpni_cmd_enable_vlan_filter {
+ /* only the LSB */
+ uint8_t en;
+};
+
+struct dpni_cmd_vlan_id {
+ uint32_t pad;
+ uint16_t vlan_id;
+};
+
+#define DPNI_SEPARATE_GRP_SHIFT 0
+#define DPNI_SEPARATE_GRP_SIZE 1
+#define DPNI_MODE_1_SHIFT 0
+#define DPNI_MODE_1_SIZE 4
+#define DPNI_MODE_2_SHIFT 4
+#define DPNI_MODE_2_SIZE 4
+
+struct dpni_cmd_set_tx_priorities {
+ uint16_t flags;
+ uint8_t prio_group_A;
+ uint8_t prio_group_B;
+ uint32_t pad0;
+ uint8_t modes[4];
+ uint32_t pad1;
+ uint64_t pad2;
+ uint16_t delta_bandwidth[8];
+};
+
+#define DPNI_DIST_MODE_SHIFT 0
+#define DPNI_DIST_MODE_SIZE 4
+#define DPNI_MISS_ACTION_SHIFT 4
+#define DPNI_MISS_ACTION_SIZE 4
+#define DPNI_KEEP_HASH_KEY_SHIFT 7
+#define DPNI_KEEP_HASH_KEY_SIZE 1
+
+struct dpni_cmd_set_rx_tc_dist {
+ uint16_t dist_size;
+ uint8_t tc_id;
+ /* from LSB: dist_mode:4, miss_action:4 */
+ uint8_t flags;
+ uint8_t pad0;
+ /* only the LSB */
+ uint8_t keep_hash_key;
+ uint16_t default_flow_id;
+ uint64_t pad1[5];
+ uint64_t key_cfg_iova;
+};
+
+struct dpni_cmd_get_queue {
+ uint8_t qtype;
+ uint8_t tc;
+ uint8_t index;
+};
+
+#define DPNI_DEST_TYPE_SHIFT 0
+#define DPNI_DEST_TYPE_SIZE 4
+#define DPNI_STASH_CTRL_SHIFT 6
+#define DPNI_STASH_CTRL_SIZE 1
+#define DPNI_HOLD_ACTIVE_SHIFT 7
+#define DPNI_HOLD_ACTIVE_SIZE 1
+
+struct dpni_rsp_get_queue {
+ /* response word 0 */
+ uint64_t pad0;
+ /* response word 1 */
+ uint32_t dest_id;
+ uint16_t pad1;
+ uint8_t dest_prio;
+ /* From LSB: dest_type:4, pad:2, flc_stash_ctrl:1, hold_active:1 */
+ uint8_t flags;
+ /* response word 2 */
+ uint64_t flc;
+ /* response word 3 */
+ uint64_t user_context;
+ /* response word 4 */
+ uint32_t fqid;
+ uint16_t qdbin;
+};
+
+struct dpni_cmd_set_queue {
+ /* cmd word 0 */
+ uint8_t qtype;
+ uint8_t tc;
+ uint8_t index;
+ uint8_t options;
+ uint32_t pad0;
+ /* cmd word 1 */
+ uint32_t dest_id;
+ uint16_t pad1;
+ uint8_t dest_prio;
+ uint8_t flags;
+ /* cmd word 2 */
+ uint64_t flc;
+ /* cmd word 3 */
+ uint64_t user_context;
+};
+
+#define DPNI_DROP_ENABLE_SHIFT 0
+#define DPNI_DROP_ENABLE_SIZE 1
+#define DPNI_DROP_UNITS_SHIFT 2
+#define DPNI_DROP_UNITS_SIZE 2
+
+struct dpni_early_drop {
+ /* from LSB: enable:1 units:2 */
+ uint8_t flags;
+ uint8_t pad0[3];
+ uint32_t pad1;
+ uint8_t green_drop_probability;
+ uint8_t pad2[7];
+ uint64_t green_max_threshold;
+ uint64_t green_min_threshold;
+ uint64_t pad3;
+ uint8_t yellow_drop_probability;
+ uint8_t pad4[7];
+ uint64_t yellow_max_threshold;
+ uint64_t yellow_min_threshold;
+ uint64_t pad5;
+ uint8_t red_drop_probability;
+ uint8_t pad6[7];
+ uint64_t red_max_threshold;
+ uint64_t red_min_threshold;
+};
+
+struct dpni_cmd_early_drop {
+ uint8_t qtype;
+ uint8_t tc;
+ uint8_t pad[6];
+ uint64_t early_drop_iova;
+};
+
+struct dpni_rsp_get_api_version {
+ uint16_t major;
+ uint16_t minor;
+};
+
+struct dpni_cmd_get_taildrop {
+ uint8_t congestion_point;
+ uint8_t qtype;
+ uint8_t tc;
+ uint8_t index;
+};
+
+struct dpni_rsp_get_taildrop {
+ /* cmd word 0 */
+ uint64_t pad0;
+ /* cmd word 1 */
+ /* from LSB: enable:1 oal_lo:7 */
+ uint8_t enable_oal_lo;
+ /* from LSB: oal_hi:5 */
+ uint8_t oal_hi;
+ uint8_t units;
+ uint8_t pad2;
+ uint32_t threshold;
+};
+
+#define DPNI_OAL_LO_SHIFT 1
+#define DPNI_OAL_LO_SIZE 7
+#define DPNI_OAL_HI_SHIFT 0
+#define DPNI_OAL_HI_SIZE 5
+
+struct dpni_cmd_set_taildrop {
+ /* cmd word 0 */
+ uint8_t congestion_point;
+ uint8_t qtype;
+ uint8_t tc;
+ uint8_t index;
+ uint32_t pad0;
+ /* cmd word 1 */
+ /* from LSB: enable:1 oal_lo:7 */
+ uint8_t enable_oal_lo;
+ /* from LSB: oal_hi:5 */
+ uint8_t oal_hi;
+ uint8_t units;
+ uint8_t pad2;
+ uint32_t threshold;
+};
+
+struct dpni_tx_confirmation_mode {
+ uint32_t pad;
+ uint8_t confirmation_mode;
+};
+
+#define DPNI_DEST_TYPE_SHIFT 0
+#define DPNI_DEST_TYPE_SIZE 4
+#define DPNI_CONG_UNITS_SHIFT 4
+#define DPNI_CONG_UNITS_SIZE 2
+
+struct dpni_cmd_set_congestion_notification {
+ uint8_t qtype;
+ uint8_t tc;
+ uint8_t pad[6];
+ uint32_t dest_id;
+ uint16_t notification_mode;
+ uint8_t dest_priority;
+ /* from LSB: dest_type: 4 units:2 */
+ uint8_t type_units;
+ uint64_t message_iova;
+ uint64_t message_ctx;
+ uint32_t threshold_entry;
+ uint32_t threshold_exit;
+};
+
+struct dpni_cmd_get_congestion_notification {
+ uint8_t qtype;
+ uint8_t tc;
+};
+
+struct dpni_rsp_get_congestion_notification {
+ uint64_t pad;
+ uint32_t dest_id;
+ uint16_t notification_mode;
+ uint8_t dest_priority;
+ /* from LSB: dest_type: 4 units:2 */
+ uint8_t type_units;
+ uint64_t message_iova;
+ uint64_t message_ctx;
+ uint32_t threshold_entry;
+ uint32_t threshold_exit;
+};
+
+#pragma pack(pop)
#endif /* _FSL_DPNI_CMD_H */