qed_fcoe_if.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2. /* Copyright (c) 2019-2020 Marvell International Ltd. */
  3. #ifndef _QED_FCOE_IF_H
  4. #define _QED_FCOE_IF_H
  5. #include <linux/types.h>
  6. #include <linux/qed/qed_if.h>
  7. struct qed_fcoe_stats {
  8. u64 fcoe_rx_byte_cnt;
  9. u64 fcoe_rx_data_pkt_cnt;
  10. u64 fcoe_rx_xfer_pkt_cnt;
  11. u64 fcoe_rx_other_pkt_cnt;
  12. u32 fcoe_silent_drop_pkt_cmdq_full_cnt;
  13. u32 fcoe_silent_drop_pkt_rq_full_cnt;
  14. u32 fcoe_silent_drop_pkt_crc_error_cnt;
  15. u32 fcoe_silent_drop_pkt_task_invalid_cnt;
  16. u32 fcoe_silent_drop_total_pkt_cnt;
  17. u64 fcoe_tx_byte_cnt;
  18. u64 fcoe_tx_data_pkt_cnt;
  19. u64 fcoe_tx_xfer_pkt_cnt;
  20. u64 fcoe_tx_other_pkt_cnt;
  21. };
  22. struct qed_dev_fcoe_info {
  23. struct qed_dev_info common;
  24. void __iomem *primary_dbq_rq_addr;
  25. void __iomem *secondary_bdq_rq_addr;
  26. u64 wwpn;
  27. u64 wwnn;
  28. u8 num_cqs;
  29. };
  30. struct qed_fcoe_params_offload {
  31. dma_addr_t sq_pbl_addr;
  32. dma_addr_t sq_curr_page_addr;
  33. dma_addr_t sq_next_page_addr;
  34. u8 src_mac[ETH_ALEN];
  35. u8 dst_mac[ETH_ALEN];
  36. u16 tx_max_fc_pay_len;
  37. u16 e_d_tov_timer_val;
  38. u16 rec_tov_timer_val;
  39. u16 rx_max_fc_pay_len;
  40. u16 vlan_tag;
  41. struct fc_addr_nw s_id;
  42. u8 max_conc_seqs_c3;
  43. struct fc_addr_nw d_id;
  44. u8 flags;
  45. u8 def_q_idx;
  46. };
  47. #define MAX_TID_BLOCKS_FCOE (512)
  48. struct qed_fcoe_tid {
  49. u32 size; /* In bytes per task */
  50. u32 num_tids_per_block;
  51. u8 *blocks[MAX_TID_BLOCKS_FCOE];
  52. };
  53. struct qed_fcoe_cb_ops {
  54. struct qed_common_cb_ops common;
  55. u32 (*get_login_failures)(void *cookie);
  56. };
  57. void qed_fcoe_set_pf_params(struct qed_dev *cdev,
  58. struct qed_fcoe_pf_params *params);
  59. /**
  60. * struct qed_fcoe_ops - qed FCoE operations.
  61. * @common: common operations pointer
  62. * @fill_dev_info: fills FCoE specific information
  63. * @param cdev
  64. * @param info
  65. * @return 0 on success, otherwise error value.
  66. * @register_ops: register FCoE operations
  67. * @param cdev
  68. * @param ops - specified using qed_iscsi_cb_ops
  69. * @param cookie - driver private
  70. * @ll2: light L2 operations pointer
  71. * @start: fcoe in FW
  72. * @param cdev
  73. * @param tasks - qed will fill information about tasks
  74. * return 0 on success, otherwise error value.
  75. * @stop: stops fcoe in FW
  76. * @param cdev
  77. * return 0 on success, otherwise error value.
  78. * @acquire_conn: acquire a new fcoe connection
  79. * @param cdev
  80. * @param handle - qed will fill handle that should be
  81. * used henceforth as identifier of the
  82. * connection.
  83. * @param p_doorbell - qed will fill the address of the
  84. * doorbell.
  85. * return 0 on success, otherwise error value.
  86. * @release_conn: release a previously acquired fcoe connection
  87. * @param cdev
  88. * @param handle - the connection handle.
  89. * return 0 on success, otherwise error value.
  90. * @offload_conn: configures an offloaded connection
  91. * @param cdev
  92. * @param handle - the connection handle.
  93. * @param conn_info - the configuration to use for the
  94. * offload.
  95. * return 0 on success, otherwise error value.
  96. * @destroy_conn: stops an offloaded connection
  97. * @param cdev
  98. * @param handle - the connection handle.
  99. * @param terminate_params
  100. * return 0 on success, otherwise error value.
  101. * @get_stats: gets FCoE related statistics
  102. * @param cdev
  103. * @param stats - pointer to struck that would be filled
  104. * we stats
  105. * return 0 on success, error otherwise.
  106. */
  107. struct qed_fcoe_ops {
  108. const struct qed_common_ops *common;
  109. int (*fill_dev_info)(struct qed_dev *cdev,
  110. struct qed_dev_fcoe_info *info);
  111. void (*register_ops)(struct qed_dev *cdev,
  112. struct qed_fcoe_cb_ops *ops, void *cookie);
  113. const struct qed_ll2_ops *ll2;
  114. int (*start)(struct qed_dev *cdev, struct qed_fcoe_tid *tasks);
  115. int (*stop)(struct qed_dev *cdev);
  116. int (*acquire_conn)(struct qed_dev *cdev,
  117. u32 *handle,
  118. u32 *fw_cid, void __iomem **p_doorbell);
  119. int (*release_conn)(struct qed_dev *cdev, u32 handle);
  120. int (*offload_conn)(struct qed_dev *cdev,
  121. u32 handle,
  122. struct qed_fcoe_params_offload *conn_info);
  123. int (*destroy_conn)(struct qed_dev *cdev,
  124. u32 handle, dma_addr_t terminate_params);
  125. int (*get_stats)(struct qed_dev *cdev, struct qed_fcoe_stats *stats);
  126. };
  127. const struct qed_fcoe_ops *qed_get_fcoe_ops(void);
  128. void qed_put_fcoe_ops(void);
  129. #endif