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