1 #include <linux/socket.h>
4 #include <rdma/ib_verbs.h>
5 #include <rdma/rdma_cm.h>
7 #define ISERT_RDMA_LISTEN_BACKLOG 10
14 enum iser_ib_op_code {
21 enum iser_conn_state {
24 ISER_CONN_TERMINATING,
29 struct iser_hdr iser_header;
30 struct iscsi_hdr iscsi_header;
31 char data[ISER_RECV_DATA_SEG_LEN];
34 char pad[ISER_RX_PAD_SIZE];
38 struct iser_hdr iser_header;
39 struct iscsi_hdr iscsi_header;
40 enum isert_desc_type type;
42 struct ib_sge tx_sg[2];
44 struct isert_cmd *isert_cmd;
45 struct ib_send_wr send_wr;
48 struct isert_rdma_wr {
49 struct list_head wr_list;
50 struct isert_cmd *isert_cmd;
51 enum iser_ib_op_code iser_ib_op;
52 struct ib_sge *ib_sge;
54 struct scatterlist *sge;
56 struct ib_send_wr *send_wr;
69 struct isert_conn *conn;
70 struct iscsi_cmd iscsi_cmd;
71 struct ib_sge *ib_sge;
72 struct iser_tx_desc tx_desc;
73 struct isert_rdma_wr rdma_wr;
74 struct work_struct comp_work;
80 enum iser_conn_state state;
81 int post_recv_buf_count;
82 atomic_t post_send_buf_count;
83 u32 responder_resources;
91 unsigned int conn_rx_desc_head;
92 struct iser_rx_desc *conn_rx_descs;
93 struct ib_recv_wr conn_rx_wr[ISERT_MIN_POSTED_RX];
94 struct iscsi_conn *conn;
95 struct list_head conn_accept_node;
96 struct completion conn_login_comp;
97 struct iser_tx_desc conn_login_tx_desc;
98 struct rdma_cm_id *conn_cm_id;
99 struct ib_pd *conn_pd;
100 struct ib_mr *conn_mr;
101 struct ib_qp *conn_qp;
102 struct isert_device *conn_device;
103 struct work_struct conn_logout_work;
104 struct mutex conn_mutex;
105 struct completion conn_wait;
106 struct completion conn_wait_comp_err;
107 struct kref conn_kref;
111 #define ISERT_MAX_CQ 64
113 struct isert_cq_desc {
114 struct isert_device *device;
116 struct work_struct cq_rx_work;
117 struct work_struct cq_tx_work;
120 struct isert_device {
123 int cq_active_qps[ISERT_MAX_CQ];
124 struct ib_device *ib_device;
125 struct ib_pd *dev_pd;
126 struct ib_mr *dev_mr;
127 struct ib_cq *dev_rx_cq[ISERT_MAX_CQ];
128 struct ib_cq *dev_tx_cq[ISERT_MAX_CQ];
129 struct isert_cq_desc *cq_desc;
130 struct list_head dev_node;
134 struct semaphore np_sem;
135 struct rdma_cm_id *np_cm_id;
136 struct mutex np_accept_mutex;
137 struct list_head np_accept_list;
138 struct completion np_login_comp;