1 /* 2 * Copyright 2014-2017 Cavium, Inc. 3 * The contents of this file are subject to the terms of the Common Development 4 * and Distribution License, v.1, (the "License"). 5 * 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the License at available 9 * at http://opensource.org/licenses/CDDL-1.0 10 * 11 * See the License for the specific language governing permissions and 12 * limitations under the License. 13 */ 14 15 #ifndef _RXP_HSI_H 16 #define _RXP_HSI_H 17 18 #define RSS_TABLE_MAX 128 19 20 // Offset of xxx_hsi in 32 bit words from beginning of scratchpad 21 #define RXP_HSI_OFFSET 0x4 22 23 typedef struct _rxp_hsi_t { 24 fw_version_t version; 25 u32_t rxp_knum; 26 u32_t rxp_flood; 27 u32_t ric; 28 u32_t l2_forward_to_mcp; 29 u32_t tcp_syn_dos_defense; 30 u32_t rss_enable; 31 u32_t rss_table_size; 32 u8_t rss_table[RSS_TABLE_MAX]; 33 u32_t rxp_os_flag; 34 u32_t discard_all; 35 u32_t rxp_num_discard_all; 36 u32_t rtca; 37 u32_t rtcc; 38 u32_t rxp_pm_ctrl; 39 #define L2_NORMAL_MODE 0 40 #define L2_EMC_RXQ_MODE_ENABLE 1 41 #define L2_EMC_RXQ_MODE_DISABLE 2 42 u32_t ooo_pkt_cnt; 43 u32_t l2_cu_cnt; 44 u32_t rxp_invalid_context_cnt; 45 u64_t rxp_unicast_bytes_rcvd; 46 u64_t rxp_multicast_bytes_rcvd; 47 u64_t rxp_broadcast_bytes_rcvd; 48 u64_t volatile idle_count; 49 u32_t hash_lookup[12][256]; 50 u32_t ulp_out_of_order_packets; // number of OOO packets that were received in L5 connections 51 u32_t cps_index; 52 u32_t cps_array[32]; 53 u32_t iscsi_rq_size; // number of RQ buffers. Note this is not size of page table 54 u32_t iscsi_rq_buf_size; // size of receive buffer in RQ 55 u32_t iscsi_err_bitmap[2]; // Error/Warning bitmap ("1" for warning) 56 u32_t iscsi_tcp_config; // Configuration register - Enable/Disable of DA/KA mechanisms 57 u32_t iscsi_teton_l4_cmd_offset; // Teton only: offset of L4 ccell command array 58 u32_t iscsi_teton_l5_offset; // Teton only: offset of L5 section 59 u32_t iscsi_teton_l5_cmd_offset; // Teton only: offset of L5 ccell command array 60 u32_t iscsi_task_offset; // offset of the task array 61 u32_t iscsi_r2tq_offset; // offset of R2TQ section 62 u32_t iscsi_max_num_of_tasks; // maximal number of pending tasks 63 u32_t iscsi_max_num_of_ccells; // maximal number of ccells 64 65 u64_t iscsi_rxp_unicast_bytes_rcvd; 66 u64_t iscsi_rxp_multicast_bytes_rcvd; 67 u64_t iscsi_rxp_broadcast_bytes_rcvd; 68 u32_t after_fin_pkt_cnt; // number of packets that came after FIN 69 u32_t extra_fin_pkt_cnt; // extra FIN packets that came after FIN 70 u32_t vmq_netq_cnt; // number of vmq or netq 71 u32_t hw_filter_ctx_offset; 72 u32_t iooo_rx_cid; 73 u32_t iooo_flags; 74 u32_t iooo_dbg_size; 75 u32_t iooo_dbg_ptr; 76 u32_t ooo_cu_pkt_cnt; 77 u32_t ooo_cu_pkt_drop_cnt; 78 u32_t ooo_max_blk_reach_cnt; 79 u32_t ooo_max_blk_pkt_drop_cnt; 80 u32_t cu_rate_limiter_enable; 81 u32_t ooo_max_blk_per_conn; 82 u64_t rxp_total_bytes_rcvd; 83 } rxp_hsi_t; 84 85 // This macro can be used for little or big endian 32-bit system 86 #define RXP_HSI_OFFSETOFF(m) (OFFSETOF(rxp_hsi_t,m) + 0x10) 87 #define RXP_HSI_SIZEOF(m) (sizeof (((rxp_hsi_t *)0)->m)) 88 89 // Calling the following macro will actually get optimized during compile 90 // time. Its sole purpose is to ensure HSI variables cannot be modified/moved 91 // unnoticed scratch[10240] 0xe0000 (RW/Reset: undefined) 92 #define TEST_RXP_HSI(){ \ 93 if (0){ \ 94 1/(RXP_HSI_OFFSETOFF(version) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x000) && \ 95 RXP_HSI_OFFSETOFF(rxp_knum) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x010) && \ 96 RXP_HSI_OFFSETOFF(rxp_flood) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x014) && \ 97 RXP_HSI_OFFSETOFF(ric) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x018) && \ 98 RXP_HSI_OFFSETOFF(l2_forward_to_mcp) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x01c) && \ 99 RXP_HSI_OFFSETOFF(tcp_syn_dos_defense) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x020) && \ 100 RXP_HSI_OFFSETOFF(rss_enable) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x024) && \ 101 RXP_HSI_OFFSETOFF(rss_table_size) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x028) && \ 102 RXP_HSI_OFFSETOFF(rss_table) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x02c) && \ 103 RXP_HSI_OFFSETOFF(rxp_os_flag) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0ac) && \ 104 RXP_HSI_OFFSETOFF(discard_all) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0b0) && \ 105 RXP_HSI_OFFSETOFF(rxp_num_discard_all) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0b4) && \ 106 RXP_HSI_OFFSETOFF(rtca) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0b8) && \ 107 RXP_HSI_OFFSETOFF(rtcc) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0bc) && \ 108 RXP_HSI_OFFSETOFF(rxp_pm_ctrl) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0c0) && \ 109 RXP_HSI_OFFSETOFF(ooo_pkt_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0c4) && \ 110 RXP_HSI_OFFSETOFF(l2_cu_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0c8) && \ 111 RXP_HSI_OFFSETOFF(rxp_invalid_context_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0cc) && \ 112 RXP_HSI_OFFSETOFF(rxp_unicast_bytes_rcvd) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0d0) && \ 113 RXP_HSI_OFFSETOFF(rxp_multicast_bytes_rcvd) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0d8) && \ 114 RXP_HSI_OFFSETOFF(rxp_broadcast_bytes_rcvd) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0e0) && \ 115 RXP_HSI_OFFSETOFF(idle_count) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0e8) && \ 116 RXP_HSI_OFFSETOFF(hash_lookup) == (RXP_HSI_OFFSET * sizeof(u32_t) + 0x0f0) && \ 117 RXP_HSI_OFFSETOFF(ulp_out_of_order_packets) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x30f0) && \ 118 RXP_HSI_OFFSETOFF(cps_index) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x30f4) && \ 119 RXP_HSI_OFFSETOFF(cps_array) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x30f8) && \ 120 RXP_HSI_OFFSETOFF(iscsi_rq_size) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3178) && \ 121 RXP_HSI_OFFSETOFF(iscsi_rq_buf_size) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x317c) && \ 122 RXP_HSI_OFFSETOFF(iscsi_err_bitmap[0]) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3180) && \ 123 RXP_HSI_OFFSETOFF(iscsi_err_bitmap[1]) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3184) && \ 124 RXP_HSI_OFFSETOFF(iscsi_tcp_config) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3188) && \ 125 RXP_HSI_OFFSETOFF(iscsi_teton_l4_cmd_offset) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x318c) && \ 126 RXP_HSI_OFFSETOFF(iscsi_teton_l5_offset) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3190) && \ 127 RXP_HSI_OFFSETOFF(iscsi_teton_l5_cmd_offset) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3194) && \ 128 RXP_HSI_OFFSETOFF(iscsi_task_offset) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x3198) && \ 129 RXP_HSI_OFFSETOFF(iscsi_r2tq_offset) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x319c) && \ 130 RXP_HSI_OFFSETOFF(iscsi_max_num_of_tasks) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31a0) && \ 131 RXP_HSI_OFFSETOFF(iscsi_max_num_of_ccells) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31a4) && \ 132 RXP_HSI_OFFSETOFF(iscsi_rxp_unicast_bytes_rcvd) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31a8) && \ 133 RXP_HSI_OFFSETOFF(iscsi_rxp_multicast_bytes_rcvd)== (RXP_HSI_OFFSET * sizeof(u32_t) +0x31b0) && \ 134 RXP_HSI_OFFSETOFF(iscsi_rxp_broadcast_bytes_rcvd)== (RXP_HSI_OFFSET * sizeof(u32_t) +0x31b8) && \ 135 RXP_HSI_OFFSETOFF(after_fin_pkt_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31c0) && \ 136 RXP_HSI_OFFSETOFF(extra_fin_pkt_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31c4) && \ 137 RXP_HSI_OFFSETOFF(vmq_netq_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31c8) && \ 138 RXP_HSI_OFFSETOFF(hw_filter_ctx_offset) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31cc) && \ 139 RXP_HSI_OFFSETOFF(iooo_rx_cid) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31d0) && \ 140 RXP_HSI_OFFSETOFF(iooo_flags) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31d4) && \ 141 RXP_HSI_OFFSETOFF(iooo_dbg_size) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31d8) && \ 142 RXP_HSI_OFFSETOFF(iooo_dbg_ptr) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31dc) && \ 143 RXP_HSI_OFFSETOFF(ooo_cu_pkt_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31e0) && \ 144 RXP_HSI_OFFSETOFF(ooo_cu_pkt_drop_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31e4) && \ 145 RXP_HSI_OFFSETOFF(ooo_max_blk_reach_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31e8) && \ 146 RXP_HSI_OFFSETOFF(ooo_max_blk_pkt_drop_cnt) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31ec) && \ 147 RXP_HSI_OFFSETOFF(cu_rate_limiter_enable) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31f0) && \ 148 RXP_HSI_OFFSETOFF(ooo_max_blk_per_conn) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31f4) && \ 149 RXP_HSI_OFFSETOFF(rxp_total_bytes_rcvd) == (RXP_HSI_OFFSET * sizeof(u32_t) +0x31f8) && \ 150 RXP_HSI_OFFSETOFF(rxp_total_bytes_rcvd)+RXP_HSI_SIZEOF(rxp_total_bytes_rcvd) == (RXP_HSI_OFFSET * sizeof(u32_t) + sizeof(rxp_hsi_t)));}} 151 #endif 152 153