1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (C) 2013-2015 Freescale Semiconductor 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+ 5*4882a593Smuzhiyun */ 6*4882a593Smuzhiyun #ifndef _FSL_DPNI_H 7*4882a593Smuzhiyun #define _FSL_DPNI_H 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun /* DPNI Version */ 10*4882a593Smuzhiyun #define DPNI_VER_MAJOR 6 11*4882a593Smuzhiyun #define DPNI_VER_MINOR 0 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun /* Command IDs */ 14*4882a593Smuzhiyun #define DPNI_CMDID_OPEN 0x801 15*4882a593Smuzhiyun #define DPNI_CMDID_CLOSE 0x800 16*4882a593Smuzhiyun #define DPNI_CMDID_CREATE 0x901 17*4882a593Smuzhiyun #define DPNI_CMDID_DESTROY 0x900 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun #define DPNI_CMDID_ENABLE 0x002 20*4882a593Smuzhiyun #define DPNI_CMDID_DISABLE 0x003 21*4882a593Smuzhiyun #define DPNI_CMDID_GET_ATTR 0x004 22*4882a593Smuzhiyun #define DPNI_CMDID_RESET 0x005 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun #define DPNI_CMDID_SET_POOLS 0x200 25*4882a593Smuzhiyun #define DPNI_CMDID_GET_RX_BUFFER_LAYOUT 0x201 26*4882a593Smuzhiyun #define DPNI_CMDID_SET_RX_BUFFER_LAYOUT 0x202 27*4882a593Smuzhiyun #define DPNI_CMDID_GET_TX_BUFFER_LAYOUT 0x203 28*4882a593Smuzhiyun #define DPNI_CMDID_SET_TX_BUFFER_LAYOUT 0x204 29*4882a593Smuzhiyun #define DPNI_CMDID_SET_TX_CONF_BUFFER_LAYOUT 0x205 30*4882a593Smuzhiyun #define DPNI_CMDID_GET_TX_CONF_BUFFER_LAYOUT 0x206 31*4882a593Smuzhiyun #define DPNI_CMDID_SET_ERRORS_BEHAVIOR 0x20B 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun #define DPNI_CMDID_GET_QDID 0x210 34*4882a593Smuzhiyun #define DPNI_CMDID_GET_TX_DATA_OFFSET 0x212 35*4882a593Smuzhiyun #define DPNI_CMDID_GET_COUNTER 0x213 36*4882a593Smuzhiyun #define DPNI_CMDID_SET_COUNTER 0x214 37*4882a593Smuzhiyun #define DPNI_CMDID_GET_LINK_STATE 0x215 38*4882a593Smuzhiyun #define DPNI_CMDID_SET_LINK_CFG 0x21A 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun #define DPNI_CMDID_SET_PRIM_MAC 0x224 41*4882a593Smuzhiyun #define DPNI_CMDID_GET_PRIM_MAC 0x225 42*4882a593Smuzhiyun #define DPNI_CMDID_ADD_MAC_ADDR 0x226 43*4882a593Smuzhiyun #define DPNI_CMDID_REMOVE_MAC_ADDR 0x227 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun #define DPNI_CMDID_SET_TX_FLOW 0x236 46*4882a593Smuzhiyun #define DPNI_CMDID_GET_TX_FLOW 0x237 47*4882a593Smuzhiyun #define DPNI_CMDID_SET_RX_FLOW 0x238 48*4882a593Smuzhiyun #define DPNI_CMDID_GET_RX_FLOW 0x239 49*4882a593Smuzhiyun #define DPNI_CMDID_SET_TX_CONF 0x257 50*4882a593Smuzhiyun #define DPNI_CMDID_GET_TX_CONF 0x258 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 53*4882a593Smuzhiyun #define DPNI_CMD_OPEN(cmd, dpni_id) \ 54*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id) 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun #define DPNI_PREP_EXTENDED_CFG(ext, cfg) \ 57*4882a593Smuzhiyun do { \ 58*4882a593Smuzhiyun MC_PREP_OP(ext, 0, 0, 16, uint16_t, cfg->tc_cfg[0].max_dist); \ 59*4882a593Smuzhiyun MC_PREP_OP(ext, 0, 16, 16, uint16_t, cfg->tc_cfg[0].max_fs_entries); \ 60*4882a593Smuzhiyun MC_PREP_OP(ext, 0, 32, 16, uint16_t, cfg->tc_cfg[1].max_dist); \ 61*4882a593Smuzhiyun MC_PREP_OP(ext, 0, 48, 16, uint16_t, cfg->tc_cfg[1].max_fs_entries); \ 62*4882a593Smuzhiyun MC_PREP_OP(ext, 1, 0, 16, uint16_t, cfg->tc_cfg[2].max_dist); \ 63*4882a593Smuzhiyun MC_PREP_OP(ext, 1, 16, 16, uint16_t, cfg->tc_cfg[2].max_fs_entries); \ 64*4882a593Smuzhiyun MC_PREP_OP(ext, 1, 32, 16, uint16_t, cfg->tc_cfg[3].max_dist); \ 65*4882a593Smuzhiyun MC_PREP_OP(ext, 1, 48, 16, uint16_t, cfg->tc_cfg[3].max_fs_entries); \ 66*4882a593Smuzhiyun MC_PREP_OP(ext, 2, 0, 16, uint16_t, cfg->tc_cfg[4].max_dist); \ 67*4882a593Smuzhiyun MC_PREP_OP(ext, 2, 16, 16, uint16_t, cfg->tc_cfg[4].max_fs_entries); \ 68*4882a593Smuzhiyun MC_PREP_OP(ext, 2, 32, 16, uint16_t, cfg->tc_cfg[5].max_dist); \ 69*4882a593Smuzhiyun MC_PREP_OP(ext, 2, 48, 16, uint16_t, cfg->tc_cfg[5].max_fs_entries); \ 70*4882a593Smuzhiyun MC_PREP_OP(ext, 3, 0, 16, uint16_t, cfg->tc_cfg[6].max_dist); \ 71*4882a593Smuzhiyun MC_PREP_OP(ext, 3, 16, 16, uint16_t, cfg->tc_cfg[6].max_fs_entries); \ 72*4882a593Smuzhiyun MC_PREP_OP(ext, 3, 32, 16, uint16_t, cfg->tc_cfg[7].max_dist); \ 73*4882a593Smuzhiyun MC_PREP_OP(ext, 3, 48, 16, uint16_t, cfg->tc_cfg[7].max_fs_entries); \ 74*4882a593Smuzhiyun MC_PREP_OP(ext, 4, 0, 16, uint16_t, \ 75*4882a593Smuzhiyun cfg->ipr_cfg.max_open_frames_ipv4); \ 76*4882a593Smuzhiyun MC_PREP_OP(ext, 4, 16, 16, uint16_t, \ 77*4882a593Smuzhiyun cfg->ipr_cfg.max_open_frames_ipv6); \ 78*4882a593Smuzhiyun MC_PREP_OP(ext, 4, 32, 16, uint16_t, \ 79*4882a593Smuzhiyun cfg->ipr_cfg.max_reass_frm_size); \ 80*4882a593Smuzhiyun MC_PREP_OP(ext, 5, 0, 16, uint16_t, \ 81*4882a593Smuzhiyun cfg->ipr_cfg.min_frag_size_ipv4); \ 82*4882a593Smuzhiyun MC_PREP_OP(ext, 5, 16, 16, uint16_t, \ 83*4882a593Smuzhiyun cfg->ipr_cfg.min_frag_size_ipv6); \ 84*4882a593Smuzhiyun } while (0) 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun #define DPNI_EXT_EXTENDED_CFG(ext, cfg) \ 87*4882a593Smuzhiyun do { \ 88*4882a593Smuzhiyun MC_EXT_OP(ext, 0, 0, 16, uint16_t, cfg->tc_cfg[0].max_dist); \ 89*4882a593Smuzhiyun MC_EXT_OP(ext, 0, 16, 16, uint16_t, cfg->tc_cfg[0].max_fs_entries); \ 90*4882a593Smuzhiyun MC_EXT_OP(ext, 0, 32, 16, uint16_t, cfg->tc_cfg[1].max_dist); \ 91*4882a593Smuzhiyun MC_EXT_OP(ext, 0, 48, 16, uint16_t, cfg->tc_cfg[1].max_fs_entries); \ 92*4882a593Smuzhiyun MC_EXT_OP(ext, 1, 0, 16, uint16_t, cfg->tc_cfg[2].max_dist); \ 93*4882a593Smuzhiyun MC_EXT_OP(ext, 1, 16, 16, uint16_t, cfg->tc_cfg[2].max_fs_entries); \ 94*4882a593Smuzhiyun MC_EXT_OP(ext, 1, 32, 16, uint16_t, cfg->tc_cfg[3].max_dist); \ 95*4882a593Smuzhiyun MC_EXT_OP(ext, 1, 48, 16, uint16_t, cfg->tc_cfg[3].max_fs_entries); \ 96*4882a593Smuzhiyun MC_EXT_OP(ext, 2, 0, 16, uint16_t, cfg->tc_cfg[4].max_dist); \ 97*4882a593Smuzhiyun MC_EXT_OP(ext, 2, 16, 16, uint16_t, cfg->tc_cfg[4].max_fs_entries); \ 98*4882a593Smuzhiyun MC_EXT_OP(ext, 2, 32, 16, uint16_t, cfg->tc_cfg[5].max_dist); \ 99*4882a593Smuzhiyun MC_EXT_OP(ext, 2, 48, 16, uint16_t, cfg->tc_cfg[5].max_fs_entries); \ 100*4882a593Smuzhiyun MC_EXT_OP(ext, 3, 0, 16, uint16_t, cfg->tc_cfg[6].max_dist); \ 101*4882a593Smuzhiyun MC_EXT_OP(ext, 3, 16, 16, uint16_t, cfg->tc_cfg[6].max_fs_entries); \ 102*4882a593Smuzhiyun MC_EXT_OP(ext, 3, 32, 16, uint16_t, cfg->tc_cfg[7].max_dist); \ 103*4882a593Smuzhiyun MC_EXT_OP(ext, 3, 48, 16, uint16_t, cfg->tc_cfg[7].max_fs_entries); \ 104*4882a593Smuzhiyun MC_EXT_OP(ext, 4, 0, 16, uint16_t, \ 105*4882a593Smuzhiyun cfg->ipr_cfg.max_open_frames_ipv4); \ 106*4882a593Smuzhiyun MC_EXT_OP(ext, 4, 16, 16, uint16_t, \ 107*4882a593Smuzhiyun cfg->ipr_cfg.max_open_frames_ipv6); \ 108*4882a593Smuzhiyun MC_EXT_OP(ext, 4, 32, 16, uint16_t, \ 109*4882a593Smuzhiyun cfg->ipr_cfg.max_reass_frm_size); \ 110*4882a593Smuzhiyun MC_EXT_OP(ext, 5, 0, 16, uint16_t, \ 111*4882a593Smuzhiyun cfg->ipr_cfg.min_frag_size_ipv4); \ 112*4882a593Smuzhiyun MC_EXT_OP(ext, 5, 16, 16, uint16_t, \ 113*4882a593Smuzhiyun cfg->ipr_cfg.min_frag_size_ipv6); \ 114*4882a593Smuzhiyun } while (0) 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 117*4882a593Smuzhiyun #define DPNI_CMD_CREATE(cmd, cfg) \ 118*4882a593Smuzhiyun do { \ 119*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->adv.max_tcs); \ 120*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->adv.max_senders); \ 121*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 8, uint8_t, cfg->mac_addr[5]); \ 122*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 24, 8, uint8_t, cfg->mac_addr[4]); \ 123*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->mac_addr[3]); \ 124*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->mac_addr[2]); \ 125*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->mac_addr[1]); \ 126*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 56, 8, uint8_t, cfg->mac_addr[0]); \ 127*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->adv.options); \ 128*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 0, 8, uint8_t, cfg->adv.max_unicast_filters); \ 129*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 8, 8, uint8_t, cfg->adv.max_multicast_filters); \ 130*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 16, 8, uint8_t, cfg->adv.max_vlan_filters); \ 131*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 24, 8, uint8_t, cfg->adv.max_qos_entries); \ 132*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 32, 8, uint8_t, cfg->adv.max_qos_key_size); \ 133*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 48, 8, uint8_t, cfg->adv.max_dist_key_size); \ 134*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 56, 8, enum net_prot, cfg->adv.start_hdr); \ 135*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 48, 8, uint8_t, cfg->adv.max_policers); \ 136*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 56, 8, uint8_t, cfg->adv.max_congestion_ctrl); \ 137*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 0, 64, uint64_t, cfg->adv.ext_cfg_iova); \ 138*4882a593Smuzhiyun } while (0) 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 141*4882a593Smuzhiyun #define DPNI_CMD_SET_POOLS(cmd, cfg) \ 142*4882a593Smuzhiyun do { \ 143*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \ 144*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \ 145*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \ 146*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \ 147*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \ 148*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \ 149*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \ 150*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \ 151*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \ 152*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \ 153*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\ 154*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \ 155*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\ 156*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \ 157*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\ 158*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \ 159*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\ 160*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \ 161*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\ 162*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \ 163*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\ 164*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \ 165*4882a593Smuzhiyun MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\ 166*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \ 167*4882a593Smuzhiyun MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\ 168*4882a593Smuzhiyun } while (0) 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 171*4882a593Smuzhiyun #define DPNI_CMD_GET_ATTR(cmd, attr) \ 172*4882a593Smuzhiyun MC_CMD_OP(cmd, 6, 0, 64, uint64_t, attr->ext_cfg_iova) 173*4882a593Smuzhiyun 174*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 175*4882a593Smuzhiyun #define DPNI_RSP_GET_ATTR(cmd, attr) \ 176*4882a593Smuzhiyun do { \ 177*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 32, int, attr->id);\ 178*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->max_tcs); \ 179*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 40, 8, uint8_t, attr->max_senders); \ 180*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 48, 8, enum net_prot, attr->start_hdr); \ 181*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options); \ 182*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->max_unicast_filters); \ 183*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->max_multicast_filters);\ 184*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 16, 8, uint8_t, attr->max_vlan_filters); \ 185*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 24, 8, uint8_t, attr->max_qos_entries); \ 186*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 32, 8, uint8_t, attr->max_qos_key_size); \ 187*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 40, 8, uint8_t, attr->max_dist_key_size); \ 188*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 48, 8, uint8_t, attr->max_policers); \ 189*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 56, 8, uint8_t, attr->max_congestion_ctrl); \ 190*4882a593Smuzhiyun MC_RSP_OP(cmd, 5, 32, 16, uint16_t, attr->version.major);\ 191*4882a593Smuzhiyun MC_RSP_OP(cmd, 5, 48, 16, uint16_t, attr->version.minor);\ 192*4882a593Smuzhiyun } while (0) 193*4882a593Smuzhiyun 194*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 195*4882a593Smuzhiyun #define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \ 196*4882a593Smuzhiyun do { \ 197*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \ 198*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \ 199*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \ 200*4882a593Smuzhiyun } while (0) 201*4882a593Smuzhiyun 202*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 203*4882a593Smuzhiyun #define DPNI_RSP_GET_RX_BUFFER_LAYOUT(cmd, layout) \ 204*4882a593Smuzhiyun do { \ 205*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \ 206*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \ 207*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \ 208*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \ 209*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \ 210*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \ 211*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \ 212*4882a593Smuzhiyun } while (0) 213*4882a593Smuzhiyun 214*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 215*4882a593Smuzhiyun #define DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout) \ 216*4882a593Smuzhiyun do { \ 217*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \ 218*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \ 219*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \ 220*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \ 221*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \ 222*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \ 223*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \ 224*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \ 225*4882a593Smuzhiyun } while (0) 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 228*4882a593Smuzhiyun #define DPNI_RSP_GET_TX_BUFFER_LAYOUT(cmd, layout) \ 229*4882a593Smuzhiyun do { \ 230*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \ 231*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \ 232*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \ 233*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \ 234*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \ 235*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \ 236*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \ 237*4882a593Smuzhiyun } while (0) 238*4882a593Smuzhiyun 239*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 240*4882a593Smuzhiyun #define DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout) \ 241*4882a593Smuzhiyun do { \ 242*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \ 243*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \ 244*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \ 245*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \ 246*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \ 247*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \ 248*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \ 249*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \ 250*4882a593Smuzhiyun } while (0) 251*4882a593Smuzhiyun 252*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 253*4882a593Smuzhiyun #define DPNI_RSP_GET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \ 254*4882a593Smuzhiyun do { \ 255*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \ 256*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \ 257*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \ 258*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \ 259*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \ 260*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \ 261*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \ 262*4882a593Smuzhiyun } while (0) 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 265*4882a593Smuzhiyun #define DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \ 266*4882a593Smuzhiyun do { \ 267*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \ 268*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \ 269*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \ 270*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \ 271*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \ 272*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \ 273*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \ 274*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \ 275*4882a593Smuzhiyun } while (0) 276*4882a593Smuzhiyun 277*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 278*4882a593Smuzhiyun #define DPNI_RSP_GET_QDID(cmd, qdid) \ 279*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid) 280*4882a593Smuzhiyun 281*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 282*4882a593Smuzhiyun #define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \ 283*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 16, uint16_t, data_offset) 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 286*4882a593Smuzhiyun #define DPNI_CMD_GET_COUNTER(cmd, counter) \ 287*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 16, enum dpni_counter, counter) 288*4882a593Smuzhiyun 289*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 290*4882a593Smuzhiyun #define DPNI_RSP_GET_COUNTER(cmd, value) \ 291*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 64, uint64_t, value) 292*4882a593Smuzhiyun 293*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 294*4882a593Smuzhiyun #define DPNI_CMD_SET_COUNTER(cmd, counter, value) \ 295*4882a593Smuzhiyun do { \ 296*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 16, enum dpni_counter, counter); \ 297*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 64, uint64_t, value); \ 298*4882a593Smuzhiyun } while (0) 299*4882a593Smuzhiyun 300*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 301*4882a593Smuzhiyun #define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \ 302*4882a593Smuzhiyun do { \ 303*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\ 304*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\ 305*4882a593Smuzhiyun } while (0) 306*4882a593Smuzhiyun 307*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 308*4882a593Smuzhiyun #define DPNI_RSP_GET_LINK_STATE(cmd, state) \ 309*4882a593Smuzhiyun do { \ 310*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\ 311*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\ 312*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\ 313*4882a593Smuzhiyun } while (0) 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 318*4882a593Smuzhiyun #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \ 319*4882a593Smuzhiyun do { \ 320*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ 321*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ 322*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ 323*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ 324*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ 325*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ 326*4882a593Smuzhiyun } while (0) 327*4882a593Smuzhiyun 328*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 329*4882a593Smuzhiyun #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \ 330*4882a593Smuzhiyun do { \ 331*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ 332*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ 333*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ 334*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ 335*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ 336*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ 337*4882a593Smuzhiyun } while (0) 338*4882a593Smuzhiyun 339*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 340*4882a593Smuzhiyun #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \ 341*4882a593Smuzhiyun do { \ 342*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ 343*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ 344*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ 345*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ 346*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ 347*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ 348*4882a593Smuzhiyun } while (0) 349*4882a593Smuzhiyun 350*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 351*4882a593Smuzhiyun #define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \ 352*4882a593Smuzhiyun do { \ 353*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \ 354*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \ 355*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \ 356*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \ 357*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \ 358*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \ 359*4882a593Smuzhiyun } while (0) 360*4882a593Smuzhiyun 361*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 362*4882a593Smuzhiyun #define DPNI_CMD_SET_TX_FLOW(cmd, flow_id, cfg) \ 363*4882a593Smuzhiyun do { \ 364*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 43, 1, int, cfg->l3_chksum_gen);\ 365*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 44, 1, int, cfg->l4_chksum_gen);\ 366*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 45, 1, int, cfg->use_common_tx_conf_queue);\ 367*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id);\ 368*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\ 369*4882a593Smuzhiyun } while (0) 370*4882a593Smuzhiyun 371*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 372*4882a593Smuzhiyun #define DPNI_RSP_SET_TX_FLOW(cmd, flow_id) \ 373*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 48, 16, uint16_t, flow_id) 374*4882a593Smuzhiyun 375*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 376*4882a593Smuzhiyun #define DPNI_CMD_GET_TX_FLOW(cmd, flow_id) \ 377*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id) 378*4882a593Smuzhiyun 379*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 380*4882a593Smuzhiyun #define DPNI_RSP_GET_TX_FLOW(cmd, attr) \ 381*4882a593Smuzhiyun do { \ 382*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 43, 1, int, attr->l3_chksum_gen);\ 383*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 44, 1, int, attr->l4_chksum_gen);\ 384*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 45, 1, int, attr->use_common_tx_conf_queue);\ 385*4882a593Smuzhiyun } while (0) 386*4882a593Smuzhiyun 387*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 388*4882a593Smuzhiyun #define DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg) \ 389*4882a593Smuzhiyun do { \ 390*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dest_cfg.dest_id); \ 391*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->dest_cfg.priority);\ 392*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 40, 2, enum dpni_dest, cfg->dest_cfg.dest_type);\ 393*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 42, 1, int, cfg->order_preservation_en);\ 394*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \ 395*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx); \ 396*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 16, 8, uint8_t, tc_id); \ 397*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 32, 32, uint32_t, cfg->options); \ 398*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 0, 4, enum dpni_flc_type, cfg->flc_cfg.flc_type); \ 399*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 4, 4, enum dpni_stash_size, \ 400*4882a593Smuzhiyun cfg->flc_cfg.frame_data_size);\ 401*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 8, 4, enum dpni_stash_size, \ 402*4882a593Smuzhiyun cfg->flc_cfg.flow_context_size);\ 403*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 32, 32, uint32_t, cfg->flc_cfg.options);\ 404*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 0, 64, uint64_t, cfg->flc_cfg.flow_context);\ 405*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 0, 32, uint32_t, cfg->tail_drop_threshold); \ 406*4882a593Smuzhiyun } while (0) 407*4882a593Smuzhiyun 408*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 409*4882a593Smuzhiyun #define DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id) \ 410*4882a593Smuzhiyun do { \ 411*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc_id); \ 412*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \ 413*4882a593Smuzhiyun } while (0) 414*4882a593Smuzhiyun 415*4882a593Smuzhiyun /* cmd, param, offset, width, type, arg_name */ 416*4882a593Smuzhiyun #define DPNI_RSP_GET_RX_FLOW(cmd, attr) \ 417*4882a593Smuzhiyun do { \ 418*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 0, 32, int, attr->dest_cfg.dest_id); \ 419*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->dest_cfg.priority);\ 420*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 40, 2, enum dpni_dest, attr->dest_cfg.dest_type); \ 421*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 42, 1, int, attr->order_preservation_en);\ 422*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->user_ctx); \ 423*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->tail_drop_threshold); \ 424*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 32, 32, uint32_t, attr->fqid); \ 425*4882a593Smuzhiyun MC_RSP_OP(cmd, 3, 0, 4, enum dpni_flc_type, attr->flc_cfg.flc_type); \ 426*4882a593Smuzhiyun MC_RSP_OP(cmd, 3, 4, 4, enum dpni_stash_size, \ 427*4882a593Smuzhiyun attr->flc_cfg.frame_data_size);\ 428*4882a593Smuzhiyun MC_RSP_OP(cmd, 3, 8, 4, enum dpni_stash_size, \ 429*4882a593Smuzhiyun attr->flc_cfg.flow_context_size);\ 430*4882a593Smuzhiyun MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->flc_cfg.options);\ 431*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 0, 64, uint64_t, attr->flc_cfg.flow_context);\ 432*4882a593Smuzhiyun } while (0) 433*4882a593Smuzhiyun 434*4882a593Smuzhiyun #define DPNI_CMD_SET_TX_CONF(cmd, flow_id, cfg) \ 435*4882a593Smuzhiyun do { \ 436*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->queue_cfg.dest_cfg.priority); \ 437*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 40, 2, enum dpni_dest, \ 438*4882a593Smuzhiyun cfg->queue_cfg.dest_cfg.dest_type); \ 439*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 42, 1, int, cfg->errors_only); \ 440*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 46, 1, int, cfg->queue_cfg.order_preservation_en); \ 441*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \ 442*4882a593Smuzhiyun MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->queue_cfg.user_ctx); \ 443*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->queue_cfg.options); \ 444*4882a593Smuzhiyun MC_CMD_OP(cmd, 2, 32, 32, int, cfg->queue_cfg.dest_cfg.dest_id); \ 445*4882a593Smuzhiyun MC_CMD_OP(cmd, 3, 0, 32, uint32_t, \ 446*4882a593Smuzhiyun cfg->queue_cfg.tail_drop_threshold); \ 447*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 0, 4, enum dpni_flc_type, \ 448*4882a593Smuzhiyun cfg->queue_cfg.flc_cfg.flc_type); \ 449*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 4, 4, enum dpni_stash_size, \ 450*4882a593Smuzhiyun cfg->queue_cfg.flc_cfg.frame_data_size); \ 451*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 8, 4, enum dpni_stash_size, \ 452*4882a593Smuzhiyun cfg->queue_cfg.flc_cfg.flow_context_size); \ 453*4882a593Smuzhiyun MC_CMD_OP(cmd, 4, 32, 32, uint32_t, cfg->queue_cfg.flc_cfg.options); \ 454*4882a593Smuzhiyun MC_CMD_OP(cmd, 5, 0, 64, uint64_t, \ 455*4882a593Smuzhiyun cfg->queue_cfg.flc_cfg.flow_context); \ 456*4882a593Smuzhiyun } while (0) 457*4882a593Smuzhiyun 458*4882a593Smuzhiyun #define DPNI_CMD_GET_TX_CONF(cmd, flow_id) \ 459*4882a593Smuzhiyun MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id) 460*4882a593Smuzhiyun 461*4882a593Smuzhiyun #define DPNI_RSP_GET_TX_CONF(cmd, attr) \ 462*4882a593Smuzhiyun do { \ 463*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 32, 8, uint8_t, \ 464*4882a593Smuzhiyun attr->queue_attr.dest_cfg.priority); \ 465*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 40, 2, enum dpni_dest, \ 466*4882a593Smuzhiyun attr->queue_attr.dest_cfg.dest_type); \ 467*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 42, 1, int, attr->errors_only); \ 468*4882a593Smuzhiyun MC_RSP_OP(cmd, 0, 46, 1, int, \ 469*4882a593Smuzhiyun attr->queue_attr.order_preservation_en); \ 470*4882a593Smuzhiyun MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->queue_attr.user_ctx); \ 471*4882a593Smuzhiyun MC_RSP_OP(cmd, 2, 32, 32, int, attr->queue_attr.dest_cfg.dest_id); \ 472*4882a593Smuzhiyun MC_RSP_OP(cmd, 3, 0, 32, uint32_t, \ 473*4882a593Smuzhiyun attr->queue_attr.tail_drop_threshold); \ 474*4882a593Smuzhiyun MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->queue_attr.fqid); \ 475*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 0, 4, enum dpni_flc_type, \ 476*4882a593Smuzhiyun attr->queue_attr.flc_cfg.flc_type); \ 477*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 4, 4, enum dpni_stash_size, \ 478*4882a593Smuzhiyun attr->queue_attr.flc_cfg.frame_data_size); \ 479*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 8, 4, enum dpni_stash_size, \ 480*4882a593Smuzhiyun attr->queue_attr.flc_cfg.flow_context_size); \ 481*4882a593Smuzhiyun MC_RSP_OP(cmd, 4, 32, 32, uint32_t, attr->queue_attr.flc_cfg.options); \ 482*4882a593Smuzhiyun MC_RSP_OP(cmd, 5, 0, 64, uint64_t, \ 483*4882a593Smuzhiyun attr->queue_attr.flc_cfg.flow_context); \ 484*4882a593Smuzhiyun } while (0) 485*4882a593Smuzhiyun 486*4882a593Smuzhiyun enum net_prot { 487*4882a593Smuzhiyun NET_PROT_NONE = 0, 488*4882a593Smuzhiyun NET_PROT_PAYLOAD, 489*4882a593Smuzhiyun NET_PROT_ETH, 490*4882a593Smuzhiyun NET_PROT_VLAN, 491*4882a593Smuzhiyun NET_PROT_IPV4, 492*4882a593Smuzhiyun NET_PROT_IPV6, 493*4882a593Smuzhiyun NET_PROT_IP, 494*4882a593Smuzhiyun NET_PROT_TCP, 495*4882a593Smuzhiyun NET_PROT_UDP, 496*4882a593Smuzhiyun NET_PROT_UDP_LITE, 497*4882a593Smuzhiyun NET_PROT_IPHC, 498*4882a593Smuzhiyun NET_PROT_SCTP, 499*4882a593Smuzhiyun NET_PROT_SCTP_CHUNK_DATA, 500*4882a593Smuzhiyun NET_PROT_PPPOE, 501*4882a593Smuzhiyun NET_PROT_PPP, 502*4882a593Smuzhiyun NET_PROT_PPPMUX, 503*4882a593Smuzhiyun NET_PROT_PPPMUX_SUBFRM, 504*4882a593Smuzhiyun NET_PROT_L2TPV2, 505*4882a593Smuzhiyun NET_PROT_L2TPV3_CTRL, 506*4882a593Smuzhiyun NET_PROT_L2TPV3_SESS, 507*4882a593Smuzhiyun NET_PROT_LLC, 508*4882a593Smuzhiyun NET_PROT_LLC_SNAP, 509*4882a593Smuzhiyun NET_PROT_NLPID, 510*4882a593Smuzhiyun NET_PROT_SNAP, 511*4882a593Smuzhiyun NET_PROT_MPLS, 512*4882a593Smuzhiyun NET_PROT_IPSEC_AH, 513*4882a593Smuzhiyun NET_PROT_IPSEC_ESP, 514*4882a593Smuzhiyun NET_PROT_UDP_ENC_ESP, /* RFC 3948 */ 515*4882a593Smuzhiyun NET_PROT_MACSEC, 516*4882a593Smuzhiyun NET_PROT_GRE, 517*4882a593Smuzhiyun NET_PROT_MINENCAP, 518*4882a593Smuzhiyun NET_PROT_DCCP, 519*4882a593Smuzhiyun NET_PROT_ICMP, 520*4882a593Smuzhiyun NET_PROT_IGMP, 521*4882a593Smuzhiyun NET_PROT_ARP, 522*4882a593Smuzhiyun NET_PROT_CAPWAP_DATA, 523*4882a593Smuzhiyun NET_PROT_CAPWAP_CTRL, 524*4882a593Smuzhiyun NET_PROT_RFC2684, 525*4882a593Smuzhiyun NET_PROT_ICMPV6, 526*4882a593Smuzhiyun NET_PROT_FCOE, 527*4882a593Smuzhiyun NET_PROT_FIP, 528*4882a593Smuzhiyun NET_PROT_ISCSI, 529*4882a593Smuzhiyun NET_PROT_GTP, 530*4882a593Smuzhiyun NET_PROT_USER_DEFINED_L2, 531*4882a593Smuzhiyun NET_PROT_USER_DEFINED_L3, 532*4882a593Smuzhiyun NET_PROT_USER_DEFINED_L4, 533*4882a593Smuzhiyun NET_PROT_USER_DEFINED_L5, 534*4882a593Smuzhiyun NET_PROT_USER_DEFINED_SHIM1, 535*4882a593Smuzhiyun NET_PROT_USER_DEFINED_SHIM2, 536*4882a593Smuzhiyun 537*4882a593Smuzhiyun NET_PROT_DUMMY_LAST 538*4882a593Smuzhiyun }; 539*4882a593Smuzhiyun 540*4882a593Smuzhiyun /** 541*4882a593Smuzhiyun * Data Path Network Interface API 542*4882a593Smuzhiyun * Contains initialization APIs and runtime control APIs for DPNI 543*4882a593Smuzhiyun */ 544*4882a593Smuzhiyun 545*4882a593Smuzhiyun struct fsl_mc_io; 546*4882a593Smuzhiyun 547*4882a593Smuzhiyun /* General DPNI macros */ 548*4882a593Smuzhiyun 549*4882a593Smuzhiyun /* Maximum number of traffic classes */ 550*4882a593Smuzhiyun #define DPNI_MAX_TC 8 551*4882a593Smuzhiyun /* Maximum number of buffer pools per DPNI */ 552*4882a593Smuzhiyun #define DPNI_MAX_DPBP 8 553*4882a593Smuzhiyun 554*4882a593Smuzhiyun /* All traffic classes considered; see dpni_set_rx_flow() */ 555*4882a593Smuzhiyun #define DPNI_ALL_TCS (uint8_t)(-1) 556*4882a593Smuzhiyun /* All flows within traffic class considered; see dpni_set_rx_flow() */ 557*4882a593Smuzhiyun #define DPNI_ALL_TC_FLOWS (uint16_t)(-1) 558*4882a593Smuzhiyun /* Generate new flow ID; see dpni_set_tx_flow() */ 559*4882a593Smuzhiyun #define DPNI_NEW_FLOW_ID (uint16_t)(-1) 560*4882a593Smuzhiyun /* use for common tx-conf queue; see dpni_set_tx_conf_<x>() */ 561*4882a593Smuzhiyun #define DPNI_COMMON_TX_CONF (uint16_t)(-1) 562*4882a593Smuzhiyun 563*4882a593Smuzhiyun /** 564*4882a593Smuzhiyun * dpni_open() - Open a control session for the specified object 565*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 566*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 567*4882a593Smuzhiyun * @dpni_id: DPNI unique ID 568*4882a593Smuzhiyun * @token: Returned token; use in subsequent API calls 569*4882a593Smuzhiyun * 570*4882a593Smuzhiyun * This function can be used to open a control session for an 571*4882a593Smuzhiyun * already created object; an object may have been declared in 572*4882a593Smuzhiyun * the DPL or by calling the dpni_create() function. 573*4882a593Smuzhiyun * This function returns a unique authentication token, 574*4882a593Smuzhiyun * associated with the specific object ID and the specific MC 575*4882a593Smuzhiyun * portal; this token must be used in all subsequent commands for 576*4882a593Smuzhiyun * this specific object. 577*4882a593Smuzhiyun * 578*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 579*4882a593Smuzhiyun */ 580*4882a593Smuzhiyun int dpni_open(struct fsl_mc_io *mc_io, 581*4882a593Smuzhiyun uint32_t cmd_flags, 582*4882a593Smuzhiyun int dpni_id, 583*4882a593Smuzhiyun uint16_t *token); 584*4882a593Smuzhiyun 585*4882a593Smuzhiyun /** 586*4882a593Smuzhiyun * dpni_close() - Close the control session of the object 587*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 588*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 589*4882a593Smuzhiyun * @token: Token of DPNI object 590*4882a593Smuzhiyun * 591*4882a593Smuzhiyun * After this function is called, no further operations are 592*4882a593Smuzhiyun * allowed on the object without opening a new control session. 593*4882a593Smuzhiyun * 594*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 595*4882a593Smuzhiyun */ 596*4882a593Smuzhiyun int dpni_close(struct fsl_mc_io *mc_io, 597*4882a593Smuzhiyun uint32_t cmd_flags, 598*4882a593Smuzhiyun uint16_t token); 599*4882a593Smuzhiyun 600*4882a593Smuzhiyun /* DPNI configuration options */ 601*4882a593Smuzhiyun 602*4882a593Smuzhiyun /** 603*4882a593Smuzhiyun * Allow different distribution key profiles for different traffic classes; 604*4882a593Smuzhiyun * if not set, a single key profile is assumed 605*4882a593Smuzhiyun */ 606*4882a593Smuzhiyun #define DPNI_OPT_ALLOW_DIST_KEY_PER_TC 0x00000001 607*4882a593Smuzhiyun 608*4882a593Smuzhiyun /** 609*4882a593Smuzhiyun * Disable all non-error transmit confirmation; error frames are reported 610*4882a593Smuzhiyun * back to a common Tx error queue 611*4882a593Smuzhiyun */ 612*4882a593Smuzhiyun #define DPNI_OPT_TX_CONF_DISABLED 0x00000002 613*4882a593Smuzhiyun 614*4882a593Smuzhiyun /* Disable per-sender private Tx confirmation/error queue */ 615*4882a593Smuzhiyun #define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED 0x00000004 616*4882a593Smuzhiyun 617*4882a593Smuzhiyun /** 618*4882a593Smuzhiyun * Support distribution based on hashed key; 619*4882a593Smuzhiyun * allows statistical distribution over receive queues in a traffic class 620*4882a593Smuzhiyun */ 621*4882a593Smuzhiyun #define DPNI_OPT_DIST_HASH 0x00000010 622*4882a593Smuzhiyun 623*4882a593Smuzhiyun /** 624*4882a593Smuzhiyun * Support distribution based on flow steering; 625*4882a593Smuzhiyun * allows explicit control of distribution over receive queues in a traffic 626*4882a593Smuzhiyun * class 627*4882a593Smuzhiyun */ 628*4882a593Smuzhiyun #define DPNI_OPT_DIST_FS 0x00000020 629*4882a593Smuzhiyun 630*4882a593Smuzhiyun /* Unicast filtering support */ 631*4882a593Smuzhiyun #define DPNI_OPT_UNICAST_FILTER 0x00000080 632*4882a593Smuzhiyun /* Multicast filtering support */ 633*4882a593Smuzhiyun #define DPNI_OPT_MULTICAST_FILTER 0x00000100 634*4882a593Smuzhiyun /* VLAN filtering support */ 635*4882a593Smuzhiyun #define DPNI_OPT_VLAN_FILTER 0x00000200 636*4882a593Smuzhiyun /* Support IP reassembly on received packets */ 637*4882a593Smuzhiyun #define DPNI_OPT_IPR 0x00000800 638*4882a593Smuzhiyun /* Support IP fragmentation on transmitted packets */ 639*4882a593Smuzhiyun #define DPNI_OPT_IPF 0x00001000 640*4882a593Smuzhiyun /* VLAN manipulation support */ 641*4882a593Smuzhiyun #define DPNI_OPT_VLAN_MANIPULATION 0x00010000 642*4882a593Smuzhiyun /* Support masking of QoS lookup keys */ 643*4882a593Smuzhiyun #define DPNI_OPT_QOS_MASK_SUPPORT 0x00020000 644*4882a593Smuzhiyun /* Support masking of Flow Steering lookup keys */ 645*4882a593Smuzhiyun #define DPNI_OPT_FS_MASK_SUPPORT 0x00040000 646*4882a593Smuzhiyun 647*4882a593Smuzhiyun /** 648*4882a593Smuzhiyun * struct dpni_extended_cfg - Structure representing extended DPNI configuration 649*4882a593Smuzhiyun * @tc_cfg: TCs configuration 650*4882a593Smuzhiyun * @ipr_cfg: IP reassembly configuration 651*4882a593Smuzhiyun */ 652*4882a593Smuzhiyun struct dpni_extended_cfg { 653*4882a593Smuzhiyun /** 654*4882a593Smuzhiyun * struct tc_cfg - TC configuration 655*4882a593Smuzhiyun * @max_dist: Maximum distribution size for Rx traffic class; 656*4882a593Smuzhiyun * supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96, 657*4882a593Smuzhiyun * 112,128,192,224,256,384,448,512,768,896,1024; 658*4882a593Smuzhiyun * value '0' will be treated as '1'. 659*4882a593Smuzhiyun * other unsupported values will be round down to the nearest 660*4882a593Smuzhiyun * supported value. 661*4882a593Smuzhiyun * @max_fs_entries: Maximum FS entries for Rx traffic class; 662*4882a593Smuzhiyun * '0' means no support for this TC; 663*4882a593Smuzhiyun */ 664*4882a593Smuzhiyun struct { 665*4882a593Smuzhiyun uint16_t max_dist; 666*4882a593Smuzhiyun uint16_t max_fs_entries; 667*4882a593Smuzhiyun } tc_cfg[DPNI_MAX_TC]; 668*4882a593Smuzhiyun /** 669*4882a593Smuzhiyun * struct ipr_cfg - Structure representing IP reassembly configuration 670*4882a593Smuzhiyun * @max_reass_frm_size: Maximum size of the reassembled frame 671*4882a593Smuzhiyun * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments 672*4882a593Smuzhiyun * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments 673*4882a593Smuzhiyun * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly 674*4882a593Smuzhiyun * process 675*4882a593Smuzhiyun * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly 676*4882a593Smuzhiyun * process 677*4882a593Smuzhiyun */ 678*4882a593Smuzhiyun struct { 679*4882a593Smuzhiyun uint16_t max_reass_frm_size; 680*4882a593Smuzhiyun uint16_t min_frag_size_ipv4; 681*4882a593Smuzhiyun uint16_t min_frag_size_ipv6; 682*4882a593Smuzhiyun uint16_t max_open_frames_ipv4; 683*4882a593Smuzhiyun uint16_t max_open_frames_ipv6; 684*4882a593Smuzhiyun } ipr_cfg; 685*4882a593Smuzhiyun }; 686*4882a593Smuzhiyun 687*4882a593Smuzhiyun /** 688*4882a593Smuzhiyun * dpni_prepare_extended_cfg() - function prepare extended parameters 689*4882a593Smuzhiyun * @cfg: extended structure 690*4882a593Smuzhiyun * @ext_cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA 691*4882a593Smuzhiyun * 692*4882a593Smuzhiyun * This function has to be called before dpni_create() 693*4882a593Smuzhiyun */ 694*4882a593Smuzhiyun int dpni_prepare_extended_cfg(const struct dpni_extended_cfg *cfg, 695*4882a593Smuzhiyun uint8_t *ext_cfg_buf); 696*4882a593Smuzhiyun 697*4882a593Smuzhiyun /** 698*4882a593Smuzhiyun * struct dpni_cfg - Structure representing DPNI configuration 699*4882a593Smuzhiyun * @mac_addr: Primary MAC address 700*4882a593Smuzhiyun * @adv: Advanced parameters; default is all zeros; 701*4882a593Smuzhiyun * use this structure to change default settings 702*4882a593Smuzhiyun */ 703*4882a593Smuzhiyun struct dpni_cfg { 704*4882a593Smuzhiyun uint8_t mac_addr[6]; 705*4882a593Smuzhiyun /** 706*4882a593Smuzhiyun * struct adv - Advanced parameters 707*4882a593Smuzhiyun * @options: Mask of available options; use 'DPNI_OPT_<X>' values 708*4882a593Smuzhiyun * @start_hdr: Selects the packet starting header for parsing; 709*4882a593Smuzhiyun * 'NET_PROT_NONE' is treated as default: 'NET_PROT_ETH' 710*4882a593Smuzhiyun * @max_senders: Maximum number of different senders; used as the number 711*4882a593Smuzhiyun * of dedicated Tx flows; Non-power-of-2 values are rounded 712*4882a593Smuzhiyun * up to the next power-of-2 value as hardware demands it; 713*4882a593Smuzhiyun * '0' will be treated as '1' 714*4882a593Smuzhiyun * @max_tcs: Maximum number of traffic classes (for both Tx and Rx); 715*4882a593Smuzhiyun * '0' will e treated as '1' 716*4882a593Smuzhiyun * @max_unicast_filters: Maximum number of unicast filters; 717*4882a593Smuzhiyun * '0' is treated as '16' 718*4882a593Smuzhiyun * @max_multicast_filters: Maximum number of multicast filters; 719*4882a593Smuzhiyun * '0' is treated as '64' 720*4882a593Smuzhiyun * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in 721*4882a593Smuzhiyun * the QoS table; '0' is treated as '64' 722*4882a593Smuzhiyun * @max_qos_key_size: Maximum key size for the QoS look-up; 723*4882a593Smuzhiyun * '0' is treated as '24' which is enough for IPv4 724*4882a593Smuzhiyun * 5-tuple 725*4882a593Smuzhiyun * @max_dist_key_size: Maximum key size for the distribution; 726*4882a593Smuzhiyun * '0' is treated as '24' which is enough for IPv4 5-tuple 727*4882a593Smuzhiyun * @max_policers: Maximum number of policers; 728*4882a593Smuzhiyun * should be between '0' and max_tcs 729*4882a593Smuzhiyun * @max_congestion_ctrl: Maximum number of congestion control groups 730*4882a593Smuzhiyun * (CGs); covers early drop and congestion notification 731*4882a593Smuzhiyun * requirements; 732*4882a593Smuzhiyun * should be between '0' and ('max_tcs' + 'max_senders') 733*4882a593Smuzhiyun * @ext_cfg_iova: I/O virtual address of 256 bytes DMA-able memory 734*4882a593Smuzhiyun * filled with the extended configuration by calling 735*4882a593Smuzhiyun * dpni_prepare_extended_cfg() 736*4882a593Smuzhiyun */ 737*4882a593Smuzhiyun struct { 738*4882a593Smuzhiyun uint32_t options; 739*4882a593Smuzhiyun enum net_prot start_hdr; 740*4882a593Smuzhiyun uint8_t max_senders; 741*4882a593Smuzhiyun uint8_t max_tcs; 742*4882a593Smuzhiyun uint8_t max_unicast_filters; 743*4882a593Smuzhiyun uint8_t max_multicast_filters; 744*4882a593Smuzhiyun uint8_t max_vlan_filters; 745*4882a593Smuzhiyun uint8_t max_qos_entries; 746*4882a593Smuzhiyun uint8_t max_qos_key_size; 747*4882a593Smuzhiyun uint8_t max_dist_key_size; 748*4882a593Smuzhiyun uint8_t max_policers; 749*4882a593Smuzhiyun uint8_t max_congestion_ctrl; 750*4882a593Smuzhiyun uint64_t ext_cfg_iova; 751*4882a593Smuzhiyun } adv; 752*4882a593Smuzhiyun }; 753*4882a593Smuzhiyun 754*4882a593Smuzhiyun /** 755*4882a593Smuzhiyun * dpni_create() - Create the DPNI object 756*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 757*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 758*4882a593Smuzhiyun * @cfg: Configuration structure 759*4882a593Smuzhiyun * @token: Returned token; use in subsequent API calls 760*4882a593Smuzhiyun * 761*4882a593Smuzhiyun * Create the DPNI object, allocate required resources and 762*4882a593Smuzhiyun * perform required initialization. 763*4882a593Smuzhiyun * 764*4882a593Smuzhiyun * The object can be created either by declaring it in the 765*4882a593Smuzhiyun * DPL file, or by calling this function. 766*4882a593Smuzhiyun * 767*4882a593Smuzhiyun * This function returns a unique authentication token, 768*4882a593Smuzhiyun * associated with the specific object ID and the specific MC 769*4882a593Smuzhiyun * portal; this token must be used in all subsequent calls to 770*4882a593Smuzhiyun * this specific object. For objects that are created using the 771*4882a593Smuzhiyun * DPL file, call dpni_open() function to get an authentication 772*4882a593Smuzhiyun * token first. 773*4882a593Smuzhiyun * 774*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 775*4882a593Smuzhiyun */ 776*4882a593Smuzhiyun int dpni_create(struct fsl_mc_io *mc_io, 777*4882a593Smuzhiyun uint32_t cmd_flags, 778*4882a593Smuzhiyun const struct dpni_cfg *cfg, 779*4882a593Smuzhiyun uint16_t *token); 780*4882a593Smuzhiyun 781*4882a593Smuzhiyun /** 782*4882a593Smuzhiyun * dpni_destroy() - Destroy the DPNI object and release all its resources. 783*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 784*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 785*4882a593Smuzhiyun * @token: Token of DPNI object 786*4882a593Smuzhiyun * 787*4882a593Smuzhiyun * Return: '0' on Success; error code otherwise. 788*4882a593Smuzhiyun */ 789*4882a593Smuzhiyun int dpni_destroy(struct fsl_mc_io *mc_io, 790*4882a593Smuzhiyun uint32_t cmd_flags, 791*4882a593Smuzhiyun uint16_t token); 792*4882a593Smuzhiyun 793*4882a593Smuzhiyun /** 794*4882a593Smuzhiyun * struct dpni_pools_cfg - Structure representing buffer pools configuration 795*4882a593Smuzhiyun * @num_dpbp: Number of DPBPs 796*4882a593Smuzhiyun * @pools: Array of buffer pools parameters; The number of valid entries 797*4882a593Smuzhiyun * must match 'num_dpbp' value 798*4882a593Smuzhiyun */ 799*4882a593Smuzhiyun struct dpni_pools_cfg { 800*4882a593Smuzhiyun uint8_t num_dpbp; 801*4882a593Smuzhiyun /** 802*4882a593Smuzhiyun * struct pools - Buffer pools parameters 803*4882a593Smuzhiyun * @dpbp_id: DPBP object ID 804*4882a593Smuzhiyun * @buffer_size: Buffer size 805*4882a593Smuzhiyun * @backup_pool: Backup pool 806*4882a593Smuzhiyun */ 807*4882a593Smuzhiyun struct { 808*4882a593Smuzhiyun int dpbp_id; 809*4882a593Smuzhiyun uint16_t buffer_size; 810*4882a593Smuzhiyun int backup_pool; 811*4882a593Smuzhiyun } pools[DPNI_MAX_DPBP]; 812*4882a593Smuzhiyun }; 813*4882a593Smuzhiyun 814*4882a593Smuzhiyun /** 815*4882a593Smuzhiyun * dpni_set_pools() - Set buffer pools configuration 816*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 817*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 818*4882a593Smuzhiyun * @token: Token of DPNI object 819*4882a593Smuzhiyun * @cfg: Buffer pools configuration 820*4882a593Smuzhiyun * 821*4882a593Smuzhiyun * mandatory for DPNI operation 822*4882a593Smuzhiyun * warning:Allowed only when DPNI is disabled 823*4882a593Smuzhiyun * 824*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 825*4882a593Smuzhiyun */ 826*4882a593Smuzhiyun int dpni_set_pools(struct fsl_mc_io *mc_io, 827*4882a593Smuzhiyun uint32_t cmd_flags, 828*4882a593Smuzhiyun uint16_t token, 829*4882a593Smuzhiyun const struct dpni_pools_cfg *cfg); 830*4882a593Smuzhiyun 831*4882a593Smuzhiyun /** 832*4882a593Smuzhiyun * dpni_enable() - Enable the DPNI, allow sending and receiving frames. 833*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 834*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 835*4882a593Smuzhiyun * @token: Token of DPNI object 836*4882a593Smuzhiyun * 837*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 838*4882a593Smuzhiyun */ 839*4882a593Smuzhiyun int dpni_enable(struct fsl_mc_io *mc_io, 840*4882a593Smuzhiyun uint32_t cmd_flags, 841*4882a593Smuzhiyun uint16_t token); 842*4882a593Smuzhiyun 843*4882a593Smuzhiyun /** 844*4882a593Smuzhiyun * dpni_disable() - Disable the DPNI, stop sending and receiving frames. 845*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 846*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 847*4882a593Smuzhiyun * @token: Token of DPNI object 848*4882a593Smuzhiyun * 849*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 850*4882a593Smuzhiyun */ 851*4882a593Smuzhiyun int dpni_disable(struct fsl_mc_io *mc_io, 852*4882a593Smuzhiyun uint32_t cmd_flags, 853*4882a593Smuzhiyun uint16_t token); 854*4882a593Smuzhiyun 855*4882a593Smuzhiyun 856*4882a593Smuzhiyun /** 857*4882a593Smuzhiyun * dpni_reset() - Reset the DPNI, returns the object to initial state. 858*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 859*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 860*4882a593Smuzhiyun * @token: Token of DPNI object 861*4882a593Smuzhiyun * 862*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 863*4882a593Smuzhiyun */ 864*4882a593Smuzhiyun int dpni_reset(struct fsl_mc_io *mc_io, 865*4882a593Smuzhiyun uint32_t cmd_flags, 866*4882a593Smuzhiyun uint16_t token); 867*4882a593Smuzhiyun 868*4882a593Smuzhiyun /** 869*4882a593Smuzhiyun * struct dpni_attr - Structure representing DPNI attributes 870*4882a593Smuzhiyun * @id: DPNI object ID 871*4882a593Smuzhiyun * @version: DPNI version 872*4882a593Smuzhiyun * @start_hdr: Indicates the packet starting header for parsing 873*4882a593Smuzhiyun * @options: Mask of available options; reflects the value as was given in 874*4882a593Smuzhiyun * object's creation 875*4882a593Smuzhiyun * @max_senders: Maximum number of different senders; used as the number 876*4882a593Smuzhiyun * of dedicated Tx flows; 877*4882a593Smuzhiyun * @max_tcs: Maximum number of traffic classes (for both Tx and Rx) 878*4882a593Smuzhiyun * @max_unicast_filters: Maximum number of unicast filters 879*4882a593Smuzhiyun * @max_multicast_filters: Maximum number of multicast filters 880*4882a593Smuzhiyun * @max_vlan_filters: Maximum number of VLAN filters 881*4882a593Smuzhiyun * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in QoS table 882*4882a593Smuzhiyun * @max_qos_key_size: Maximum key size for the QoS look-up 883*4882a593Smuzhiyun * @max_dist_key_size: Maximum key size for the distribution look-up 884*4882a593Smuzhiyun * @max_policers: Maximum number of policers; 885*4882a593Smuzhiyun * @max_congestion_ctrl: Maximum number of congestion control groups (CGs); 886*4882a593Smuzhiyun * @ext_cfg_iova: I/O virtual address of 256 bytes DMA-able memory; 887*4882a593Smuzhiyun * call dpni_extract_extended_cfg() to extract the extended configuration 888*4882a593Smuzhiyun */ 889*4882a593Smuzhiyun struct dpni_attr { 890*4882a593Smuzhiyun int id; 891*4882a593Smuzhiyun /** 892*4882a593Smuzhiyun * struct version - DPNI version 893*4882a593Smuzhiyun * @major: DPNI major version 894*4882a593Smuzhiyun * @minor: DPNI minor version 895*4882a593Smuzhiyun */ 896*4882a593Smuzhiyun struct { 897*4882a593Smuzhiyun uint16_t major; 898*4882a593Smuzhiyun uint16_t minor; 899*4882a593Smuzhiyun } version; 900*4882a593Smuzhiyun enum net_prot start_hdr; 901*4882a593Smuzhiyun uint32_t options; 902*4882a593Smuzhiyun uint8_t max_senders; 903*4882a593Smuzhiyun uint8_t max_tcs; 904*4882a593Smuzhiyun uint8_t max_unicast_filters; 905*4882a593Smuzhiyun uint8_t max_multicast_filters; 906*4882a593Smuzhiyun uint8_t max_vlan_filters; 907*4882a593Smuzhiyun uint8_t max_qos_entries; 908*4882a593Smuzhiyun uint8_t max_qos_key_size; 909*4882a593Smuzhiyun uint8_t max_dist_key_size; 910*4882a593Smuzhiyun uint8_t max_policers; 911*4882a593Smuzhiyun uint8_t max_congestion_ctrl; 912*4882a593Smuzhiyun uint64_t ext_cfg_iova; 913*4882a593Smuzhiyun }; 914*4882a593Smuzhiyun 915*4882a593Smuzhiyun /** 916*4882a593Smuzhiyun * dpni_get_attributes() - Retrieve DPNI attributes. 917*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 918*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 919*4882a593Smuzhiyun * @token: Token of DPNI object 920*4882a593Smuzhiyun * @attr: Object's attributes 921*4882a593Smuzhiyun * 922*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 923*4882a593Smuzhiyun */ 924*4882a593Smuzhiyun int dpni_get_attributes(struct fsl_mc_io *mc_io, 925*4882a593Smuzhiyun uint32_t cmd_flags, 926*4882a593Smuzhiyun uint16_t token, 927*4882a593Smuzhiyun struct dpni_attr *attr); 928*4882a593Smuzhiyun 929*4882a593Smuzhiyun /** 930*4882a593Smuzhiyun * dpni_extract_extended_cfg() - extract the extended parameters 931*4882a593Smuzhiyun * @cfg: extended structure 932*4882a593Smuzhiyun * @ext_cfg_buf: 256 bytes of DMA-able memory 933*4882a593Smuzhiyun * 934*4882a593Smuzhiyun * This function has to be called after dpni_get_attributes() 935*4882a593Smuzhiyun */ 936*4882a593Smuzhiyun int dpni_extract_extended_cfg(struct dpni_extended_cfg *cfg, 937*4882a593Smuzhiyun const uint8_t *ext_cfg_buf); 938*4882a593Smuzhiyun 939*4882a593Smuzhiyun /** 940*4882a593Smuzhiyun * DPNI errors 941*4882a593Smuzhiyun */ 942*4882a593Smuzhiyun 943*4882a593Smuzhiyun /** 944*4882a593Smuzhiyun * Extract out of frame header error 945*4882a593Smuzhiyun */ 946*4882a593Smuzhiyun #define DPNI_ERROR_EOFHE 0x00020000 947*4882a593Smuzhiyun /** 948*4882a593Smuzhiyun * Frame length error 949*4882a593Smuzhiyun */ 950*4882a593Smuzhiyun #define DPNI_ERROR_FLE 0x00002000 951*4882a593Smuzhiyun /** 952*4882a593Smuzhiyun * Frame physical error 953*4882a593Smuzhiyun */ 954*4882a593Smuzhiyun #define DPNI_ERROR_FPE 0x00001000 955*4882a593Smuzhiyun /** 956*4882a593Smuzhiyun * Parsing header error 957*4882a593Smuzhiyun */ 958*4882a593Smuzhiyun #define DPNI_ERROR_PHE 0x00000020 959*4882a593Smuzhiyun /** 960*4882a593Smuzhiyun * Parser L3 checksum error 961*4882a593Smuzhiyun */ 962*4882a593Smuzhiyun #define DPNI_ERROR_L3CE 0x00000004 963*4882a593Smuzhiyun /** 964*4882a593Smuzhiyun * Parser L3 checksum error 965*4882a593Smuzhiyun */ 966*4882a593Smuzhiyun #define DPNI_ERROR_L4CE 0x00000001 967*4882a593Smuzhiyun 968*4882a593Smuzhiyun /** 969*4882a593Smuzhiyun * enum dpni_error_action - Defines DPNI behavior for errors 970*4882a593Smuzhiyun * @DPNI_ERROR_ACTION_DISCARD: Discard the frame 971*4882a593Smuzhiyun * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow 972*4882a593Smuzhiyun * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue 973*4882a593Smuzhiyun */ 974*4882a593Smuzhiyun enum dpni_error_action { 975*4882a593Smuzhiyun DPNI_ERROR_ACTION_DISCARD = 0, 976*4882a593Smuzhiyun DPNI_ERROR_ACTION_CONTINUE = 1, 977*4882a593Smuzhiyun DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2 978*4882a593Smuzhiyun }; 979*4882a593Smuzhiyun 980*4882a593Smuzhiyun /** 981*4882a593Smuzhiyun * struct dpni_error_cfg - Structure representing DPNI errors treatment 982*4882a593Smuzhiyun * @errors: Errors mask; use 'DPNI_ERROR__<X> 983*4882a593Smuzhiyun * @error_action: The desired action for the errors mask 984*4882a593Smuzhiyun * @set_frame_annotation: Set to '1' to mark the errors in frame annotation 985*4882a593Smuzhiyun * status (FAS); relevant only for the non-discard action 986*4882a593Smuzhiyun */ 987*4882a593Smuzhiyun struct dpni_error_cfg { 988*4882a593Smuzhiyun uint32_t errors; 989*4882a593Smuzhiyun enum dpni_error_action error_action; 990*4882a593Smuzhiyun int set_frame_annotation; 991*4882a593Smuzhiyun }; 992*4882a593Smuzhiyun 993*4882a593Smuzhiyun /** 994*4882a593Smuzhiyun * dpni_set_errors_behavior() - Set errors behavior 995*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 996*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 997*4882a593Smuzhiyun * @token: Token of DPNI object 998*4882a593Smuzhiyun * @cfg: Errors configuration 999*4882a593Smuzhiyun * 1000*4882a593Smuzhiyun * this function may be called numerous times with different 1001*4882a593Smuzhiyun * error masks 1002*4882a593Smuzhiyun * 1003*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1004*4882a593Smuzhiyun */ 1005*4882a593Smuzhiyun int dpni_set_errors_behavior(struct fsl_mc_io *mc_io, 1006*4882a593Smuzhiyun uint32_t cmd_flags, 1007*4882a593Smuzhiyun uint16_t token, 1008*4882a593Smuzhiyun struct dpni_error_cfg *cfg); 1009*4882a593Smuzhiyun 1010*4882a593Smuzhiyun /* DPNI buffer layout modification options */ 1011*4882a593Smuzhiyun 1012*4882a593Smuzhiyun /* Select to modify the time-stamp setting */ 1013*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001 1014*4882a593Smuzhiyun /* Select to modify the parser-result setting; not applicable for Tx */ 1015*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002 1016*4882a593Smuzhiyun /* Select to modify the frame-status setting */ 1017*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004 1018*4882a593Smuzhiyun /* Select to modify the private-data-size setting */ 1019*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008 1020*4882a593Smuzhiyun /* Select to modify the data-alignment setting */ 1021*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010 1022*4882a593Smuzhiyun /* Select to modify the data-head-room setting */ 1023*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020 1024*4882a593Smuzhiyun /*!< Select to modify the data-tail-room setting */ 1025*4882a593Smuzhiyun #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040 1026*4882a593Smuzhiyun 1027*4882a593Smuzhiyun /** 1028*4882a593Smuzhiyun * struct dpni_buffer_layout - Structure representing DPNI buffer layout 1029*4882a593Smuzhiyun * @options: Flags representing the suggested modifications to the buffer 1030*4882a593Smuzhiyun * layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags 1031*4882a593Smuzhiyun * @pass_timestamp: Pass timestamp value 1032*4882a593Smuzhiyun * @pass_parser_result: Pass parser results 1033*4882a593Smuzhiyun * @pass_frame_status: Pass frame status 1034*4882a593Smuzhiyun * @private_data_size: Size kept for private data (in bytes) 1035*4882a593Smuzhiyun * @data_align: Data alignment 1036*4882a593Smuzhiyun * @data_head_room: Data head room 1037*4882a593Smuzhiyun * @data_tail_room: Data tail room 1038*4882a593Smuzhiyun */ 1039*4882a593Smuzhiyun struct dpni_buffer_layout { 1040*4882a593Smuzhiyun uint32_t options; 1041*4882a593Smuzhiyun int pass_timestamp; 1042*4882a593Smuzhiyun int pass_parser_result; 1043*4882a593Smuzhiyun int pass_frame_status; 1044*4882a593Smuzhiyun uint16_t private_data_size; 1045*4882a593Smuzhiyun uint16_t data_align; 1046*4882a593Smuzhiyun uint16_t data_head_room; 1047*4882a593Smuzhiyun uint16_t data_tail_room; 1048*4882a593Smuzhiyun }; 1049*4882a593Smuzhiyun 1050*4882a593Smuzhiyun /** 1051*4882a593Smuzhiyun * dpni_get_rx_buffer_layout() - Retrieve Rx buffer layout attributes. 1052*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1053*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1054*4882a593Smuzhiyun * @token: Token of DPNI object 1055*4882a593Smuzhiyun * @layout: Returns buffer layout attributes 1056*4882a593Smuzhiyun * 1057*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1058*4882a593Smuzhiyun */ 1059*4882a593Smuzhiyun int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io, 1060*4882a593Smuzhiyun uint32_t cmd_flags, 1061*4882a593Smuzhiyun uint16_t token, 1062*4882a593Smuzhiyun struct dpni_buffer_layout *layout); 1063*4882a593Smuzhiyun 1064*4882a593Smuzhiyun /** 1065*4882a593Smuzhiyun * dpni_set_rx_buffer_layout() - Set Rx buffer layout configuration. 1066*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1067*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1068*4882a593Smuzhiyun * @token: Token of DPNI object 1069*4882a593Smuzhiyun * @layout: Buffer layout configuration 1070*4882a593Smuzhiyun * 1071*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1072*4882a593Smuzhiyun * 1073*4882a593Smuzhiyun * @warning Allowed only when DPNI is disabled 1074*4882a593Smuzhiyun */ 1075*4882a593Smuzhiyun int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io, 1076*4882a593Smuzhiyun uint32_t cmd_flags, 1077*4882a593Smuzhiyun uint16_t token, 1078*4882a593Smuzhiyun const struct dpni_buffer_layout *layout); 1079*4882a593Smuzhiyun 1080*4882a593Smuzhiyun /** 1081*4882a593Smuzhiyun * dpni_get_tx_buffer_layout() - Retrieve Tx buffer layout attributes. 1082*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1083*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1084*4882a593Smuzhiyun * @token: Token of DPNI object 1085*4882a593Smuzhiyun * @layout: Returns buffer layout attributes 1086*4882a593Smuzhiyun * 1087*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1088*4882a593Smuzhiyun */ 1089*4882a593Smuzhiyun int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io, 1090*4882a593Smuzhiyun uint32_t cmd_flags, 1091*4882a593Smuzhiyun uint16_t token, 1092*4882a593Smuzhiyun struct dpni_buffer_layout *layout); 1093*4882a593Smuzhiyun 1094*4882a593Smuzhiyun /** 1095*4882a593Smuzhiyun * dpni_set_tx_buffer_layout() - Set Tx buffer layout configuration. 1096*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1097*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1098*4882a593Smuzhiyun * @token: Token of DPNI object 1099*4882a593Smuzhiyun * @layout: Buffer layout configuration 1100*4882a593Smuzhiyun * 1101*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1102*4882a593Smuzhiyun * 1103*4882a593Smuzhiyun * @warning Allowed only when DPNI is disabled 1104*4882a593Smuzhiyun */ 1105*4882a593Smuzhiyun int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io, 1106*4882a593Smuzhiyun uint32_t cmd_flags, 1107*4882a593Smuzhiyun uint16_t token, 1108*4882a593Smuzhiyun const struct dpni_buffer_layout *layout); 1109*4882a593Smuzhiyun 1110*4882a593Smuzhiyun /** 1111*4882a593Smuzhiyun * dpni_get_tx_conf_buffer_layout() - Retrieve Tx confirmation buffer layout 1112*4882a593Smuzhiyun * attributes. 1113*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1114*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1115*4882a593Smuzhiyun * @token: Token of DPNI object 1116*4882a593Smuzhiyun * @layout: Returns buffer layout attributes 1117*4882a593Smuzhiyun * 1118*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1119*4882a593Smuzhiyun */ 1120*4882a593Smuzhiyun int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io, 1121*4882a593Smuzhiyun uint32_t cmd_flags, 1122*4882a593Smuzhiyun uint16_t token, 1123*4882a593Smuzhiyun struct dpni_buffer_layout *layout); 1124*4882a593Smuzhiyun 1125*4882a593Smuzhiyun /** 1126*4882a593Smuzhiyun * dpni_set_tx_conf_buffer_layout() - Set Tx confirmation buffer layout 1127*4882a593Smuzhiyun * configuration. 1128*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1129*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1130*4882a593Smuzhiyun * @token: Token of DPNI object 1131*4882a593Smuzhiyun * @layout: Buffer layout configuration 1132*4882a593Smuzhiyun * 1133*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1134*4882a593Smuzhiyun * 1135*4882a593Smuzhiyun * @warning Allowed only when DPNI is disabled 1136*4882a593Smuzhiyun */ 1137*4882a593Smuzhiyun int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io, 1138*4882a593Smuzhiyun uint32_t cmd_flags, 1139*4882a593Smuzhiyun uint16_t token, 1140*4882a593Smuzhiyun const struct dpni_buffer_layout *layout); 1141*4882a593Smuzhiyun 1142*4882a593Smuzhiyun /** 1143*4882a593Smuzhiyun * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used 1144*4882a593Smuzhiyun * for enqueue operations 1145*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1146*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1147*4882a593Smuzhiyun * @token: Token of DPNI object 1148*4882a593Smuzhiyun * @qdid: Returned virtual QDID value that should be used as an argument 1149*4882a593Smuzhiyun * in all enqueue operations 1150*4882a593Smuzhiyun * 1151*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1152*4882a593Smuzhiyun */ 1153*4882a593Smuzhiyun int dpni_get_qdid(struct fsl_mc_io *mc_io, 1154*4882a593Smuzhiyun uint32_t cmd_flags, 1155*4882a593Smuzhiyun uint16_t token, 1156*4882a593Smuzhiyun uint16_t *qdid); 1157*4882a593Smuzhiyun 1158*4882a593Smuzhiyun /** 1159*4882a593Smuzhiyun * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer) 1160*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1161*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1162*4882a593Smuzhiyun * @token: Token of DPNI object 1163*4882a593Smuzhiyun * @data_offset: Tx data offset (from start of buffer) 1164*4882a593Smuzhiyun * 1165*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1166*4882a593Smuzhiyun */ 1167*4882a593Smuzhiyun int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, 1168*4882a593Smuzhiyun uint32_t cmd_flags, 1169*4882a593Smuzhiyun uint16_t token, 1170*4882a593Smuzhiyun uint16_t *data_offset); 1171*4882a593Smuzhiyun 1172*4882a593Smuzhiyun /** 1173*4882a593Smuzhiyun * enum dpni_counter - DPNI counter types 1174*4882a593Smuzhiyun * @DPNI_CNT_ING_FRAME: Counts ingress frames 1175*4882a593Smuzhiyun * @DPNI_CNT_ING_BYTE: Counts ingress bytes 1176*4882a593Smuzhiyun * @DPNI_CNT_ING_FRAME_DROP: Counts ingress frames dropped due to explicit 1177*4882a593Smuzhiyun * 'drop' setting 1178*4882a593Smuzhiyun * @DPNI_CNT_ING_FRAME_DISCARD: Counts ingress frames discarded due to errors 1179*4882a593Smuzhiyun * @DPNI_CNT_ING_MCAST_FRAME: Counts ingress multicast frames 1180*4882a593Smuzhiyun * @DPNI_CNT_ING_MCAST_BYTE: Counts ingress multicast bytes 1181*4882a593Smuzhiyun * @DPNI_CNT_ING_BCAST_FRAME: Counts ingress broadcast frames 1182*4882a593Smuzhiyun * @DPNI_CNT_ING_BCAST_BYTES: Counts ingress broadcast bytes 1183*4882a593Smuzhiyun * @DPNI_CNT_EGR_FRAME: Counts egress frames 1184*4882a593Smuzhiyun * @DPNI_CNT_EGR_BYTE: Counts egress bytes 1185*4882a593Smuzhiyun * @DPNI_CNT_EGR_FRAME_DISCARD: Counts egress frames discarded due to errors 1186*4882a593Smuzhiyun */ 1187*4882a593Smuzhiyun enum dpni_counter { 1188*4882a593Smuzhiyun DPNI_CNT_ING_FRAME = 0x0, 1189*4882a593Smuzhiyun DPNI_CNT_ING_BYTE = 0x1, 1190*4882a593Smuzhiyun DPNI_CNT_ING_FRAME_DROP = 0x2, 1191*4882a593Smuzhiyun DPNI_CNT_ING_FRAME_DISCARD = 0x3, 1192*4882a593Smuzhiyun DPNI_CNT_ING_MCAST_FRAME = 0x4, 1193*4882a593Smuzhiyun DPNI_CNT_ING_MCAST_BYTE = 0x5, 1194*4882a593Smuzhiyun DPNI_CNT_ING_BCAST_FRAME = 0x6, 1195*4882a593Smuzhiyun DPNI_CNT_ING_BCAST_BYTES = 0x7, 1196*4882a593Smuzhiyun DPNI_CNT_EGR_FRAME = 0x8, 1197*4882a593Smuzhiyun DPNI_CNT_EGR_BYTE = 0x9, 1198*4882a593Smuzhiyun DPNI_CNT_EGR_FRAME_DISCARD = 0xa 1199*4882a593Smuzhiyun }; 1200*4882a593Smuzhiyun 1201*4882a593Smuzhiyun /** 1202*4882a593Smuzhiyun * dpni_get_counter() - Read a specific DPNI counter 1203*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1204*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1205*4882a593Smuzhiyun * @token: Token of DPNI object 1206*4882a593Smuzhiyun * @counter: The requested counter 1207*4882a593Smuzhiyun * @value: Returned counter's current value 1208*4882a593Smuzhiyun * 1209*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1210*4882a593Smuzhiyun */ 1211*4882a593Smuzhiyun int dpni_get_counter(struct fsl_mc_io *mc_io, 1212*4882a593Smuzhiyun uint32_t cmd_flags, 1213*4882a593Smuzhiyun uint16_t token, 1214*4882a593Smuzhiyun enum dpni_counter counter, 1215*4882a593Smuzhiyun uint64_t *value); 1216*4882a593Smuzhiyun 1217*4882a593Smuzhiyun /** 1218*4882a593Smuzhiyun * dpni_set_counter() - Set (or clear) a specific DPNI counter 1219*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1220*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1221*4882a593Smuzhiyun * @token: Token of DPNI object 1222*4882a593Smuzhiyun * @counter: The requested counter 1223*4882a593Smuzhiyun * @value: New counter value; typically pass '0' for resetting 1224*4882a593Smuzhiyun * the counter. 1225*4882a593Smuzhiyun * 1226*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1227*4882a593Smuzhiyun */ 1228*4882a593Smuzhiyun int dpni_set_counter(struct fsl_mc_io *mc_io, 1229*4882a593Smuzhiyun uint32_t cmd_flags, 1230*4882a593Smuzhiyun uint16_t token, 1231*4882a593Smuzhiyun enum dpni_counter counter, 1232*4882a593Smuzhiyun uint64_t value); 1233*4882a593Smuzhiyun 1234*4882a593Smuzhiyun /* Enable auto-negotiation */ 1235*4882a593Smuzhiyun #define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL 1236*4882a593Smuzhiyun /* Enable half-duplex mode */ 1237*4882a593Smuzhiyun #define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL 1238*4882a593Smuzhiyun /* Enable pause frames */ 1239*4882a593Smuzhiyun #define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL 1240*4882a593Smuzhiyun /* Enable a-symmetric pause frames */ 1241*4882a593Smuzhiyun #define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL 1242*4882a593Smuzhiyun 1243*4882a593Smuzhiyun /** 1244*4882a593Smuzhiyun * struct - Structure representing DPNI link configuration 1245*4882a593Smuzhiyun * @rate: Rate 1246*4882a593Smuzhiyun * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values 1247*4882a593Smuzhiyun */ 1248*4882a593Smuzhiyun struct dpni_link_cfg { 1249*4882a593Smuzhiyun uint32_t rate; 1250*4882a593Smuzhiyun uint64_t options; 1251*4882a593Smuzhiyun }; 1252*4882a593Smuzhiyun 1253*4882a593Smuzhiyun /** 1254*4882a593Smuzhiyun * dpni_set_link_cfg() - set the link configuration. 1255*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1256*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1257*4882a593Smuzhiyun * @token: Token of DPNI object 1258*4882a593Smuzhiyun * @cfg: Link configuration 1259*4882a593Smuzhiyun * 1260*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1261*4882a593Smuzhiyun */ 1262*4882a593Smuzhiyun int dpni_set_link_cfg(struct fsl_mc_io *mc_io, 1263*4882a593Smuzhiyun uint32_t cmd_flags, 1264*4882a593Smuzhiyun uint16_t token, 1265*4882a593Smuzhiyun const struct dpni_link_cfg *cfg); 1266*4882a593Smuzhiyun 1267*4882a593Smuzhiyun /** 1268*4882a593Smuzhiyun * struct dpni_link_state - Structure representing DPNI link state 1269*4882a593Smuzhiyun * @rate: Rate 1270*4882a593Smuzhiyun * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values 1271*4882a593Smuzhiyun * @up: Link state; '0' for down, '1' for up 1272*4882a593Smuzhiyun */ 1273*4882a593Smuzhiyun struct dpni_link_state { 1274*4882a593Smuzhiyun uint32_t rate; 1275*4882a593Smuzhiyun uint64_t options; 1276*4882a593Smuzhiyun int up; 1277*4882a593Smuzhiyun }; 1278*4882a593Smuzhiyun 1279*4882a593Smuzhiyun /** 1280*4882a593Smuzhiyun * dpni_get_link_state() - Return the link state (either up or down) 1281*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1282*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1283*4882a593Smuzhiyun * @token: Token of DPNI object 1284*4882a593Smuzhiyun * @state: Returned link state; 1285*4882a593Smuzhiyun * 1286*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1287*4882a593Smuzhiyun */ 1288*4882a593Smuzhiyun int dpni_get_link_state(struct fsl_mc_io *mc_io, 1289*4882a593Smuzhiyun uint32_t cmd_flags, 1290*4882a593Smuzhiyun uint16_t token, 1291*4882a593Smuzhiyun struct dpni_link_state *state); 1292*4882a593Smuzhiyun 1293*4882a593Smuzhiyun /** 1294*4882a593Smuzhiyun * dpni_set_primary_mac_addr() - Set the primary MAC address 1295*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1296*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1297*4882a593Smuzhiyun * @token: Token of DPNI object 1298*4882a593Smuzhiyun * @mac_addr: MAC address to set as primary address 1299*4882a593Smuzhiyun * 1300*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1301*4882a593Smuzhiyun */ 1302*4882a593Smuzhiyun int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io, 1303*4882a593Smuzhiyun uint32_t cmd_flags, 1304*4882a593Smuzhiyun uint16_t token, 1305*4882a593Smuzhiyun const uint8_t mac_addr[6]); 1306*4882a593Smuzhiyun 1307*4882a593Smuzhiyun /** 1308*4882a593Smuzhiyun * dpni_get_primary_mac_addr() - Get the primary MAC address 1309*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1310*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1311*4882a593Smuzhiyun * @token: Token of DPNI object 1312*4882a593Smuzhiyun * @mac_addr: Returned MAC address 1313*4882a593Smuzhiyun * 1314*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1315*4882a593Smuzhiyun */ 1316*4882a593Smuzhiyun int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, 1317*4882a593Smuzhiyun uint32_t cmd_flags, 1318*4882a593Smuzhiyun uint16_t token, 1319*4882a593Smuzhiyun uint8_t mac_addr[6]); 1320*4882a593Smuzhiyun 1321*4882a593Smuzhiyun /** 1322*4882a593Smuzhiyun * dpni_add_mac_addr() - Add MAC address filter 1323*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1324*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1325*4882a593Smuzhiyun * @token: Token of DPNI object 1326*4882a593Smuzhiyun * @mac_addr: MAC address to add 1327*4882a593Smuzhiyun * 1328*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1329*4882a593Smuzhiyun */ 1330*4882a593Smuzhiyun int dpni_add_mac_addr(struct fsl_mc_io *mc_io, 1331*4882a593Smuzhiyun uint32_t cmd_flags, 1332*4882a593Smuzhiyun uint16_t token, 1333*4882a593Smuzhiyun const uint8_t mac_addr[6]); 1334*4882a593Smuzhiyun 1335*4882a593Smuzhiyun /** 1336*4882a593Smuzhiyun * dpni_remove_mac_addr() - Remove MAC address filter 1337*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1338*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1339*4882a593Smuzhiyun * @token: Token of DPNI object 1340*4882a593Smuzhiyun * @mac_addr: MAC address to remove 1341*4882a593Smuzhiyun * 1342*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1343*4882a593Smuzhiyun */ 1344*4882a593Smuzhiyun int dpni_remove_mac_addr(struct fsl_mc_io *mc_io, 1345*4882a593Smuzhiyun uint32_t cmd_flags, 1346*4882a593Smuzhiyun uint16_t token, 1347*4882a593Smuzhiyun const uint8_t mac_addr[6]); 1348*4882a593Smuzhiyun 1349*4882a593Smuzhiyun /** 1350*4882a593Smuzhiyun * enum dpni_dest - DPNI destination types 1351*4882a593Smuzhiyun * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and 1352*4882a593Smuzhiyun * does not generate FQDAN notifications; user is expected to 1353*4882a593Smuzhiyun * dequeue from the queue based on polling or other user-defined 1354*4882a593Smuzhiyun * method 1355*4882a593Smuzhiyun * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN 1356*4882a593Smuzhiyun * notifications to the specified DPIO; user is expected to dequeue 1357*4882a593Smuzhiyun * from the queue only after notification is received 1358*4882a593Smuzhiyun * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate 1359*4882a593Smuzhiyun * FQDAN notifications, but is connected to the specified DPCON 1360*4882a593Smuzhiyun * object; user is expected to dequeue from the DPCON channel 1361*4882a593Smuzhiyun */ 1362*4882a593Smuzhiyun enum dpni_dest { 1363*4882a593Smuzhiyun DPNI_DEST_NONE = 0, 1364*4882a593Smuzhiyun DPNI_DEST_DPIO = 1, 1365*4882a593Smuzhiyun DPNI_DEST_DPCON = 2 1366*4882a593Smuzhiyun }; 1367*4882a593Smuzhiyun 1368*4882a593Smuzhiyun /** 1369*4882a593Smuzhiyun * struct dpni_dest_cfg - Structure representing DPNI destination parameters 1370*4882a593Smuzhiyun * @dest_type: Destination type 1371*4882a593Smuzhiyun * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type 1372*4882a593Smuzhiyun * @priority: Priority selection within the DPIO or DPCON channel; valid values 1373*4882a593Smuzhiyun * are 0-1 or 0-7, depending on the number of priorities in that 1374*4882a593Smuzhiyun * channel; not relevant for 'DPNI_DEST_NONE' option 1375*4882a593Smuzhiyun */ 1376*4882a593Smuzhiyun struct dpni_dest_cfg { 1377*4882a593Smuzhiyun enum dpni_dest dest_type; 1378*4882a593Smuzhiyun int dest_id; 1379*4882a593Smuzhiyun uint8_t priority; 1380*4882a593Smuzhiyun }; 1381*4882a593Smuzhiyun 1382*4882a593Smuzhiyun /** 1383*4882a593Smuzhiyun * enum dpni_flc_type - DPNI FLC types 1384*4882a593Smuzhiyun * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value 1385*4882a593Smuzhiyun * @DPNI_FLC_STASH: select the FLC to be used for stash control 1386*4882a593Smuzhiyun */ 1387*4882a593Smuzhiyun enum dpni_flc_type { 1388*4882a593Smuzhiyun DPNI_FLC_USER_DEFINED = 0, 1389*4882a593Smuzhiyun DPNI_FLC_STASH = 1, 1390*4882a593Smuzhiyun }; 1391*4882a593Smuzhiyun 1392*4882a593Smuzhiyun /** 1393*4882a593Smuzhiyun * enum dpni_stash_size - DPNI FLC stashing size 1394*4882a593Smuzhiyun * @DPNI_STASH_SIZE_0B: no stash 1395*4882a593Smuzhiyun * @DPNI_STASH_SIZE_64B: stashes 64 bytes 1396*4882a593Smuzhiyun * @DPNI_STASH_SIZE_128B: stashes 128 bytes 1397*4882a593Smuzhiyun * @DPNI_STASH_SIZE_192B: stashes 192 bytes 1398*4882a593Smuzhiyun */ 1399*4882a593Smuzhiyun enum dpni_stash_size { 1400*4882a593Smuzhiyun DPNI_STASH_SIZE_0B = 0, 1401*4882a593Smuzhiyun DPNI_STASH_SIZE_64B = 1, 1402*4882a593Smuzhiyun DPNI_STASH_SIZE_128B = 2, 1403*4882a593Smuzhiyun DPNI_STASH_SIZE_192B = 3, 1404*4882a593Smuzhiyun }; 1405*4882a593Smuzhiyun 1406*4882a593Smuzhiyun /* DPNI FLC stash options */ 1407*4882a593Smuzhiyun 1408*4882a593Smuzhiyun /* stashes the whole annotation area (up to 192 bytes) */ 1409*4882a593Smuzhiyun #define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001 1410*4882a593Smuzhiyun 1411*4882a593Smuzhiyun /** 1412*4882a593Smuzhiyun * struct dpni_flc_cfg - Structure representing DPNI FLC configuration 1413*4882a593Smuzhiyun * @flc_type: FLC type 1414*4882a593Smuzhiyun * @options: Mask of available options; 1415*4882a593Smuzhiyun * use 'DPNI_FLC_STASH_<X>' values 1416*4882a593Smuzhiyun * @frame_data_size: Size of frame data to be stashed 1417*4882a593Smuzhiyun * @flow_context_size: Size of flow context to be stashed 1418*4882a593Smuzhiyun * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED': 1419*4882a593Smuzhiyun * this value will be provided in the frame descriptor 1420*4882a593Smuzhiyun * (FD[FLC]) 1421*4882a593Smuzhiyun * 2. In case flc_type is 'DPNI_FLC_STASH': 1422*4882a593Smuzhiyun * this value will be I/O virtual address of the 1423*4882a593Smuzhiyun * flow-context; 1424*4882a593Smuzhiyun * Must be cacheline-aligned and DMA-able memory 1425*4882a593Smuzhiyun */ 1426*4882a593Smuzhiyun struct dpni_flc_cfg { 1427*4882a593Smuzhiyun enum dpni_flc_type flc_type; 1428*4882a593Smuzhiyun uint32_t options; 1429*4882a593Smuzhiyun enum dpni_stash_size frame_data_size; 1430*4882a593Smuzhiyun enum dpni_stash_size flow_context_size; 1431*4882a593Smuzhiyun uint64_t flow_context; 1432*4882a593Smuzhiyun }; 1433*4882a593Smuzhiyun 1434*4882a593Smuzhiyun /* DPNI queue modification options */ 1435*4882a593Smuzhiyun 1436*4882a593Smuzhiyun /* Select to modify the user's context associated with the queue */ 1437*4882a593Smuzhiyun #define DPNI_QUEUE_OPT_USER_CTX 0x00000001 1438*4882a593Smuzhiyun /* Select to modify the queue's destination */ 1439*4882a593Smuzhiyun #define DPNI_QUEUE_OPT_DEST 0x00000002 1440*4882a593Smuzhiyun /** Select to modify the flow-context parameters; 1441*4882a593Smuzhiyun * not applicable for Tx-conf/Err queues as the FD comes from the user 1442*4882a593Smuzhiyun */ 1443*4882a593Smuzhiyun #define DPNI_QUEUE_OPT_FLC 0x00000004 1444*4882a593Smuzhiyun /* Select to modify the queue's order preservation */ 1445*4882a593Smuzhiyun #define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008 1446*4882a593Smuzhiyun /* Select to modify the queue's tail-drop threshold */ 1447*4882a593Smuzhiyun #define DPNI_QUEUE_OPT_TAILDROP_THRESHOLD 0x00000010 1448*4882a593Smuzhiyun 1449*4882a593Smuzhiyun /** 1450*4882a593Smuzhiyun * struct dpni_queue_cfg - Structure representing queue configuration 1451*4882a593Smuzhiyun * @options: Flags representing the suggested modifications to the queue; 1452*4882a593Smuzhiyun * Use any combination of 'DPNI_QUEUE_OPT_<X>' flags 1453*4882a593Smuzhiyun * @user_ctx: User context value provided in the frame descriptor of each 1454*4882a593Smuzhiyun * dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX' 1455*4882a593Smuzhiyun * is contained in 'options' 1456*4882a593Smuzhiyun * @dest_cfg: Queue destination parameters; 1457*4882a593Smuzhiyun * valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options' 1458*4882a593Smuzhiyun * @flc_cfg: Flow context configuration; in case the TC's distribution 1459*4882a593Smuzhiyun * is either NONE or HASH the FLC's settings of flow#0 are used. 1460*4882a593Smuzhiyun * in the case of FS (flow-steering) the flow's FLC settings 1461*4882a593Smuzhiyun * are used. 1462*4882a593Smuzhiyun * valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options' 1463*4882a593Smuzhiyun * @order_preservation_en: enable/disable order preservation; 1464*4882a593Smuzhiyun * valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained 1465*4882a593Smuzhiyun * in 'options' 1466*4882a593Smuzhiyun * @tail_drop_threshold: set the queue's tail drop threshold in bytes; 1467*4882a593Smuzhiyun * '0' value disable the threshold; maximum value is 0xE000000; 1468*4882a593Smuzhiyun * valid only if 'DPNI_QUEUE_OPT_TAILDROP_THRESHOLD' is contained 1469*4882a593Smuzhiyun * in 'options' 1470*4882a593Smuzhiyun */ 1471*4882a593Smuzhiyun struct dpni_queue_cfg { 1472*4882a593Smuzhiyun uint32_t options; 1473*4882a593Smuzhiyun uint64_t user_ctx; 1474*4882a593Smuzhiyun struct dpni_dest_cfg dest_cfg; 1475*4882a593Smuzhiyun struct dpni_flc_cfg flc_cfg; 1476*4882a593Smuzhiyun int order_preservation_en; 1477*4882a593Smuzhiyun uint32_t tail_drop_threshold; 1478*4882a593Smuzhiyun }; 1479*4882a593Smuzhiyun 1480*4882a593Smuzhiyun /** 1481*4882a593Smuzhiyun * struct dpni_queue_attr - Structure representing queue attributes 1482*4882a593Smuzhiyun * @user_ctx: User context value provided in the frame descriptor of each 1483*4882a593Smuzhiyun * dequeued frame 1484*4882a593Smuzhiyun * @dest_cfg: Queue destination configuration 1485*4882a593Smuzhiyun * @flc_cfg: Flow context configuration 1486*4882a593Smuzhiyun * @order_preservation_en: enable/disable order preservation 1487*4882a593Smuzhiyun * @tail_drop_threshold: queue's tail drop threshold in bytes; 1488*4882a593Smuzhiyun * @fqid: Virtual fqid value to be used for dequeue operations 1489*4882a593Smuzhiyun */ 1490*4882a593Smuzhiyun struct dpni_queue_attr { 1491*4882a593Smuzhiyun uint64_t user_ctx; 1492*4882a593Smuzhiyun struct dpni_dest_cfg dest_cfg; 1493*4882a593Smuzhiyun struct dpni_flc_cfg flc_cfg; 1494*4882a593Smuzhiyun int order_preservation_en; 1495*4882a593Smuzhiyun uint32_t tail_drop_threshold; 1496*4882a593Smuzhiyun uint32_t fqid; 1497*4882a593Smuzhiyun }; 1498*4882a593Smuzhiyun 1499*4882a593Smuzhiyun /* DPNI Tx flow modification options */ 1500*4882a593Smuzhiyun 1501*4882a593Smuzhiyun /* Select to modify the settings for dedicate Tx confirmation/error */ 1502*4882a593Smuzhiyun #define DPNI_TX_FLOW_OPT_TX_CONF_ERROR 0x00000001 1503*4882a593Smuzhiyun /*!< Select to modify the L3 checksum generation setting */ 1504*4882a593Smuzhiyun #define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN 0x00000010 1505*4882a593Smuzhiyun /*!< Select to modify the L4 checksum generation setting */ 1506*4882a593Smuzhiyun #define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020 1507*4882a593Smuzhiyun 1508*4882a593Smuzhiyun /** 1509*4882a593Smuzhiyun * struct dpni_tx_flow_cfg - Structure representing Tx flow configuration 1510*4882a593Smuzhiyun * @options: Flags representing the suggested modifications to the Tx flow; 1511*4882a593Smuzhiyun * Use any combination 'DPNI_TX_FLOW_OPT_<X>' flags 1512*4882a593Smuzhiyun * @use_common_tx_conf_queue: Set to '1' to use the common (default) Tx 1513*4882a593Smuzhiyun * confirmation and error queue; Set to '0' to use the private 1514*4882a593Smuzhiyun * Tx confirmation and error queue; valid only if 1515*4882a593Smuzhiyun * 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' wasn't set at DPNI creation 1516*4882a593Smuzhiyun * and 'DPNI_TX_FLOW_OPT_TX_CONF_ERROR' is contained in 'options' 1517*4882a593Smuzhiyun * @l3_chksum_gen: Set to '1' to enable L3 checksum generation; '0' to disable; 1518*4882a593Smuzhiyun * valid only if 'DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN' is contained in 'options' 1519*4882a593Smuzhiyun * @l4_chksum_gen: Set to '1' to enable L4 checksum generation; '0' to disable; 1520*4882a593Smuzhiyun * valid only if 'DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN' is contained in 'options' 1521*4882a593Smuzhiyun */ 1522*4882a593Smuzhiyun struct dpni_tx_flow_cfg { 1523*4882a593Smuzhiyun uint32_t options; 1524*4882a593Smuzhiyun int use_common_tx_conf_queue; 1525*4882a593Smuzhiyun int l3_chksum_gen; 1526*4882a593Smuzhiyun int l4_chksum_gen; 1527*4882a593Smuzhiyun }; 1528*4882a593Smuzhiyun 1529*4882a593Smuzhiyun /** 1530*4882a593Smuzhiyun * dpni_set_tx_flow() - Set Tx flow configuration 1531*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1532*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1533*4882a593Smuzhiyun * @token: Token of DPNI object 1534*4882a593Smuzhiyun * @flow_id: Provides (or returns) the sender's flow ID; 1535*4882a593Smuzhiyun * for each new sender set (*flow_id) to 'DPNI_NEW_FLOW_ID' to generate 1536*4882a593Smuzhiyun * a new flow_id; this ID should be used as the QDBIN argument 1537*4882a593Smuzhiyun * in enqueue operations 1538*4882a593Smuzhiyun * @cfg: Tx flow configuration 1539*4882a593Smuzhiyun * 1540*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1541*4882a593Smuzhiyun */ 1542*4882a593Smuzhiyun int dpni_set_tx_flow(struct fsl_mc_io *mc_io, 1543*4882a593Smuzhiyun uint32_t cmd_flags, 1544*4882a593Smuzhiyun uint16_t token, 1545*4882a593Smuzhiyun uint16_t *flow_id, 1546*4882a593Smuzhiyun const struct dpni_tx_flow_cfg *cfg); 1547*4882a593Smuzhiyun 1548*4882a593Smuzhiyun /** 1549*4882a593Smuzhiyun * struct dpni_tx_flow_attr - Structure representing Tx flow attributes 1550*4882a593Smuzhiyun * @use_common_tx_conf_queue: '1' if using common (default) Tx confirmation and 1551*4882a593Smuzhiyun * error queue; '0' if using private Tx confirmation and error queue 1552*4882a593Smuzhiyun * @l3_chksum_gen: '1' if L3 checksum generation is enabled; '0' if disabled 1553*4882a593Smuzhiyun * @l4_chksum_gen: '1' if L4 checksum generation is enabled; '0' if disabled 1554*4882a593Smuzhiyun */ 1555*4882a593Smuzhiyun struct dpni_tx_flow_attr { 1556*4882a593Smuzhiyun int use_common_tx_conf_queue; 1557*4882a593Smuzhiyun int l3_chksum_gen; 1558*4882a593Smuzhiyun int l4_chksum_gen; 1559*4882a593Smuzhiyun }; 1560*4882a593Smuzhiyun 1561*4882a593Smuzhiyun /** 1562*4882a593Smuzhiyun * dpni_get_tx_flow() - Get Tx flow attributes 1563*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1564*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1565*4882a593Smuzhiyun * @token: Token of DPNI object 1566*4882a593Smuzhiyun * @flow_id: The sender's flow ID, as returned by the 1567*4882a593Smuzhiyun * dpni_set_tx_flow() function 1568*4882a593Smuzhiyun * @attr: Returned Tx flow attributes 1569*4882a593Smuzhiyun * 1570*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1571*4882a593Smuzhiyun */ 1572*4882a593Smuzhiyun int dpni_get_tx_flow(struct fsl_mc_io *mc_io, 1573*4882a593Smuzhiyun uint32_t cmd_flags, 1574*4882a593Smuzhiyun uint16_t token, 1575*4882a593Smuzhiyun uint16_t flow_id, 1576*4882a593Smuzhiyun struct dpni_tx_flow_attr *attr); 1577*4882a593Smuzhiyun 1578*4882a593Smuzhiyun /** 1579*4882a593Smuzhiyun * struct dpni_tx_conf_cfg - Structure representing Tx conf configuration 1580*4882a593Smuzhiyun * @errors_only: Set to '1' to report back only error frames; 1581*4882a593Smuzhiyun * Set to '0' to confirm transmission/error for all transmitted frames; 1582*4882a593Smuzhiyun * @queue_cfg: Queue configuration 1583*4882a593Smuzhiyun */ 1584*4882a593Smuzhiyun struct dpni_tx_conf_cfg { 1585*4882a593Smuzhiyun int errors_only; 1586*4882a593Smuzhiyun struct dpni_queue_cfg queue_cfg; 1587*4882a593Smuzhiyun }; 1588*4882a593Smuzhiyun 1589*4882a593Smuzhiyun /** 1590*4882a593Smuzhiyun * dpni_set_tx_conf() - Set Tx confirmation and error queue configuration 1591*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1592*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1593*4882a593Smuzhiyun * @token: Token of DPNI object 1594*4882a593Smuzhiyun * @flow_id: The sender's flow ID, as returned by the 1595*4882a593Smuzhiyun * dpni_set_tx_flow() function; 1596*4882a593Smuzhiyun * use 'DPNI_COMMON_TX_CONF' for common tx-conf 1597*4882a593Smuzhiyun * @cfg: Queue configuration 1598*4882a593Smuzhiyun * 1599*4882a593Smuzhiyun * If either 'DPNI_OPT_TX_CONF_DISABLED' or 1600*4882a593Smuzhiyun * 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' were selected at DPNI creation, 1601*4882a593Smuzhiyun * this function can ONLY be used with 'flow_id == DPNI_COMMON_TX_CONF'; 1602*4882a593Smuzhiyun * i.e. only serve the common tx-conf-err queue; 1603*4882a593Smuzhiyun * if 'DPNI_OPT_TX_CONF_DISABLED' was selected, only error frames are reported 1604*4882a593Smuzhiyun * back - successfully transmitted frames are not confirmed. Otherwise, all 1605*4882a593Smuzhiyun * transmitted frames are sent for confirmation. 1606*4882a593Smuzhiyun * 1607*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1608*4882a593Smuzhiyun */ 1609*4882a593Smuzhiyun int dpni_set_tx_conf(struct fsl_mc_io *mc_io, 1610*4882a593Smuzhiyun uint32_t cmd_flags, 1611*4882a593Smuzhiyun uint16_t token, 1612*4882a593Smuzhiyun uint16_t flow_id, 1613*4882a593Smuzhiyun const struct dpni_tx_conf_cfg *cfg); 1614*4882a593Smuzhiyun 1615*4882a593Smuzhiyun /** 1616*4882a593Smuzhiyun * struct dpni_tx_conf_attr - Structure representing Tx conf attributes 1617*4882a593Smuzhiyun * @errors_only: '1' if only error frames are reported back; '0' if all 1618*4882a593Smuzhiyun * transmitted frames are confirmed 1619*4882a593Smuzhiyun * @queue_attr: Queue attributes 1620*4882a593Smuzhiyun */ 1621*4882a593Smuzhiyun struct dpni_tx_conf_attr { 1622*4882a593Smuzhiyun int errors_only; 1623*4882a593Smuzhiyun struct dpni_queue_attr queue_attr; 1624*4882a593Smuzhiyun }; 1625*4882a593Smuzhiyun 1626*4882a593Smuzhiyun /** 1627*4882a593Smuzhiyun * dpni_get_tx_conf() - Get Tx confirmation and error queue attributes 1628*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1629*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1630*4882a593Smuzhiyun * @token: Token of DPNI object 1631*4882a593Smuzhiyun * @flow_id: The sender's flow ID, as returned by the 1632*4882a593Smuzhiyun * dpni_set_tx_flow() function; 1633*4882a593Smuzhiyun * use 'DPNI_COMMON_TX_CONF' for common tx-conf 1634*4882a593Smuzhiyun * @attr: Returned tx-conf attributes 1635*4882a593Smuzhiyun * 1636*4882a593Smuzhiyun * If either 'DPNI_OPT_TX_CONF_DISABLED' or 1637*4882a593Smuzhiyun * 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' were selected at DPNI creation, 1638*4882a593Smuzhiyun * this function can ONLY be used with 'flow_id == DPNI_COMMON_TX_CONF'; 1639*4882a593Smuzhiyun * i.e. only serve the common tx-conf-err queue; 1640*4882a593Smuzhiyun * 1641*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1642*4882a593Smuzhiyun */ 1643*4882a593Smuzhiyun int dpni_get_tx_conf(struct fsl_mc_io *mc_io, 1644*4882a593Smuzhiyun uint32_t cmd_flags, 1645*4882a593Smuzhiyun uint16_t token, 1646*4882a593Smuzhiyun uint16_t flow_id, 1647*4882a593Smuzhiyun struct dpni_tx_conf_attr *attr); 1648*4882a593Smuzhiyun /** 1649*4882a593Smuzhiyun * dpni_set_rx_flow() - Set Rx flow configuration 1650*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1651*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1652*4882a593Smuzhiyun * @token: Token of DPNI object 1653*4882a593Smuzhiyun * @tc_id: Traffic class selection (0-7); 1654*4882a593Smuzhiyun * use 'DPNI_ALL_TCS' to set all TCs and all flows 1655*4882a593Smuzhiyun * @flow_id: Rx flow id within the traffic class; use 1656*4882a593Smuzhiyun * 'DPNI_ALL_TC_FLOWS' to set all flows within 1657*4882a593Smuzhiyun * this tc_id; ignored if tc_id is set to 1658*4882a593Smuzhiyun * 'DPNI_ALL_TCS'; 1659*4882a593Smuzhiyun * @cfg: Rx flow configuration 1660*4882a593Smuzhiyun * 1661*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1662*4882a593Smuzhiyun */ 1663*4882a593Smuzhiyun int dpni_set_rx_flow(struct fsl_mc_io *mc_io, 1664*4882a593Smuzhiyun uint32_t cmd_flags, 1665*4882a593Smuzhiyun uint16_t token, 1666*4882a593Smuzhiyun uint8_t tc_id, 1667*4882a593Smuzhiyun uint16_t flow_id, 1668*4882a593Smuzhiyun const struct dpni_queue_cfg *cfg); 1669*4882a593Smuzhiyun 1670*4882a593Smuzhiyun /** 1671*4882a593Smuzhiyun * dpni_get_rx_flow() - Get Rx flow attributes 1672*4882a593Smuzhiyun * @mc_io: Pointer to MC portal's I/O object 1673*4882a593Smuzhiyun * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 1674*4882a593Smuzhiyun * @token: Token of DPNI object 1675*4882a593Smuzhiyun * @tc_id: Traffic class selection (0-7) 1676*4882a593Smuzhiyun * @flow_id: Rx flow id within the traffic class 1677*4882a593Smuzhiyun * @attr: Returned Rx flow attributes 1678*4882a593Smuzhiyun * 1679*4882a593Smuzhiyun * Return: '0' on Success; Error code otherwise. 1680*4882a593Smuzhiyun */ 1681*4882a593Smuzhiyun int dpni_get_rx_flow(struct fsl_mc_io *mc_io, 1682*4882a593Smuzhiyun uint32_t cmd_flags, 1683*4882a593Smuzhiyun uint16_t token, 1684*4882a593Smuzhiyun uint8_t tc_id, 1685*4882a593Smuzhiyun uint16_t flow_id, 1686*4882a593Smuzhiyun struct dpni_queue_attr *attr); 1687*4882a593Smuzhiyun 1688*4882a593Smuzhiyun #endif /* _FSL_DPNI_H */ 1689