Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1 | /* Broadcom NetXtreme-C/E network driver. |
| 2 | * |
Michael Chan | 11f15ed | 2016-04-05 14:08:55 -0400 | [diff] [blame] | 3 | * Copyright (c) 2014-2016 Broadcom Corporation |
Michael Chan | 894aa69 | 2018-01-17 03:21:03 -0500 | [diff] [blame] | 4 | * Copyright (c) 2016-2018 Broadcom Limited |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #ifndef BNXT_H |
| 12 | #define BNXT_H |
| 13 | |
| 14 | #define DRV_MODULE_NAME "bnxt_en" |
Michael Chan | 31d357c | 2018-10-14 07:02:37 -0400 | [diff] [blame] | 15 | #define DRV_MODULE_VERSION "1.10.0" |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 16 | |
Michael Chan | c193554 | 2015-12-27 18:19:28 -0500 | [diff] [blame] | 17 | #define DRV_VER_MAJ 1 |
Michael Chan | 31d357c | 2018-10-14 07:02:37 -0400 | [diff] [blame] | 18 | #define DRV_VER_MIN 10 |
| 19 | #define DRV_VER_UPD 0 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 20 | |
Florian Westphal | 282ccf6 | 2017-03-29 17:17:31 +0200 | [diff] [blame] | 21 | #include <linux/interrupt.h> |
Sathya Perla | 2ae7408 | 2017-08-28 13:40:33 -0400 | [diff] [blame] | 22 | #include <linux/rhashtable.h> |
Michael Chan | d629522 | 2019-05-22 19:12:56 -0400 | [diff] [blame] | 23 | #include <linux/crash_dump.h> |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 24 | #include <net/devlink.h> |
Sathya Perla | ee5c7fb | 2017-07-24 12:34:28 -0400 | [diff] [blame] | 25 | #include <net/dst_metadata.h> |
Jesper Dangaard Brouer | 96a8604 | 2018-01-03 11:25:44 +0100 | [diff] [blame] | 26 | #include <net/xdp.h> |
Tal Gilboa | 4f75da3 | 2019-01-10 17:33:17 +0200 | [diff] [blame] | 27 | #include <linux/dim.h> |
Florian Westphal | 282ccf6 | 2017-03-29 17:17:31 +0200 | [diff] [blame] | 28 | |
Andy Gospodarek | 322b87c | 2019-07-08 17:53:04 -0400 | [diff] [blame] | 29 | struct page_pool; |
| 30 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 31 | struct tx_bd { |
| 32 | __le32 tx_bd_len_flags_type; |
| 33 | #define TX_BD_TYPE (0x3f << 0) |
| 34 | #define TX_BD_TYPE_SHORT_TX_BD (0x00 << 0) |
| 35 | #define TX_BD_TYPE_LONG_TX_BD (0x10 << 0) |
| 36 | #define TX_BD_FLAGS_PACKET_END (1 << 6) |
| 37 | #define TX_BD_FLAGS_NO_CMPL (1 << 7) |
| 38 | #define TX_BD_FLAGS_BD_CNT (0x1f << 8) |
| 39 | #define TX_BD_FLAGS_BD_CNT_SHIFT 8 |
| 40 | #define TX_BD_FLAGS_LHINT (3 << 13) |
| 41 | #define TX_BD_FLAGS_LHINT_SHIFT 13 |
| 42 | #define TX_BD_FLAGS_LHINT_512_AND_SMALLER (0 << 13) |
| 43 | #define TX_BD_FLAGS_LHINT_512_TO_1023 (1 << 13) |
| 44 | #define TX_BD_FLAGS_LHINT_1024_TO_2047 (2 << 13) |
| 45 | #define TX_BD_FLAGS_LHINT_2048_AND_LARGER (3 << 13) |
| 46 | #define TX_BD_FLAGS_COAL_NOW (1 << 15) |
| 47 | #define TX_BD_LEN (0xffff << 16) |
| 48 | #define TX_BD_LEN_SHIFT 16 |
| 49 | |
| 50 | u32 tx_bd_opaque; |
| 51 | __le64 tx_bd_haddr; |
| 52 | } __packed; |
| 53 | |
| 54 | struct tx_bd_ext { |
| 55 | __le32 tx_bd_hsize_lflags; |
| 56 | #define TX_BD_FLAGS_TCP_UDP_CHKSUM (1 << 0) |
| 57 | #define TX_BD_FLAGS_IP_CKSUM (1 << 1) |
| 58 | #define TX_BD_FLAGS_NO_CRC (1 << 2) |
| 59 | #define TX_BD_FLAGS_STAMP (1 << 3) |
| 60 | #define TX_BD_FLAGS_T_IP_CHKSUM (1 << 4) |
| 61 | #define TX_BD_FLAGS_LSO (1 << 5) |
| 62 | #define TX_BD_FLAGS_IPID_FMT (1 << 6) |
| 63 | #define TX_BD_FLAGS_T_IPID (1 << 7) |
| 64 | #define TX_BD_HSIZE (0xff << 16) |
| 65 | #define TX_BD_HSIZE_SHIFT 16 |
| 66 | |
| 67 | __le32 tx_bd_mss; |
| 68 | __le32 tx_bd_cfa_action; |
| 69 | #define TX_BD_CFA_ACTION (0xffff << 16) |
| 70 | #define TX_BD_CFA_ACTION_SHIFT 16 |
| 71 | |
| 72 | __le32 tx_bd_cfa_meta; |
| 73 | #define TX_BD_CFA_META_MASK 0xfffffff |
| 74 | #define TX_BD_CFA_META_VID_MASK 0xfff |
| 75 | #define TX_BD_CFA_META_PRI_MASK (0xf << 12) |
| 76 | #define TX_BD_CFA_META_PRI_SHIFT 12 |
| 77 | #define TX_BD_CFA_META_TPID_MASK (3 << 16) |
| 78 | #define TX_BD_CFA_META_TPID_SHIFT 16 |
| 79 | #define TX_BD_CFA_META_KEY (0xf << 28) |
| 80 | #define TX_BD_CFA_META_KEY_SHIFT 28 |
| 81 | #define TX_BD_CFA_META_KEY_VLAN (1 << 28) |
| 82 | }; |
| 83 | |
| 84 | struct rx_bd { |
| 85 | __le32 rx_bd_len_flags_type; |
| 86 | #define RX_BD_TYPE (0x3f << 0) |
| 87 | #define RX_BD_TYPE_RX_PACKET_BD 0x4 |
| 88 | #define RX_BD_TYPE_RX_BUFFER_BD 0x5 |
| 89 | #define RX_BD_TYPE_RX_AGG_BD 0x6 |
| 90 | #define RX_BD_TYPE_16B_BD_SIZE (0 << 4) |
| 91 | #define RX_BD_TYPE_32B_BD_SIZE (1 << 4) |
| 92 | #define RX_BD_TYPE_48B_BD_SIZE (2 << 4) |
| 93 | #define RX_BD_TYPE_64B_BD_SIZE (3 << 4) |
| 94 | #define RX_BD_FLAGS_SOP (1 << 6) |
| 95 | #define RX_BD_FLAGS_EOP (1 << 7) |
| 96 | #define RX_BD_FLAGS_BUFFERS (3 << 8) |
| 97 | #define RX_BD_FLAGS_1_BUFFER_PACKET (0 << 8) |
| 98 | #define RX_BD_FLAGS_2_BUFFER_PACKET (1 << 8) |
| 99 | #define RX_BD_FLAGS_3_BUFFER_PACKET (2 << 8) |
| 100 | #define RX_BD_FLAGS_4_BUFFER_PACKET (3 << 8) |
| 101 | #define RX_BD_LEN (0xffff << 16) |
| 102 | #define RX_BD_LEN_SHIFT 16 |
| 103 | |
| 104 | u32 rx_bd_opaque; |
| 105 | __le64 rx_bd_haddr; |
| 106 | }; |
| 107 | |
| 108 | struct tx_cmp { |
| 109 | __le32 tx_cmp_flags_type; |
| 110 | #define CMP_TYPE (0x3f << 0) |
| 111 | #define CMP_TYPE_TX_L2_CMP 0 |
| 112 | #define CMP_TYPE_RX_L2_CMP 17 |
| 113 | #define CMP_TYPE_RX_AGG_CMP 18 |
| 114 | #define CMP_TYPE_RX_L2_TPA_START_CMP 19 |
| 115 | #define CMP_TYPE_RX_L2_TPA_END_CMP 21 |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 116 | #define CMP_TYPE_RX_TPA_AGG_CMP 22 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 117 | #define CMP_TYPE_STATUS_CMP 32 |
| 118 | #define CMP_TYPE_REMOTE_DRIVER_REQ 34 |
| 119 | #define CMP_TYPE_REMOTE_DRIVER_RESP 36 |
| 120 | #define CMP_TYPE_ERROR_STATUS 48 |
Michael Chan | 441cabb | 2016-09-19 03:58:02 -0400 | [diff] [blame] | 121 | #define CMPL_BASE_TYPE_STAT_EJECT 0x1aUL |
| 122 | #define CMPL_BASE_TYPE_HWRM_DONE 0x20UL |
| 123 | #define CMPL_BASE_TYPE_HWRM_FWD_REQ 0x22UL |
| 124 | #define CMPL_BASE_TYPE_HWRM_FWD_RESP 0x24UL |
| 125 | #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT 0x2eUL |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 126 | |
| 127 | #define TX_CMP_FLAGS_ERROR (1 << 6) |
| 128 | #define TX_CMP_FLAGS_PUSH (1 << 7) |
| 129 | |
| 130 | u32 tx_cmp_opaque; |
| 131 | __le32 tx_cmp_errors_v; |
| 132 | #define TX_CMP_V (1 << 0) |
| 133 | #define TX_CMP_ERRORS_BUFFER_ERROR (7 << 1) |
| 134 | #define TX_CMP_ERRORS_BUFFER_ERROR_NO_ERROR 0 |
| 135 | #define TX_CMP_ERRORS_BUFFER_ERROR_BAD_FORMAT 2 |
| 136 | #define TX_CMP_ERRORS_BUFFER_ERROR_INVALID_STAG 4 |
| 137 | #define TX_CMP_ERRORS_BUFFER_ERROR_STAG_BOUNDS 5 |
| 138 | #define TX_CMP_ERRORS_ZERO_LENGTH_PKT (1 << 4) |
| 139 | #define TX_CMP_ERRORS_EXCESSIVE_BD_LEN (1 << 5) |
| 140 | #define TX_CMP_ERRORS_DMA_ERROR (1 << 6) |
| 141 | #define TX_CMP_ERRORS_HINT_TOO_SHORT (1 << 7) |
| 142 | |
| 143 | __le32 tx_cmp_unsed_3; |
| 144 | }; |
| 145 | |
| 146 | struct rx_cmp { |
| 147 | __le32 rx_cmp_len_flags_type; |
| 148 | #define RX_CMP_CMP_TYPE (0x3f << 0) |
| 149 | #define RX_CMP_FLAGS_ERROR (1 << 6) |
| 150 | #define RX_CMP_FLAGS_PLACEMENT (7 << 7) |
| 151 | #define RX_CMP_FLAGS_RSS_VALID (1 << 10) |
| 152 | #define RX_CMP_FLAGS_UNUSED (1 << 11) |
| 153 | #define RX_CMP_FLAGS_ITYPES_SHIFT 12 |
| 154 | #define RX_CMP_FLAGS_ITYPE_UNKNOWN (0 << 12) |
| 155 | #define RX_CMP_FLAGS_ITYPE_IP (1 << 12) |
| 156 | #define RX_CMP_FLAGS_ITYPE_TCP (2 << 12) |
| 157 | #define RX_CMP_FLAGS_ITYPE_UDP (3 << 12) |
| 158 | #define RX_CMP_FLAGS_ITYPE_FCOE (4 << 12) |
| 159 | #define RX_CMP_FLAGS_ITYPE_ROCE (5 << 12) |
| 160 | #define RX_CMP_FLAGS_ITYPE_PTP_WO_TS (8 << 12) |
| 161 | #define RX_CMP_FLAGS_ITYPE_PTP_W_TS (9 << 12) |
| 162 | #define RX_CMP_LEN (0xffff << 16) |
| 163 | #define RX_CMP_LEN_SHIFT 16 |
| 164 | |
| 165 | u32 rx_cmp_opaque; |
| 166 | __le32 rx_cmp_misc_v1; |
| 167 | #define RX_CMP_V1 (1 << 0) |
| 168 | #define RX_CMP_AGG_BUFS (0x1f << 1) |
| 169 | #define RX_CMP_AGG_BUFS_SHIFT 1 |
| 170 | #define RX_CMP_RSS_HASH_TYPE (0x7f << 9) |
| 171 | #define RX_CMP_RSS_HASH_TYPE_SHIFT 9 |
| 172 | #define RX_CMP_PAYLOAD_OFFSET (0xff << 16) |
| 173 | #define RX_CMP_PAYLOAD_OFFSET_SHIFT 16 |
| 174 | |
| 175 | __le32 rx_cmp_rss_hash; |
| 176 | }; |
| 177 | |
| 178 | #define RX_CMP_HASH_VALID(rxcmp) \ |
| 179 | ((rxcmp)->rx_cmp_len_flags_type & cpu_to_le32(RX_CMP_FLAGS_RSS_VALID)) |
| 180 | |
Michael Chan | 614388c | 2015-11-05 16:25:48 -0500 | [diff] [blame] | 181 | #define RSS_PROFILE_ID_MASK 0x1f |
| 182 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 183 | #define RX_CMP_HASH_TYPE(rxcmp) \ |
Michael Chan | 614388c | 2015-11-05 16:25:48 -0500 | [diff] [blame] | 184 | (((le32_to_cpu((rxcmp)->rx_cmp_misc_v1) & RX_CMP_RSS_HASH_TYPE) >>\ |
| 185 | RX_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 186 | |
| 187 | struct rx_cmp_ext { |
| 188 | __le32 rx_cmp_flags2; |
| 189 | #define RX_CMP_FLAGS2_IP_CS_CALC 0x1 |
| 190 | #define RX_CMP_FLAGS2_L4_CS_CALC (0x1 << 1) |
| 191 | #define RX_CMP_FLAGS2_T_IP_CS_CALC (0x1 << 2) |
| 192 | #define RX_CMP_FLAGS2_T_L4_CS_CALC (0x1 << 3) |
| 193 | #define RX_CMP_FLAGS2_META_FORMAT_VLAN (0x1 << 4) |
| 194 | __le32 rx_cmp_meta_data; |
Michael Chan | ed7bc602 | 2018-03-09 23:46:06 -0500 | [diff] [blame] | 195 | #define RX_CMP_FLAGS2_METADATA_TCI_MASK 0xffff |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 196 | #define RX_CMP_FLAGS2_METADATA_VID_MASK 0xfff |
| 197 | #define RX_CMP_FLAGS2_METADATA_TPID_MASK 0xffff0000 |
| 198 | #define RX_CMP_FLAGS2_METADATA_TPID_SFT 16 |
| 199 | __le32 rx_cmp_cfa_code_errors_v2; |
| 200 | #define RX_CMP_V (1 << 0) |
| 201 | #define RX_CMPL_ERRORS_MASK (0x7fff << 1) |
| 202 | #define RX_CMPL_ERRORS_SFT 1 |
| 203 | #define RX_CMPL_ERRORS_BUFFER_ERROR_MASK (0x7 << 1) |
| 204 | #define RX_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER (0x0 << 1) |
| 205 | #define RX_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT (0x1 << 1) |
| 206 | #define RX_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP (0x2 << 1) |
| 207 | #define RX_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT (0x3 << 1) |
| 208 | #define RX_CMPL_ERRORS_IP_CS_ERROR (0x1 << 4) |
| 209 | #define RX_CMPL_ERRORS_L4_CS_ERROR (0x1 << 5) |
| 210 | #define RX_CMPL_ERRORS_T_IP_CS_ERROR (0x1 << 6) |
| 211 | #define RX_CMPL_ERRORS_T_L4_CS_ERROR (0x1 << 7) |
| 212 | #define RX_CMPL_ERRORS_CRC_ERROR (0x1 << 8) |
| 213 | #define RX_CMPL_ERRORS_T_PKT_ERROR_MASK (0x7 << 9) |
| 214 | #define RX_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (0x0 << 9) |
| 215 | #define RX_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION (0x1 << 9) |
| 216 | #define RX_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN (0x2 << 9) |
| 217 | #define RX_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR (0x3 << 9) |
| 218 | #define RX_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR (0x4 << 9) |
| 219 | #define RX_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR (0x5 << 9) |
| 220 | #define RX_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL (0x6 << 9) |
| 221 | #define RX_CMPL_ERRORS_PKT_ERROR_MASK (0xf << 12) |
| 222 | #define RX_CMPL_ERRORS_PKT_ERROR_NO_ERROR (0x0 << 12) |
| 223 | #define RX_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION (0x1 << 12) |
| 224 | #define RX_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN (0x2 << 12) |
| 225 | #define RX_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (0x3 << 12) |
| 226 | #define RX_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR (0x4 << 12) |
| 227 | #define RX_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR (0x5 << 12) |
| 228 | #define RX_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN (0x6 << 12) |
| 229 | #define RX_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL (0x7 << 12) |
| 230 | #define RX_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN (0x8 << 12) |
| 231 | |
| 232 | #define RX_CMPL_CFA_CODE_MASK (0xffff << 16) |
| 233 | #define RX_CMPL_CFA_CODE_SFT 16 |
| 234 | |
| 235 | __le32 rx_cmp_unused3; |
| 236 | }; |
| 237 | |
| 238 | #define RX_CMP_L2_ERRORS \ |
| 239 | cpu_to_le32(RX_CMPL_ERRORS_BUFFER_ERROR_MASK | RX_CMPL_ERRORS_CRC_ERROR) |
| 240 | |
| 241 | #define RX_CMP_L4_CS_BITS \ |
| 242 | (cpu_to_le32(RX_CMP_FLAGS2_L4_CS_CALC | RX_CMP_FLAGS2_T_L4_CS_CALC)) |
| 243 | |
| 244 | #define RX_CMP_L4_CS_ERR_BITS \ |
| 245 | (cpu_to_le32(RX_CMPL_ERRORS_L4_CS_ERROR | RX_CMPL_ERRORS_T_L4_CS_ERROR)) |
| 246 | |
| 247 | #define RX_CMP_L4_CS_OK(rxcmp1) \ |
| 248 | (((rxcmp1)->rx_cmp_flags2 & RX_CMP_L4_CS_BITS) && \ |
| 249 | !((rxcmp1)->rx_cmp_cfa_code_errors_v2 & RX_CMP_L4_CS_ERR_BITS)) |
| 250 | |
| 251 | #define RX_CMP_ENCAP(rxcmp1) \ |
| 252 | ((le32_to_cpu((rxcmp1)->rx_cmp_flags2) & \ |
| 253 | RX_CMP_FLAGS2_T_L4_CS_CALC) >> 3) |
| 254 | |
Sathya Perla | ee5c7fb | 2017-07-24 12:34:28 -0400 | [diff] [blame] | 255 | #define RX_CMP_CFA_CODE(rxcmpl1) \ |
| 256 | ((le32_to_cpu((rxcmpl1)->rx_cmp_cfa_code_errors_v2) & \ |
| 257 | RX_CMPL_CFA_CODE_MASK) >> RX_CMPL_CFA_CODE_SFT) |
| 258 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 259 | struct rx_agg_cmp { |
| 260 | __le32 rx_agg_cmp_len_flags_type; |
| 261 | #define RX_AGG_CMP_TYPE (0x3f << 0) |
| 262 | #define RX_AGG_CMP_LEN (0xffff << 16) |
| 263 | #define RX_AGG_CMP_LEN_SHIFT 16 |
| 264 | u32 rx_agg_cmp_opaque; |
| 265 | __le32 rx_agg_cmp_v; |
| 266 | #define RX_AGG_CMP_V (1 << 0) |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 267 | #define RX_AGG_CMP_AGG_ID (0xffff << 16) |
| 268 | #define RX_AGG_CMP_AGG_ID_SHIFT 16 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 269 | __le32 rx_agg_cmp_unused; |
| 270 | }; |
| 271 | |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 272 | #define TPA_AGG_AGG_ID(rx_agg) \ |
| 273 | ((le32_to_cpu((rx_agg)->rx_agg_cmp_v) & \ |
| 274 | RX_AGG_CMP_AGG_ID) >> RX_AGG_CMP_AGG_ID_SHIFT) |
| 275 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 276 | struct rx_tpa_start_cmp { |
| 277 | __le32 rx_tpa_start_cmp_len_flags_type; |
| 278 | #define RX_TPA_START_CMP_TYPE (0x3f << 0) |
| 279 | #define RX_TPA_START_CMP_FLAGS (0x3ff << 6) |
| 280 | #define RX_TPA_START_CMP_FLAGS_SHIFT 6 |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 281 | #define RX_TPA_START_CMP_FLAGS_ERROR (0x1 << 6) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 282 | #define RX_TPA_START_CMP_FLAGS_PLACEMENT (0x7 << 7) |
| 283 | #define RX_TPA_START_CMP_FLAGS_PLACEMENT_SHIFT 7 |
| 284 | #define RX_TPA_START_CMP_FLAGS_PLACEMENT_JUMBO (0x1 << 7) |
| 285 | #define RX_TPA_START_CMP_FLAGS_PLACEMENT_HDS (0x2 << 7) |
| 286 | #define RX_TPA_START_CMP_FLAGS_PLACEMENT_GRO_JUMBO (0x5 << 7) |
| 287 | #define RX_TPA_START_CMP_FLAGS_PLACEMENT_GRO_HDS (0x6 << 7) |
| 288 | #define RX_TPA_START_CMP_FLAGS_RSS_VALID (0x1 << 10) |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 289 | #define RX_TPA_START_CMP_FLAGS_TIMESTAMP (0x1 << 11) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 290 | #define RX_TPA_START_CMP_FLAGS_ITYPES (0xf << 12) |
| 291 | #define RX_TPA_START_CMP_FLAGS_ITYPES_SHIFT 12 |
| 292 | #define RX_TPA_START_CMP_FLAGS_ITYPE_TCP (0x2 << 12) |
| 293 | #define RX_TPA_START_CMP_LEN (0xffff << 16) |
| 294 | #define RX_TPA_START_CMP_LEN_SHIFT 16 |
| 295 | |
| 296 | u32 rx_tpa_start_cmp_opaque; |
| 297 | __le32 rx_tpa_start_cmp_misc_v1; |
| 298 | #define RX_TPA_START_CMP_V1 (0x1 << 0) |
| 299 | #define RX_TPA_START_CMP_RSS_HASH_TYPE (0x7f << 9) |
| 300 | #define RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT 9 |
| 301 | #define RX_TPA_START_CMP_AGG_ID (0x7f << 25) |
| 302 | #define RX_TPA_START_CMP_AGG_ID_SHIFT 25 |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 303 | #define RX_TPA_START_CMP_AGG_ID_P5 (0xffff << 16) |
| 304 | #define RX_TPA_START_CMP_AGG_ID_SHIFT_P5 16 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 305 | |
| 306 | __le32 rx_tpa_start_cmp_rss_hash; |
| 307 | }; |
| 308 | |
| 309 | #define TPA_START_HASH_VALID(rx_tpa_start) \ |
| 310 | ((rx_tpa_start)->rx_tpa_start_cmp_len_flags_type & \ |
| 311 | cpu_to_le32(RX_TPA_START_CMP_FLAGS_RSS_VALID)) |
| 312 | |
| 313 | #define TPA_START_HASH_TYPE(rx_tpa_start) \ |
Michael Chan | 614388c | 2015-11-05 16:25:48 -0500 | [diff] [blame] | 314 | (((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \ |
| 315 | RX_TPA_START_CMP_RSS_HASH_TYPE) >> \ |
| 316 | RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 317 | |
| 318 | #define TPA_START_AGG_ID(rx_tpa_start) \ |
| 319 | ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \ |
| 320 | RX_TPA_START_CMP_AGG_ID) >> RX_TPA_START_CMP_AGG_ID_SHIFT) |
| 321 | |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 322 | #define TPA_START_AGG_ID_P5(rx_tpa_start) \ |
| 323 | ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \ |
| 324 | RX_TPA_START_CMP_AGG_ID_P5) >> RX_TPA_START_CMP_AGG_ID_SHIFT_P5) |
| 325 | |
| 326 | #define TPA_START_ERROR(rx_tpa_start) \ |
| 327 | ((rx_tpa_start)->rx_tpa_start_cmp_len_flags_type & \ |
| 328 | cpu_to_le32(RX_TPA_START_CMP_FLAGS_ERROR)) |
| 329 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 330 | struct rx_tpa_start_cmp_ext { |
| 331 | __le32 rx_tpa_start_cmp_flags2; |
| 332 | #define RX_TPA_START_CMP_FLAGS2_IP_CS_CALC (0x1 << 0) |
| 333 | #define RX_TPA_START_CMP_FLAGS2_L4_CS_CALC (0x1 << 1) |
| 334 | #define RX_TPA_START_CMP_FLAGS2_T_IP_CS_CALC (0x1 << 2) |
| 335 | #define RX_TPA_START_CMP_FLAGS2_T_L4_CS_CALC (0x1 << 3) |
Michael Chan | 94758f8 | 2016-06-13 02:25:35 -0400 | [diff] [blame] | 336 | #define RX_TPA_START_CMP_FLAGS2_IP_TYPE (0x1 << 8) |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 337 | #define RX_TPA_START_CMP_FLAGS2_CSUM_CMPL_VALID (0x1 << 9) |
| 338 | #define RX_TPA_START_CMP_FLAGS2_EXT_META_FORMAT (0x3 << 10) |
| 339 | #define RX_TPA_START_CMP_FLAGS2_EXT_META_FORMAT_SHIFT 10 |
| 340 | #define RX_TPA_START_CMP_FLAGS2_CSUM_CMPL (0xffff << 16) |
| 341 | #define RX_TPA_START_CMP_FLAGS2_CSUM_CMPL_SHIFT 16 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 342 | |
| 343 | __le32 rx_tpa_start_cmp_metadata; |
| 344 | __le32 rx_tpa_start_cmp_cfa_code_v2; |
| 345 | #define RX_TPA_START_CMP_V2 (0x1 << 0) |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 346 | #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_MASK (0x7 << 1) |
| 347 | #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_SHIFT 1 |
| 348 | #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_NO_BUFFER (0x0 << 1) |
| 349 | #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_BAD_FORMAT (0x3 << 1) |
| 350 | #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_FLUSH (0x5 << 1) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 351 | #define RX_TPA_START_CMP_CFA_CODE (0xffff << 16) |
| 352 | #define RX_TPA_START_CMPL_CFA_CODE_SHIFT 16 |
Michael Chan | 94758f8 | 2016-06-13 02:25:35 -0400 | [diff] [blame] | 353 | __le32 rx_tpa_start_cmp_hdr_info; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 354 | }; |
| 355 | |
Sathya Perla | ee5c7fb | 2017-07-24 12:34:28 -0400 | [diff] [blame] | 356 | #define TPA_START_CFA_CODE(rx_tpa_start) \ |
| 357 | ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_cfa_code_v2) & \ |
| 358 | RX_TPA_START_CMP_CFA_CODE) >> RX_TPA_START_CMPL_CFA_CODE_SHIFT) |
| 359 | |
Michael Chan | 50f011b | 2018-08-05 16:51:51 -0400 | [diff] [blame] | 360 | #define TPA_START_IS_IPV6(rx_tpa_start) \ |
| 361 | (!!((rx_tpa_start)->rx_tpa_start_cmp_flags2 & \ |
| 362 | cpu_to_le32(RX_TPA_START_CMP_FLAGS2_IP_TYPE))) |
| 363 | |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 364 | #define TPA_START_ERROR_CODE(rx_tpa_start) \ |
| 365 | ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_cfa_code_v2) & \ |
| 366 | RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_MASK) >> \ |
| 367 | RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_SHIFT) |
| 368 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 369 | struct rx_tpa_end_cmp { |
| 370 | __le32 rx_tpa_end_cmp_len_flags_type; |
| 371 | #define RX_TPA_END_CMP_TYPE (0x3f << 0) |
| 372 | #define RX_TPA_END_CMP_FLAGS (0x3ff << 6) |
| 373 | #define RX_TPA_END_CMP_FLAGS_SHIFT 6 |
| 374 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT (0x7 << 7) |
| 375 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT_SHIFT 7 |
| 376 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT_JUMBO (0x1 << 7) |
| 377 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT_HDS (0x2 << 7) |
| 378 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_JUMBO (0x5 << 7) |
| 379 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_HDS (0x6 << 7) |
| 380 | #define RX_TPA_END_CMP_FLAGS_RSS_VALID (0x1 << 10) |
| 381 | #define RX_TPA_END_CMP_FLAGS_ITYPES (0xf << 12) |
| 382 | #define RX_TPA_END_CMP_FLAGS_ITYPES_SHIFT 12 |
| 383 | #define RX_TPA_END_CMP_FLAGS_ITYPE_TCP (0x2 << 12) |
| 384 | #define RX_TPA_END_CMP_LEN (0xffff << 16) |
| 385 | #define RX_TPA_END_CMP_LEN_SHIFT 16 |
| 386 | |
| 387 | u32 rx_tpa_end_cmp_opaque; |
| 388 | __le32 rx_tpa_end_cmp_misc_v1; |
| 389 | #define RX_TPA_END_CMP_V1 (0x1 << 0) |
| 390 | #define RX_TPA_END_CMP_AGG_BUFS (0x3f << 1) |
| 391 | #define RX_TPA_END_CMP_AGG_BUFS_SHIFT 1 |
| 392 | #define RX_TPA_END_CMP_TPA_SEGS (0xff << 8) |
| 393 | #define RX_TPA_END_CMP_TPA_SEGS_SHIFT 8 |
| 394 | #define RX_TPA_END_CMP_PAYLOAD_OFFSET (0xff << 16) |
| 395 | #define RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT 16 |
| 396 | #define RX_TPA_END_CMP_AGG_ID (0x7f << 25) |
| 397 | #define RX_TPA_END_CMP_AGG_ID_SHIFT 25 |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 398 | #define RX_TPA_END_CMP_AGG_ID_P5 (0xffff << 16) |
| 399 | #define RX_TPA_END_CMP_AGG_ID_SHIFT_P5 16 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 400 | |
| 401 | __le32 rx_tpa_end_cmp_tsdelta; |
| 402 | #define RX_TPA_END_GRO_TS (0x1 << 31) |
| 403 | }; |
| 404 | |
| 405 | #define TPA_END_AGG_ID(rx_tpa_end) \ |
| 406 | ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ |
| 407 | RX_TPA_END_CMP_AGG_ID) >> RX_TPA_END_CMP_AGG_ID_SHIFT) |
| 408 | |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 409 | #define TPA_END_AGG_ID_P5(rx_tpa_end) \ |
| 410 | ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ |
| 411 | RX_TPA_END_CMP_AGG_ID_P5) >> RX_TPA_END_CMP_AGG_ID_SHIFT_P5) |
| 412 | |
| 413 | #define TPA_END_PAYLOAD_OFF(rx_tpa_end) \ |
| 414 | ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ |
| 415 | RX_TPA_END_CMP_PAYLOAD_OFFSET) >> RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT) |
| 416 | |
| 417 | #define TPA_END_AGG_BUFS(rx_tpa_end) \ |
| 418 | ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ |
| 419 | RX_TPA_END_CMP_AGG_BUFS) >> RX_TPA_END_CMP_AGG_BUFS_SHIFT) |
| 420 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 421 | #define TPA_END_TPA_SEGS(rx_tpa_end) \ |
| 422 | ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ |
| 423 | RX_TPA_END_CMP_TPA_SEGS) >> RX_TPA_END_CMP_TPA_SEGS_SHIFT) |
| 424 | |
| 425 | #define RX_TPA_END_CMP_FLAGS_PLACEMENT_ANY_GRO \ |
| 426 | cpu_to_le32(RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_JUMBO & \ |
| 427 | RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_HDS) |
| 428 | |
| 429 | #define TPA_END_GRO(rx_tpa_end) \ |
| 430 | ((rx_tpa_end)->rx_tpa_end_cmp_len_flags_type & \ |
| 431 | RX_TPA_END_CMP_FLAGS_PLACEMENT_ANY_GRO) |
| 432 | |
| 433 | #define TPA_END_GRO_TS(rx_tpa_end) \ |
Michael Chan | a58a3e6 | 2016-07-01 18:46:20 -0400 | [diff] [blame] | 434 | (!!((rx_tpa_end)->rx_tpa_end_cmp_tsdelta & \ |
| 435 | cpu_to_le32(RX_TPA_END_GRO_TS))) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 436 | |
| 437 | struct rx_tpa_end_cmp_ext { |
| 438 | __le32 rx_tpa_end_cmp_dup_acks; |
| 439 | #define RX_TPA_END_CMP_TPA_DUP_ACKS (0xf << 0) |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 440 | #define RX_TPA_END_CMP_PAYLOAD_OFFSET_P5 (0xff << 16) |
| 441 | #define RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT_P5 16 |
| 442 | #define RX_TPA_END_CMP_AGG_BUFS_P5 (0xff << 24) |
| 443 | #define RX_TPA_END_CMP_AGG_BUFS_SHIFT_P5 24 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 444 | |
| 445 | __le32 rx_tpa_end_cmp_seg_len; |
| 446 | #define RX_TPA_END_CMP_TPA_SEG_LEN (0xffff << 0) |
| 447 | |
| 448 | __le32 rx_tpa_end_cmp_errors_v2; |
| 449 | #define RX_TPA_END_CMP_V2 (0x1 << 0) |
Michael Chan | 69c149e | 2017-06-23 14:01:00 -0400 | [diff] [blame] | 450 | #define RX_TPA_END_CMP_ERRORS (0x3 << 1) |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 451 | #define RX_TPA_END_CMP_ERRORS_P5 (0x7 << 1) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 452 | #define RX_TPA_END_CMPL_ERRORS_SHIFT 1 |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 453 | #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_NO_BUFFER (0x0 << 1) |
| 454 | #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_NOT_ON_CHIP (0x2 << 1) |
| 455 | #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_BAD_FORMAT (0x3 << 1) |
| 456 | #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_RSV_ERROR (0x4 << 1) |
| 457 | #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_FLUSH (0x5 << 1) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 458 | |
| 459 | u32 rx_tpa_end_cmp_start_opaque; |
| 460 | }; |
| 461 | |
Michael Chan | 69c149e | 2017-06-23 14:01:00 -0400 | [diff] [blame] | 462 | #define TPA_END_ERRORS(rx_tpa_end_ext) \ |
| 463 | ((rx_tpa_end_ext)->rx_tpa_end_cmp_errors_v2 & \ |
| 464 | cpu_to_le32(RX_TPA_END_CMP_ERRORS)) |
| 465 | |
Michael Chan | 218a8a7 | 2019-07-29 06:10:19 -0400 | [diff] [blame] | 466 | #define TPA_END_PAYLOAD_OFF_P5(rx_tpa_end_ext) \ |
| 467 | ((le32_to_cpu((rx_tpa_end_ext)->rx_tpa_end_cmp_dup_acks) & \ |
| 468 | RX_TPA_END_CMP_PAYLOAD_OFFSET_P5) >> \ |
| 469 | RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT_P5) |
| 470 | |
| 471 | #define TPA_END_AGG_BUFS_P5(rx_tpa_end_ext) \ |
| 472 | ((le32_to_cpu((rx_tpa_end_ext)->rx_tpa_end_cmp_dup_acks) & \ |
| 473 | RX_TPA_END_CMP_AGG_BUFS_P5) >> RX_TPA_END_CMP_AGG_BUFS_SHIFT_P5) |
| 474 | |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 475 | struct nqe_cn { |
| 476 | __le16 type; |
| 477 | #define NQ_CN_TYPE_MASK 0x3fUL |
| 478 | #define NQ_CN_TYPE_SFT 0 |
| 479 | #define NQ_CN_TYPE_CQ_NOTIFICATION 0x30UL |
| 480 | #define NQ_CN_TYPE_LAST NQ_CN_TYPE_CQ_NOTIFICATION |
| 481 | __le16 reserved16; |
| 482 | __le32 cq_handle_low; |
| 483 | __le32 v; |
| 484 | #define NQ_CN_V 0x1UL |
| 485 | __le32 cq_handle_high; |
| 486 | }; |
| 487 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 488 | #define DB_IDX_MASK 0xffffff |
| 489 | #define DB_IDX_VALID (0x1 << 26) |
| 490 | #define DB_IRQ_DIS (0x1 << 27) |
| 491 | #define DB_KEY_TX (0x0 << 28) |
| 492 | #define DB_KEY_RX (0x1 << 28) |
| 493 | #define DB_KEY_CP (0x2 << 28) |
| 494 | #define DB_KEY_ST (0x3 << 28) |
| 495 | #define DB_KEY_TX_PUSH (0x4 << 28) |
| 496 | #define DB_LONG_TX_PUSH (0x2 << 24) |
| 497 | |
Michael Chan | e4060d3 | 2016-12-07 00:26:19 -0500 | [diff] [blame] | 498 | #define BNXT_MIN_ROCE_CP_RINGS 2 |
| 499 | #define BNXT_MIN_ROCE_STAT_CTXS 1 |
| 500 | |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 501 | /* 64-bit doorbell */ |
| 502 | #define DBR_INDEX_MASK 0x0000000000ffffffULL |
| 503 | #define DBR_XID_MASK 0x000fffff00000000ULL |
| 504 | #define DBR_XID_SFT 32 |
| 505 | #define DBR_PATH_L2 (0x1ULL << 56) |
| 506 | #define DBR_TYPE_SQ (0x0ULL << 60) |
| 507 | #define DBR_TYPE_RQ (0x1ULL << 60) |
| 508 | #define DBR_TYPE_SRQ (0x2ULL << 60) |
| 509 | #define DBR_TYPE_SRQ_ARM (0x3ULL << 60) |
| 510 | #define DBR_TYPE_CQ (0x4ULL << 60) |
| 511 | #define DBR_TYPE_CQ_ARMSE (0x5ULL << 60) |
| 512 | #define DBR_TYPE_CQ_ARMALL (0x6ULL << 60) |
| 513 | #define DBR_TYPE_CQ_ARMENA (0x7ULL << 60) |
| 514 | #define DBR_TYPE_SRQ_ARMENA (0x8ULL << 60) |
| 515 | #define DBR_TYPE_CQ_CUTOFF_ACK (0x9ULL << 60) |
| 516 | #define DBR_TYPE_NQ (0xaULL << 60) |
| 517 | #define DBR_TYPE_NQ_ARM (0xbULL << 60) |
| 518 | #define DBR_TYPE_NULL (0xfULL << 60) |
| 519 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 520 | #define INVALID_HW_RING_ID ((u16)-1) |
| 521 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 522 | /* The hardware supports certain page sizes. Use the supported page sizes |
| 523 | * to allocate the rings. |
| 524 | */ |
| 525 | #if (PAGE_SHIFT < 12) |
| 526 | #define BNXT_PAGE_SHIFT 12 |
| 527 | #elif (PAGE_SHIFT <= 13) |
| 528 | #define BNXT_PAGE_SHIFT PAGE_SHIFT |
| 529 | #elif (PAGE_SHIFT < 16) |
| 530 | #define BNXT_PAGE_SHIFT 13 |
| 531 | #else |
| 532 | #define BNXT_PAGE_SHIFT 16 |
| 533 | #endif |
| 534 | |
| 535 | #define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT) |
| 536 | |
Michael Chan | 2839f28 | 2016-04-25 02:30:50 -0400 | [diff] [blame] | 537 | /* The RXBD length is 16-bit so we can only support page sizes < 64K */ |
| 538 | #if (PAGE_SHIFT > 15) |
| 539 | #define BNXT_RX_PAGE_SHIFT 15 |
| 540 | #else |
| 541 | #define BNXT_RX_PAGE_SHIFT PAGE_SHIFT |
| 542 | #endif |
| 543 | |
| 544 | #define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT) |
| 545 | |
Michael Chan | c61fb99 | 2017-02-06 16:55:36 -0500 | [diff] [blame] | 546 | #define BNXT_MAX_MTU 9500 |
| 547 | #define BNXT_MAX_PAGE_MODE_MTU \ |
Michael Chan | c6d30e8 | 2017-02-06 16:55:42 -0500 | [diff] [blame] | 548 | ((unsigned int)PAGE_SIZE - VLAN_ETH_HLEN - NET_IP_ALIGN - \ |
| 549 | XDP_PACKET_HEADROOM) |
Michael Chan | c61fb99 | 2017-02-06 16:55:36 -0500 | [diff] [blame] | 550 | |
Michael Chan | 4ffcd58 | 2016-09-19 03:58:07 -0400 | [diff] [blame] | 551 | #define BNXT_MIN_PKT_SIZE 52 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 552 | |
Michael Chan | 51dd55b | 2016-02-10 17:33:50 -0500 | [diff] [blame] | 553 | #define BNXT_DEFAULT_RX_RING_SIZE 511 |
| 554 | #define BNXT_DEFAULT_TX_RING_SIZE 511 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 555 | |
| 556 | #define MAX_TPA 64 |
Michael Chan | 79632e9 | 2019-07-29 06:10:21 -0400 | [diff] [blame] | 557 | #define MAX_TPA_P5 256 |
Michael Chan | ec4d8e7 | 2019-07-29 06:10:26 -0400 | [diff] [blame] | 558 | #define MAX_TPA_P5_MASK (MAX_TPA_P5 - 1) |
Michael Chan | 79632e9 | 2019-07-29 06:10:21 -0400 | [diff] [blame] | 559 | #define MAX_TPA_SEGS_P5 0x3f |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 560 | |
Michael Chan | d0a42d6 | 2016-05-15 03:04:46 -0400 | [diff] [blame] | 561 | #if (BNXT_PAGE_SHIFT == 16) |
| 562 | #define MAX_RX_PAGES 1 |
| 563 | #define MAX_RX_AGG_PAGES 4 |
| 564 | #define MAX_TX_PAGES 1 |
| 565 | #define MAX_CP_PAGES 8 |
| 566 | #else |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 567 | #define MAX_RX_PAGES 8 |
| 568 | #define MAX_RX_AGG_PAGES 32 |
| 569 | #define MAX_TX_PAGES 8 |
| 570 | #define MAX_CP_PAGES 64 |
Michael Chan | d0a42d6 | 2016-05-15 03:04:46 -0400 | [diff] [blame] | 571 | #endif |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 572 | |
| 573 | #define RX_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct rx_bd)) |
| 574 | #define TX_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct tx_bd)) |
| 575 | #define CP_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct tx_cmp)) |
| 576 | |
| 577 | #define SW_RXBD_RING_SIZE (sizeof(struct bnxt_sw_rx_bd) * RX_DESC_CNT) |
| 578 | #define HW_RXBD_RING_SIZE (sizeof(struct rx_bd) * RX_DESC_CNT) |
| 579 | |
| 580 | #define SW_RXBD_AGG_RING_SIZE (sizeof(struct bnxt_sw_rx_agg_bd) * RX_DESC_CNT) |
| 581 | |
| 582 | #define SW_TXBD_RING_SIZE (sizeof(struct bnxt_sw_tx_bd) * TX_DESC_CNT) |
| 583 | #define HW_TXBD_RING_SIZE (sizeof(struct tx_bd) * TX_DESC_CNT) |
| 584 | |
| 585 | #define HW_CMPD_RING_SIZE (sizeof(struct tx_cmp) * CP_DESC_CNT) |
| 586 | |
| 587 | #define BNXT_MAX_RX_DESC_CNT (RX_DESC_CNT * MAX_RX_PAGES - 1) |
| 588 | #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) |
| 589 | #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) |
| 590 | |
| 591 | #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) |
| 592 | #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) |
| 593 | |
| 594 | #define TX_RING(x) (((x) & ~(TX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) |
| 595 | #define TX_IDX(x) ((x) & (TX_DESC_CNT - 1)) |
| 596 | |
| 597 | #define CP_RING(x) (((x) & ~(CP_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) |
| 598 | #define CP_IDX(x) ((x) & (CP_DESC_CNT - 1)) |
| 599 | |
| 600 | #define TX_CMP_VALID(txcmp, raw_cons) \ |
| 601 | (!!((txcmp)->tx_cmp_errors_v & cpu_to_le32(TX_CMP_V)) == \ |
| 602 | !((raw_cons) & bp->cp_bit)) |
| 603 | |
| 604 | #define RX_CMP_VALID(rxcmp1, raw_cons) \ |
| 605 | (!!((rxcmp1)->rx_cmp_cfa_code_errors_v2 & cpu_to_le32(RX_CMP_V)) ==\ |
| 606 | !((raw_cons) & bp->cp_bit)) |
| 607 | |
| 608 | #define RX_AGG_CMP_VALID(agg, raw_cons) \ |
| 609 | (!!((agg)->rx_agg_cmp_v & cpu_to_le32(RX_AGG_CMP_V)) == \ |
| 610 | !((raw_cons) & bp->cp_bit)) |
| 611 | |
Michael Chan | 0fcec98 | 2018-10-14 07:02:58 -0400 | [diff] [blame] | 612 | #define NQ_CMP_VALID(nqcmp, raw_cons) \ |
| 613 | (!!((nqcmp)->v & cpu_to_le32(NQ_CN_V)) == !((raw_cons) & bp->cp_bit)) |
| 614 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 615 | #define TX_CMP_TYPE(txcmp) \ |
| 616 | (le32_to_cpu((txcmp)->tx_cmp_flags_type) & CMP_TYPE) |
| 617 | |
| 618 | #define RX_CMP_TYPE(rxcmp) \ |
| 619 | (le32_to_cpu((rxcmp)->rx_cmp_len_flags_type) & RX_CMP_CMP_TYPE) |
| 620 | |
| 621 | #define NEXT_RX(idx) (((idx) + 1) & bp->rx_ring_mask) |
| 622 | |
| 623 | #define NEXT_RX_AGG(idx) (((idx) + 1) & bp->rx_agg_ring_mask) |
| 624 | |
| 625 | #define NEXT_TX(idx) (((idx) + 1) & bp->tx_ring_mask) |
| 626 | |
| 627 | #define ADV_RAW_CMP(idx, n) ((idx) + (n)) |
| 628 | #define NEXT_RAW_CMP(idx) ADV_RAW_CMP(idx, 1) |
| 629 | #define RING_CMP(idx) ((idx) & bp->cp_ring_mask) |
| 630 | #define NEXT_CMP(idx) RING_CMP(ADV_RAW_CMP(idx, 1)) |
| 631 | |
Michael Chan | e6ef269 | 2016-03-28 19:46:05 -0400 | [diff] [blame] | 632 | #define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len) |
Deepak Khungar | e605db8 | 2017-05-29 19:06:04 -0400 | [diff] [blame] | 633 | #define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) |
Michael Chan | ff4fe81 | 2016-02-26 04:00:04 -0500 | [diff] [blame] | 634 | #define DFLT_HWRM_CMD_TIMEOUT 500 |
| 635 | #define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 636 | #define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4) |
| 637 | #define HWRM_RESP_ERR_CODE_MASK 0xffff |
Michael Chan | a8643e1 | 2016-02-26 04:00:05 -0500 | [diff] [blame] | 638 | #define HWRM_RESP_LEN_OFFSET 4 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 639 | #define HWRM_RESP_LEN_MASK 0xffff0000 |
| 640 | #define HWRM_RESP_LEN_SFT 16 |
| 641 | #define HWRM_RESP_VALID_MASK 0xff000000 |
| 642 | #define BNXT_HWRM_REQ_MAX_SIZE 128 |
| 643 | #define BNXT_HWRM_REQS_PER_PAGE (BNXT_PAGE_SIZE / \ |
| 644 | BNXT_HWRM_REQ_MAX_SIZE) |
Andy Gospodarek | 9751e8e | 2018-04-26 17:44:39 -0400 | [diff] [blame] | 645 | #define HWRM_SHORT_MIN_TIMEOUT 3 |
| 646 | #define HWRM_SHORT_MAX_TIMEOUT 10 |
| 647 | #define HWRM_SHORT_TIMEOUT_COUNTER 5 |
| 648 | |
| 649 | #define HWRM_MIN_TIMEOUT 25 |
| 650 | #define HWRM_MAX_TIMEOUT 40 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 651 | |
Michael Chan | cc559c1 | 2018-05-08 03:18:38 -0400 | [diff] [blame] | 652 | #define HWRM_TOTAL_TIMEOUT(n) (((n) <= HWRM_SHORT_TIMEOUT_COUNTER) ? \ |
| 653 | ((n) * HWRM_SHORT_MIN_TIMEOUT) : \ |
| 654 | (HWRM_SHORT_TIMEOUT_COUNTER * HWRM_SHORT_MIN_TIMEOUT + \ |
| 655 | ((n) - HWRM_SHORT_TIMEOUT_COUNTER) * HWRM_MIN_TIMEOUT)) |
| 656 | |
Michael Chan | 0000b81 | 2019-02-20 19:07:32 -0500 | [diff] [blame] | 657 | #define HWRM_VALID_BIT_DELAY_USEC 150 |
Michael Chan | cc559c1 | 2018-05-08 03:18:38 -0400 | [diff] [blame] | 658 | |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 659 | #define BNXT_HWRM_CHNL_CHIMP 0 |
| 660 | #define BNXT_HWRM_CHNL_KONG 1 |
| 661 | |
Andy Gospodarek | f18c2b7 | 2019-07-08 17:53:03 -0400 | [diff] [blame] | 662 | #define BNXT_RX_EVENT 1 |
| 663 | #define BNXT_AGG_EVENT 2 |
| 664 | #define BNXT_TX_EVENT 4 |
| 665 | #define BNXT_REDIRECT_EVENT 8 |
Michael Chan | 4e5dbbda | 2017-02-06 16:55:37 -0500 | [diff] [blame] | 666 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 667 | struct bnxt_sw_tx_bd { |
Andy Gospodarek | f18c2b7 | 2019-07-08 17:53:03 -0400 | [diff] [blame] | 668 | union { |
| 669 | struct sk_buff *skb; |
| 670 | struct xdp_frame *xdpf; |
| 671 | }; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 672 | DEFINE_DMA_UNMAP_ADDR(mapping); |
Andy Gospodarek | f18c2b7 | 2019-07-08 17:53:03 -0400 | [diff] [blame] | 673 | DEFINE_DMA_UNMAP_LEN(len); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 674 | u8 is_gso; |
| 675 | u8 is_push; |
Michael Chan | c1ba92a | 2019-07-08 17:53:02 -0400 | [diff] [blame] | 676 | u8 action; |
Michael Chan | 3841340 | 2017-02-06 16:55:43 -0500 | [diff] [blame] | 677 | union { |
| 678 | unsigned short nr_frags; |
| 679 | u16 rx_prod; |
| 680 | }; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 681 | }; |
| 682 | |
| 683 | struct bnxt_sw_rx_bd { |
Michael Chan | 6bb1947 | 2017-02-06 16:55:32 -0500 | [diff] [blame] | 684 | void *data; |
| 685 | u8 *data_ptr; |
Michael Chan | 11cd119 | 2017-02-06 16:55:33 -0500 | [diff] [blame] | 686 | dma_addr_t mapping; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 687 | }; |
| 688 | |
| 689 | struct bnxt_sw_rx_agg_bd { |
| 690 | struct page *page; |
Michael Chan | 89d0a06 | 2016-04-25 02:30:51 -0400 | [diff] [blame] | 691 | unsigned int offset; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 692 | dma_addr_t mapping; |
| 693 | }; |
| 694 | |
Michael Chan | 6fe1988 | 2018-10-14 07:02:41 -0400 | [diff] [blame] | 695 | struct bnxt_ring_mem_info { |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 696 | int nr_pages; |
| 697 | int page_size; |
Michael Chan | 4f49b2b | 2018-12-20 03:38:49 -0500 | [diff] [blame] | 698 | u16 flags; |
Michael Chan | 66cca20 | 2018-10-14 07:02:42 -0400 | [diff] [blame] | 699 | #define BNXT_RMEM_VALID_PTE_FLAG 1 |
| 700 | #define BNXT_RMEM_RING_PTE_FLAG 2 |
Michael Chan | 4f49b2b | 2018-12-20 03:38:49 -0500 | [diff] [blame] | 701 | #define BNXT_RMEM_USE_FULL_PAGE_FLAG 4 |
| 702 | |
| 703 | u16 depth; |
Michael Chan | 66cca20 | 2018-10-14 07:02:42 -0400 | [diff] [blame] | 704 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 705 | void **pg_arr; |
| 706 | dma_addr_t *dma_arr; |
| 707 | |
| 708 | __le64 *pg_tbl; |
| 709 | dma_addr_t pg_tbl_map; |
| 710 | |
| 711 | int vmem_size; |
| 712 | void **vmem; |
Michael Chan | 6fe1988 | 2018-10-14 07:02:41 -0400 | [diff] [blame] | 713 | }; |
| 714 | |
| 715 | struct bnxt_ring_struct { |
| 716 | struct bnxt_ring_mem_info ring_mem; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 717 | |
| 718 | u16 fw_ring_id; /* Ring id filled by Chimp FW */ |
Michael Chan | 9899bb5 | 2018-03-31 13:54:16 -0400 | [diff] [blame] | 719 | union { |
| 720 | u16 grp_idx; |
| 721 | u16 map_idx; /* Used by cmpl rings */ |
| 722 | }; |
Michael Chan | 23aefdd | 2018-10-14 07:02:51 -0400 | [diff] [blame] | 723 | u32 handle; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 724 | u8 queue_id; |
| 725 | }; |
| 726 | |
| 727 | struct tx_push_bd { |
| 728 | __le32 doorbell; |
Michael Chan | 4419dbe | 2016-02-10 17:33:49 -0500 | [diff] [blame] | 729 | __le32 tx_bd_len_flags_type; |
| 730 | u32 tx_bd_opaque; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 731 | struct tx_bd_ext txbd2; |
| 732 | }; |
| 733 | |
Michael Chan | 4419dbe | 2016-02-10 17:33:49 -0500 | [diff] [blame] | 734 | struct tx_push_buffer { |
| 735 | struct tx_push_bd push_bd; |
| 736 | u32 data[25]; |
| 737 | }; |
| 738 | |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 739 | struct bnxt_db_info { |
| 740 | void __iomem *doorbell; |
| 741 | union { |
| 742 | u64 db_key64; |
| 743 | u32 db_key32; |
| 744 | }; |
| 745 | }; |
| 746 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 747 | struct bnxt_tx_ring_info { |
Michael Chan | b6ab4b0 | 2016-01-02 23:44:59 -0500 | [diff] [blame] | 748 | struct bnxt_napi *bnapi; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 749 | u16 tx_prod; |
| 750 | u16 tx_cons; |
Michael Chan | a960dec | 2017-02-06 16:55:39 -0500 | [diff] [blame] | 751 | u16 txq_index; |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 752 | struct bnxt_db_info tx_db; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 753 | |
| 754 | struct tx_bd *tx_desc_ring[MAX_TX_PAGES]; |
| 755 | struct bnxt_sw_tx_bd *tx_buf_ring; |
| 756 | |
| 757 | dma_addr_t tx_desc_mapping[MAX_TX_PAGES]; |
| 758 | |
Michael Chan | 4419dbe | 2016-02-10 17:33:49 -0500 | [diff] [blame] | 759 | struct tx_push_buffer *tx_push; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 760 | dma_addr_t tx_push_mapping; |
Michael Chan | 4419dbe | 2016-02-10 17:33:49 -0500 | [diff] [blame] | 761 | __le64 data_mapping; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 762 | |
| 763 | #define BNXT_DEV_STATE_CLOSING 0x1 |
| 764 | u32 dev_state; |
| 765 | |
| 766 | struct bnxt_ring_struct tx_ring_struct; |
| 767 | }; |
| 768 | |
Michael Chan | 74706af | 2018-10-14 07:02:40 -0400 | [diff] [blame] | 769 | #define BNXT_LEGACY_COAL_CMPL_PARAMS \ |
| 770 | (RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_INT_LAT_TMR_MIN | \ |
| 771 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_INT_LAT_TMR_MAX | \ |
| 772 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_TIMER_RESET | \ |
| 773 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_RING_IDLE | \ |
| 774 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_NUM_CMPL_DMA_AGGR | \ |
| 775 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_NUM_CMPL_DMA_AGGR_DURING_INT | \ |
| 776 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_CMPL_AGGR_DMA_TMR | \ |
| 777 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_CMPL_AGGR_DMA_TMR_DURING_INT | \ |
| 778 | RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_NUM_CMPL_AGGR_INT) |
| 779 | |
| 780 | #define BNXT_COAL_CMPL_ENABLES \ |
| 781 | (RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_NUM_CMPL_DMA_AGGR | \ |
| 782 | RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_CMPL_AGGR_DMA_TMR | \ |
| 783 | RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_INT_LAT_TMR_MAX | \ |
| 784 | RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_NUM_CMPL_AGGR_INT) |
| 785 | |
| 786 | #define BNXT_COAL_CMPL_MIN_TMR_ENABLE \ |
| 787 | RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_INT_LAT_TMR_MIN |
| 788 | |
| 789 | #define BNXT_COAL_CMPL_AGGR_TMR_DURING_INT_ENABLE \ |
| 790 | RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_NUM_CMPL_DMA_AGGR_DURING_INT |
| 791 | |
| 792 | struct bnxt_coal_cap { |
| 793 | u32 cmpl_params; |
| 794 | u32 nq_params; |
| 795 | u16 num_cmpl_dma_aggr_max; |
| 796 | u16 num_cmpl_dma_aggr_during_int_max; |
| 797 | u16 cmpl_aggr_dma_tmr_max; |
| 798 | u16 cmpl_aggr_dma_tmr_during_int_max; |
| 799 | u16 int_lat_tmr_min_max; |
| 800 | u16 int_lat_tmr_max_max; |
| 801 | u16 num_cmpl_aggr_int_max; |
| 802 | u16 timer_units; |
| 803 | }; |
| 804 | |
Andy Gospodarek | 6a8788f | 2018-01-09 16:06:20 -0500 | [diff] [blame] | 805 | struct bnxt_coal { |
| 806 | u16 coal_ticks; |
| 807 | u16 coal_ticks_irq; |
| 808 | u16 coal_bufs; |
| 809 | u16 coal_bufs_irq; |
| 810 | /* RING_IDLE enabled when coal ticks < idle_thresh */ |
| 811 | u16 idle_thresh; |
| 812 | u8 bufs_per_record; |
| 813 | u8 budget; |
| 814 | }; |
| 815 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 816 | struct bnxt_tpa_info { |
Michael Chan | 6bb1947 | 2017-02-06 16:55:32 -0500 | [diff] [blame] | 817 | void *data; |
| 818 | u8 *data_ptr; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 819 | dma_addr_t mapping; |
| 820 | u16 len; |
| 821 | unsigned short gso_type; |
| 822 | u32 flags2; |
| 823 | u32 metadata; |
| 824 | enum pkt_hash_types hash_type; |
| 825 | u32 rss_hash; |
Michael Chan | 94758f8 | 2016-06-13 02:25:35 -0400 | [diff] [blame] | 826 | u32 hdr_info; |
| 827 | |
| 828 | #define BNXT_TPA_L4_SIZE(hdr_info) \ |
| 829 | (((hdr_info) & 0xf8000000) ? ((hdr_info) >> 27) : 32) |
| 830 | |
| 831 | #define BNXT_TPA_INNER_L3_OFF(hdr_info) \ |
| 832 | (((hdr_info) >> 18) & 0x1ff) |
| 833 | |
| 834 | #define BNXT_TPA_INNER_L2_OFF(hdr_info) \ |
| 835 | (((hdr_info) >> 9) & 0x1ff) |
| 836 | |
| 837 | #define BNXT_TPA_OUTER_L3_OFF(hdr_info) \ |
| 838 | ((hdr_info) & 0x1ff) |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 839 | |
| 840 | u16 cfa_code; /* cfa_code in TPA start compl */ |
Michael Chan | 79632e9 | 2019-07-29 06:10:21 -0400 | [diff] [blame] | 841 | u8 agg_count; |
| 842 | struct rx_agg_cmp *agg_arr; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 843 | }; |
| 844 | |
Michael Chan | ec4d8e7 | 2019-07-29 06:10:26 -0400 | [diff] [blame] | 845 | #define BNXT_AGG_IDX_BMAP_SIZE (MAX_TPA_P5 / BITS_PER_LONG) |
| 846 | |
| 847 | struct bnxt_tpa_idx_map { |
| 848 | u16 agg_id_tbl[1024]; |
| 849 | unsigned long agg_idx_bmap[BNXT_AGG_IDX_BMAP_SIZE]; |
| 850 | }; |
| 851 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 852 | struct bnxt_rx_ring_info { |
Michael Chan | b6ab4b0 | 2016-01-02 23:44:59 -0500 | [diff] [blame] | 853 | struct bnxt_napi *bnapi; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 854 | u16 rx_prod; |
| 855 | u16 rx_agg_prod; |
| 856 | u16 rx_sw_agg_prod; |
Michael Chan | 376a5b8 | 2016-05-10 19:17:59 -0400 | [diff] [blame] | 857 | u16 rx_next_cons; |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 858 | struct bnxt_db_info rx_db; |
| 859 | struct bnxt_db_info rx_agg_db; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 860 | |
Michael Chan | c6d30e8 | 2017-02-06 16:55:42 -0500 | [diff] [blame] | 861 | struct bpf_prog *xdp_prog; |
| 862 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 863 | struct rx_bd *rx_desc_ring[MAX_RX_PAGES]; |
| 864 | struct bnxt_sw_rx_bd *rx_buf_ring; |
| 865 | |
| 866 | struct rx_bd *rx_agg_desc_ring[MAX_RX_AGG_PAGES]; |
| 867 | struct bnxt_sw_rx_agg_bd *rx_agg_ring; |
| 868 | |
| 869 | unsigned long *rx_agg_bmap; |
| 870 | u16 rx_agg_bmap_size; |
| 871 | |
Michael Chan | 89d0a06 | 2016-04-25 02:30:51 -0400 | [diff] [blame] | 872 | struct page *rx_page; |
| 873 | unsigned int rx_page_offset; |
| 874 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 875 | dma_addr_t rx_desc_mapping[MAX_RX_PAGES]; |
| 876 | dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES]; |
| 877 | |
| 878 | struct bnxt_tpa_info *rx_tpa; |
Michael Chan | ec4d8e7 | 2019-07-29 06:10:26 -0400 | [diff] [blame] | 879 | struct bnxt_tpa_idx_map *rx_tpa_idx_map; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 880 | |
| 881 | struct bnxt_ring_struct rx_ring_struct; |
| 882 | struct bnxt_ring_struct rx_agg_ring_struct; |
Jesper Dangaard Brouer | 96a8604 | 2018-01-03 11:25:44 +0100 | [diff] [blame] | 883 | struct xdp_rxq_info xdp_rxq; |
Andy Gospodarek | 322b87c | 2019-07-08 17:53:04 -0400 | [diff] [blame] | 884 | struct page_pool *page_pool; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 885 | }; |
| 886 | |
| 887 | struct bnxt_cp_ring_info { |
Michael Chan | 50e3ab7 | 2018-10-14 07:02:49 -0400 | [diff] [blame] | 888 | struct bnxt_napi *bnapi; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 889 | u32 cp_raw_cons; |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 890 | struct bnxt_db_info cp_db; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 891 | |
Michael Chan | 3675b92 | 2018-10-14 07:02:57 -0400 | [diff] [blame] | 892 | u8 had_work_done:1; |
Michael Chan | 0fcec98 | 2018-10-14 07:02:58 -0400 | [diff] [blame] | 893 | u8 has_more_work:1; |
Michael Chan | 3675b92 | 2018-10-14 07:02:57 -0400 | [diff] [blame] | 894 | |
Michael Chan | ffd7762 | 2018-11-15 03:25:40 -0500 | [diff] [blame] | 895 | u32 last_cp_raw_cons; |
| 896 | |
Andy Gospodarek | 6a8788f | 2018-01-09 16:06:20 -0500 | [diff] [blame] | 897 | struct bnxt_coal rx_ring_coal; |
| 898 | u64 rx_packets; |
| 899 | u64 rx_bytes; |
| 900 | u64 event_ctr; |
| 901 | |
Tal Gilboa | 8960b38 | 2019-01-31 16:44:48 +0200 | [diff] [blame] | 902 | struct dim dim; |
Andy Gospodarek | 6a8788f | 2018-01-09 16:06:20 -0500 | [diff] [blame] | 903 | |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 904 | union { |
| 905 | struct tx_cmp *cp_desc_ring[MAX_CP_PAGES]; |
| 906 | struct nqe_cn *nq_desc_ring[MAX_CP_PAGES]; |
| 907 | }; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 908 | |
| 909 | dma_addr_t cp_desc_mapping[MAX_CP_PAGES]; |
| 910 | |
| 911 | struct ctx_hw_stats *hw_stats; |
| 912 | dma_addr_t hw_stats_map; |
| 913 | u32 hw_stats_ctx_id; |
| 914 | u64 rx_l4_csum_errors; |
Michael Chan | 83eb5c5 | 2018-11-15 03:25:41 -0500 | [diff] [blame] | 915 | u64 missed_irqs; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 916 | |
| 917 | struct bnxt_ring_struct cp_ring_struct; |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 918 | |
| 919 | struct bnxt_cp_ring_info *cp_ring_arr[2]; |
Michael Chan | 50e3ab7 | 2018-10-14 07:02:49 -0400 | [diff] [blame] | 920 | #define BNXT_RX_HDL 0 |
| 921 | #define BNXT_TX_HDL 1 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 922 | }; |
| 923 | |
| 924 | struct bnxt_napi { |
| 925 | struct napi_struct napi; |
| 926 | struct bnxt *bp; |
| 927 | |
| 928 | int index; |
| 929 | struct bnxt_cp_ring_info cp_ring; |
Michael Chan | b6ab4b0 | 2016-01-02 23:44:59 -0500 | [diff] [blame] | 930 | struct bnxt_rx_ring_info *rx_ring; |
| 931 | struct bnxt_tx_ring_info *tx_ring; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 932 | |
Michael Chan | fa3e93e | 2017-02-06 16:55:41 -0500 | [diff] [blame] | 933 | void (*tx_int)(struct bnxt *, struct bnxt_napi *, |
| 934 | int); |
Michael Chan | 3675b92 | 2018-10-14 07:02:57 -0400 | [diff] [blame] | 935 | int tx_pkts; |
| 936 | u8 events; |
| 937 | |
Michael Chan | fa3e93e | 2017-02-06 16:55:41 -0500 | [diff] [blame] | 938 | u32 flags; |
| 939 | #define BNXT_NAPI_FLAG_XDP 0x1 |
| 940 | |
Michael Chan | fa7e281 | 2016-05-10 19:18:00 -0400 | [diff] [blame] | 941 | bool in_reset; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 942 | }; |
| 943 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 944 | struct bnxt_irq { |
| 945 | irq_handler_t handler; |
| 946 | unsigned int vector; |
Vasundhara Volam | 56f0fd8 | 2017-08-28 13:40:27 -0400 | [diff] [blame] | 947 | u8 requested:1; |
| 948 | u8 have_cpumask:1; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 949 | char name[IFNAMSIZ + 2]; |
Vasundhara Volam | 56f0fd8 | 2017-08-28 13:40:27 -0400 | [diff] [blame] | 950 | cpumask_var_t cpu_mask; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 951 | }; |
| 952 | |
| 953 | #define HWRM_RING_ALLOC_TX 0x1 |
| 954 | #define HWRM_RING_ALLOC_RX 0x2 |
| 955 | #define HWRM_RING_ALLOC_AGG 0x4 |
| 956 | #define HWRM_RING_ALLOC_CMPL 0x8 |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 957 | #define HWRM_RING_ALLOC_NQ 0x10 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 958 | |
| 959 | #define INVALID_STATS_CTX_ID -1 |
| 960 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 961 | struct bnxt_ring_grp_info { |
| 962 | u16 fw_stats_ctx; |
| 963 | u16 fw_grp_id; |
| 964 | u16 rx_fw_ring_id; |
| 965 | u16 agg_fw_ring_id; |
| 966 | u16 cp_fw_ring_id; |
| 967 | }; |
| 968 | |
| 969 | struct bnxt_vnic_info { |
| 970 | u16 fw_vnic_id; /* returned by Chimp during alloc */ |
Michael Chan | 44c6f72 | 2018-10-14 07:02:53 -0400 | [diff] [blame] | 971 | #define BNXT_MAX_CTX_PER_VNIC 8 |
Prashant Sreedharan | 94ce9ca | 2016-07-18 07:15:21 -0400 | [diff] [blame] | 972 | u16 fw_rss_cos_lb_ctx[BNXT_MAX_CTX_PER_VNIC]; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 973 | u16 fw_l2_ctx_id; |
| 974 | #define BNXT_MAX_UC_ADDRS 4 |
| 975 | __le64 fw_l2_filter_id[BNXT_MAX_UC_ADDRS]; |
| 976 | /* index 0 always dev_addr */ |
| 977 | u16 uc_filter_count; |
| 978 | u8 *uc_list; |
| 979 | |
| 980 | u16 *fw_grp_ids; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 981 | dma_addr_t rss_table_dma_addr; |
| 982 | __le16 *rss_table; |
| 983 | dma_addr_t rss_hash_key_dma_addr; |
| 984 | u64 *rss_hash_key; |
| 985 | u32 rx_mask; |
| 986 | |
| 987 | u8 *mc_list; |
| 988 | int mc_list_size; |
| 989 | int mc_list_count; |
| 990 | dma_addr_t mc_list_mapping; |
| 991 | #define BNXT_MAX_MC_ADDRS 16 |
| 992 | |
| 993 | u32 flags; |
| 994 | #define BNXT_VNIC_RSS_FLAG 1 |
| 995 | #define BNXT_VNIC_RFS_FLAG 2 |
| 996 | #define BNXT_VNIC_MCAST_FLAG 4 |
| 997 | #define BNXT_VNIC_UCAST_FLAG 8 |
Michael Chan | ae10ae7 | 2016-12-29 12:13:38 -0500 | [diff] [blame] | 998 | #define BNXT_VNIC_RFS_NEW_RSS_FLAG 0x10 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 999 | }; |
| 1000 | |
Michael Chan | 6a4f294 | 2018-01-17 03:21:06 -0500 | [diff] [blame] | 1001 | struct bnxt_hw_resc { |
| 1002 | u16 min_rsscos_ctxs; |
| 1003 | u16 max_rsscos_ctxs; |
| 1004 | u16 min_cp_rings; |
| 1005 | u16 max_cp_rings; |
| 1006 | u16 resv_cp_rings; |
| 1007 | u16 min_tx_rings; |
| 1008 | u16 max_tx_rings; |
| 1009 | u16 resv_tx_rings; |
Michael Chan | db4723b | 2018-03-31 13:54:13 -0400 | [diff] [blame] | 1010 | u16 max_tx_sch_inputs; |
Michael Chan | 6a4f294 | 2018-01-17 03:21:06 -0500 | [diff] [blame] | 1011 | u16 min_rx_rings; |
| 1012 | u16 max_rx_rings; |
| 1013 | u16 resv_rx_rings; |
| 1014 | u16 min_hw_ring_grps; |
| 1015 | u16 max_hw_ring_grps; |
| 1016 | u16 resv_hw_ring_grps; |
| 1017 | u16 min_l2_ctxs; |
| 1018 | u16 max_l2_ctxs; |
| 1019 | u16 min_vnics; |
| 1020 | u16 max_vnics; |
| 1021 | u16 resv_vnics; |
| 1022 | u16 min_stat_ctxs; |
| 1023 | u16 max_stat_ctxs; |
Vasundhara Volam | 780baad | 2018-12-16 18:46:23 -0500 | [diff] [blame] | 1024 | u16 resv_stat_ctxs; |
Michael Chan | f7588cd | 2018-12-16 18:46:19 -0500 | [diff] [blame] | 1025 | u16 max_nqs; |
Michael Chan | 6a4f294 | 2018-01-17 03:21:06 -0500 | [diff] [blame] | 1026 | u16 max_irqs; |
Michael Chan | 75720e6 | 2018-12-09 07:01:00 -0500 | [diff] [blame] | 1027 | u16 resv_irqs; |
Michael Chan | 6a4f294 | 2018-01-17 03:21:06 -0500 | [diff] [blame] | 1028 | }; |
| 1029 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1030 | #if defined(CONFIG_BNXT_SRIOV) |
| 1031 | struct bnxt_vf_info { |
| 1032 | u16 fw_fid; |
Vasundhara Volam | 91cdda4 | 2018-01-17 03:21:14 -0500 | [diff] [blame] | 1033 | u8 mac_addr[ETH_ALEN]; /* PF assigned MAC Address */ |
| 1034 | u8 vf_mac_addr[ETH_ALEN]; /* VF assigned MAC address, only |
| 1035 | * stored by PF. |
| 1036 | */ |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1037 | u16 vlan; |
Michael Chan | 2a51644 | 2019-02-19 05:31:14 -0500 | [diff] [blame] | 1038 | u16 func_qcfg_flags; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1039 | u32 flags; |
| 1040 | #define BNXT_VF_QOS 0x1 |
| 1041 | #define BNXT_VF_SPOOFCHK 0x2 |
| 1042 | #define BNXT_VF_LINK_FORCED 0x4 |
| 1043 | #define BNXT_VF_LINK_UP 0x8 |
Vasundhara Volam | 746df13 | 2018-03-31 13:54:10 -0400 | [diff] [blame] | 1044 | #define BNXT_VF_TRUST 0x10 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1045 | u32 func_flags; /* func cfg flags */ |
| 1046 | u32 min_tx_rate; |
| 1047 | u32 max_tx_rate; |
| 1048 | void *hwrm_cmd_req_addr; |
| 1049 | dma_addr_t hwrm_cmd_req_dma_addr; |
| 1050 | }; |
Michael Chan | 379a80a | 2015-10-23 15:06:19 -0400 | [diff] [blame] | 1051 | #endif |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1052 | |
| 1053 | struct bnxt_pf_info { |
| 1054 | #define BNXT_FIRST_PF_FID 1 |
| 1055 | #define BNXT_FIRST_VF_FID 128 |
Michael Chan | a58a3e6 | 2016-07-01 18:46:20 -0400 | [diff] [blame] | 1056 | u16 fw_fid; |
| 1057 | u16 port_id; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1058 | u8 mac_addr[ETH_ALEN]; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1059 | u32 first_vf_id; |
| 1060 | u16 active_vfs; |
| 1061 | u16 max_vfs; |
| 1062 | u32 max_encap_records; |
| 1063 | u32 max_decap_records; |
| 1064 | u32 max_tx_em_flows; |
| 1065 | u32 max_tx_wm_flows; |
| 1066 | u32 max_rx_em_flows; |
| 1067 | u32 max_rx_wm_flows; |
| 1068 | unsigned long *vf_event_bmap; |
| 1069 | u16 hwrm_cmd_req_pages; |
Michael Chan | 4673d66 | 2018-01-17 03:21:11 -0500 | [diff] [blame] | 1070 | u8 vf_resv_strategy; |
| 1071 | #define BNXT_VF_RESV_STRATEGY_MAXIMAL 0 |
| 1072 | #define BNXT_VF_RESV_STRATEGY_MINIMAL 1 |
Michael Chan | bf82736 | 2018-08-05 16:51:50 -0400 | [diff] [blame] | 1073 | #define BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC 2 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1074 | void *hwrm_cmd_req_addr[4]; |
| 1075 | dma_addr_t hwrm_cmd_req_dma_addr[4]; |
| 1076 | struct bnxt_vf_info *vf; |
| 1077 | }; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1078 | |
| 1079 | struct bnxt_ntuple_filter { |
| 1080 | struct hlist_node hash; |
Michael Chan | a54c4d7 | 2016-07-25 12:33:35 -0400 | [diff] [blame] | 1081 | u8 dst_mac_addr[ETH_ALEN]; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1082 | u8 src_mac_addr[ETH_ALEN]; |
| 1083 | struct flow_keys fkeys; |
| 1084 | __le64 filter_id; |
| 1085 | u16 sw_id; |
Michael Chan | a54c4d7 | 2016-07-25 12:33:35 -0400 | [diff] [blame] | 1086 | u8 l2_fltr_idx; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1087 | u16 rxq; |
| 1088 | u32 flow_id; |
| 1089 | unsigned long state; |
| 1090 | #define BNXT_FLTR_VALID 0 |
| 1091 | #define BNXT_FLTR_UPDATE 1 |
| 1092 | }; |
| 1093 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1094 | struct bnxt_link_info { |
Michael Chan | 03efbec | 2016-04-11 04:11:11 -0400 | [diff] [blame] | 1095 | u8 phy_type; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1096 | u8 media_type; |
| 1097 | u8 transceiver; |
| 1098 | u8 phy_addr; |
| 1099 | u8 phy_link_status; |
| 1100 | #define BNXT_LINK_NO_LINK PORT_PHY_QCFG_RESP_LINK_NO_LINK |
| 1101 | #define BNXT_LINK_SIGNAL PORT_PHY_QCFG_RESP_LINK_SIGNAL |
| 1102 | #define BNXT_LINK_LINK PORT_PHY_QCFG_RESP_LINK_LINK |
| 1103 | u8 wire_speed; |
| 1104 | u8 loop_back; |
| 1105 | u8 link_up; |
| 1106 | u8 duplex; |
Michael Chan | acb2005 | 2017-07-24 12:34:20 -0400 | [diff] [blame] | 1107 | #define BNXT_LINK_DUPLEX_HALF PORT_PHY_QCFG_RESP_DUPLEX_STATE_HALF |
| 1108 | #define BNXT_LINK_DUPLEX_FULL PORT_PHY_QCFG_RESP_DUPLEX_STATE_FULL |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1109 | u8 pause; |
| 1110 | #define BNXT_LINK_PAUSE_TX PORT_PHY_QCFG_RESP_PAUSE_TX |
| 1111 | #define BNXT_LINK_PAUSE_RX PORT_PHY_QCFG_RESP_PAUSE_RX |
| 1112 | #define BNXT_LINK_PAUSE_BOTH (PORT_PHY_QCFG_RESP_PAUSE_RX | \ |
| 1113 | PORT_PHY_QCFG_RESP_PAUSE_TX) |
Michael Chan | 3277360 | 2016-03-07 15:38:42 -0500 | [diff] [blame] | 1114 | u8 lp_pause; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1115 | u8 auto_pause_setting; |
| 1116 | u8 force_pause_setting; |
| 1117 | u8 duplex_setting; |
| 1118 | u8 auto_mode; |
| 1119 | #define BNXT_AUTO_MODE(mode) ((mode) > BNXT_LINK_AUTO_NONE && \ |
| 1120 | (mode) <= BNXT_LINK_AUTO_MSK) |
| 1121 | #define BNXT_LINK_AUTO_NONE PORT_PHY_QCFG_RESP_AUTO_MODE_NONE |
| 1122 | #define BNXT_LINK_AUTO_ALLSPDS PORT_PHY_QCFG_RESP_AUTO_MODE_ALL_SPEEDS |
| 1123 | #define BNXT_LINK_AUTO_ONESPD PORT_PHY_QCFG_RESP_AUTO_MODE_ONE_SPEED |
| 1124 | #define BNXT_LINK_AUTO_ONEORBELOW PORT_PHY_QCFG_RESP_AUTO_MODE_ONE_OR_BELOW |
Michael Chan | 11f15ed | 2016-04-05 14:08:55 -0400 | [diff] [blame] | 1125 | #define BNXT_LINK_AUTO_MSK PORT_PHY_QCFG_RESP_AUTO_MODE_SPEED_MASK |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1126 | #define PHY_VER_LEN 3 |
| 1127 | u8 phy_ver[PHY_VER_LEN]; |
| 1128 | u16 link_speed; |
| 1129 | #define BNXT_LINK_SPEED_100MB PORT_PHY_QCFG_RESP_LINK_SPEED_100MB |
| 1130 | #define BNXT_LINK_SPEED_1GB PORT_PHY_QCFG_RESP_LINK_SPEED_1GB |
| 1131 | #define BNXT_LINK_SPEED_2GB PORT_PHY_QCFG_RESP_LINK_SPEED_2GB |
| 1132 | #define BNXT_LINK_SPEED_2_5GB PORT_PHY_QCFG_RESP_LINK_SPEED_2_5GB |
| 1133 | #define BNXT_LINK_SPEED_10GB PORT_PHY_QCFG_RESP_LINK_SPEED_10GB |
| 1134 | #define BNXT_LINK_SPEED_20GB PORT_PHY_QCFG_RESP_LINK_SPEED_20GB |
| 1135 | #define BNXT_LINK_SPEED_25GB PORT_PHY_QCFG_RESP_LINK_SPEED_25GB |
| 1136 | #define BNXT_LINK_SPEED_40GB PORT_PHY_QCFG_RESP_LINK_SPEED_40GB |
| 1137 | #define BNXT_LINK_SPEED_50GB PORT_PHY_QCFG_RESP_LINK_SPEED_50GB |
Deepak Khungar | 38a21b3 | 2017-04-21 20:11:24 -0400 | [diff] [blame] | 1138 | #define BNXT_LINK_SPEED_100GB PORT_PHY_QCFG_RESP_LINK_SPEED_100GB |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1139 | u16 support_speeds; |
Michael Chan | 68515a1 | 2016-12-29 12:13:34 -0500 | [diff] [blame] | 1140 | u16 auto_link_speeds; /* fw adv setting */ |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1141 | #define BNXT_LINK_SPEED_MSK_100MB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_100MB |
| 1142 | #define BNXT_LINK_SPEED_MSK_1GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_1GB |
| 1143 | #define BNXT_LINK_SPEED_MSK_2GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_2GB |
| 1144 | #define BNXT_LINK_SPEED_MSK_10GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_10GB |
| 1145 | #define BNXT_LINK_SPEED_MSK_2_5GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_2_5GB |
| 1146 | #define BNXT_LINK_SPEED_MSK_20GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_20GB |
| 1147 | #define BNXT_LINK_SPEED_MSK_25GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_25GB |
| 1148 | #define BNXT_LINK_SPEED_MSK_40GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_40GB |
| 1149 | #define BNXT_LINK_SPEED_MSK_50GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_50GB |
Deepak Khungar | 38a21b3 | 2017-04-21 20:11:24 -0400 | [diff] [blame] | 1150 | #define BNXT_LINK_SPEED_MSK_100GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_100GB |
Michael Chan | 93ed811 | 2016-06-13 02:25:37 -0400 | [diff] [blame] | 1151 | u16 support_auto_speeds; |
Michael Chan | 3277360 | 2016-03-07 15:38:42 -0500 | [diff] [blame] | 1152 | u16 lp_auto_link_speeds; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1153 | u16 force_link_speed; |
| 1154 | u32 preemphasis; |
Ajit Khaparde | 42ee18f | 2016-05-15 03:04:44 -0400 | [diff] [blame] | 1155 | u8 module_status; |
Michael Chan | e70c752 | 2017-02-12 19:18:16 -0500 | [diff] [blame] | 1156 | u16 fec_cfg; |
| 1157 | #define BNXT_FEC_AUTONEG PORT_PHY_QCFG_RESP_FEC_CFG_FEC_AUTONEG_ENABLED |
| 1158 | #define BNXT_FEC_ENC_BASE_R PORT_PHY_QCFG_RESP_FEC_CFG_FEC_CLAUSE74_ENABLED |
| 1159 | #define BNXT_FEC_ENC_RS PORT_PHY_QCFG_RESP_FEC_CFG_FEC_CLAUSE91_ENABLED |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1160 | |
| 1161 | /* copy of requested setting from ethtool cmd */ |
| 1162 | u8 autoneg; |
| 1163 | #define BNXT_AUTONEG_SPEED 1 |
| 1164 | #define BNXT_AUTONEG_FLOW_CTRL 2 |
| 1165 | u8 req_duplex; |
| 1166 | u8 req_flow_ctrl; |
| 1167 | u16 req_link_speed; |
Michael Chan | 68515a1 | 2016-12-29 12:13:34 -0500 | [diff] [blame] | 1168 | u16 advertising; /* user adv setting */ |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1169 | bool force_link_chng; |
Michael Chan | 4bb13ab | 2016-04-05 14:09:01 -0400 | [diff] [blame] | 1170 | |
Michael Chan | a1ef4a79 | 2018-08-05 16:51:49 -0400 | [diff] [blame] | 1171 | bool phy_retry; |
| 1172 | unsigned long phy_retry_expires; |
| 1173 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1174 | /* a copy of phy_qcfg output used to report link |
| 1175 | * info to VF |
| 1176 | */ |
| 1177 | struct hwrm_port_phy_qcfg_output phy_qcfg_resp; |
| 1178 | }; |
| 1179 | |
| 1180 | #define BNXT_MAX_QUEUE 8 |
| 1181 | |
| 1182 | struct bnxt_queue_info { |
| 1183 | u8 queue_id; |
| 1184 | u8 queue_profile; |
| 1185 | }; |
| 1186 | |
Michael Chan | 5ad2cbe | 2017-01-13 01:32:03 -0500 | [diff] [blame] | 1187 | #define BNXT_MAX_LED 4 |
| 1188 | |
| 1189 | struct bnxt_led_info { |
| 1190 | u8 led_id; |
| 1191 | u8 led_type; |
| 1192 | u8 led_group_id; |
| 1193 | u8 unused; |
| 1194 | __le16 led_state_caps; |
| 1195 | #define BNXT_LED_ALT_BLINK_CAP(x) ((x) & \ |
| 1196 | cpu_to_le16(PORT_LED_QCAPS_RESP_LED0_STATE_CAPS_BLINK_ALT_SUPPORTED)) |
| 1197 | |
| 1198 | __le16 led_color_caps; |
| 1199 | }; |
| 1200 | |
Michael Chan | eb51365 | 2017-04-04 18:14:12 -0400 | [diff] [blame] | 1201 | #define BNXT_MAX_TEST 8 |
| 1202 | |
| 1203 | struct bnxt_test_info { |
| 1204 | u8 offline_mask; |
Michael Chan | 55fd0cf | 2018-08-05 16:51:48 -0400 | [diff] [blame] | 1205 | u8 flags; |
| 1206 | #define BNXT_TEST_FL_EXT_LPBK 0x1 |
Michael Chan | eb51365 | 2017-04-04 18:14:12 -0400 | [diff] [blame] | 1207 | u16 timeout; |
| 1208 | char string[BNXT_MAX_TEST][ETH_GSTRING_LEN]; |
| 1209 | }; |
| 1210 | |
Venkat Duvvuru | 2e9ee39 | 2018-12-20 03:38:45 -0500 | [diff] [blame] | 1211 | #define BNXT_GRCPF_REG_CHIMP_COMM 0x0 |
| 1212 | #define BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER 0x100 |
| 1213 | #define BNXT_GRCPF_REG_WINDOW_BASE_OUT 0x400 |
| 1214 | #define BNXT_CAG_REG_LEGACY_INT_STATUS 0x4014 |
| 1215 | #define BNXT_CAG_REG_BASE 0x300000 |
Jeffrey Huang | 1180949 | 2015-11-05 16:25:49 -0500 | [diff] [blame] | 1216 | |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1217 | #define BNXT_GRCPF_REG_KONG_COMM 0xA00 |
| 1218 | #define BNXT_GRCPF_REG_KONG_COMM_TRIGGER 0xB00 |
| 1219 | |
Sathya Perla | 5a84acb | 2017-10-26 11:51:31 -0400 | [diff] [blame] | 1220 | struct bnxt_tc_flow_stats { |
| 1221 | u64 packets; |
| 1222 | u64 bytes; |
| 1223 | }; |
| 1224 | |
Sathya Perla | 2ae7408 | 2017-08-28 13:40:33 -0400 | [diff] [blame] | 1225 | struct bnxt_tc_info { |
| 1226 | bool enabled; |
| 1227 | |
| 1228 | /* hash table to store TC offloaded flows */ |
| 1229 | struct rhashtable flow_table; |
| 1230 | struct rhashtable_params flow_ht_params; |
| 1231 | |
| 1232 | /* hash table to store L2 keys of TC flows */ |
| 1233 | struct rhashtable l2_table; |
| 1234 | struct rhashtable_params l2_ht_params; |
Sathya Perla | 8c95f77 | 2017-10-26 11:51:29 -0400 | [diff] [blame] | 1235 | /* hash table to store L2 keys for TC tunnel decap */ |
| 1236 | struct rhashtable decap_l2_table; |
| 1237 | struct rhashtable_params decap_l2_ht_params; |
| 1238 | /* hash table to store tunnel decap entries */ |
| 1239 | struct rhashtable decap_table; |
| 1240 | struct rhashtable_params decap_ht_params; |
| 1241 | /* hash table to store tunnel encap entries */ |
| 1242 | struct rhashtable encap_table; |
| 1243 | struct rhashtable_params encap_ht_params; |
Sathya Perla | 2ae7408 | 2017-08-28 13:40:33 -0400 | [diff] [blame] | 1244 | |
| 1245 | /* lock to atomically add/del an l2 node when a flow is |
| 1246 | * added or deleted. |
| 1247 | */ |
| 1248 | struct mutex lock; |
| 1249 | |
Sathya Perla | 5a84acb | 2017-10-26 11:51:31 -0400 | [diff] [blame] | 1250 | /* Fields used for batching stats query */ |
| 1251 | struct rhashtable_iter iter; |
| 1252 | #define BNXT_FLOW_STATS_BATCH_MAX 10 |
| 1253 | struct bnxt_tc_stats_batch { |
| 1254 | void *flow_node; |
| 1255 | struct bnxt_tc_flow_stats hw_stats; |
| 1256 | } stats_batch[BNXT_FLOW_STATS_BATCH_MAX]; |
| 1257 | |
Sathya Perla | 2ae7408 | 2017-08-28 13:40:33 -0400 | [diff] [blame] | 1258 | /* Stat counter mask (width) */ |
| 1259 | u64 bytes_mask; |
| 1260 | u64 packets_mask; |
| 1261 | }; |
| 1262 | |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 1263 | struct bnxt_vf_rep_stats { |
| 1264 | u64 packets; |
| 1265 | u64 bytes; |
| 1266 | u64 dropped; |
| 1267 | }; |
| 1268 | |
| 1269 | struct bnxt_vf_rep { |
| 1270 | struct bnxt *bp; |
| 1271 | struct net_device *dev; |
Sathya Perla | ee5c7fb | 2017-07-24 12:34:28 -0400 | [diff] [blame] | 1272 | struct metadata_dst *dst; |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 1273 | u16 vf_idx; |
| 1274 | u16 tx_cfa_action; |
| 1275 | u16 rx_cfa_code; |
| 1276 | |
| 1277 | struct bnxt_vf_rep_stats rx_stats; |
| 1278 | struct bnxt_vf_rep_stats tx_stats; |
| 1279 | }; |
| 1280 | |
Michael Chan | 66cca20 | 2018-10-14 07:02:42 -0400 | [diff] [blame] | 1281 | #define PTU_PTE_VALID 0x1UL |
| 1282 | #define PTU_PTE_LAST 0x2UL |
| 1283 | #define PTU_PTE_NEXT_TO_LAST 0x4UL |
| 1284 | |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1285 | #define MAX_CTX_PAGES (BNXT_PAGE_SIZE / 8) |
Michael Chan | 08fe9d1 | 2018-12-20 03:38:50 -0500 | [diff] [blame] | 1286 | #define MAX_CTX_TOTAL_PAGES (MAX_CTX_PAGES * MAX_CTX_PAGES) |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1287 | |
| 1288 | struct bnxt_ctx_pg_info { |
| 1289 | u32 entries; |
Michael Chan | 08fe9d1 | 2018-12-20 03:38:50 -0500 | [diff] [blame] | 1290 | u32 nr_pages; |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1291 | void *ctx_pg_arr[MAX_CTX_PAGES]; |
| 1292 | dma_addr_t ctx_dma_arr[MAX_CTX_PAGES]; |
| 1293 | struct bnxt_ring_mem_info ring_mem; |
Michael Chan | 08fe9d1 | 2018-12-20 03:38:50 -0500 | [diff] [blame] | 1294 | struct bnxt_ctx_pg_info **ctx_pg_tbl; |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1295 | }; |
| 1296 | |
| 1297 | struct bnxt_ctx_mem_info { |
| 1298 | u32 qp_max_entries; |
| 1299 | u16 qp_min_qp1_entries; |
| 1300 | u16 qp_max_l2_entries; |
| 1301 | u16 qp_entry_size; |
| 1302 | u16 srq_max_l2_entries; |
| 1303 | u32 srq_max_entries; |
| 1304 | u16 srq_entry_size; |
| 1305 | u16 cq_max_l2_entries; |
| 1306 | u32 cq_max_entries; |
| 1307 | u16 cq_entry_size; |
| 1308 | u16 vnic_max_vnic_entries; |
| 1309 | u16 vnic_max_ring_table_entries; |
| 1310 | u16 vnic_entry_size; |
| 1311 | u32 stat_max_entries; |
| 1312 | u16 stat_entry_size; |
| 1313 | u16 tqm_entry_size; |
| 1314 | u32 tqm_min_entries_per_ring; |
| 1315 | u32 tqm_max_entries_per_ring; |
| 1316 | u32 mrav_max_entries; |
| 1317 | u16 mrav_entry_size; |
| 1318 | u16 tim_entry_size; |
| 1319 | u32 tim_max_entries; |
Devesh Sharma | 53579e3 | 2019-05-05 07:17:04 -0400 | [diff] [blame] | 1320 | u16 mrav_num_entries_units; |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1321 | u8 tqm_entries_multiple; |
| 1322 | |
| 1323 | u32 flags; |
| 1324 | #define BNXT_CTX_FLAG_INITED 0x01 |
| 1325 | |
| 1326 | struct bnxt_ctx_pg_info qp_mem; |
| 1327 | struct bnxt_ctx_pg_info srq_mem; |
| 1328 | struct bnxt_ctx_pg_info cq_mem; |
| 1329 | struct bnxt_ctx_pg_info vnic_mem; |
| 1330 | struct bnxt_ctx_pg_info stat_mem; |
Michael Chan | cf6daed | 2018-12-20 03:38:51 -0500 | [diff] [blame] | 1331 | struct bnxt_ctx_pg_info mrav_mem; |
| 1332 | struct bnxt_ctx_pg_info tim_mem; |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1333 | struct bnxt_ctx_pg_info *tqm_mem[9]; |
| 1334 | }; |
| 1335 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1336 | struct bnxt { |
| 1337 | void __iomem *bar0; |
| 1338 | void __iomem *bar1; |
| 1339 | void __iomem *bar2; |
| 1340 | |
| 1341 | u32 reg_base; |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1342 | u16 chip_num; |
| 1343 | #define CHIP_NUM_57301 0x16c8 |
| 1344 | #define CHIP_NUM_57302 0x16c9 |
| 1345 | #define CHIP_NUM_57304 0x16ca |
Prashant Sreedharan | 3e8060f | 2016-07-18 07:15:20 -0400 | [diff] [blame] | 1346 | #define CHIP_NUM_58700 0x16cd |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1347 | #define CHIP_NUM_57402 0x16d0 |
| 1348 | #define CHIP_NUM_57404 0x16d1 |
| 1349 | #define CHIP_NUM_57406 0x16d2 |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1350 | #define CHIP_NUM_57407 0x16d5 |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1351 | |
| 1352 | #define CHIP_NUM_57311 0x16ce |
| 1353 | #define CHIP_NUM_57312 0x16cf |
| 1354 | #define CHIP_NUM_57314 0x16df |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1355 | #define CHIP_NUM_57317 0x16e0 |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1356 | #define CHIP_NUM_57412 0x16d6 |
| 1357 | #define CHIP_NUM_57414 0x16d7 |
| 1358 | #define CHIP_NUM_57416 0x16d8 |
| 1359 | #define CHIP_NUM_57417 0x16d9 |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1360 | #define CHIP_NUM_57412L 0x16da |
| 1361 | #define CHIP_NUM_57414L 0x16db |
| 1362 | |
| 1363 | #define CHIP_NUM_5745X 0xd730 |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1364 | |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 1365 | #define CHIP_NUM_57500 0x1750 |
| 1366 | |
Ray Jui | 4a58139 | 2017-08-28 13:40:28 -0400 | [diff] [blame] | 1367 | #define CHIP_NUM_58802 0xd802 |
Ray Jui | 8ed693b | 2017-10-26 11:51:20 -0400 | [diff] [blame] | 1368 | #define CHIP_NUM_58804 0xd804 |
Ray Jui | 4a58139 | 2017-08-28 13:40:28 -0400 | [diff] [blame] | 1369 | #define CHIP_NUM_58808 0xd808 |
| 1370 | |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1371 | #define BNXT_CHIP_NUM_5730X(chip_num) \ |
| 1372 | ((chip_num) >= CHIP_NUM_57301 && \ |
| 1373 | (chip_num) <= CHIP_NUM_57304) |
| 1374 | |
| 1375 | #define BNXT_CHIP_NUM_5740X(chip_num) \ |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1376 | (((chip_num) >= CHIP_NUM_57402 && \ |
| 1377 | (chip_num) <= CHIP_NUM_57406) || \ |
| 1378 | (chip_num) == CHIP_NUM_57407) |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1379 | |
| 1380 | #define BNXT_CHIP_NUM_5731X(chip_num) \ |
| 1381 | ((chip_num) == CHIP_NUM_57311 || \ |
| 1382 | (chip_num) == CHIP_NUM_57312 || \ |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1383 | (chip_num) == CHIP_NUM_57314 || \ |
| 1384 | (chip_num) == CHIP_NUM_57317) |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1385 | |
| 1386 | #define BNXT_CHIP_NUM_5741X(chip_num) \ |
| 1387 | ((chip_num) >= CHIP_NUM_57412 && \ |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1388 | (chip_num) <= CHIP_NUM_57414L) |
| 1389 | |
| 1390 | #define BNXT_CHIP_NUM_58700(chip_num) \ |
| 1391 | ((chip_num) == CHIP_NUM_58700) |
| 1392 | |
| 1393 | #define BNXT_CHIP_NUM_5745X(chip_num) \ |
| 1394 | ((chip_num) == CHIP_NUM_5745X) |
Michael Chan | 659c805 | 2016-06-13 02:25:33 -0400 | [diff] [blame] | 1395 | |
| 1396 | #define BNXT_CHIP_NUM_57X0X(chip_num) \ |
| 1397 | (BNXT_CHIP_NUM_5730X(chip_num) || BNXT_CHIP_NUM_5740X(chip_num)) |
| 1398 | |
| 1399 | #define BNXT_CHIP_NUM_57X1X(chip_num) \ |
| 1400 | (BNXT_CHIP_NUM_5731X(chip_num) || BNXT_CHIP_NUM_5741X(chip_num)) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1401 | |
Ray Jui | 4a58139 | 2017-08-28 13:40:28 -0400 | [diff] [blame] | 1402 | #define BNXT_CHIP_NUM_588XX(chip_num) \ |
| 1403 | ((chip_num) == CHIP_NUM_58802 || \ |
Ray Jui | 8ed693b | 2017-10-26 11:51:20 -0400 | [diff] [blame] | 1404 | (chip_num) == CHIP_NUM_58804 || \ |
Ray Jui | 4a58139 | 2017-08-28 13:40:28 -0400 | [diff] [blame] | 1405 | (chip_num) == CHIP_NUM_58808) |
| 1406 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1407 | struct net_device *dev; |
| 1408 | struct pci_dev *pdev; |
| 1409 | |
| 1410 | atomic_t intr_sem; |
| 1411 | |
| 1412 | u32 flags; |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 1413 | #define BNXT_FLAG_CHIP_P5 0x1 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1414 | #define BNXT_FLAG_VF 0x2 |
| 1415 | #define BNXT_FLAG_LRO 0x4 |
Michael Chan | d1611c3 | 2015-10-25 22:27:57 -0400 | [diff] [blame] | 1416 | #ifdef CONFIG_INET |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1417 | #define BNXT_FLAG_GRO 0x8 |
Michael Chan | d1611c3 | 2015-10-25 22:27:57 -0400 | [diff] [blame] | 1418 | #else |
| 1419 | /* Cannot support hardware GRO if CONFIG_INET is not set */ |
| 1420 | #define BNXT_FLAG_GRO 0x0 |
| 1421 | #endif |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1422 | #define BNXT_FLAG_TPA (BNXT_FLAG_LRO | BNXT_FLAG_GRO) |
| 1423 | #define BNXT_FLAG_JUMBO 0x10 |
| 1424 | #define BNXT_FLAG_STRIP_VLAN 0x20 |
| 1425 | #define BNXT_FLAG_AGG_RINGS (BNXT_FLAG_JUMBO | BNXT_FLAG_GRO | \ |
| 1426 | BNXT_FLAG_LRO) |
| 1427 | #define BNXT_FLAG_USING_MSIX 0x40 |
| 1428 | #define BNXT_FLAG_MSIX_CAP 0x80 |
| 1429 | #define BNXT_FLAG_RFS 0x100 |
Michael Chan | 6e6c5a5 | 2016-01-02 23:45:02 -0500 | [diff] [blame] | 1430 | #define BNXT_FLAG_SHARED_RINGS 0x200 |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1431 | #define BNXT_FLAG_PORT_STATS 0x400 |
Michael Chan | 87da7f7 | 2016-11-16 21:13:09 -0500 | [diff] [blame] | 1432 | #define BNXT_FLAG_UDP_RSS_CAP 0x800 |
Michael Chan | 170ce01 | 2016-04-05 14:08:57 -0400 | [diff] [blame] | 1433 | #define BNXT_FLAG_EEE_CAP 0x1000 |
Michael Chan | 8fdefd6 | 2016-12-29 12:13:36 -0500 | [diff] [blame] | 1434 | #define BNXT_FLAG_NEW_RSS_CAP 0x2000 |
Michael Chan | c1ef146 | 2017-04-04 18:14:07 -0400 | [diff] [blame] | 1435 | #define BNXT_FLAG_WOL_CAP 0x4000 |
Michael Chan | e4060d3 | 2016-12-07 00:26:19 -0500 | [diff] [blame] | 1436 | #define BNXT_FLAG_ROCEV1_CAP 0x8000 |
| 1437 | #define BNXT_FLAG_ROCEV2_CAP 0x10000 |
| 1438 | #define BNXT_FLAG_ROCE_CAP (BNXT_FLAG_ROCEV1_CAP | \ |
| 1439 | BNXT_FLAG_ROCEV2_CAP) |
Michael Chan | bdbd1eb | 2016-12-29 12:13:43 -0500 | [diff] [blame] | 1440 | #define BNXT_FLAG_NO_AGG_RINGS 0x20000 |
Michael Chan | c61fb99 | 2017-02-06 16:55:36 -0500 | [diff] [blame] | 1441 | #define BNXT_FLAG_RX_PAGE_MODE 0x40000 |
Deepak Khungar | 9e54e32 | 2017-04-21 20:11:26 -0400 | [diff] [blame] | 1442 | #define BNXT_FLAG_MULTI_HOST 0x100000 |
Michael Chan | 434c975 | 2017-05-29 19:06:08 -0400 | [diff] [blame] | 1443 | #define BNXT_FLAG_DOUBLE_DB 0x400000 |
Prashant Sreedharan | 3e8060f | 2016-07-18 07:15:20 -0400 | [diff] [blame] | 1444 | #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 |
Andy Gospodarek | 6a8788f | 2018-01-09 16:06:20 -0500 | [diff] [blame] | 1445 | #define BNXT_FLAG_DIM 0x2000000 |
Michael Chan | abe93ad | 2018-03-31 13:54:08 -0400 | [diff] [blame] | 1446 | #define BNXT_FLAG_ROCE_MIRROR_CAP 0x4000000 |
Vasundhara Volam | 00db3cb | 2018-03-31 13:54:12 -0400 | [diff] [blame] | 1447 | #define BNXT_FLAG_PORT_STATS_EXT 0x10000000 |
Vasundhara Volam | 55e4398 | 2019-05-05 07:17:00 -0400 | [diff] [blame] | 1448 | #define BNXT_FLAG_PCIE_STATS 0x40000000 |
Michael Chan | 6e6c5a5 | 2016-01-02 23:45:02 -0500 | [diff] [blame] | 1449 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1450 | #define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \ |
| 1451 | BNXT_FLAG_RFS | \ |
| 1452 | BNXT_FLAG_STRIP_VLAN) |
| 1453 | |
| 1454 | #define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF)) |
| 1455 | #define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF) |
Satish Baddipadige | 567b2ab | 2016-06-13 02:25:31 -0400 | [diff] [blame] | 1456 | #define BNXT_NPAR(bp) ((bp)->port_partition_type) |
Deepak Khungar | 9e54e32 | 2017-04-21 20:11:26 -0400 | [diff] [blame] | 1457 | #define BNXT_MH(bp) ((bp)->flags & BNXT_FLAG_MULTI_HOST) |
| 1458 | #define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp)) |
Prashant Sreedharan | 3e8060f | 2016-07-18 07:15:20 -0400 | [diff] [blame] | 1459 | #define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0) |
Michael Chan | c61fb99 | 2017-02-06 16:55:36 -0500 | [diff] [blame] | 1460 | #define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE) |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 1461 | #define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \ |
Michael Chan | 7c38091 | 2019-07-29 06:10:31 -0400 | [diff] [blame^] | 1462 | (!((bp)->flags & BNXT_FLAG_CHIP_P5) || \ |
| 1463 | (bp)->max_tpa_v2) && !is_kdump_kernel()) |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1464 | |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 1465 | /* Chip class phase 5 */ |
| 1466 | #define BNXT_CHIP_P5(bp) \ |
| 1467 | ((bp)->chip_num == CHIP_NUM_57500) |
| 1468 | |
| 1469 | /* Chip class phase 4.x */ |
| 1470 | #define BNXT_CHIP_P4(bp) \ |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1471 | (BNXT_CHIP_NUM_57X1X((bp)->chip_num) || \ |
| 1472 | BNXT_CHIP_NUM_5745X((bp)->chip_num) || \ |
Ray Jui | 4a58139 | 2017-08-28 13:40:28 -0400 | [diff] [blame] | 1473 | BNXT_CHIP_NUM_588XX((bp)->chip_num) || \ |
Michael Chan | 3284f9e | 2017-05-29 19:06:07 -0400 | [diff] [blame] | 1474 | (BNXT_CHIP_NUM_58700((bp)->chip_num) && \ |
| 1475 | !BNXT_CHIP_TYPE_NITRO_A0(bp))) |
| 1476 | |
Michael Chan | e38287b | 2018-10-14 07:02:45 -0400 | [diff] [blame] | 1477 | #define BNXT_CHIP_P4_PLUS(bp) \ |
| 1478 | (BNXT_CHIP_P4(bp) || BNXT_CHIP_P5(bp)) |
| 1479 | |
Michael Chan | a588e45 | 2016-12-07 00:26:21 -0500 | [diff] [blame] | 1480 | struct bnxt_en_dev *edev; |
| 1481 | struct bnxt_en_dev * (*ulp_probe)(struct net_device *); |
| 1482 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1483 | struct bnxt_napi **bnapi; |
| 1484 | |
Michael Chan | b6ab4b0 | 2016-01-02 23:44:59 -0500 | [diff] [blame] | 1485 | struct bnxt_rx_ring_info *rx_ring; |
| 1486 | struct bnxt_tx_ring_info *tx_ring; |
Michael Chan | a960dec | 2017-02-06 16:55:39 -0500 | [diff] [blame] | 1487 | u16 *tx_ring_map; |
Michael Chan | b6ab4b0 | 2016-01-02 23:44:59 -0500 | [diff] [blame] | 1488 | |
Michael Chan | 309369c | 2016-06-13 02:25:34 -0400 | [diff] [blame] | 1489 | struct sk_buff * (*gro_func)(struct bnxt_tpa_info *, int, int, |
| 1490 | struct sk_buff *); |
| 1491 | |
Michael Chan | 6bb1947 | 2017-02-06 16:55:32 -0500 | [diff] [blame] | 1492 | struct sk_buff * (*rx_skb_func)(struct bnxt *, |
| 1493 | struct bnxt_rx_ring_info *, |
| 1494 | u16, void *, u8 *, dma_addr_t, |
| 1495 | unsigned int); |
| 1496 | |
Michael Chan | 79632e9 | 2019-07-29 06:10:21 -0400 | [diff] [blame] | 1497 | u16 max_tpa_v2; |
| 1498 | u16 max_tpa; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1499 | u32 rx_buf_size; |
| 1500 | u32 rx_buf_use_size; /* useable size */ |
Michael Chan | b3dba77 | 2017-02-06 16:55:35 -0500 | [diff] [blame] | 1501 | u16 rx_offset; |
| 1502 | u16 rx_dma_offset; |
Michael Chan | 745fc05 | 2017-02-06 16:55:34 -0500 | [diff] [blame] | 1503 | enum dma_data_direction rx_dir; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1504 | u32 rx_ring_size; |
| 1505 | u32 rx_agg_ring_size; |
| 1506 | u32 rx_copy_thresh; |
| 1507 | u32 rx_ring_mask; |
| 1508 | u32 rx_agg_ring_mask; |
| 1509 | int rx_nr_pages; |
| 1510 | int rx_agg_nr_pages; |
| 1511 | int rx_nr_rings; |
| 1512 | int rsscos_nr_ctxs; |
| 1513 | |
| 1514 | u32 tx_ring_size; |
| 1515 | u32 tx_ring_mask; |
| 1516 | int tx_nr_pages; |
| 1517 | int tx_nr_rings; |
| 1518 | int tx_nr_rings_per_tc; |
Michael Chan | 5f44924 | 2017-02-06 16:55:40 -0500 | [diff] [blame] | 1519 | int tx_nr_rings_xdp; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1520 | |
| 1521 | int tx_wake_thresh; |
| 1522 | int tx_push_thresh; |
| 1523 | int tx_push_size; |
| 1524 | |
| 1525 | u32 cp_ring_size; |
| 1526 | u32 cp_ring_mask; |
| 1527 | u32 cp_bit; |
| 1528 | int cp_nr_pages; |
| 1529 | int cp_nr_rings; |
| 1530 | |
Michael Chan | b81a90d | 2016-01-02 23:45:01 -0500 | [diff] [blame] | 1531 | /* grp_info indexed by completion ring index */ |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1532 | struct bnxt_ring_grp_info *grp_info; |
| 1533 | struct bnxt_vnic_info *vnic_info; |
| 1534 | int nr_vnics; |
Michael Chan | 87da7f7 | 2016-11-16 21:13:09 -0500 | [diff] [blame] | 1535 | u32 rss_hash_cfg; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1536 | |
Michael Chan | 7eb9bb3 | 2017-10-26 11:51:25 -0400 | [diff] [blame] | 1537 | u16 max_mtu; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1538 | u8 max_tc; |
Michael Chan | 87c374d | 2016-12-02 21:17:16 -0500 | [diff] [blame] | 1539 | u8 max_lltc; /* lossless TCs */ |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1540 | struct bnxt_queue_info q_info[BNXT_MAX_QUEUE]; |
Michael Chan | 2e8ef77 | 2018-04-26 17:44:31 -0400 | [diff] [blame] | 1541 | u8 tc_to_qidx[BNXT_MAX_QUEUE]; |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1542 | u8 q_ids[BNXT_MAX_QUEUE]; |
| 1543 | u8 max_q; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1544 | |
| 1545 | unsigned int current_interval; |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1546 | #define BNXT_TIMER_INTERVAL HZ |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1547 | |
| 1548 | struct timer_list timer; |
| 1549 | |
Michael Chan | caefe52 | 2015-12-09 19:35:42 -0500 | [diff] [blame] | 1550 | unsigned long state; |
| 1551 | #define BNXT_STATE_OPEN 0 |
Michael Chan | 4cebdce | 2015-12-09 19:35:43 -0500 | [diff] [blame] | 1552 | #define BNXT_STATE_IN_SP_TASK 1 |
Michael Chan | f9b76eb | 2017-07-11 13:05:34 -0400 | [diff] [blame] | 1553 | #define BNXT_STATE_READ_STATS 2 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1554 | |
| 1555 | struct bnxt_irq *irq_tbl; |
Michael Chan | 7809592 | 2016-12-07 00:26:16 -0500 | [diff] [blame] | 1556 | int total_irqs; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1557 | u8 mac_addr[ETH_ALEN]; |
| 1558 | |
Michael Chan | 7df4ae9 | 2016-12-02 21:17:17 -0500 | [diff] [blame] | 1559 | #ifdef CONFIG_BNXT_DCB |
| 1560 | struct ieee_pfc *ieee_pfc; |
| 1561 | struct ieee_ets *ieee_ets; |
| 1562 | u8 dcbx_cap; |
| 1563 | u8 default_pri; |
Michael Chan | afdc8a8 | 2018-08-05 16:51:57 -0400 | [diff] [blame] | 1564 | u8 max_dscp_value; |
Michael Chan | 7df4ae9 | 2016-12-02 21:17:17 -0500 | [diff] [blame] | 1565 | #endif /* CONFIG_BNXT_DCB */ |
| 1566 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1567 | u32 msg_enable; |
| 1568 | |
Michael Chan | 97381a1 | 2018-08-05 16:51:54 -0400 | [diff] [blame] | 1569 | u32 fw_cap; |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1570 | #define BNXT_FW_CAP_SHORT_CMD 0x00000001 |
| 1571 | #define BNXT_FW_CAP_LLDP_AGENT 0x00000002 |
| 1572 | #define BNXT_FW_CAP_DCBX_AGENT 0x00000004 |
| 1573 | #define BNXT_FW_CAP_NEW_RM 0x00000008 |
| 1574 | #define BNXT_FW_CAP_IF_CHANGE 0x00000010 |
| 1575 | #define BNXT_FW_CAP_KONG_MB_CHNL 0x00000080 |
Venkat Duvvuru | abd43a1 | 2018-12-20 03:38:52 -0500 | [diff] [blame] | 1576 | #define BNXT_FW_CAP_OVS_64BIT_HANDLE 0x00000400 |
Michael Chan | 2a51644 | 2019-02-19 05:31:14 -0500 | [diff] [blame] | 1577 | #define BNXT_FW_CAP_TRUSTED_VF 0x00000800 |
Vasundhara Volam | 691aa62 | 2019-05-05 07:17:02 -0400 | [diff] [blame] | 1578 | #define BNXT_FW_CAP_PKG_VER 0x00004000 |
Michael Chan | e969ae5 | 2019-05-05 07:17:06 -0400 | [diff] [blame] | 1579 | #define BNXT_FW_CAP_CFA_ADV_FLOW 0x00008000 |
| 1580 | #define BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX 0x00010000 |
Vasundhara Volam | 55e4398 | 2019-05-05 07:17:00 -0400 | [diff] [blame] | 1581 | #define BNXT_FW_CAP_PCIE_STATS_SUPPORTED 0x00020000 |
Vasundhara Volam | 6154532 | 2019-05-05 07:17:01 -0400 | [diff] [blame] | 1582 | #define BNXT_FW_CAP_EXT_STATS_SUPPORTED 0x00040000 |
Michael Chan | 97381a1 | 2018-08-05 16:51:54 -0400 | [diff] [blame] | 1583 | |
| 1584 | #define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM) |
Michael Chan | 11f15ed | 2016-04-05 14:08:55 -0400 | [diff] [blame] | 1585 | u32 hwrm_spec_code; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1586 | u16 hwrm_cmd_seq; |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1587 | u16 hwrm_cmd_kong_seq; |
Venkat Duvvuru | fc718bb | 2018-12-20 03:38:44 -0500 | [diff] [blame] | 1588 | u16 hwrm_intr_seq_id; |
Deepak Khungar | e605db8 | 2017-05-29 19:06:04 -0400 | [diff] [blame] | 1589 | void *hwrm_short_cmd_req_addr; |
| 1590 | dma_addr_t hwrm_short_cmd_req_dma_addr; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1591 | void *hwrm_cmd_resp_addr; |
| 1592 | dma_addr_t hwrm_cmd_resp_dma_addr; |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1593 | void *hwrm_cmd_kong_resp_addr; |
| 1594 | dma_addr_t hwrm_cmd_kong_resp_dma_addr; |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1595 | |
Michael Chan | b8875ca | 2018-12-16 18:46:29 -0500 | [diff] [blame] | 1596 | struct rtnl_link_stats64 net_stats_prev; |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1597 | struct rx_port_stats *hw_rx_port_stats; |
| 1598 | struct tx_port_stats *hw_tx_port_stats; |
Vasundhara Volam | 00db3cb | 2018-03-31 13:54:12 -0400 | [diff] [blame] | 1599 | struct rx_port_stats_ext *hw_rx_port_stats_ext; |
Dan Carpenter | 35b842f | 2018-10-18 11:02:39 +0300 | [diff] [blame] | 1600 | struct tx_port_stats_ext *hw_tx_port_stats_ext; |
Vasundhara Volam | 55e4398 | 2019-05-05 07:17:00 -0400 | [diff] [blame] | 1601 | struct pcie_ctx_hw_stats *hw_pcie_stats; |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1602 | dma_addr_t hw_rx_port_stats_map; |
| 1603 | dma_addr_t hw_tx_port_stats_map; |
Vasundhara Volam | 00db3cb | 2018-03-31 13:54:12 -0400 | [diff] [blame] | 1604 | dma_addr_t hw_rx_port_stats_ext_map; |
Michael Chan | 36e5334 | 2018-10-14 07:02:38 -0400 | [diff] [blame] | 1605 | dma_addr_t hw_tx_port_stats_ext_map; |
Vasundhara Volam | 55e4398 | 2019-05-05 07:17:00 -0400 | [diff] [blame] | 1606 | dma_addr_t hw_pcie_stats_map; |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1607 | int hw_port_stats_size; |
Michael Chan | 36e5334 | 2018-10-14 07:02:38 -0400 | [diff] [blame] | 1608 | u16 fw_rx_stats_ext_size; |
| 1609 | u16 fw_tx_stats_ext_size; |
Michael Chan | 4e74850 | 2019-07-29 06:10:29 -0400 | [diff] [blame] | 1610 | u16 hw_ring_stats_size; |
Michael Chan | e37fed7 | 2018-12-16 18:46:26 -0500 | [diff] [blame] | 1611 | u8 pri2cos[8]; |
| 1612 | u8 pri2cos_valid; |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1613 | |
Michael Chan | e6ef269 | 2016-03-28 19:46:05 -0400 | [diff] [blame] | 1614 | u16 hwrm_max_req_len; |
Michael Chan | 1dfddc4 | 2018-10-14 07:02:39 -0400 | [diff] [blame] | 1615 | u16 hwrm_max_ext_req_len; |
Michael Chan | ff4fe81 | 2016-02-26 04:00:04 -0500 | [diff] [blame] | 1616 | int hwrm_cmd_timeout; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1617 | struct mutex hwrm_cmd_lock; /* serialize hwrm messages */ |
| 1618 | struct hwrm_ver_get_output ver_resp; |
| 1619 | #define FW_VER_STR_LEN 32 |
| 1620 | #define BC_HWRM_STR_LEN 21 |
| 1621 | #define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN) |
| 1622 | char fw_ver_str[FW_VER_STR_LEN]; |
| 1623 | __be16 vxlan_port; |
| 1624 | u8 vxlan_port_cnt; |
| 1625 | __le16 vxlan_fw_dst_port_id; |
Alexander Duyck | 7cdd5fc | 2016-06-16 12:21:36 -0700 | [diff] [blame] | 1626 | __be16 nge_port; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1627 | u8 nge_port_cnt; |
| 1628 | __le16 nge_fw_dst_port_id; |
Satish Baddipadige | 567b2ab | 2016-06-13 02:25:31 -0400 | [diff] [blame] | 1629 | u8 port_partition_type; |
Michael Chan | d5430d3 | 2017-08-28 13:40:31 -0400 | [diff] [blame] | 1630 | u8 port_count; |
Michael Chan | 32e8239c | 2017-07-24 12:34:21 -0400 | [diff] [blame] | 1631 | u16 br_mode; |
Michael Chan | dfc9c94 | 2016-02-26 04:00:03 -0500 | [diff] [blame] | 1632 | |
Michael Chan | 74706af | 2018-10-14 07:02:40 -0400 | [diff] [blame] | 1633 | struct bnxt_coal_cap coal_cap; |
Michael Chan | 18775aa | 2017-10-26 11:51:27 -0400 | [diff] [blame] | 1634 | struct bnxt_coal rx_coal; |
| 1635 | struct bnxt_coal tx_coal; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1636 | |
Michael Chan | 51f3078 | 2016-07-01 18:46:29 -0400 | [diff] [blame] | 1637 | u32 stats_coal_ticks; |
| 1638 | #define BNXT_DEF_STATS_COAL_TICKS 1000000 |
| 1639 | #define BNXT_MIN_STATS_COAL_TICKS 250000 |
| 1640 | #define BNXT_MAX_STATS_COAL_TICKS 1000000 |
| 1641 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1642 | struct work_struct sp_task; |
| 1643 | unsigned long sp_event; |
| 1644 | #define BNXT_RX_MASK_SP_EVENT 0 |
| 1645 | #define BNXT_RX_NTP_FLTR_SP_EVENT 1 |
| 1646 | #define BNXT_LINK_CHNG_SP_EVENT 2 |
Jeffrey Huang | c5d7774 | 2015-11-05 16:25:47 -0500 | [diff] [blame] | 1647 | #define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT 3 |
| 1648 | #define BNXT_VXLAN_ADD_PORT_SP_EVENT 4 |
| 1649 | #define BNXT_VXLAN_DEL_PORT_SP_EVENT 5 |
| 1650 | #define BNXT_RESET_TASK_SP_EVENT 6 |
| 1651 | #define BNXT_RST_RING_SP_EVENT 7 |
Jeffrey Huang | 1924136 | 2016-02-26 04:00:00 -0500 | [diff] [blame] | 1652 | #define BNXT_HWRM_PF_UNLOAD_SP_EVENT 8 |
Michael Chan | 3bdf56c | 2016-03-07 15:38:45 -0500 | [diff] [blame] | 1653 | #define BNXT_PERIODIC_STATS_SP_EVENT 9 |
Michael Chan | 4bb13ab | 2016-04-05 14:09:01 -0400 | [diff] [blame] | 1654 | #define BNXT_HWRM_PORT_MODULE_SP_EVENT 10 |
Michael Chan | fc0f192 | 2016-06-13 02:25:30 -0400 | [diff] [blame] | 1655 | #define BNXT_RESET_TASK_SILENT_SP_EVENT 11 |
Alexander Duyck | 7cdd5fc | 2016-06-16 12:21:36 -0700 | [diff] [blame] | 1656 | #define BNXT_GENEVE_ADD_PORT_SP_EVENT 12 |
| 1657 | #define BNXT_GENEVE_DEL_PORT_SP_EVENT 13 |
Michael Chan | 286ef9d | 2016-11-16 21:13:08 -0500 | [diff] [blame] | 1658 | #define BNXT_LINK_SPEED_CHNG_SP_EVENT 14 |
Sathya Perla | 5a84acb | 2017-10-26 11:51:31 -0400 | [diff] [blame] | 1659 | #define BNXT_FLOW_STATS_SP_EVENT 15 |
Michael Chan | a1ef4a79 | 2018-08-05 16:51:49 -0400 | [diff] [blame] | 1660 | #define BNXT_UPDATE_PHY_SP_EVENT 16 |
Michael Chan | ffd7762 | 2018-11-15 03:25:40 -0500 | [diff] [blame] | 1661 | #define BNXT_RING_COAL_NOW_SP_EVENT 17 |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1662 | |
Michael Chan | 6a4f294 | 2018-01-17 03:21:06 -0500 | [diff] [blame] | 1663 | struct bnxt_hw_resc hw_resc; |
Michael Chan | 379a80a | 2015-10-23 15:06:19 -0400 | [diff] [blame] | 1664 | struct bnxt_pf_info pf; |
Michael Chan | 98f04cf | 2018-10-14 07:02:43 -0400 | [diff] [blame] | 1665 | struct bnxt_ctx_mem_info *ctx; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1666 | #ifdef CONFIG_BNXT_SRIOV |
| 1667 | int nr_vfs; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1668 | struct bnxt_vf_info vf; |
| 1669 | wait_queue_head_t sriov_cfg_wait; |
| 1670 | bool sriov_cfg; |
| 1671 | #define BNXT_SRIOV_CFG_WAIT_TMO msecs_to_jiffies(10000) |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 1672 | |
| 1673 | /* lock to protect VF-rep creation/cleanup via |
| 1674 | * multiple paths such as ->sriov_configure() and |
| 1675 | * devlink ->eswitch_mode_set() |
| 1676 | */ |
| 1677 | struct mutex sriov_lock; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1678 | #endif |
| 1679 | |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 1680 | #if BITS_PER_LONG == 32 |
| 1681 | /* ensure atomic 64-bit doorbell writes on 32-bit systems. */ |
| 1682 | spinlock_t db_lock; |
| 1683 | #endif |
| 1684 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1685 | #define BNXT_NTP_FLTR_MAX_FLTR 4096 |
| 1686 | #define BNXT_NTP_FLTR_HASH_SIZE 512 |
| 1687 | #define BNXT_NTP_FLTR_HASH_MASK (BNXT_NTP_FLTR_HASH_SIZE - 1) |
| 1688 | struct hlist_head ntp_fltr_hash_tbl[BNXT_NTP_FLTR_HASH_SIZE]; |
| 1689 | spinlock_t ntp_fltr_lock; /* for hash table add, del */ |
| 1690 | |
| 1691 | unsigned long *ntp_fltr_bmap; |
| 1692 | int ntp_fltr_count; |
| 1693 | |
Michael Chan | e2dc9b6 | 2017-10-13 21:09:30 -0400 | [diff] [blame] | 1694 | /* To protect link related settings during link changes and |
| 1695 | * ethtool settings changes. |
| 1696 | */ |
| 1697 | struct mutex link_lock; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1698 | struct bnxt_link_info link_info; |
Michael Chan | 170ce01 | 2016-04-05 14:08:57 -0400 | [diff] [blame] | 1699 | struct ethtool_eee eee; |
| 1700 | u32 lpi_tmr_lo; |
| 1701 | u32 lpi_tmr_hi; |
Michael Chan | 5ad2cbe | 2017-01-13 01:32:03 -0500 | [diff] [blame] | 1702 | |
Michael Chan | eb51365 | 2017-04-04 18:14:12 -0400 | [diff] [blame] | 1703 | u8 num_tests; |
| 1704 | struct bnxt_test_info *test_info; |
| 1705 | |
Michael Chan | c1ef146 | 2017-04-04 18:14:07 -0400 | [diff] [blame] | 1706 | u8 wol_filter_id; |
| 1707 | u8 wol; |
| 1708 | |
Michael Chan | 5ad2cbe | 2017-01-13 01:32:03 -0500 | [diff] [blame] | 1709 | u8 num_leds; |
| 1710 | struct bnxt_led_info leds[BNXT_MAX_LED]; |
Michael Chan | c6d30e8 | 2017-02-06 16:55:42 -0500 | [diff] [blame] | 1711 | |
| 1712 | struct bpf_prog *xdp_prog; |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 1713 | |
| 1714 | /* devlink interface and vf-rep structs */ |
| 1715 | struct devlink *dl; |
Vasundhara Volam | 782a624 | 2019-01-28 18:00:27 +0530 | [diff] [blame] | 1716 | struct devlink_port dl_port; |
Sathya Perla | 4ab0c6a | 2017-07-24 12:34:27 -0400 | [diff] [blame] | 1717 | enum devlink_eswitch_mode eswitch_mode; |
| 1718 | struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */ |
| 1719 | u16 *cfa_code_map; /* cfa_code -> vf_idx map */ |
Sathya Perla | dd4ea1d | 2018-01-17 03:21:16 -0500 | [diff] [blame] | 1720 | u8 switch_id[8]; |
Sathya Perla | cd66358 | 2017-10-26 11:51:32 -0400 | [diff] [blame] | 1721 | struct bnxt_tc_info *tc_info; |
Andy Gospodarek | cabfb09 | 2018-04-26 17:44:40 -0400 | [diff] [blame] | 1722 | struct dentry *debugfs_pdev; |
| 1723 | struct dentry *debugfs_dim; |
Vasundhara Volam | cde49a4 | 2018-08-05 16:51:56 -0400 | [diff] [blame] | 1724 | struct device *hwmon_dev; |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1725 | }; |
| 1726 | |
Michael Chan | c77192f | 2016-12-02 21:17:18 -0500 | [diff] [blame] | 1727 | #define BNXT_RX_STATS_OFFSET(counter) \ |
| 1728 | (offsetof(struct rx_port_stats, counter) / 8) |
| 1729 | |
| 1730 | #define BNXT_TX_STATS_OFFSET(counter) \ |
| 1731 | ((offsetof(struct tx_port_stats, counter) + \ |
| 1732 | sizeof(struct rx_port_stats) + 512) / 8) |
| 1733 | |
Vasundhara Volam | 00db3cb | 2018-03-31 13:54:12 -0400 | [diff] [blame] | 1734 | #define BNXT_RX_STATS_EXT_OFFSET(counter) \ |
| 1735 | (offsetof(struct rx_port_stats_ext, counter) / 8) |
| 1736 | |
Michael Chan | 36e5334 | 2018-10-14 07:02:38 -0400 | [diff] [blame] | 1737 | #define BNXT_TX_STATS_EXT_OFFSET(counter) \ |
| 1738 | (offsetof(struct tx_port_stats_ext, counter) / 8) |
| 1739 | |
Vasundhara Volam | 55e4398 | 2019-05-05 07:17:00 -0400 | [diff] [blame] | 1740 | #define BNXT_PCIE_STATS_OFFSET(counter) \ |
| 1741 | (offsetof(struct pcie_ctx_hw_stats, counter) / 8) |
| 1742 | |
Ajit Khaparde | 42ee18f | 2016-05-15 03:04:44 -0400 | [diff] [blame] | 1743 | #define I2C_DEV_ADDR_A0 0xa0 |
| 1744 | #define I2C_DEV_ADDR_A2 0xa2 |
Vasundhara Volam | 7328a23 | 2018-05-08 03:18:40 -0400 | [diff] [blame] | 1745 | #define SFF_DIAG_SUPPORT_OFFSET 0x5c |
Ajit Khaparde | 42ee18f | 2016-05-15 03:04:44 -0400 | [diff] [blame] | 1746 | #define SFF_MODULE_ID_SFP 0x3 |
| 1747 | #define SFF_MODULE_ID_QSFP 0xc |
| 1748 | #define SFF_MODULE_ID_QSFP_PLUS 0xd |
| 1749 | #define SFF_MODULE_ID_QSFP28 0x11 |
| 1750 | #define BNXT_MAX_PHY_I2C_RESP_SIZE 64 |
| 1751 | |
Michael Chan | 3841340 | 2017-02-06 16:55:43 -0500 | [diff] [blame] | 1752 | static inline u32 bnxt_tx_avail(struct bnxt *bp, struct bnxt_tx_ring_info *txr) |
| 1753 | { |
| 1754 | /* Tell compiler to fetch tx indices from memory. */ |
| 1755 | barrier(); |
| 1756 | |
| 1757 | return bp->tx_ring_size - |
| 1758 | ((txr->tx_prod - txr->tx_cons) & bp->tx_ring_mask); |
| 1759 | } |
| 1760 | |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 1761 | #if BITS_PER_LONG == 32 |
| 1762 | #define writeq(val64, db) \ |
| 1763 | do { \ |
| 1764 | spin_lock(&bp->db_lock); \ |
| 1765 | writel((val64) & 0xffffffff, db); \ |
| 1766 | writel((val64) >> 32, (db) + 4); \ |
| 1767 | spin_unlock(&bp->db_lock); \ |
| 1768 | } while (0) |
| 1769 | |
| 1770 | #define writeq_relaxed writeq |
| 1771 | #endif |
| 1772 | |
Sinan Kaya | fd141fa | 2018-03-25 10:39:20 -0400 | [diff] [blame] | 1773 | /* For TX and RX ring doorbells with no ordering guarantee*/ |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 1774 | static inline void bnxt_db_write_relaxed(struct bnxt *bp, |
| 1775 | struct bnxt_db_info *db, u32 idx) |
Sinan Kaya | fd141fa | 2018-03-25 10:39:20 -0400 | [diff] [blame] | 1776 | { |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 1777 | if (bp->flags & BNXT_FLAG_CHIP_P5) { |
| 1778 | writeq_relaxed(db->db_key64 | idx, db->doorbell); |
| 1779 | } else { |
| 1780 | u32 db_val = db->db_key32 | idx; |
| 1781 | |
| 1782 | writel_relaxed(db_val, db->doorbell); |
| 1783 | if (bp->flags & BNXT_FLAG_DOUBLE_DB) |
| 1784 | writel_relaxed(db_val, db->doorbell); |
| 1785 | } |
Sinan Kaya | fd141fa | 2018-03-25 10:39:20 -0400 | [diff] [blame] | 1786 | } |
| 1787 | |
Michael Chan | 434c975 | 2017-05-29 19:06:08 -0400 | [diff] [blame] | 1788 | /* For TX and RX ring doorbells */ |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 1789 | static inline void bnxt_db_write(struct bnxt *bp, struct bnxt_db_info *db, |
| 1790 | u32 idx) |
Michael Chan | 434c975 | 2017-05-29 19:06:08 -0400 | [diff] [blame] | 1791 | { |
Michael Chan | 697197e | 2018-10-14 07:02:46 -0400 | [diff] [blame] | 1792 | if (bp->flags & BNXT_FLAG_CHIP_P5) { |
| 1793 | writeq(db->db_key64 | idx, db->doorbell); |
| 1794 | } else { |
| 1795 | u32 db_val = db->db_key32 | idx; |
| 1796 | |
| 1797 | writel(db_val, db->doorbell); |
| 1798 | if (bp->flags & BNXT_FLAG_DOUBLE_DB) |
| 1799 | writel(db_val, db->doorbell); |
| 1800 | } |
Michael Chan | 434c975 | 2017-05-29 19:06:08 -0400 | [diff] [blame] | 1801 | } |
| 1802 | |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1803 | static inline bool bnxt_cfa_hwrm_message(u16 req_type) |
Venkat Duvvuru | 5c209fc | 2018-12-20 03:38:47 -0500 | [diff] [blame] | 1804 | { |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1805 | switch (req_type) { |
| 1806 | case HWRM_CFA_ENCAP_RECORD_ALLOC: |
| 1807 | case HWRM_CFA_ENCAP_RECORD_FREE: |
| 1808 | case HWRM_CFA_DECAP_FILTER_ALLOC: |
| 1809 | case HWRM_CFA_DECAP_FILTER_FREE: |
| 1810 | case HWRM_CFA_NTUPLE_FILTER_ALLOC: |
| 1811 | case HWRM_CFA_NTUPLE_FILTER_FREE: |
| 1812 | case HWRM_CFA_NTUPLE_FILTER_CFG: |
| 1813 | case HWRM_CFA_EM_FLOW_ALLOC: |
| 1814 | case HWRM_CFA_EM_FLOW_FREE: |
| 1815 | case HWRM_CFA_EM_FLOW_CFG: |
| 1816 | case HWRM_CFA_FLOW_ALLOC: |
| 1817 | case HWRM_CFA_FLOW_FREE: |
| 1818 | case HWRM_CFA_FLOW_INFO: |
| 1819 | case HWRM_CFA_FLOW_FLUSH: |
| 1820 | case HWRM_CFA_FLOW_STATS: |
| 1821 | case HWRM_CFA_METER_PROFILE_ALLOC: |
| 1822 | case HWRM_CFA_METER_PROFILE_FREE: |
| 1823 | case HWRM_CFA_METER_PROFILE_CFG: |
| 1824 | case HWRM_CFA_METER_INSTANCE_ALLOC: |
| 1825 | case HWRM_CFA_METER_INSTANCE_FREE: |
| 1826 | return true; |
| 1827 | default: |
| 1828 | return false; |
| 1829 | } |
Venkat Duvvuru | 5c209fc | 2018-12-20 03:38:47 -0500 | [diff] [blame] | 1830 | } |
| 1831 | |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1832 | static inline bool bnxt_kong_hwrm_message(struct bnxt *bp, struct input *req) |
| 1833 | { |
| 1834 | return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL && |
| 1835 | bnxt_cfa_hwrm_message(le16_to_cpu(req->req_type))); |
| 1836 | } |
| 1837 | |
| 1838 | static inline bool bnxt_hwrm_kong_chnl(struct bnxt *bp, struct input *req) |
| 1839 | { |
| 1840 | return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL && |
| 1841 | req->resp_addr == cpu_to_le64(bp->hwrm_cmd_kong_resp_dma_addr)); |
| 1842 | } |
| 1843 | |
| 1844 | static inline void *bnxt_get_hwrm_resp_addr(struct bnxt *bp, void *req) |
| 1845 | { |
| 1846 | if (bnxt_hwrm_kong_chnl(bp, (struct input *)req)) |
| 1847 | return bp->hwrm_cmd_kong_resp_addr; |
| 1848 | else |
| 1849 | return bp->hwrm_cmd_resp_addr; |
| 1850 | } |
| 1851 | |
| 1852 | static inline u16 bnxt_get_hwrm_seq_id(struct bnxt *bp, u16 dst) |
Venkat Duvvuru | 5c209fc | 2018-12-20 03:38:47 -0500 | [diff] [blame] | 1853 | { |
| 1854 | u16 seq_id; |
| 1855 | |
Venkat Duvvuru | 760b6d3 | 2018-12-20 03:38:48 -0500 | [diff] [blame] | 1856 | if (dst == BNXT_HWRM_CHNL_CHIMP) |
| 1857 | seq_id = bp->hwrm_cmd_seq++; |
| 1858 | else |
| 1859 | seq_id = bp->hwrm_cmd_kong_seq++; |
Venkat Duvvuru | 5c209fc | 2018-12-20 03:38:47 -0500 | [diff] [blame] | 1860 | return seq_id; |
| 1861 | } |
| 1862 | |
Michael Chan | 3841340 | 2017-02-06 16:55:43 -0500 | [diff] [blame] | 1863 | extern const u16 bnxt_lhint_arr[]; |
| 1864 | |
| 1865 | int bnxt_alloc_rx_data(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, |
| 1866 | u16 prod, gfp_t gfp); |
Michael Chan | c6d30e8 | 2017-02-06 16:55:42 -0500 | [diff] [blame] | 1867 | void bnxt_reuse_rx_data(struct bnxt_rx_ring_info *rxr, u16 cons, void *data); |
| 1868 | void bnxt_set_tpa_flags(struct bnxt *bp); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1869 | void bnxt_set_ring_params(struct bnxt *); |
Michael Chan | c61fb99 | 2017-02-06 16:55:36 -0500 | [diff] [blame] | 1870 | int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1871 | void bnxt_hwrm_cmd_hdr_init(struct bnxt *, void *, u16, u16, u16); |
| 1872 | int _hwrm_send_message(struct bnxt *, void *, u32, int); |
Michael Chan | cc72f3b | 2017-10-13 21:09:33 -0400 | [diff] [blame] | 1873 | int _hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 len, int timeout); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1874 | int hwrm_send_message(struct bnxt *, void *, u32, int); |
Michael Chan | 90e20921 | 2016-02-26 04:00:08 -0500 | [diff] [blame] | 1875 | int hwrm_send_message_silent(struct bnxt *, void *, u32, int); |
Michael Chan | a1653b1 | 2016-12-07 00:26:20 -0500 | [diff] [blame] | 1876 | int bnxt_hwrm_func_rgtr_async_events(struct bnxt *bp, unsigned long *bmap, |
| 1877 | int bmap_size); |
Michael Chan | a588e45 | 2016-12-07 00:26:21 -0500 | [diff] [blame] | 1878 | int bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id); |
Michael Chan | 391be5c | 2016-12-29 12:13:41 -0500 | [diff] [blame] | 1879 | int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings); |
Michael Chan | b16b689 | 2018-12-16 18:46:25 -0500 | [diff] [blame] | 1880 | int bnxt_nq_rings_in_use(struct bnxt *bp); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1881 | int bnxt_hwrm_set_coal(struct bnxt *); |
Michael Chan | e4060d3 | 2016-12-07 00:26:19 -0500 | [diff] [blame] | 1882 | unsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp); |
Vasundhara Volam | c027c6b | 2018-12-16 18:46:21 -0500 | [diff] [blame] | 1883 | unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp); |
Michael Chan | e4060d3 | 2016-12-07 00:26:19 -0500 | [diff] [blame] | 1884 | unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); |
Michael Chan | e916b08 | 2018-12-16 18:46:20 -0500 | [diff] [blame] | 1885 | unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp); |
Michael Chan | fbcfc8e | 2018-03-31 13:54:20 -0400 | [diff] [blame] | 1886 | int bnxt_get_avail_msix(struct bnxt *bp, int num); |
Michael Chan | 1b3f0b7 | 2019-05-22 19:12:55 -0400 | [diff] [blame] | 1887 | int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init); |
Michael Chan | 7df4ae9 | 2016-12-02 21:17:17 -0500 | [diff] [blame] | 1888 | void bnxt_tx_disable(struct bnxt *bp); |
| 1889 | void bnxt_tx_enable(struct bnxt *bp); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1890 | int bnxt_hwrm_set_pause(struct bnxt *); |
Michael Chan | 939f7f0 | 2016-04-05 14:08:58 -0400 | [diff] [blame] | 1891 | int bnxt_hwrm_set_link_setting(struct bnxt *, bool, bool); |
Michael Chan | 5282db6 | 2017-04-04 18:14:10 -0400 | [diff] [blame] | 1892 | int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp); |
| 1893 | int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); |
Michael Chan | db4723b | 2018-03-31 13:54:13 -0400 | [diff] [blame] | 1894 | int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); |
Rob Swindell | 5ac67d8 | 2016-09-19 03:58:03 -0400 | [diff] [blame] | 1895 | int bnxt_hwrm_fw_set_time(struct bnxt *); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1896 | int bnxt_open_nic(struct bnxt *, bool, bool); |
Michael Chan | f7dc1ea | 2017-04-04 18:14:13 -0400 | [diff] [blame] | 1897 | int bnxt_half_open_nic(struct bnxt *bp); |
| 1898 | void bnxt_half_close_nic(struct bnxt *bp); |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1899 | int bnxt_close_nic(struct bnxt *, bool, bool); |
Michael Chan | 98fdbe7 | 2017-08-28 13:40:26 -0400 | [diff] [blame] | 1900 | int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, |
| 1901 | int tx_xdp); |
Michael Chan | c5e3deb | 2016-12-02 21:17:15 -0500 | [diff] [blame] | 1902 | int bnxt_setup_mq_tc(struct net_device *dev, u8 tc); |
Michael Chan | 6e6c5a5 | 2016-01-02 23:45:02 -0500 | [diff] [blame] | 1903 | int bnxt_get_max_rings(struct bnxt *, int *, int *, bool); |
Michael Chan | 80fcaf4 | 2018-01-17 03:21:05 -0500 | [diff] [blame] | 1904 | int bnxt_restore_pf_fw_resources(struct bnxt *bp); |
Florian Fainelli | 52d5254 | 2019-02-06 09:45:36 -0800 | [diff] [blame] | 1905 | int bnxt_get_port_parent_id(struct net_device *dev, |
| 1906 | struct netdev_phys_item_id *ppid); |
Andy Gospodarek | 6a8788f | 2018-01-09 16:06:20 -0500 | [diff] [blame] | 1907 | void bnxt_dim_work(struct work_struct *work); |
| 1908 | int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi); |
| 1909 | |
Michael Chan | c0c050c | 2015-10-22 16:01:17 -0400 | [diff] [blame] | 1910 | #endif |