i40iw_p.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*******************************************************************************
  2. *
  3. * Copyright (c) 2015-2016 Intel Corporation. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenFabrics.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. *
  33. *******************************************************************************/
  34. #ifndef I40IW_P_H
  35. #define I40IW_P_H
  36. #define PAUSE_TIMER_VALUE 0xFFFF
  37. #define REFRESH_THRESHOLD 0x7FFF
  38. #define HIGH_THRESHOLD 0x800
  39. #define LOW_THRESHOLD 0x200
  40. #define ALL_TC2PFC 0xFF
  41. #define CQP_COMPL_WAIT_TIME 0x3E8
  42. #define CQP_TIMEOUT_THRESHOLD 5
  43. void i40iw_debug_buf(struct i40iw_sc_dev *dev, enum i40iw_debug_flag mask,
  44. char *desc, u64 *buf, u32 size);
  45. /* init operations */
  46. enum i40iw_status_code i40iw_device_init(struct i40iw_sc_dev *dev,
  47. struct i40iw_device_init_info *info);
  48. void i40iw_sc_cqp_post_sq(struct i40iw_sc_cqp *cqp);
  49. u64 *i40iw_sc_cqp_get_next_send_wqe(struct i40iw_sc_cqp *cqp, u64 scratch);
  50. void i40iw_check_cqp_progress(struct i40iw_cqp_timeout *cqp_timeout, struct i40iw_sc_dev *dev);
  51. enum i40iw_status_code i40iw_sc_mr_fast_register(struct i40iw_sc_qp *qp,
  52. struct i40iw_fast_reg_stag_info *info,
  53. bool post_sq);
  54. void i40iw_insert_wqe_hdr(u64 *wqe, u64 header);
  55. /* HMC/FPM functions */
  56. enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev,
  57. u8 hmc_fn_id);
  58. enum i40iw_status_code i40iw_pf_init_vfhmc(struct i40iw_sc_dev *dev, u8 vf_hmc_fn_id,
  59. u32 *vf_cnt_array);
  60. /* stats functions */
  61. void i40iw_hw_stats_refresh_all(struct i40iw_vsi_pestat *stats);
  62. void i40iw_hw_stats_read_all(struct i40iw_vsi_pestat *stats, struct i40iw_dev_hw_stats *stats_values);
  63. void i40iw_hw_stats_read_32(struct i40iw_vsi_pestat *stats,
  64. enum i40iw_hw_stats_index_32b index,
  65. u64 *value);
  66. void i40iw_hw_stats_read_64(struct i40iw_vsi_pestat *stats,
  67. enum i40iw_hw_stats_index_64b index,
  68. u64 *value);
  69. void i40iw_hw_stats_init(struct i40iw_vsi_pestat *stats, u8 index, bool is_pf);
  70. /* vsi misc functions */
  71. enum i40iw_status_code i40iw_vsi_stats_init(struct i40iw_sc_vsi *vsi, struct i40iw_vsi_stats_info *info);
  72. void i40iw_vsi_stats_free(struct i40iw_sc_vsi *vsi);
  73. void i40iw_sc_vsi_init(struct i40iw_sc_vsi *vsi, struct i40iw_vsi_init_info *info);
  74. void i40iw_change_l2params(struct i40iw_sc_vsi *vsi, struct i40iw_l2params *l2params);
  75. void i40iw_qp_add_qos(struct i40iw_sc_qp *qp);
  76. void i40iw_terminate_send_fin(struct i40iw_sc_qp *qp);
  77. void i40iw_terminate_connection(struct i40iw_sc_qp *qp, struct i40iw_aeqe_info *info);
  78. void i40iw_terminate_received(struct i40iw_sc_qp *qp, struct i40iw_aeqe_info *info);
  79. enum i40iw_status_code i40iw_sc_suspend_qp(struct i40iw_sc_cqp *cqp,
  80. struct i40iw_sc_qp *qp, u64 scratch);
  81. enum i40iw_status_code i40iw_sc_resume_qp(struct i40iw_sc_cqp *cqp,
  82. struct i40iw_sc_qp *qp, u64 scratch);
  83. enum i40iw_status_code i40iw_sc_static_hmc_pages_allocated(struct i40iw_sc_cqp *cqp,
  84. u64 scratch, u8 hmc_fn_id,
  85. bool post_sq,
  86. bool poll_registers);
  87. enum i40iw_status_code i40iw_config_fpm_values(struct i40iw_sc_dev *dev, u32 qp_count);
  88. void free_sd_mem(struct i40iw_sc_dev *dev);
  89. enum i40iw_status_code i40iw_process_cqp_cmd(struct i40iw_sc_dev *dev,
  90. struct cqp_commands_info *pcmdinfo);
  91. enum i40iw_status_code i40iw_process_bh(struct i40iw_sc_dev *dev);
  92. /* prototype for functions used for dynamic memory allocation */
  93. enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw,
  94. struct i40iw_dma_mem *mem, u64 size,
  95. u32 alignment);
  96. void i40iw_free_dma_mem(struct i40iw_hw *hw, struct i40iw_dma_mem *mem);
  97. enum i40iw_status_code i40iw_allocate_virt_mem(struct i40iw_hw *hw,
  98. struct i40iw_virt_mem *mem, u32 size);
  99. enum i40iw_status_code i40iw_free_virt_mem(struct i40iw_hw *hw,
  100. struct i40iw_virt_mem *mem);
  101. u8 i40iw_get_encoded_wqe_size(u32 wqsize, bool cqpsq);
  102. #endif