1 /*- 2 * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: 9 * 10 * Redistribution and use in source and binary forms, with or 11 * without modification, are permitted provided that the following 12 * conditions are met: 13 * 14 * - Redistributions of source code must retain the above 15 * copyright notice, this list of conditions and the following 16 * disclaimer. 17 * 18 * - Redistributions in binary form must reproduce the above 19 * copyright notice, this list of conditions and the following 20 * disclaimer in the documentation and/or other materials 21 * provided with the distribution. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * SOFTWARE. 31 * 32 * $FreeBSD$ 33 */ 34 35 #ifndef MLX5_IFC_FPGA_H 36 #define MLX5_IFC_FPGA_H 37 38 enum { 39 MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9, 40 }; 41 42 enum { 43 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_EXAMPLE = 0x1, 44 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2, 45 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_TLS = 0x3, 46 }; 47 48 enum { 49 MLX5_FPGA_SHELL_CAPS_QP_TYPE_SHELL_QP = 0x1, 50 MLX5_FPGA_SHELL_CAPS_QP_TYPE_SANDBOX_QP = 0x2, 51 }; 52 53 struct mlx5_ifc_fpga_shell_caps_bits { 54 u8 max_num_qps[0x10]; 55 u8 reserved_at_10[0x8]; 56 u8 total_rcv_credits[0x8]; 57 58 u8 reserved_at_20[0xe]; 59 u8 qp_type[0x2]; 60 u8 reserved_at_30[0x5]; 61 u8 rae[0x1]; 62 u8 rwe[0x1]; 63 u8 rre[0x1]; 64 u8 reserved_at_38[0x4]; 65 u8 dc[0x1]; 66 u8 ud[0x1]; 67 u8 uc[0x1]; 68 u8 rc[0x1]; 69 70 u8 reserved_at_40[0x1a]; 71 u8 log_ddr_size[0x6]; 72 73 u8 max_fpga_qp_msg_size[0x20]; 74 75 u8 reserved_at_80[0x180]; 76 }; 77 78 struct mlx5_ifc_fpga_cap_bits { 79 u8 fpga_id[0x8]; 80 u8 fpga_device[0x18]; 81 82 u8 register_file_ver[0x20]; 83 84 u8 fpga_ctrl_modify[0x1]; 85 u8 reserved_at_41[0x5]; 86 u8 access_reg_query_mode[0x2]; 87 u8 reserved_at_48[0x6]; 88 u8 access_reg_modify_mode[0x2]; 89 u8 reserved_at_50[0x10]; 90 91 u8 reserved_at_60[0x20]; 92 93 u8 image_version[0x20]; 94 95 u8 image_date[0x20]; 96 97 u8 image_time[0x20]; 98 99 u8 shell_version[0x20]; 100 101 u8 reserved_at_100[0x80]; 102 103 struct mlx5_ifc_fpga_shell_caps_bits shell_caps; 104 105 u8 reserved_at_380[0x8]; 106 u8 ieee_vendor_id[0x18]; 107 108 u8 sandbox_product_version[0x10]; 109 u8 sandbox_product_id[0x10]; 110 111 u8 sandbox_basic_caps[0x20]; 112 113 u8 reserved_at_3e0[0x10]; 114 u8 sandbox_extended_caps_len[0x10]; 115 116 u8 sandbox_extended_caps_addr[0x40]; 117 118 u8 fpga_ddr_start_addr[0x40]; 119 120 u8 fpga_cr_space_start_addr[0x40]; 121 122 u8 fpga_ddr_size[0x20]; 123 124 u8 fpga_cr_space_size[0x20]; 125 126 u8 reserved_at_500[0x300]; 127 }; 128 129 enum { 130 MLX5_FPGA_CTRL_OPERATION_LOAD = 0x1, 131 MLX5_FPGA_CTRL_OPERATION_RESET = 0x2, 132 MLX5_FPGA_CTRL_OPERATION_FLASH_SELECT = 0x3, 133 MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4, 134 MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5, 135 MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, 136 }; 137 138 struct mlx5_ifc_fpga_ctrl_bits { 139 u8 reserved_at_0[0x8]; 140 u8 operation[0x8]; 141 u8 reserved_at_10[0x8]; 142 u8 status[0x8]; 143 144 u8 reserved_at_20[0x8]; 145 u8 flash_select_admin[0x8]; 146 u8 reserved_at_30[0x8]; 147 u8 flash_select_oper[0x8]; 148 149 u8 reserved_at_40[0x40]; 150 }; 151 152 enum { 153 MLX5_FPGA_ERROR_EVENT_SYNDROME_CORRUPTED_DDR = 0x1, 154 MLX5_FPGA_ERROR_EVENT_SYNDROME_FLASH_TIMEOUT = 0x2, 155 MLX5_FPGA_ERROR_EVENT_SYNDROME_INTERNAL_LINK_ERROR = 0x3, 156 MLX5_FPGA_ERROR_EVENT_SYNDROME_WATCHDOG_FAILURE = 0x4, 157 MLX5_FPGA_ERROR_EVENT_SYNDROME_I2C_FAILURE = 0x5, 158 MLX5_FPGA_ERROR_EVENT_SYNDROME_IMAGE_CHANGED = 0x6, 159 MLX5_FPGA_ERROR_EVENT_SYNDROME_TEMPERATURE_CRITICAL = 0x7, 160 }; 161 162 struct mlx5_ifc_fpga_error_event_bits { 163 u8 reserved_at_0[0x40]; 164 165 u8 reserved_at_40[0x18]; 166 u8 syndrome[0x8]; 167 168 u8 reserved_at_60[0x80]; 169 }; 170 171 #define MLX5_FPGA_ACCESS_REG_SIZE_MAX 64 172 173 struct mlx5_ifc_fpga_access_reg_bits { 174 u8 reserved_at_0[0x20]; 175 176 u8 reserved_at_20[0x10]; 177 u8 size[0x10]; 178 179 u8 address[0x40]; 180 181 u8 data[0][0x8]; 182 }; 183 184 enum mlx5_ifc_fpga_qp_state { 185 MLX5_FPGA_QPC_STATE_INIT = 0x0, 186 MLX5_FPGA_QPC_STATE_ACTIVE = 0x1, 187 MLX5_FPGA_QPC_STATE_ERROR = 0x2, 188 }; 189 190 enum mlx5_ifc_fpga_qp_type { 191 MLX5_FPGA_QPC_QP_TYPE_SHELL_QP = 0x0, 192 MLX5_FPGA_QPC_QP_TYPE_SANDBOX_QP = 0x1, 193 }; 194 195 enum mlx5_ifc_fpga_qp_service_type { 196 MLX5_FPGA_QPC_ST_RC = 0x0, 197 }; 198 199 struct mlx5_ifc_fpga_qpc_bits { 200 u8 state[0x4]; 201 u8 reserved_at_4[0x1b]; 202 u8 qp_type[0x1]; 203 204 u8 reserved_at_20[0x4]; 205 u8 st[0x4]; 206 u8 reserved_at_28[0x10]; 207 u8 traffic_class[0x8]; 208 209 u8 ether_type[0x10]; 210 u8 prio[0x3]; 211 u8 dei[0x1]; 212 u8 vid[0xc]; 213 214 u8 reserved_at_60[0x20]; 215 216 u8 reserved_at_80[0x8]; 217 u8 next_rcv_psn[0x18]; 218 219 u8 reserved_at_a0[0x8]; 220 u8 next_send_psn[0x18]; 221 222 u8 reserved_at_c0[0x10]; 223 u8 pkey[0x10]; 224 225 u8 reserved_at_e0[0x8]; 226 u8 remote_qpn[0x18]; 227 228 u8 reserved_at_100[0x15]; 229 u8 rnr_retry[0x3]; 230 u8 reserved_at_118[0x5]; 231 u8 retry_count[0x3]; 232 233 u8 reserved_at_120[0x20]; 234 235 u8 reserved_at_140[0x10]; 236 u8 remote_mac_47_32[0x10]; 237 238 u8 remote_mac_31_0[0x20]; 239 240 u8 remote_ip[16][0x8]; 241 242 u8 reserved_at_200[0x40]; 243 244 u8 reserved_at_240[0x10]; 245 u8 fpga_mac_47_32[0x10]; 246 247 u8 fpga_mac_31_0[0x20]; 248 249 u8 fpga_ip[16][0x8]; 250 }; 251 252 struct mlx5_ifc_fpga_create_qp_in_bits { 253 u8 opcode[0x10]; 254 u8 reserved_at_10[0x10]; 255 256 u8 reserved_at_20[0x10]; 257 u8 op_mod[0x10]; 258 259 u8 reserved_at_40[0x40]; 260 261 struct mlx5_ifc_fpga_qpc_bits fpga_qpc; 262 }; 263 264 struct mlx5_ifc_fpga_create_qp_out_bits { 265 u8 status[0x8]; 266 u8 reserved_at_8[0x18]; 267 268 u8 syndrome[0x20]; 269 270 u8 reserved_at_40[0x8]; 271 u8 fpga_qpn[0x18]; 272 273 u8 reserved_at_60[0x20]; 274 275 struct mlx5_ifc_fpga_qpc_bits fpga_qpc; 276 }; 277 278 struct mlx5_ifc_fpga_modify_qp_in_bits { 279 u8 opcode[0x10]; 280 u8 reserved_at_10[0x10]; 281 282 u8 reserved_at_20[0x10]; 283 u8 op_mod[0x10]; 284 285 u8 reserved_at_40[0x8]; 286 u8 fpga_qpn[0x18]; 287 288 u8 field_select[0x20]; 289 290 struct mlx5_ifc_fpga_qpc_bits fpga_qpc; 291 }; 292 293 struct mlx5_ifc_fpga_modify_qp_out_bits { 294 u8 status[0x8]; 295 u8 reserved_at_8[0x18]; 296 297 u8 syndrome[0x20]; 298 299 u8 reserved_at_40[0x40]; 300 }; 301 302 struct mlx5_ifc_fpga_query_qp_in_bits { 303 u8 opcode[0x10]; 304 u8 reserved_at_10[0x10]; 305 306 u8 reserved_at_20[0x10]; 307 u8 op_mod[0x10]; 308 309 u8 reserved_at_40[0x8]; 310 u8 fpga_qpn[0x18]; 311 312 u8 reserved_at_60[0x20]; 313 }; 314 315 struct mlx5_ifc_fpga_query_qp_out_bits { 316 u8 status[0x8]; 317 u8 reserved_at_8[0x18]; 318 319 u8 syndrome[0x20]; 320 321 u8 reserved_at_40[0x40]; 322 323 struct mlx5_ifc_fpga_qpc_bits fpga_qpc; 324 }; 325 326 struct mlx5_ifc_fpga_query_qp_counters_in_bits { 327 u8 opcode[0x10]; 328 u8 reserved_at_10[0x10]; 329 330 u8 reserved_at_20[0x10]; 331 u8 op_mod[0x10]; 332 333 u8 clear[0x1]; 334 u8 reserved_at_41[0x7]; 335 u8 fpga_qpn[0x18]; 336 337 u8 reserved_at_60[0x20]; 338 }; 339 340 struct mlx5_ifc_fpga_query_qp_counters_out_bits { 341 u8 status[0x8]; 342 u8 reserved_at_8[0x18]; 343 344 u8 syndrome[0x20]; 345 346 u8 reserved_at_40[0x40]; 347 348 u8 rx_ack_packets[0x40]; 349 350 u8 rx_send_packets[0x40]; 351 352 u8 tx_ack_packets[0x40]; 353 354 u8 tx_send_packets[0x40]; 355 356 u8 rx_total_drop[0x40]; 357 358 u8 reserved_at_1c0[0x1c0]; 359 }; 360 361 struct mlx5_ifc_fpga_destroy_qp_in_bits { 362 u8 opcode[0x10]; 363 u8 reserved_at_10[0x10]; 364 365 u8 reserved_at_20[0x10]; 366 u8 op_mod[0x10]; 367 368 u8 reserved_at_40[0x8]; 369 u8 fpga_qpn[0x18]; 370 371 u8 reserved_at_60[0x20]; 372 }; 373 374 struct mlx5_ifc_fpga_destroy_qp_out_bits { 375 u8 status[0x8]; 376 u8 reserved_at_8[0x18]; 377 378 u8 syndrome[0x20]; 379 380 u8 reserved_at_40[0x40]; 381 }; 382 383 struct mlx5_ifc_ipsec_extended_cap_bits { 384 u8 encapsulation[0x20]; 385 386 u8 reserved_0[0x15]; 387 u8 ipv4_fragment[0x1]; 388 u8 ipv6[0x1]; 389 u8 esn[0x1]; 390 u8 lso[0x1]; 391 u8 transport_and_tunnel_mode[0x1]; 392 u8 tunnel_mode[0x1]; 393 u8 transport_mode[0x1]; 394 u8 ah_esp[0x1]; 395 u8 esp[0x1]; 396 u8 ah[0x1]; 397 u8 ipv4_options[0x1]; 398 399 u8 auth_alg[0x20]; 400 401 u8 enc_alg[0x20]; 402 403 u8 sa_cap[0x20]; 404 405 u8 reserved_1[0x10]; 406 u8 number_of_ipsec_counters[0x10]; 407 408 u8 ipsec_counters_addr_low[0x20]; 409 u8 ipsec_counters_addr_high[0x20]; 410 }; 411 412 struct mlx5_ifc_ipsec_counters_bits { 413 u8 dec_in_packets[0x40]; 414 415 u8 dec_out_packets[0x40]; 416 417 u8 dec_bypass_packets[0x40]; 418 419 u8 enc_in_packets[0x40]; 420 421 u8 enc_out_packets[0x40]; 422 423 u8 enc_bypass_packets[0x40]; 424 425 u8 drop_dec_packets[0x40]; 426 427 u8 failed_auth_dec_packets[0x40]; 428 429 u8 drop_enc_packets[0x40]; 430 431 u8 success_add_sa[0x40]; 432 433 u8 fail_add_sa[0x40]; 434 435 u8 success_delete_sa[0x40]; 436 437 u8 fail_delete_sa[0x40]; 438 439 u8 dropped_cmd[0x40]; 440 }; 441 442 struct mlx5_ifc_fpga_shell_counters_bits { 443 u8 reserved_0[0x20]; 444 445 u8 clear[0x1]; 446 u8 reserved_1[0x1f]; 447 448 u8 reserved_2[0x40]; 449 450 u8 ddr_read_requests[0x40]; 451 452 u8 ddr_write_requests[0x40]; 453 454 u8 ddr_read_bytes[0x40]; 455 456 u8 ddr_write_bytes[0x40]; 457 458 u8 reserved_3[0x200]; 459 }; 460 461 enum { 462 MLX5_FPGA_SHELL_QP_PACKET_TYPE_DDR_READ = 0x0, 463 MLX5_FPGA_SHELL_QP_PACKET_TYPE_DDR_WRITE = 0x1, 464 MLX5_FPGA_SHELL_QP_PACKET_TYPE_DDR_READ_RESPONSE = 0x2, 465 MLX5_FPGA_SHELL_QP_PACKET_TYPE_DDR_WRITE_RESPONSE = 0x3, 466 }; 467 468 struct mlx5_ifc_fpga_shell_qp_packet_bits { 469 u8 version[0x4]; 470 u8 syndrome[0x4]; 471 u8 reserved_at_8[0x4]; 472 u8 type[0x4]; 473 u8 reserved_at_10[0x8]; 474 u8 tid[0x8]; 475 476 u8 len[0x20]; 477 478 u8 address[0x40]; 479 480 u8 data[0][0x8]; 481 }; 482 483 enum { 484 MLX5_FPGA_QP_ERROR_EVENT_SYNDROME_RETRY_COUNTER_EXPIRED = 0x1, 485 MLX5_FPGA_QP_ERROR_EVENT_SYNDROME_RNR_EXPIRED = 0x2, 486 }; 487 488 struct mlx5_ifc_fpga_qp_error_event_bits { 489 u8 reserved_0[0x40]; 490 491 u8 reserved_1[0x18]; 492 u8 syndrome[0x8]; 493 494 u8 reserved_2[0x60]; 495 496 u8 reserved_3[0x8]; 497 u8 fpga_qpn[0x18]; 498 }; 499 500 #endif /* MLX5_IFC_FPGA_H */ 501