Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /* QLogic qed NIC Driver
0003  * Copyright (c) 2015-2017  QLogic Corporation
0004  * Copyright (c) 2019-2020 Marvell International Ltd.
0005  */
0006 
0007 #ifndef _QED_ISCSI_IF_H
0008 #define _QED_ISCSI_IF_H
0009 #include <linux/types.h>
0010 #include <linux/qed/qed_if.h>
0011 
0012 typedef int (*iscsi_event_cb_t) (void *context,
0013                  u8 fw_event_code, void *fw_handle);
0014 struct qed_iscsi_stats {
0015     u64 iscsi_rx_bytes_cnt;
0016     u64 iscsi_rx_packet_cnt;
0017     u64 iscsi_rx_new_ooo_isle_events_cnt;
0018     u32 iscsi_cmdq_threshold_cnt;
0019     u32 iscsi_rq_threshold_cnt;
0020     u32 iscsi_immq_threshold_cnt;
0021 
0022     u64 iscsi_rx_dropped_pdus_task_not_valid;
0023 
0024     u64 iscsi_rx_data_pdu_cnt;
0025     u64 iscsi_rx_r2t_pdu_cnt;
0026     u64 iscsi_rx_total_pdu_cnt;
0027 
0028     u64 iscsi_tx_go_to_slow_start_event_cnt;
0029     u64 iscsi_tx_fast_retransmit_event_cnt;
0030 
0031     u64 iscsi_tx_data_pdu_cnt;
0032     u64 iscsi_tx_r2t_pdu_cnt;
0033     u64 iscsi_tx_total_pdu_cnt;
0034 
0035     u64 iscsi_tx_bytes_cnt;
0036     u64 iscsi_tx_packet_cnt;
0037 };
0038 
0039 struct qed_dev_iscsi_info {
0040     struct qed_dev_info common;
0041 
0042     void __iomem *primary_dbq_rq_addr;
0043     void __iomem *secondary_bdq_rq_addr;
0044 
0045     u8 num_cqs;
0046 };
0047 
0048 struct qed_iscsi_id_params {
0049     u8 mac[ETH_ALEN];
0050     u32 ip[4];
0051     u16 port;
0052 };
0053 
0054 struct qed_iscsi_params_offload {
0055     u8 layer_code;
0056     dma_addr_t sq_pbl_addr;
0057     u32 initial_ack;
0058 
0059     struct qed_iscsi_id_params src;
0060     struct qed_iscsi_id_params dst;
0061     u16 vlan_id;
0062     u8 tcp_flags;
0063     u8 ip_version;
0064     u8 default_cq;
0065 
0066     u8 ka_max_probe_cnt;
0067     u8 dup_ack_theshold;
0068     u32 rcv_next;
0069     u32 snd_una;
0070     u32 snd_next;
0071     u32 snd_max;
0072     u32 snd_wnd;
0073     u32 rcv_wnd;
0074     u32 snd_wl1;
0075     u32 cwnd;
0076     u32 ss_thresh;
0077     u16 srtt;
0078     u16 rtt_var;
0079     u32 ts_recent;
0080     u32 ts_recent_age;
0081     u32 total_rt;
0082     u32 ka_timeout_delta;
0083     u32 rt_timeout_delta;
0084     u8 dup_ack_cnt;
0085     u8 snd_wnd_probe_cnt;
0086     u8 ka_probe_cnt;
0087     u8 rt_cnt;
0088     u32 flow_label;
0089     u32 ka_timeout;
0090     u32 ka_interval;
0091     u32 max_rt_time;
0092     u32 initial_rcv_wnd;
0093     u8 ttl;
0094     u8 tos_or_tc;
0095     u16 remote_port;
0096     u16 local_port;
0097     u16 mss;
0098     u8 snd_wnd_scale;
0099     u8 rcv_wnd_scale;
0100     u16 da_timeout_value;
0101     u8 ack_frequency;
0102 };
0103 
0104 struct qed_iscsi_params_update {
0105     u8 update_flag;
0106 #define QED_ISCSI_CONN_HD_EN            BIT(0)
0107 #define QED_ISCSI_CONN_DD_EN            BIT(1)
0108 #define QED_ISCSI_CONN_INITIAL_R2T      BIT(2)
0109 #define QED_ISCSI_CONN_IMMEDIATE_DATA   BIT(3)
0110 
0111     u32 max_seq_size;
0112     u32 max_recv_pdu_length;
0113     u32 max_send_pdu_length;
0114     u32 first_seq_length;
0115     u32 exp_stat_sn;
0116 };
0117 
0118 #define MAX_TID_BLOCKS_ISCSI (512)
0119 struct qed_iscsi_tid {
0120     u32 size;       /* In bytes per task */
0121     u32 num_tids_per_block;
0122     u8 *blocks[MAX_TID_BLOCKS_ISCSI];
0123 };
0124 
0125 struct qed_iscsi_cb_ops {
0126     struct qed_common_cb_ops common;
0127 };
0128 
0129 /**
0130  * struct qed_iscsi_ops - qed iSCSI operations.
0131  * @common:     common operations pointer
0132  * @ll2:        light L2 operations pointer
0133  * @fill_dev_info:  fills iSCSI specific information
0134  *          @param cdev
0135  *          @param info
0136  *          @return 0 on success, otherwise error value.
0137  * @register_ops:   register iscsi operations
0138  *          @param cdev
0139  *          @param ops - specified using qed_iscsi_cb_ops
0140  *          @param cookie - driver private
0141  * @start:      iscsi in FW
0142  *          @param cdev
0143  *          @param tasks - qed will fill information about tasks
0144  *          return 0 on success, otherwise error value.
0145  * @stop:       iscsi in FW
0146  *          @param cdev
0147  *          return 0 on success, otherwise error value.
0148  * @acquire_conn:   acquire a new iscsi connection
0149  *          @param cdev
0150  *          @param handle - qed will fill handle that should be
0151  *              used henceforth as identifier of the
0152  *              connection.
0153  *          @param p_doorbell - qed will fill the address of the
0154  *              doorbell.
0155  *          @return 0 on success, otherwise error value.
0156  * @release_conn:   release a previously acquired iscsi connection
0157  *          @param cdev
0158  *          @param handle - the connection handle.
0159  *          @return 0 on success, otherwise error value.
0160  * @offload_conn:   configures an offloaded connection
0161  *          @param cdev
0162  *          @param handle - the connection handle.
0163  *          @param conn_info - the configuration to use for the
0164  *              offload.
0165  *          @return 0 on success, otherwise error value.
0166  * @update_conn:    updates an offloaded connection
0167  *          @param cdev
0168  *          @param handle - the connection handle.
0169  *          @param conn_info - the configuration to use for the
0170  *              offload.
0171  *          @return 0 on success, otherwise error value.
0172  * @destroy_conn:   stops an offloaded connection
0173  *          @param cdev
0174  *          @param handle - the connection handle.
0175  *          @return 0 on success, otherwise error value.
0176  * @clear_sq:       clear all task in sq
0177  *          @param cdev
0178  *          @param handle - the connection handle.
0179  *          @return 0 on success, otherwise error value.
0180  * @get_stats:      iSCSI related statistics
0181  *          @param cdev
0182  *          @param stats - pointer to struck that would be filled
0183  *              we stats
0184  *          @return 0 on success, error otherwise.
0185  * @change_mac:     Change MAC of interface
0186  *          @param cdev
0187  *          @param handle - the connection handle.
0188  *          @param mac - new MAC to configure.
0189  *          @return 0 on success, otherwise error value.
0190  */
0191 struct qed_iscsi_ops {
0192     const struct qed_common_ops *common;
0193 
0194     const struct qed_ll2_ops *ll2;
0195 
0196     int (*fill_dev_info)(struct qed_dev *cdev,
0197                  struct qed_dev_iscsi_info *info);
0198 
0199     void (*register_ops)(struct qed_dev *cdev,
0200                  struct qed_iscsi_cb_ops *ops, void *cookie);
0201 
0202     int (*start)(struct qed_dev *cdev,
0203              struct qed_iscsi_tid *tasks,
0204              void *event_context, iscsi_event_cb_t async_event_cb);
0205 
0206     int (*stop)(struct qed_dev *cdev);
0207 
0208     int (*acquire_conn)(struct qed_dev *cdev,
0209                 u32 *handle,
0210                 u32 *fw_cid, void __iomem **p_doorbell);
0211 
0212     int (*release_conn)(struct qed_dev *cdev, u32 handle);
0213 
0214     int (*offload_conn)(struct qed_dev *cdev,
0215                 u32 handle,
0216                 struct qed_iscsi_params_offload *conn_info);
0217 
0218     int (*update_conn)(struct qed_dev *cdev,
0219                u32 handle,
0220                struct qed_iscsi_params_update *conn_info);
0221 
0222     int (*destroy_conn)(struct qed_dev *cdev, u32 handle, u8 abrt_conn);
0223 
0224     int (*clear_sq)(struct qed_dev *cdev, u32 handle);
0225 
0226     int (*get_stats)(struct qed_dev *cdev,
0227              struct qed_iscsi_stats *stats);
0228 
0229     int (*change_mac)(struct qed_dev *cdev, u32 handle, const u8 *mac);
0230 };
0231 
0232 const struct qed_iscsi_ops *qed_get_iscsi_ops(void);
0233 void qed_put_iscsi_ops(void);
0234 #endif