Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 2 | /* |
Yogesh Gaur | 1a0c4ae | 2018-05-09 10:52:17 +0530 | [diff] [blame] | 3 | * Copyright 2013-2016 Freescale Semiconductor, Inc. |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 4 | * Copyright 2017 NXP |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 5 | */ |
| 6 | #ifndef _FSL_DPNI_H |
| 7 | #define _FSL_DPNI_H |
| 8 | |
| 9 | /* DPNI Version */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 10 | #define DPNI_VER_MAJOR 7 |
| 11 | #define DPNI_VER_MINOR 3 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 12 | |
| 13 | /* Command IDs */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 14 | #define DPNI_CMDID_OPEN 0x8011 |
| 15 | #define DPNI_CMDID_CLOSE 0x8001 |
| 16 | #define DPNI_CMDID_CREATE 0x9011 |
| 17 | #define DPNI_CMDID_DESTROY 0x9811 |
| 18 | #define DPNI_CMDID_GET_API_VERSION 0xa011 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 19 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 20 | #define DPNI_CMDID_ENABLE 0x0021 |
| 21 | #define DPNI_CMDID_DISABLE 0x0031 |
| 22 | #define DPNI_CMDID_GET_ATTR 0x0041 |
| 23 | #define DPNI_CMDID_RESET 0x0051 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 24 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 25 | #define DPNI_CMDID_SET_POOLS 0x2002 |
| 26 | #define DPNI_CMDID_SET_BUFFER_LAYOUT 0x2651 |
| 27 | #define DPNI_CMDID_GET_BUFFER_LAYOUT 0x2641 |
| 28 | #define DPNI_CMDID_SET_ERRORS_BEHAVIOR 0x20B1 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 29 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 30 | #define DPNI_CMDID_GET_QDID 0x2101 |
| 31 | #define DPNI_CMDID_GET_TX_DATA_OFFSET 0x2121 |
| 32 | #define DPNI_CMDID_GET_LINK_STATE 0x2151 |
| 33 | #define DPNI_CMDID_SET_LINK_CFG 0x21A1 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 34 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 35 | #define DPNI_CMDID_SET_PRIM_MAC 0x2241 |
| 36 | #define DPNI_CMDID_GET_PRIM_MAC 0x2251 |
| 37 | #define DPNI_CMDID_ADD_MAC_ADDR 0x2261 |
| 38 | #define DPNI_CMDID_REMOVE_MAC_ADDR 0x2271 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 39 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 40 | #define DPNI_CMDID_GET_STATISTICS 0x25D1 |
| 41 | #define DPNI_CMDID_RESET_STATISTICS 0x25E1 |
| 42 | #define DPNI_CMDID_GET_QUEUE 0x25F1 |
| 43 | #define DPNI_CMDID_SET_QUEUE 0x2601 |
| 44 | #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE 0x2661 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 45 | |
| 46 | /* cmd, param, offset, width, type, arg_name */ |
| 47 | #define DPNI_CMD_OPEN(cmd, dpni_id) \ |
| 48 | MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id) |
| 49 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 50 | /* cmd, param, offset, width, type, arg_name */ |
| 51 | #define DPNI_PREP_CFG(param, cfg) \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 52 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 53 | MC_PREP_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \ |
| 54 | MC_PREP_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \ |
| 55 | MC_PREP_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \ |
| 56 | MC_PREP_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \ |
| 57 | MC_PREP_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \ |
| 58 | MC_PREP_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \ |
| 59 | MC_PREP_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 60 | } while (0) |
| 61 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 62 | /* cmd, param, offset, width, type, arg_name */ |
| 63 | #define DPNI_EXT_CFG(param, cfg) \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 64 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 65 | MC_EXT_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \ |
| 66 | MC_EXT_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \ |
| 67 | MC_EXT_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \ |
| 68 | MC_EXT_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \ |
| 69 | MC_EXT_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \ |
| 70 | MC_EXT_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \ |
| 71 | MC_EXT_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 72 | } while (0) |
| 73 | |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 74 | /* cmd, param, offset, width, type, arg_name */ |
| 75 | #define DPNI_CMD_CREATE(cmd, cfg) \ |
| 76 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 77 | MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->adv.options); \ |
| 78 | MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->adv.num_queues); \ |
| 79 | MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->adv.num_tcs); \ |
| 80 | MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->adv.mac_entries); \ |
| 81 | MC_CMD_OP(cmd, 1, 0, 8, uint8_t, cfg->adv.vlan_entries); \ |
| 82 | MC_CMD_OP(cmd, 1, 16, 8, uint8_t, cfg->adv.qos_entries); \ |
| 83 | MC_CMD_OP(cmd, 1, 32, 16, uint8_t, cfg->adv.fs_entries); \ |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 84 | } while (0) |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 85 | |
| 86 | /* cmd, param, offset, width, type, arg_name */ |
| 87 | #define DPNI_CMD_SET_POOLS(cmd, cfg) \ |
| 88 | do { \ |
| 89 | MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 90 | MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \ |
| 91 | MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \ |
| 92 | MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \ |
| 93 | MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \ |
| 94 | MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \ |
| 95 | MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \ |
| 96 | MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \ |
| 97 | MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 98 | MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \ |
| 99 | MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\ |
| 100 | MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \ |
| 101 | MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\ |
| 102 | MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \ |
| 103 | MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\ |
| 104 | MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \ |
| 105 | MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\ |
| 106 | MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \ |
| 107 | MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\ |
| 108 | MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \ |
| 109 | MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\ |
| 110 | MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \ |
| 111 | MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\ |
| 112 | MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \ |
| 113 | MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\ |
| 114 | } while (0) |
| 115 | |
| 116 | /* cmd, param, offset, width, type, arg_name */ |
| 117 | #define DPNI_RSP_GET_ATTR(cmd, attr) \ |
| 118 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 119 | MC_RSP_OP(cmd, 0, 0, 32, int, attr->options);\ |
| 120 | MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->max_num_queues); \ |
| 121 | MC_RSP_OP(cmd, 0, 40, 8, uint8_t, attr->max_num_tcs); \ |
| 122 | MC_RSP_OP(cmd, 0, 48, 8, uint8_t, attr->max_mac_entries); \ |
| 123 | MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->max_vlan_entries); \ |
| 124 | MC_RSP_OP(cmd, 1, 16, 8, uint8_t, attr->max_qos_entries); \ |
| 125 | MC_RSP_OP(cmd, 1, 32, 16, uint16_t, attr->max_fs_entries); \ |
| 126 | MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->max_qos_key_size); \ |
| 127 | MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->max_fs_key_size); \ |
| 128 | MC_RSP_OP(cmd, 2, 16, 16, uint16_t, attr->wriop_version); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 129 | } while (0) |
| 130 | |
| 131 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 132 | #define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \ |
| 133 | do { \ |
| 134 | MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \ |
| 135 | MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \ |
| 136 | MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \ |
| 137 | } while (0) |
| 138 | |
| 139 | /* cmd, param, offset, width, type, arg_name */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 140 | #define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, layout, queue) \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 141 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 142 | MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, queue); \ |
| 143 | MC_CMD_OP(cmd, 1, 0, 16, uint16_t, layout->private_data_size); \ |
| 144 | MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_align); \ |
| 145 | MC_CMD_OP(cmd, 0, 32, 16, uint16_t, layout->options); \ |
| 146 | MC_CMD_OP(cmd, 0, 48, 1, int, layout->pass_timestamp); \ |
| 147 | MC_CMD_OP(cmd, 0, 49, 1, int, layout->pass_parser_result); \ |
| 148 | MC_CMD_OP(cmd, 0, 50, 1, int, layout->pass_frame_status); \ |
| 149 | MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_head_room); \ |
| 150 | MC_CMD_OP(cmd, 1, 48, 16, uint16_t, layout->data_tail_room); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 151 | } while (0) |
| 152 | |
| 153 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 154 | #define DPNI_RSP_GET_QDID(cmd, qdid) \ |
| 155 | MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid) |
| 156 | |
| 157 | /* cmd, param, offset, width, type, arg_name */ |
| 158 | #define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \ |
| 159 | MC_RSP_OP(cmd, 0, 0, 16, uint16_t, data_offset) |
| 160 | |
| 161 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 162 | #define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \ |
| 163 | do { \ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 164 | MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 165 | MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\ |
| 166 | } while (0) |
| 167 | |
| 168 | /* cmd, param, offset, width, type, arg_name */ |
| 169 | #define DPNI_RSP_GET_LINK_STATE(cmd, state) \ |
| 170 | do { \ |
| 171 | MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 172 | MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 173 | MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\ |
| 174 | } while (0) |
| 175 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 176 | /* cmd, param, offset, width, type, arg_name */ |
| 177 | #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \ |
| 178 | do { \ |
| 179 | MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ |
| 180 | MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ |
| 181 | MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ |
| 182 | MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ |
| 183 | MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ |
| 184 | MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ |
| 185 | } while (0) |
| 186 | |
| 187 | /* cmd, param, offset, width, type, arg_name */ |
| 188 | #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \ |
| 189 | do { \ |
| 190 | MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ |
| 191 | MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ |
| 192 | MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ |
| 193 | MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ |
| 194 | MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ |
| 195 | MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ |
| 196 | } while (0) |
| 197 | |
| 198 | /* cmd, param, offset, width, type, arg_name */ |
| 199 | #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \ |
| 200 | do { \ |
| 201 | MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ |
| 202 | MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ |
| 203 | MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ |
| 204 | MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ |
| 205 | MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ |
| 206 | MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ |
| 207 | } while (0) |
| 208 | |
| 209 | /* cmd, param, offset, width, type, arg_name */ |
| 210 | #define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \ |
| 211 | do { \ |
| 212 | MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ |
| 213 | MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ |
| 214 | MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ |
| 215 | MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ |
| 216 | MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ |
| 217 | MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ |
| 218 | } while (0) |
| 219 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 220 | #define DPNI_CMD_GET_QUEUE(cmd, type, tc, index) \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 221 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 222 | MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \ |
| 223 | MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \ |
| 224 | MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 225 | } while (0) |
| 226 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 227 | #define DPNI_RSP_GET_QUEUE(cmd, queue) \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 228 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 229 | MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \ |
| 230 | MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \ |
| 231 | MC_RSP_OP(cmd, 1, 62, 1, char, (queue)->destination.stash_ctrl); \ |
| 232 | MC_RSP_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \ |
| 233 | MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc); \ |
| 234 | MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \ |
| 235 | MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (queue)->fqid); \ |
| 236 | MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue)->qdbin); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 237 | } while (0) |
| 238 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 239 | #define DPNI_CMD_SET_QUEUE(cmd, type, tc, index, queue) \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 240 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 241 | MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \ |
| 242 | MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \ |
| 243 | MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \ |
| 244 | MC_CMD_OP(cmd, 0, 24, 8, uint8_t, (queue)->options); \ |
| 245 | MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \ |
| 246 | MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \ |
| 247 | MC_CMD_OP(cmd, 1, 62, 1, char, (queue)->destination.stash_ctrl); \ |
| 248 | MC_CMD_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \ |
| 249 | MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \ |
| 250 | MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc); \ |
| 251 | MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 252 | } while (0) |
| 253 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 254 | /* cmd, param, offset, width, type, arg_name */ |
| 255 | #define DPNI_CMD_GET_STATISTICS(cmd, page) \ |
| 256 | MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page) |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 257 | |
| 258 | /* cmd, param, offset, width, type, arg_name */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 259 | #define DPNI_RSP_GET_STATISTICS(cmd, stat) \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 260 | do { \ |
Ioana Ciornei | d6733a4 | 2023-05-23 16:47:44 +0300 | [diff] [blame^] | 261 | MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->raw.counter[0]); \ |
| 262 | MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->raw.counter[1]); \ |
| 263 | MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->raw.counter[2]); \ |
| 264 | MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->raw.counter[3]); \ |
| 265 | MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->raw.counter[4]); \ |
| 266 | MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->raw.counter[5]); \ |
| 267 | MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->raw.counter[6]); \ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 268 | } while (0) |
| 269 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 270 | enum net_prot { |
| 271 | NET_PROT_NONE = 0, |
| 272 | NET_PROT_PAYLOAD, |
| 273 | NET_PROT_ETH, |
| 274 | NET_PROT_VLAN, |
| 275 | NET_PROT_IPV4, |
| 276 | NET_PROT_IPV6, |
| 277 | NET_PROT_IP, |
| 278 | NET_PROT_TCP, |
| 279 | NET_PROT_UDP, |
| 280 | NET_PROT_UDP_LITE, |
| 281 | NET_PROT_IPHC, |
| 282 | NET_PROT_SCTP, |
| 283 | NET_PROT_SCTP_CHUNK_DATA, |
| 284 | NET_PROT_PPPOE, |
| 285 | NET_PROT_PPP, |
| 286 | NET_PROT_PPPMUX, |
| 287 | NET_PROT_PPPMUX_SUBFRM, |
| 288 | NET_PROT_L2TPV2, |
| 289 | NET_PROT_L2TPV3_CTRL, |
| 290 | NET_PROT_L2TPV3_SESS, |
| 291 | NET_PROT_LLC, |
| 292 | NET_PROT_LLC_SNAP, |
| 293 | NET_PROT_NLPID, |
| 294 | NET_PROT_SNAP, |
| 295 | NET_PROT_MPLS, |
| 296 | NET_PROT_IPSEC_AH, |
| 297 | NET_PROT_IPSEC_ESP, |
| 298 | NET_PROT_UDP_ENC_ESP, /* RFC 3948 */ |
| 299 | NET_PROT_MACSEC, |
| 300 | NET_PROT_GRE, |
| 301 | NET_PROT_MINENCAP, |
| 302 | NET_PROT_DCCP, |
| 303 | NET_PROT_ICMP, |
| 304 | NET_PROT_IGMP, |
| 305 | NET_PROT_ARP, |
| 306 | NET_PROT_CAPWAP_DATA, |
| 307 | NET_PROT_CAPWAP_CTRL, |
| 308 | NET_PROT_RFC2684, |
| 309 | NET_PROT_ICMPV6, |
| 310 | NET_PROT_FCOE, |
| 311 | NET_PROT_FIP, |
| 312 | NET_PROT_ISCSI, |
| 313 | NET_PROT_GTP, |
| 314 | NET_PROT_USER_DEFINED_L2, |
| 315 | NET_PROT_USER_DEFINED_L3, |
| 316 | NET_PROT_USER_DEFINED_L4, |
| 317 | NET_PROT_USER_DEFINED_L5, |
| 318 | NET_PROT_USER_DEFINED_SHIM1, |
| 319 | NET_PROT_USER_DEFINED_SHIM2, |
| 320 | |
| 321 | NET_PROT_DUMMY_LAST |
| 322 | }; |
| 323 | |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 324 | /** |
| 325 | * Data Path Network Interface API |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 326 | * Contains initialization APIs and runtime control APIs for DPNI |
| 327 | */ |
| 328 | |
| 329 | struct fsl_mc_io; |
| 330 | |
| 331 | /* General DPNI macros */ |
| 332 | |
| 333 | /* Maximum number of traffic classes */ |
| 334 | #define DPNI_MAX_TC 8 |
| 335 | /* Maximum number of buffer pools per DPNI */ |
| 336 | #define DPNI_MAX_DPBP 8 |
| 337 | |
| 338 | /* All traffic classes considered; see dpni_set_rx_flow() */ |
| 339 | #define DPNI_ALL_TCS (uint8_t)(-1) |
| 340 | /* All flows within traffic class considered; see dpni_set_rx_flow() */ |
| 341 | #define DPNI_ALL_TC_FLOWS (uint16_t)(-1) |
| 342 | /* Generate new flow ID; see dpni_set_tx_flow() */ |
| 343 | #define DPNI_NEW_FLOW_ID (uint16_t)(-1) |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 344 | /* use for common tx-conf queue; see dpni_set_tx_conf_<x>() */ |
| 345 | #define DPNI_COMMON_TX_CONF (uint16_t)(-1) |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 346 | |
| 347 | /** |
| 348 | * dpni_open() - Open a control session for the specified object |
| 349 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 350 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 351 | * @dpni_id: DPNI unique ID |
| 352 | * @token: Returned token; use in subsequent API calls |
| 353 | * |
| 354 | * This function can be used to open a control session for an |
| 355 | * already created object; an object may have been declared in |
| 356 | * the DPL or by calling the dpni_create() function. |
| 357 | * This function returns a unique authentication token, |
| 358 | * associated with the specific object ID and the specific MC |
| 359 | * portal; this token must be used in all subsequent commands for |
| 360 | * this specific object. |
| 361 | * |
| 362 | * Return: '0' on Success; Error code otherwise. |
| 363 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 364 | int dpni_open(struct fsl_mc_io *mc_io, |
| 365 | uint32_t cmd_flags, |
| 366 | int dpni_id, |
| 367 | uint16_t *token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 368 | |
| 369 | /** |
| 370 | * dpni_close() - Close the control session of the object |
| 371 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 372 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 373 | * @token: Token of DPNI object |
| 374 | * |
| 375 | * After this function is called, no further operations are |
| 376 | * allowed on the object without opening a new control session. |
| 377 | * |
| 378 | * Return: '0' on Success; Error code otherwise. |
| 379 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 380 | int dpni_close(struct fsl_mc_io *mc_io, |
| 381 | uint32_t cmd_flags, |
| 382 | uint16_t token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 383 | |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 384 | /* DPNI configuration options */ |
| 385 | |
| 386 | /** |
| 387 | * Allow different distribution key profiles for different traffic classes; |
| 388 | * if not set, a single key profile is assumed |
| 389 | */ |
| 390 | #define DPNI_OPT_ALLOW_DIST_KEY_PER_TC 0x00000001 |
| 391 | |
| 392 | /** |
| 393 | * Disable all non-error transmit confirmation; error frames are reported |
| 394 | * back to a common Tx error queue |
| 395 | */ |
| 396 | #define DPNI_OPT_TX_CONF_DISABLED 0x00000002 |
| 397 | |
| 398 | /* Disable per-sender private Tx confirmation/error queue */ |
| 399 | #define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED 0x00000004 |
| 400 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 401 | /** |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 402 | * Support distribution based on hashed key; |
| 403 | * allows statistical distribution over receive queues in a traffic class |
| 404 | */ |
| 405 | #define DPNI_OPT_DIST_HASH 0x00000010 |
| 406 | |
| 407 | /** |
| 408 | * Support distribution based on flow steering; |
| 409 | * allows explicit control of distribution over receive queues in a traffic |
| 410 | * class |
| 411 | */ |
| 412 | #define DPNI_OPT_DIST_FS 0x00000020 |
| 413 | |
| 414 | /* Unicast filtering support */ |
| 415 | #define DPNI_OPT_UNICAST_FILTER 0x00000080 |
| 416 | /* Multicast filtering support */ |
| 417 | #define DPNI_OPT_MULTICAST_FILTER 0x00000100 |
| 418 | /* VLAN filtering support */ |
| 419 | #define DPNI_OPT_VLAN_FILTER 0x00000200 |
| 420 | /* Support IP reassembly on received packets */ |
| 421 | #define DPNI_OPT_IPR 0x00000800 |
| 422 | /* Support IP fragmentation on transmitted packets */ |
| 423 | #define DPNI_OPT_IPF 0x00001000 |
| 424 | /* VLAN manipulation support */ |
| 425 | #define DPNI_OPT_VLAN_MANIPULATION 0x00010000 |
| 426 | /* Support masking of QoS lookup keys */ |
| 427 | #define DPNI_OPT_QOS_MASK_SUPPORT 0x00020000 |
| 428 | /* Support masking of Flow Steering lookup keys */ |
| 429 | #define DPNI_OPT_FS_MASK_SUPPORT 0x00040000 |
| 430 | |
| 431 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 432 | * enum dpni_queue_type - Identifies a type of queue targeted by the command |
| 433 | * @DPNI_QUEUE_RX: Rx queue |
| 434 | * @DPNI_QUEUE_TX: Tx queue |
| 435 | * @DPNI_QUEUE_TX_CONFIRM: Tx confirmation queue |
| 436 | * @DPNI_QUEUE_RX_ERR: Rx error queue |
| 437 | */ |
| 438 | enum dpni_queue_type { |
| 439 | DPNI_QUEUE_RX, |
| 440 | DPNI_QUEUE_TX, |
| 441 | DPNI_QUEUE_TX_CONFIRM, |
| 442 | DPNI_QUEUE_RX_ERR, |
| 443 | }; |
| 444 | |
| 445 | struct dpni_cfg { |
| 446 | uint8_t mac_addr[6]; |
| 447 | struct { |
| 448 | uint32_t options; |
| 449 | uint16_t fs_entries; |
| 450 | uint8_t num_queues; |
| 451 | uint8_t num_tcs; |
| 452 | uint8_t mac_entries; |
| 453 | uint8_t vlan_entries; |
| 454 | uint8_t qos_entries; |
| 455 | } adv; |
| 456 | }; |
| 457 | |
| 458 | /** |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 459 | * struct dpni_extended_cfg - Structure representing extended DPNI configuration |
| 460 | * @tc_cfg: TCs configuration |
| 461 | * @ipr_cfg: IP reassembly configuration |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 462 | */ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 463 | struct dpni_extended_cfg { |
| 464 | /** |
| 465 | * struct tc_cfg - TC configuration |
| 466 | * @max_dist: Maximum distribution size for Rx traffic class; |
| 467 | * supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96, |
| 468 | * 112,128,192,224,256,384,448,512,768,896,1024; |
| 469 | * value '0' will be treated as '1'. |
| 470 | * other unsupported values will be round down to the nearest |
| 471 | * supported value. |
| 472 | * @max_fs_entries: Maximum FS entries for Rx traffic class; |
| 473 | * '0' means no support for this TC; |
| 474 | */ |
| 475 | struct { |
| 476 | uint16_t max_dist; |
| 477 | uint16_t max_fs_entries; |
| 478 | } tc_cfg[DPNI_MAX_TC]; |
| 479 | /** |
| 480 | * struct ipr_cfg - Structure representing IP reassembly configuration |
| 481 | * @max_reass_frm_size: Maximum size of the reassembled frame |
| 482 | * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments |
| 483 | * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments |
| 484 | * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly |
| 485 | * process |
| 486 | * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly |
| 487 | * process |
| 488 | */ |
| 489 | struct { |
| 490 | uint16_t max_reass_frm_size; |
| 491 | uint16_t min_frag_size_ipv4; |
| 492 | uint16_t min_frag_size_ipv6; |
| 493 | uint16_t max_open_frames_ipv4; |
| 494 | uint16_t max_open_frames_ipv6; |
| 495 | } ipr_cfg; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 496 | }; |
| 497 | |
| 498 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 499 | * dpni_prepare_cfg() - function prepare parameters |
| 500 | * @cfg: cfg structure |
| 501 | * @cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 502 | * |
| 503 | * This function has to be called before dpni_create() |
| 504 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 505 | int dpni_prepare_cfg(const struct dpni_cfg *cfg, |
| 506 | uint8_t *cfg_buf); |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 507 | /** |
| 508 | * dpni_create() - Create the DPNI object |
| 509 | * @mc_io: Pointer to MC portal's I/O object |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 510 | * @token: Authentication token. |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 511 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 512 | * @cfg: Configuration structure |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 513 | * @obj_id: Returned obj_id; use in subsequent API calls |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 514 | * |
| 515 | * Create the DPNI object, allocate required resources and |
| 516 | * perform required initialization. |
| 517 | * |
| 518 | * The object can be created either by declaring it in the |
| 519 | * DPL file, or by calling this function. |
| 520 | * |
| 521 | * This function returns a unique authentication token, |
| 522 | * associated with the specific object ID and the specific MC |
| 523 | * portal; this token must be used in all subsequent calls to |
| 524 | * this specific object. For objects that are created using the |
| 525 | * DPL file, call dpni_open() function to get an authentication |
| 526 | * token first. |
| 527 | * |
| 528 | * Return: '0' on Success; Error code otherwise. |
| 529 | */ |
| 530 | int dpni_create(struct fsl_mc_io *mc_io, |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 531 | uint16_t token, |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 532 | uint32_t cmd_flags, |
| 533 | const struct dpni_cfg *cfg, |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 534 | uint32_t *obj_id); |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 535 | |
| 536 | /** |
| 537 | * dpni_destroy() - Destroy the DPNI object and release all its resources. |
| 538 | * @mc_io: Pointer to MC portal's I/O object |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 539 | * @token: Authentication token. |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 540 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 541 | * @obj_id: Returned obj_id; use in subsequent API calls |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 542 | * |
| 543 | * Return: '0' on Success; error code otherwise. |
| 544 | */ |
| 545 | int dpni_destroy(struct fsl_mc_io *mc_io, |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 546 | uint16_t token, |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 547 | uint32_t cmd_flags, |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 548 | uint32_t obj_id); |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 549 | |
| 550 | /** |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 551 | * struct dpni_pools_cfg - Structure representing buffer pools configuration |
| 552 | * @num_dpbp: Number of DPBPs |
| 553 | * @pools: Array of buffer pools parameters; The number of valid entries |
| 554 | * must match 'num_dpbp' value |
| 555 | */ |
| 556 | struct dpni_pools_cfg { |
| 557 | uint8_t num_dpbp; |
| 558 | /** |
| 559 | * struct pools - Buffer pools parameters |
| 560 | * @dpbp_id: DPBP object ID |
| 561 | * @buffer_size: Buffer size |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 562 | * @backup_pool: Backup pool |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 563 | */ |
| 564 | struct { |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 565 | int dpbp_id; |
| 566 | uint16_t buffer_size; |
| 567 | int backup_pool; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 568 | } pools[DPNI_MAX_DPBP]; |
| 569 | }; |
| 570 | |
| 571 | /** |
| 572 | * dpni_set_pools() - Set buffer pools configuration |
| 573 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 574 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 575 | * @token: Token of DPNI object |
| 576 | * @cfg: Buffer pools configuration |
| 577 | * |
| 578 | * mandatory for DPNI operation |
| 579 | * warning:Allowed only when DPNI is disabled |
| 580 | * |
| 581 | * Return: '0' on Success; Error code otherwise. |
| 582 | */ |
| 583 | int dpni_set_pools(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 584 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 585 | uint16_t token, |
| 586 | const struct dpni_pools_cfg *cfg); |
| 587 | |
| 588 | /** |
| 589 | * dpni_enable() - Enable the DPNI, allow sending and receiving frames. |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 590 | * @mc_io: Pointer to MC portal's I/O object |
| 591 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 592 | * @token: Token of DPNI object |
| 593 | * |
| 594 | * Return: '0' on Success; Error code otherwise. |
| 595 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 596 | int dpni_enable(struct fsl_mc_io *mc_io, |
| 597 | uint32_t cmd_flags, |
| 598 | uint16_t token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 599 | |
| 600 | /** |
| 601 | * dpni_disable() - Disable the DPNI, stop sending and receiving frames. |
| 602 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 603 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 604 | * @token: Token of DPNI object |
| 605 | * |
| 606 | * Return: '0' on Success; Error code otherwise. |
| 607 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 608 | int dpni_disable(struct fsl_mc_io *mc_io, |
| 609 | uint32_t cmd_flags, |
| 610 | uint16_t token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 611 | |
| 612 | |
| 613 | /** |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 614 | * dpni_reset() - Reset the DPNI, returns the object to initial state. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 615 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 616 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 617 | * @token: Token of DPNI object |
| 618 | * |
| 619 | * Return: '0' on Success; Error code otherwise. |
| 620 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 621 | int dpni_reset(struct fsl_mc_io *mc_io, |
| 622 | uint32_t cmd_flags, |
| 623 | uint16_t token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 624 | |
| 625 | /** |
| 626 | * struct dpni_attr - Structure representing DPNI attributes |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 627 | * @options: Mask of available options; reflects the value as was given in |
| 628 | * object's creation |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 629 | * @max_num_queues: Number of queues available (for both Tx and Rx) |
| 630 | * @max_num_tcs: Maximum number of traffic classes (for both Tx and Rx) |
| 631 | * @max_mac_entries: Maximum number of traffic classes (for both Tx and Rx) |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 632 | * @max_unicast_filters: Maximum number of unicast filters |
| 633 | * @max_multicast_filters: Maximum number of multicast filters |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 634 | * @max_vlan_entries: Maximum number of VLAN filters |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 635 | * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in QoS table |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 636 | * @max_fs_entries: declares the maximum entries in flow steering table |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 637 | * @max_qos_key_size: Maximum key size for the QoS look-up |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 638 | * @max_fs_key_size: Maximum key size for the flow steering |
| 639 | * @wriop_version: Indicates revision of WRIOP hardware block |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 640 | */ |
| 641 | struct dpni_attr { |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 642 | uint32_t id; |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 643 | uint32_t options; |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 644 | uint8_t max_num_queues; |
| 645 | uint8_t max_num_tcs; |
| 646 | uint8_t max_mac_entries; |
| 647 | uint8_t max_vlan_entries; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 648 | uint8_t max_qos_entries; |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 649 | uint16_t max_fs_entries; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 650 | uint8_t max_qos_key_size; |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 651 | uint8_t max_fs_key_size; |
| 652 | uint16_t wriop_version; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 653 | }; |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 654 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 655 | /** |
| 656 | * dpni_get_attributes() - Retrieve DPNI attributes. |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 657 | * @mc_io: Pointer to MC portal's I/O object |
| 658 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 659 | * @token: Token of DPNI object |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 660 | * @attr: Object's attributes |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 661 | * |
| 662 | * Return: '0' on Success; Error code otherwise. |
| 663 | */ |
| 664 | int dpni_get_attributes(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 665 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 666 | uint16_t token, |
| 667 | struct dpni_attr *attr); |
| 668 | |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 669 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 670 | * dpni_extract_cfg() - extract the parameters |
| 671 | * @cfg: cfg structure |
| 672 | * @cfg_buf: 256 bytes of DMA-able memory |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 673 | * |
| 674 | * This function has to be called after dpni_get_attributes() |
| 675 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 676 | int dpni_extract_cfg(struct dpni_cfg *cfg, |
| 677 | const uint8_t *cfg_buf); |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 678 | |
| 679 | /** |
| 680 | * DPNI errors |
| 681 | */ |
| 682 | |
| 683 | /** |
| 684 | * Extract out of frame header error |
| 685 | */ |
| 686 | #define DPNI_ERROR_EOFHE 0x00020000 |
| 687 | /** |
| 688 | * Frame length error |
| 689 | */ |
| 690 | #define DPNI_ERROR_FLE 0x00002000 |
| 691 | /** |
| 692 | * Frame physical error |
| 693 | */ |
| 694 | #define DPNI_ERROR_FPE 0x00001000 |
| 695 | /** |
| 696 | * Parsing header error |
| 697 | */ |
| 698 | #define DPNI_ERROR_PHE 0x00000020 |
| 699 | /** |
| 700 | * Parser L3 checksum error |
| 701 | */ |
| 702 | #define DPNI_ERROR_L3CE 0x00000004 |
| 703 | /** |
| 704 | * Parser L3 checksum error |
| 705 | */ |
| 706 | #define DPNI_ERROR_L4CE 0x00000001 |
| 707 | |
| 708 | /** |
| 709 | * enum dpni_error_action - Defines DPNI behavior for errors |
| 710 | * @DPNI_ERROR_ACTION_DISCARD: Discard the frame |
| 711 | * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow |
| 712 | * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue |
| 713 | */ |
| 714 | enum dpni_error_action { |
| 715 | DPNI_ERROR_ACTION_DISCARD = 0, |
| 716 | DPNI_ERROR_ACTION_CONTINUE = 1, |
| 717 | DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2 |
| 718 | }; |
| 719 | |
| 720 | /** |
| 721 | * struct dpni_error_cfg - Structure representing DPNI errors treatment |
| 722 | * @errors: Errors mask; use 'DPNI_ERROR__<X> |
| 723 | * @error_action: The desired action for the errors mask |
| 724 | * @set_frame_annotation: Set to '1' to mark the errors in frame annotation |
| 725 | * status (FAS); relevant only for the non-discard action |
| 726 | */ |
| 727 | struct dpni_error_cfg { |
| 728 | uint32_t errors; |
| 729 | enum dpni_error_action error_action; |
| 730 | int set_frame_annotation; |
| 731 | }; |
| 732 | |
| 733 | /** |
| 734 | * dpni_set_errors_behavior() - Set errors behavior |
| 735 | * @mc_io: Pointer to MC portal's I/O object |
| 736 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 737 | * @token: Token of DPNI object |
| 738 | * @cfg: Errors configuration |
| 739 | * |
| 740 | * this function may be called numerous times with different |
| 741 | * error masks |
| 742 | * |
| 743 | * Return: '0' on Success; Error code otherwise. |
| 744 | */ |
| 745 | int dpni_set_errors_behavior(struct fsl_mc_io *mc_io, |
| 746 | uint32_t cmd_flags, |
| 747 | uint16_t token, |
| 748 | struct dpni_error_cfg *cfg); |
| 749 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 750 | /* DPNI buffer layout modification options */ |
| 751 | |
| 752 | /* Select to modify the time-stamp setting */ |
| 753 | #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001 |
| 754 | /* Select to modify the parser-result setting; not applicable for Tx */ |
| 755 | #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002 |
| 756 | /* Select to modify the frame-status setting */ |
| 757 | #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004 |
| 758 | /* Select to modify the private-data-size setting */ |
| 759 | #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008 |
| 760 | /* Select to modify the data-alignment setting */ |
| 761 | #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010 |
| 762 | /* Select to modify the data-head-room setting */ |
| 763 | #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020 |
| 764 | /*!< Select to modify the data-tail-room setting */ |
| 765 | #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040 |
| 766 | |
| 767 | /** |
| 768 | * struct dpni_buffer_layout - Structure representing DPNI buffer layout |
| 769 | * @options: Flags representing the suggested modifications to the buffer |
| 770 | * layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags |
| 771 | * @pass_timestamp: Pass timestamp value |
| 772 | * @pass_parser_result: Pass parser results |
| 773 | * @pass_frame_status: Pass frame status |
| 774 | * @private_data_size: Size kept for private data (in bytes) |
| 775 | * @data_align: Data alignment |
| 776 | * @data_head_room: Data head room |
| 777 | * @data_tail_room: Data tail room |
| 778 | */ |
| 779 | struct dpni_buffer_layout { |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 780 | uint16_t options; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 781 | int pass_timestamp; |
| 782 | int pass_parser_result; |
| 783 | int pass_frame_status; |
| 784 | uint16_t private_data_size; |
| 785 | uint16_t data_align; |
| 786 | uint16_t data_head_room; |
| 787 | uint16_t data_tail_room; |
| 788 | }; |
| 789 | |
| 790 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 791 | * dpni_get_buffer_layout() - Retrieve buffer layout attributes. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 792 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 793 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 794 | * @token: Token of DPNI object |
| 795 | * @layout: Returns buffer layout attributes |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 796 | * @type: DPNI queue type |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 797 | * |
| 798 | * Return: '0' on Success; Error code otherwise. |
| 799 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 800 | int dpni_get_buffer_layout(struct fsl_mc_io *mc_io, |
| 801 | uint32_t cmd_flags, |
| 802 | uint16_t token, |
| 803 | const struct dpni_buffer_layout *layout, |
| 804 | enum dpni_queue_type type); |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 805 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 806 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 807 | * dpni_set_buffer_layout() - Set buffer layout configuration. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 808 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 809 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 810 | * @token: Token of DPNI object |
| 811 | * @layout: Buffer layout configuration |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 812 | * @type: DPNI queue type |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 813 | * |
| 814 | * Return: '0' on Success; Error code otherwise. |
| 815 | * |
| 816 | * @warning Allowed only when DPNI is disabled |
| 817 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 818 | int dpni_set_buffer_layout(struct fsl_mc_io *mc_io, |
| 819 | uint32_t cmd_flags, |
| 820 | uint16_t token, |
| 821 | const struct dpni_buffer_layout *layout, |
| 822 | enum dpni_queue_type type); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 823 | |
| 824 | /** |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 825 | * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used |
| 826 | * for enqueue operations |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 827 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 828 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 829 | * @token: Token of DPNI object |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 830 | * @qdid: Returned virtual QDID value that should be used as an argument |
| 831 | * in all enqueue operations |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 832 | * |
| 833 | * Return: '0' on Success; Error code otherwise. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 834 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 835 | int dpni_get_qdid(struct fsl_mc_io *mc_io, |
| 836 | uint32_t cmd_flags, |
| 837 | uint16_t token, |
| 838 | uint16_t *qdid); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 839 | |
| 840 | /** |
| 841 | * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer) |
| 842 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 843 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 844 | * @token: Token of DPNI object |
| 845 | * @data_offset: Tx data offset (from start of buffer) |
| 846 | * |
| 847 | * Return: '0' on Success; Error code otherwise. |
| 848 | */ |
| 849 | int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 850 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 851 | uint16_t token, |
| 852 | uint16_t *data_offset); |
| 853 | |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 854 | /* Enable auto-negotiation */ |
| 855 | #define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL |
| 856 | /* Enable half-duplex mode */ |
| 857 | #define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL |
| 858 | /* Enable pause frames */ |
| 859 | #define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL |
| 860 | /* Enable a-symmetric pause frames */ |
| 861 | #define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL |
| 862 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 863 | /** |
| 864 | * struct - Structure representing DPNI link configuration |
| 865 | * @rate: Rate |
| 866 | * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values |
| 867 | */ |
| 868 | struct dpni_link_cfg { |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 869 | uint32_t rate; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 870 | uint64_t options; |
| 871 | }; |
| 872 | |
| 873 | /** |
| 874 | * dpni_set_link_cfg() - set the link configuration. |
| 875 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 876 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 877 | * @token: Token of DPNI object |
| 878 | * @cfg: Link configuration |
| 879 | * |
| 880 | * Return: '0' on Success; Error code otherwise. |
| 881 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 882 | int dpni_set_link_cfg(struct fsl_mc_io *mc_io, |
| 883 | uint32_t cmd_flags, |
| 884 | uint16_t token, |
| 885 | const struct dpni_link_cfg *cfg); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 886 | |
| 887 | /** |
| 888 | * struct dpni_link_state - Structure representing DPNI link state |
| 889 | * @rate: Rate |
| 890 | * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values |
| 891 | * @up: Link state; '0' for down, '1' for up |
| 892 | */ |
| 893 | struct dpni_link_state { |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 894 | uint32_t rate; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 895 | uint64_t options; |
| 896 | int up; |
| 897 | }; |
| 898 | |
| 899 | /** |
| 900 | * dpni_get_link_state() - Return the link state (either up or down) |
| 901 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 902 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 903 | * @token: Token of DPNI object |
| 904 | * @state: Returned link state; |
| 905 | * |
| 906 | * Return: '0' on Success; Error code otherwise. |
| 907 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 908 | int dpni_get_link_state(struct fsl_mc_io *mc_io, |
| 909 | uint32_t cmd_flags, |
| 910 | uint16_t token, |
| 911 | struct dpni_link_state *state); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 912 | |
| 913 | /** |
| 914 | * dpni_set_primary_mac_addr() - Set the primary MAC address |
| 915 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 916 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 917 | * @token: Token of DPNI object |
| 918 | * @mac_addr: MAC address to set as primary address |
| 919 | * |
| 920 | * Return: '0' on Success; Error code otherwise. |
| 921 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 922 | int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io, |
| 923 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 924 | uint16_t token, |
| 925 | const uint8_t mac_addr[6]); |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 926 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 927 | /** |
| 928 | * dpni_get_primary_mac_addr() - Get the primary MAC address |
| 929 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 930 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 931 | * @token: Token of DPNI object |
| 932 | * @mac_addr: Returned MAC address |
| 933 | * |
| 934 | * Return: '0' on Success; Error code otherwise. |
| 935 | */ |
| 936 | int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 937 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 938 | uint16_t token, |
| 939 | uint8_t mac_addr[6]); |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 940 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 941 | /** |
| 942 | * dpni_add_mac_addr() - Add MAC address filter |
| 943 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 944 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 945 | * @token: Token of DPNI object |
| 946 | * @mac_addr: MAC address to add |
| 947 | * |
| 948 | * Return: '0' on Success; Error code otherwise. |
| 949 | */ |
| 950 | int dpni_add_mac_addr(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 951 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 952 | uint16_t token, |
| 953 | const uint8_t mac_addr[6]); |
| 954 | |
| 955 | /** |
| 956 | * dpni_remove_mac_addr() - Remove MAC address filter |
| 957 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 958 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 959 | * @token: Token of DPNI object |
| 960 | * @mac_addr: MAC address to remove |
| 961 | * |
| 962 | * Return: '0' on Success; Error code otherwise. |
| 963 | */ |
| 964 | int dpni_remove_mac_addr(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 965 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 966 | uint16_t token, |
| 967 | const uint8_t mac_addr[6]); |
| 968 | |
| 969 | /** |
| 970 | * enum dpni_dest - DPNI destination types |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 971 | * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 972 | * does not generate FQDAN notifications; user is expected to |
| 973 | * dequeue from the queue based on polling or other user-defined |
| 974 | * method |
| 975 | * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN |
| 976 | * notifications to the specified DPIO; user is expected to dequeue |
| 977 | * from the queue only after notification is received |
| 978 | * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate |
| 979 | * FQDAN notifications, but is connected to the specified DPCON |
| 980 | * object; user is expected to dequeue from the DPCON channel |
| 981 | */ |
| 982 | enum dpni_dest { |
| 983 | DPNI_DEST_NONE = 0, |
| 984 | DPNI_DEST_DPIO = 1, |
| 985 | DPNI_DEST_DPCON = 2 |
| 986 | }; |
| 987 | |
| 988 | /** |
| 989 | * struct dpni_dest_cfg - Structure representing DPNI destination parameters |
| 990 | * @dest_type: Destination type |
| 991 | * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type |
| 992 | * @priority: Priority selection within the DPIO or DPCON channel; valid values |
| 993 | * are 0-1 or 0-7, depending on the number of priorities in that |
| 994 | * channel; not relevant for 'DPNI_DEST_NONE' option |
| 995 | */ |
| 996 | struct dpni_dest_cfg { |
| 997 | enum dpni_dest dest_type; |
| 998 | int dest_id; |
| 999 | uint8_t priority; |
| 1000 | }; |
| 1001 | |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 1002 | /** |
| 1003 | * enum dpni_flc_type - DPNI FLC types |
| 1004 | * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value |
| 1005 | * @DPNI_FLC_STASH: select the FLC to be used for stash control |
| 1006 | */ |
| 1007 | enum dpni_flc_type { |
| 1008 | DPNI_FLC_USER_DEFINED = 0, |
| 1009 | DPNI_FLC_STASH = 1, |
| 1010 | }; |
| 1011 | |
| 1012 | /** |
| 1013 | * enum dpni_stash_size - DPNI FLC stashing size |
| 1014 | * @DPNI_STASH_SIZE_0B: no stash |
| 1015 | * @DPNI_STASH_SIZE_64B: stashes 64 bytes |
| 1016 | * @DPNI_STASH_SIZE_128B: stashes 128 bytes |
| 1017 | * @DPNI_STASH_SIZE_192B: stashes 192 bytes |
| 1018 | */ |
| 1019 | enum dpni_stash_size { |
| 1020 | DPNI_STASH_SIZE_0B = 0, |
| 1021 | DPNI_STASH_SIZE_64B = 1, |
| 1022 | DPNI_STASH_SIZE_128B = 2, |
| 1023 | DPNI_STASH_SIZE_192B = 3, |
| 1024 | }; |
| 1025 | |
| 1026 | /* DPNI FLC stash options */ |
| 1027 | |
| 1028 | /* stashes the whole annotation area (up to 192 bytes) */ |
| 1029 | #define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001 |
| 1030 | |
| 1031 | /** |
| 1032 | * struct dpni_flc_cfg - Structure representing DPNI FLC configuration |
| 1033 | * @flc_type: FLC type |
| 1034 | * @options: Mask of available options; |
| 1035 | * use 'DPNI_FLC_STASH_<X>' values |
| 1036 | * @frame_data_size: Size of frame data to be stashed |
| 1037 | * @flow_context_size: Size of flow context to be stashed |
| 1038 | * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED': |
| 1039 | * this value will be provided in the frame descriptor |
| 1040 | * (FD[FLC]) |
| 1041 | * 2. In case flc_type is 'DPNI_FLC_STASH': |
| 1042 | * this value will be I/O virtual address of the |
| 1043 | * flow-context; |
| 1044 | * Must be cacheline-aligned and DMA-able memory |
| 1045 | */ |
| 1046 | struct dpni_flc_cfg { |
| 1047 | enum dpni_flc_type flc_type; |
| 1048 | uint32_t options; |
| 1049 | enum dpni_stash_size frame_data_size; |
| 1050 | enum dpni_stash_size flow_context_size; |
| 1051 | uint64_t flow_context; |
| 1052 | }; |
| 1053 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1054 | /* DPNI queue modification options */ |
| 1055 | |
| 1056 | /* Select to modify the user's context associated with the queue */ |
| 1057 | #define DPNI_QUEUE_OPT_USER_CTX 0x00000001 |
| 1058 | /* Select to modify the queue's destination */ |
| 1059 | #define DPNI_QUEUE_OPT_DEST 0x00000002 |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 1060 | /** Select to modify the flow-context parameters; |
| 1061 | * not applicable for Tx-conf/Err queues as the FD comes from the user |
| 1062 | */ |
| 1063 | #define DPNI_QUEUE_OPT_FLC 0x00000004 |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1064 | /* Select to modify the queue's order preservation */ |
| 1065 | #define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008 |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1066 | /* Select to modify the queue's tail-drop threshold */ |
| 1067 | #define DPNI_QUEUE_OPT_TAILDROP_THRESHOLD 0x00000010 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1068 | |
| 1069 | /** |
| 1070 | * struct dpni_queue_cfg - Structure representing queue configuration |
| 1071 | * @options: Flags representing the suggested modifications to the queue; |
| 1072 | * Use any combination of 'DPNI_QUEUE_OPT_<X>' flags |
| 1073 | * @user_ctx: User context value provided in the frame descriptor of each |
| 1074 | * dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX' |
| 1075 | * is contained in 'options' |
| 1076 | * @dest_cfg: Queue destination parameters; |
| 1077 | * valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options' |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 1078 | * @flc_cfg: Flow context configuration; in case the TC's distribution |
| 1079 | * is either NONE or HASH the FLC's settings of flow#0 are used. |
| 1080 | * in the case of FS (flow-steering) the flow's FLC settings |
| 1081 | * are used. |
| 1082 | * valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options' |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1083 | * @order_preservation_en: enable/disable order preservation; |
| 1084 | * valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained |
| 1085 | * in 'options' |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1086 | * @tail_drop_threshold: set the queue's tail drop threshold in bytes; |
| 1087 | * '0' value disable the threshold; maximum value is 0xE000000; |
| 1088 | * valid only if 'DPNI_QUEUE_OPT_TAILDROP_THRESHOLD' is contained |
| 1089 | * in 'options' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1090 | */ |
| 1091 | struct dpni_queue_cfg { |
| 1092 | uint32_t options; |
| 1093 | uint64_t user_ctx; |
| 1094 | struct dpni_dest_cfg dest_cfg; |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 1095 | struct dpni_flc_cfg flc_cfg; |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1096 | int order_preservation_en; |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1097 | uint32_t tail_drop_threshold; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1098 | }; |
| 1099 | |
| 1100 | /** |
| 1101 | * struct dpni_queue_attr - Structure representing queue attributes |
| 1102 | * @user_ctx: User context value provided in the frame descriptor of each |
| 1103 | * dequeued frame |
| 1104 | * @dest_cfg: Queue destination configuration |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 1105 | * @flc_cfg: Flow context configuration |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1106 | * @order_preservation_en: enable/disable order preservation |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1107 | * @tail_drop_threshold: queue's tail drop threshold in bytes; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1108 | * @fqid: Virtual fqid value to be used for dequeue operations |
| 1109 | */ |
| 1110 | struct dpni_queue_attr { |
| 1111 | uint64_t user_ctx; |
| 1112 | struct dpni_dest_cfg dest_cfg; |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 1113 | struct dpni_flc_cfg flc_cfg; |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1114 | int order_preservation_en; |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1115 | uint32_t tail_drop_threshold; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1116 | uint32_t fqid; |
| 1117 | }; |
| 1118 | |
| 1119 | /* DPNI Tx flow modification options */ |
| 1120 | |
| 1121 | /* Select to modify the settings for dedicate Tx confirmation/error */ |
| 1122 | #define DPNI_TX_FLOW_OPT_TX_CONF_ERROR 0x00000001 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1123 | /*!< Select to modify the L3 checksum generation setting */ |
| 1124 | #define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN 0x00000010 |
| 1125 | /*!< Select to modify the L4 checksum generation setting */ |
| 1126 | #define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020 |
| 1127 | |
| 1128 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1129 | * dpni_get_api_version - Retrieve DPNI Major and Minor version info. |
| 1130 | * |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1131 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1132 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1133 | * @major_ver: DPNI major version |
| 1134 | * @minor_ver: DPNI minor version |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1135 | * |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1136 | * Return: '0' on Success; Error code otherwise. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1137 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1138 | int dpni_get_api_version(struct fsl_mc_io *mc_io, |
| 1139 | u32 cmd_flags, |
| 1140 | u16 *major_ver, |
| 1141 | u16 *minor_ver); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1142 | |
| 1143 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1144 | * enum dpni_confirmation_mode - Defines DPNI options supported for Tx |
| 1145 | * confirmation |
| 1146 | * @DPNI_CONF_AFFINE: For each Tx queue set associated with a sender there is |
| 1147 | * an affine Tx Confirmation queue |
| 1148 | * @DPNI_CONF_SINGLE: All Tx queues are associated with a single Tx |
| 1149 | * confirmation queue |
| 1150 | * @DPNI_CONF_DISABLE: Tx frames are not confirmed. This must be associated |
| 1151 | * with proper FD set-up to have buffers release to a Buffer Pool, otherwise |
| 1152 | * buffers will be leaked. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1153 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1154 | enum dpni_confirmation_mode { |
| 1155 | DPNI_CONF_AFFINE, |
| 1156 | DPNI_CONF_SINGLE, |
| 1157 | DPNI_CONF_DISABLE, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1158 | }; |
| 1159 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1160 | struct dpni_tx_confirmation_mode { |
| 1161 | uint32_t pad; |
| 1162 | uint8_t confirmation_mode; |
| 1163 | }; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1164 | |
| 1165 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1166 | * struct dpni_queue - Queue structure |
| 1167 | * @fqid: FQID used for enqueueing to and/or configuration of this specific FQ |
| 1168 | * @qdbin: Queueing bin, used to enqueue using QDID, DQBIN, QPRI. Only relevant |
| 1169 | * for Tx queues. |
| 1170 | * @flc: FLC value for traffic dequeued from this queue. |
| 1171 | * @user_context: User data, presented to the user along with any frames |
| 1172 | * from this queue. Not relevant for Tx queues. |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1173 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1174 | struct dpni_queue { |
| 1175 | /** |
| 1176 | * struct destination - Destination structure |
| 1177 | * @id: ID of the destination, only relevant if DEST_TYPE is > 0. |
| 1178 | * Identifies either a DPIO or a DPCON object. Not relevant for Tx |
| 1179 | * queues. |
| 1180 | * @type: May be one of the following: |
| 1181 | * 0 - No destination, queue can be manually queried, but won't |
| 1182 | * push traffic or notifications to a DPIO; |
| 1183 | * 1 - The destination is DPIO. When traffic becomes available in |
| 1184 | * the queue a FQDAN (FQ data available notification) will be |
| 1185 | * generated to selected DPIO; |
| 1186 | * 2 - The destination is a DPCON. The queue is associated with a |
| 1187 | * DPCON object for purpose of scheduling between multiple |
| 1188 | * queues. The DPCON may be independently configured to |
| 1189 | * generate notifications. Not relevant for Tx queues. |
| 1190 | * @hold_active: Hold active |
| 1191 | */ |
| 1192 | struct { |
| 1193 | uint32_t id; |
| 1194 | enum dpni_dest type; |
| 1195 | char hold_active; |
| 1196 | char stash_ctrl; |
| 1197 | } destination; |
| 1198 | uint8_t options; |
| 1199 | uint32_t fqid; |
| 1200 | uint16_t qdbin; |
| 1201 | uint64_t flc; |
| 1202 | uint64_t user_context; |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1203 | }; |
| 1204 | |
| 1205 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1206 | * dpni_set_queue() - Set queue parameters |
| 1207 | * @mc_io: Pointer to MC portal's I/O object |
| 1208 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 1209 | * @token: Token of DPNI object |
| 1210 | * @type: Type of queue |
| 1211 | * @tc: Traffic class, in range 0 to NUM_TCS - 1 |
| 1212 | * @index: Selects the specific queue out of the set allocated for the same |
| 1213 | * TC. Value must be in range 0 to NUM_QUEUES - 1 |
| 1214 | * @queue: Queue structure |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1215 | * |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1216 | * Return: '0' on Success; Error code otherwise. |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1217 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1218 | int dpni_set_queue(struct fsl_mc_io *mc_io, |
| 1219 | uint32_t cmd_flags, |
| 1220 | uint16_t token, |
| 1221 | enum dpni_queue_type type, |
| 1222 | uint8_t tc, |
| 1223 | uint8_t index, |
| 1224 | const struct dpni_queue *queue); |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1225 | |
| 1226 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1227 | * dpni_get_queue() - Get queue parameters |
| 1228 | * @mc_io: Pointer to MC portal's I/O object |
| 1229 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 1230 | * @token: Token of DPNI object |
| 1231 | * @type: Type of queue |
| 1232 | * @tc: Traffic class, in range 0 to NUM_TCS - 1 |
| 1233 | * @index: Selects the specific queue out of the set allocated for the same |
| 1234 | * TC. Value must be in range 0 to NUM_QUEUES - 1 |
| 1235 | * @queue: Queue structure |
| 1236 | * |
| 1237 | * Return: '0' on Success; Error code otherwise. |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1238 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1239 | int dpni_get_queue(struct fsl_mc_io *mc_io, |
| 1240 | uint32_t cmd_flags, |
| 1241 | uint16_t token, |
| 1242 | enum dpni_queue_type type, |
| 1243 | uint8_t tc, |
| 1244 | uint8_t index, |
| 1245 | struct dpni_queue *queue); |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1246 | |
| 1247 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1248 | * dpni_set_tx_confirmation_mode() - Set TX conf mode |
| 1249 | * @mc_io: Pointer to MC portal's I/O object |
| 1250 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 1251 | * @token: Token of DPNI object |
| 1252 | * @mode: DPNI confirmation mode type |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1253 | * |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1254 | * Return: '0' on Success; Error code otherwise. |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1255 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1256 | int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io, |
| 1257 | uint32_t cmd_flags, |
| 1258 | uint16_t token, |
| 1259 | enum dpni_confirmation_mode mode); |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1260 | |
Ioana Ciornei | d6733a4 | 2023-05-23 16:47:44 +0300 | [diff] [blame^] | 1261 | #define DPNI_STATISTICS_CNT 7 |
| 1262 | |
| 1263 | /** |
| 1264 | * union dpni_statistics - Union describing the DPNI statistics |
| 1265 | * @page_0: Page_0 statistics structure |
| 1266 | * @page_0.ingress_all_frames: Ingress frame count |
| 1267 | * @page_0.ingress_all_bytes: Ingress byte count |
| 1268 | * @page_0.ingress_multicast_frames: Ingress multicast frame count |
| 1269 | * @page_0.ingress_multicast_bytes: Ingress multicast byte count |
| 1270 | * @page_0.ingress_broadcast_frames: Ingress broadcast frame count |
| 1271 | * @page_0.ingress_broadcast_bytes: Ingress broadcast byte count |
| 1272 | * @page_1: Page_1 statistics structure |
| 1273 | * @page_1.egress_all_frames: Egress frame count |
| 1274 | * @page_1.egress_all_bytes: Egress byte count |
| 1275 | * @page_1.egress_multicast_frames: Egress multicast frame count |
| 1276 | * @page_1.egress_multicast_bytes: Egress multicast byte count |
| 1277 | * @page_1.egress_broadcast_frames: Egress broadcast frame count |
| 1278 | * @page_1.egress_broadcast_bytes: Egress broadcast byte count |
| 1279 | * @page_2: Page_2 statistics structure |
| 1280 | * @page_2.ingress_filtered_frames: Ingress filtered frame count |
| 1281 | * @page_2.ingress_discarded_frames: Ingress discarded frame count |
| 1282 | * @page_2.ingress_nobuffer_discards: Ingress discarded frame count due to |
| 1283 | * lack of buffers |
| 1284 | * @page_2.egress_discarded_frames: Egress discarded frame count |
| 1285 | * @page_2.egress_confirmed_frames: Egress confirmed frame count |
| 1286 | * @page_3: Page_3 statistics structure |
| 1287 | * @page_3.egress_dequeue_bytes: Cumulative count of the number of bytes |
| 1288 | * dequeued from egress FQs |
| 1289 | * @page_3.egress_dequeue_frames: Cumulative count of the number of frames |
| 1290 | * dequeued from egress FQs |
| 1291 | * @page_3.egress_reject_bytes: Cumulative count of the number of bytes in |
| 1292 | * egress frames whose enqueue was rejected |
| 1293 | * @page_3.egress_reject_frames: Cumulative count of the number of egress |
| 1294 | * frames whose enqueue was rejected |
| 1295 | * @page_4: Page_4 statistics structure: congestion points |
| 1296 | * @page_4.cgr_reject_frames: number of rejected frames due to congestion point |
| 1297 | * @page_4.cgr_reject_bytes: number of rejected bytes due to congestion point |
| 1298 | * @page_5: Page_5 statistics structure: policer |
| 1299 | * @page_5.policer_cnt_red: NUmber of red colored frames |
| 1300 | * @page_5.policer_cnt_yellow: number of yellow colored frames |
| 1301 | * @page_5.policer_cnt_green: number of green colored frames |
| 1302 | * @page_5.policer_cnt_re_red: number of recolored red frames |
| 1303 | * @page_5.policer_cnt_re_yellow: number of recolored yellow frames |
| 1304 | * @page_6: Page_6 statistics structure |
| 1305 | * @page_6.tx_pending_frames: total number of frames pending in egress FQs |
| 1306 | * @raw: raw statistics structure, used to index counters |
| 1307 | */ |
| 1308 | union dpni_statistics { |
| 1309 | struct { |
| 1310 | u64 ingress_all_frames; |
| 1311 | u64 ingress_all_bytes; |
| 1312 | u64 ingress_multicast_frames; |
| 1313 | u64 ingress_multicast_bytes; |
| 1314 | u64 ingress_broadcast_frames; |
| 1315 | u64 ingress_broadcast_bytes; |
| 1316 | } page_0; |
| 1317 | struct { |
| 1318 | u64 egress_all_frames; |
| 1319 | u64 egress_all_bytes; |
| 1320 | u64 egress_multicast_frames; |
| 1321 | u64 egress_multicast_bytes; |
| 1322 | u64 egress_broadcast_frames; |
| 1323 | u64 egress_broadcast_bytes; |
| 1324 | } page_1; |
| 1325 | struct { |
| 1326 | u64 ingress_filtered_frames; |
| 1327 | u64 ingress_discarded_frames; |
| 1328 | u64 ingress_nobuffer_discards; |
| 1329 | u64 egress_discarded_frames; |
| 1330 | u64 egress_confirmed_frames; |
| 1331 | } page_2; |
| 1332 | struct { |
| 1333 | u64 egress_dequeue_bytes; |
| 1334 | u64 egress_dequeue_frames; |
| 1335 | u64 egress_reject_bytes; |
| 1336 | u64 egress_reject_frames; |
| 1337 | } page_3; |
| 1338 | struct { |
| 1339 | u64 cgr_reject_frames; |
| 1340 | u64 cgr_reject_bytes; |
| 1341 | } page_4; |
| 1342 | struct { |
| 1343 | u64 policer_cnt_red; |
| 1344 | u64 policer_cnt_yellow; |
| 1345 | u64 policer_cnt_green; |
| 1346 | u64 policer_cnt_re_red; |
| 1347 | u64 policer_cnt_re_yellow; |
| 1348 | } page_5; |
| 1349 | struct { |
| 1350 | u64 tx_pending_frames; |
| 1351 | } page_6; |
| 1352 | struct { |
| 1353 | u64 counter[DPNI_STATISTICS_CNT]; |
| 1354 | } raw; |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1355 | }; |
| 1356 | |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 1357 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1358 | * dpni_get_statistics() - Get DPNI statistics |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1359 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1360 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1361 | * @token: Token of DPNI object |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1362 | * @page: Selects the statistics page to retrieve, see DPNI_GET_STATISTICS |
| 1363 | * output. Pages are numbered 0 to 2. |
| 1364 | * @stat: Structure containing the statistics |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1365 | * |
| 1366 | * Return: '0' on Success; Error code otherwise. |
| 1367 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1368 | int dpni_get_statistics(struct fsl_mc_io *mc_io, |
| 1369 | uint32_t cmd_flags, |
| 1370 | uint16_t token, |
| 1371 | uint8_t page, |
Ioana Ciornei | d6733a4 | 2023-05-23 16:47:44 +0300 | [diff] [blame^] | 1372 | union dpni_statistics *stat); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1373 | |
| 1374 | /** |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1375 | * dpni_reset_statistics() - Clears DPNI statistics |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1376 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 1377 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1378 | * @token: Token of DPNI object |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1379 | * |
| 1380 | * Return: '0' on Success; Error code otherwise. |
| 1381 | */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 1382 | int dpni_reset_statistics(struct fsl_mc_io *mc_io, |
| 1383 | uint32_t cmd_flags, |
| 1384 | uint16_t token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 1385 | #endif /* _FSL_DPNI_H */ |