qed_iscsi_if.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2. /* QLogic qed NIC Driver
  3. * Copyright (c) 2015-2017 QLogic Corporation
  4. * Copyright (c) 2019-2020 Marvell International Ltd.
  5. */
  6. #ifndef _QED_ISCSI_IF_H
  7. #define _QED_ISCSI_IF_H
  8. #include <linux/types.h>
  9. #include <linux/qed/qed_if.h>
  10. typedef int (*iscsi_event_cb_t) (void *context,
  11. u8 fw_event_code, void *fw_handle);
  12. struct qed_iscsi_stats {
  13. u64 iscsi_rx_bytes_cnt;
  14. u64 iscsi_rx_packet_cnt;
  15. u64 iscsi_rx_new_ooo_isle_events_cnt;
  16. u32 iscsi_cmdq_threshold_cnt;
  17. u32 iscsi_rq_threshold_cnt;
  18. u32 iscsi_immq_threshold_cnt;
  19. u64 iscsi_rx_dropped_pdus_task_not_valid;
  20. u64 iscsi_rx_data_pdu_cnt;
  21. u64 iscsi_rx_r2t_pdu_cnt;
  22. u64 iscsi_rx_total_pdu_cnt;
  23. u64 iscsi_tx_go_to_slow_start_event_cnt;
  24. u64 iscsi_tx_fast_retransmit_event_cnt;
  25. u64 iscsi_tx_data_pdu_cnt;
  26. u64 iscsi_tx_r2t_pdu_cnt;
  27. u64 iscsi_tx_total_pdu_cnt;
  28. u64 iscsi_tx_bytes_cnt;
  29. u64 iscsi_tx_packet_cnt;
  30. };
  31. struct qed_dev_iscsi_info {
  32. struct qed_dev_info common;
  33. void __iomem *primary_dbq_rq_addr;
  34. void __iomem *secondary_bdq_rq_addr;
  35. u8 num_cqs;
  36. };
  37. struct qed_iscsi_id_params {
  38. u8 mac[ETH_ALEN];
  39. u32 ip[4];
  40. u16 port;
  41. };
  42. struct qed_iscsi_params_offload {
  43. u8 layer_code;
  44. dma_addr_t sq_pbl_addr;
  45. u32 initial_ack;
  46. struct qed_iscsi_id_params src;
  47. struct qed_iscsi_id_params dst;
  48. u16 vlan_id;
  49. u8 tcp_flags;
  50. u8 ip_version;
  51. u8 default_cq;
  52. u8 ka_max_probe_cnt;
  53. u8 dup_ack_theshold;
  54. u32 rcv_next;
  55. u32 snd_una;
  56. u32 snd_next;
  57. u32 snd_max;
  58. u32 snd_wnd;
  59. u32 rcv_wnd;
  60. u32 snd_wl1;
  61. u32 cwnd;
  62. u32 ss_thresh;
  63. u16 srtt;
  64. u16 rtt_var;
  65. u32 ts_recent;
  66. u32 ts_recent_age;
  67. u32 total_rt;
  68. u32 ka_timeout_delta;
  69. u32 rt_timeout_delta;
  70. u8 dup_ack_cnt;
  71. u8 snd_wnd_probe_cnt;
  72. u8 ka_probe_cnt;
  73. u8 rt_cnt;
  74. u32 flow_label;
  75. u32 ka_timeout;
  76. u32 ka_interval;
  77. u32 max_rt_time;
  78. u32 initial_rcv_wnd;
  79. u8 ttl;
  80. u8 tos_or_tc;
  81. u16 remote_port;
  82. u16 local_port;
  83. u16 mss;
  84. u8 snd_wnd_scale;
  85. u8 rcv_wnd_scale;
  86. u16 da_timeout_value;
  87. u8 ack_frequency;
  88. };
  89. struct qed_iscsi_params_update {
  90. u8 update_flag;
  91. #define QED_ISCSI_CONN_HD_EN BIT(0)
  92. #define QED_ISCSI_CONN_DD_EN BIT(1)
  93. #define QED_ISCSI_CONN_INITIAL_R2T BIT(2)
  94. #define QED_ISCSI_CONN_IMMEDIATE_DATA BIT(3)
  95. u32 max_seq_size;
  96. u32 max_recv_pdu_length;
  97. u32 max_send_pdu_length;
  98. u32 first_seq_length;
  99. u32 exp_stat_sn;
  100. };
  101. #define MAX_TID_BLOCKS_ISCSI (512)
  102. struct qed_iscsi_tid {
  103. u32 size; /* In bytes per task */
  104. u32 num_tids_per_block;
  105. u8 *blocks[MAX_TID_BLOCKS_ISCSI];
  106. };
  107. struct qed_iscsi_cb_ops {
  108. struct qed_common_cb_ops common;
  109. };
  110. /**
  111. * struct qed_iscsi_ops - qed iSCSI operations.
  112. * @common: common operations pointer
  113. * @ll2: light L2 operations pointer
  114. * @fill_dev_info: fills iSCSI specific information
  115. * @param cdev
  116. * @param info
  117. * @return 0 on success, otherwise error value.
  118. * @register_ops: register iscsi operations
  119. * @param cdev
  120. * @param ops - specified using qed_iscsi_cb_ops
  121. * @param cookie - driver private
  122. * @start: iscsi in FW
  123. * @param cdev
  124. * @param tasks - qed will fill information about tasks
  125. * return 0 on success, otherwise error value.
  126. * @stop: iscsi in FW
  127. * @param cdev
  128. * return 0 on success, otherwise error value.
  129. * @acquire_conn: acquire a new iscsi connection
  130. * @param cdev
  131. * @param handle - qed will fill handle that should be
  132. * used henceforth as identifier of the
  133. * connection.
  134. * @param p_doorbell - qed will fill the address of the
  135. * doorbell.
  136. * @return 0 on success, otherwise error value.
  137. * @release_conn: release a previously acquired iscsi connection
  138. * @param cdev
  139. * @param handle - the connection handle.
  140. * @return 0 on success, otherwise error value.
  141. * @offload_conn: configures an offloaded connection
  142. * @param cdev
  143. * @param handle - the connection handle.
  144. * @param conn_info - the configuration to use for the
  145. * offload.
  146. * @return 0 on success, otherwise error value.
  147. * @update_conn: updates an offloaded connection
  148. * @param cdev
  149. * @param handle - the connection handle.
  150. * @param conn_info - the configuration to use for the
  151. * offload.
  152. * @return 0 on success, otherwise error value.
  153. * @destroy_conn: stops an offloaded connection
  154. * @param cdev
  155. * @param handle - the connection handle.
  156. * @return 0 on success, otherwise error value.
  157. * @clear_sq: clear all task in sq
  158. * @param cdev
  159. * @param handle - the connection handle.
  160. * @return 0 on success, otherwise error value.
  161. * @get_stats: iSCSI related statistics
  162. * @param cdev
  163. * @param stats - pointer to struck that would be filled
  164. * we stats
  165. * @return 0 on success, error otherwise.
  166. * @change_mac: Change MAC of interface
  167. * @param cdev
  168. * @param handle - the connection handle.
  169. * @param mac - new MAC to configure.
  170. * @return 0 on success, otherwise error value.
  171. */
  172. struct qed_iscsi_ops {
  173. const struct qed_common_ops *common;
  174. const struct qed_ll2_ops *ll2;
  175. int (*fill_dev_info)(struct qed_dev *cdev,
  176. struct qed_dev_iscsi_info *info);
  177. void (*register_ops)(struct qed_dev *cdev,
  178. struct qed_iscsi_cb_ops *ops, void *cookie);
  179. int (*start)(struct qed_dev *cdev,
  180. struct qed_iscsi_tid *tasks,
  181. void *event_context, iscsi_event_cb_t async_event_cb);
  182. int (*stop)(struct qed_dev *cdev);
  183. int (*acquire_conn)(struct qed_dev *cdev,
  184. u32 *handle,
  185. u32 *fw_cid, void __iomem **p_doorbell);
  186. int (*release_conn)(struct qed_dev *cdev, u32 handle);
  187. int (*offload_conn)(struct qed_dev *cdev,
  188. u32 handle,
  189. struct qed_iscsi_params_offload *conn_info);
  190. int (*update_conn)(struct qed_dev *cdev,
  191. u32 handle,
  192. struct qed_iscsi_params_update *conn_info);
  193. int (*destroy_conn)(struct qed_dev *cdev, u32 handle, u8 abrt_conn);
  194. int (*clear_sq)(struct qed_dev *cdev, u32 handle);
  195. int (*get_stats)(struct qed_dev *cdev,
  196. struct qed_iscsi_stats *stats);
  197. int (*change_mac)(struct qed_dev *cdev, u32 handle, const u8 *mac);
  198. };
  199. const struct qed_iscsi_ops *qed_get_iscsi_ops(void);
  200. void qed_put_iscsi_ops(void);
  201. #endif