x86/xen: resume timer irqs early
[linux/fpc-iii.git] / drivers / infiniband / ulp / isert / ib_isert.h
blob90e6aa3c25d2fea512d7c10799f91741eb6a21ed
1 #include <linux/socket.h>
2 #include <linux/in.h>
3 #include <linux/in6.h>
4 #include <rdma/ib_verbs.h>
5 #include <rdma/rdma_cm.h>
7 #define ISERT_RDMA_LISTEN_BACKLOG 10
8 #define ISCSI_ISER_SG_TABLESIZE 256
9 #define ISER_FASTREG_LI_WRID 0xffffffffffffffffULL
11 enum isert_desc_type {
12 ISCSI_TX_CONTROL,
13 ISCSI_TX_DATAIN
16 enum iser_ib_op_code {
17 ISER_IB_RECV,
18 ISER_IB_SEND,
19 ISER_IB_RDMA_WRITE,
20 ISER_IB_RDMA_READ,
23 enum iser_conn_state {
24 ISER_CONN_INIT,
25 ISER_CONN_UP,
26 ISER_CONN_TERMINATING,
27 ISER_CONN_DOWN,
30 struct iser_rx_desc {
31 struct iser_hdr iser_header;
32 struct iscsi_hdr iscsi_header;
33 char data[ISER_RECV_DATA_SEG_LEN];
34 u64 dma_addr;
35 struct ib_sge rx_sg;
36 char pad[ISER_RX_PAD_SIZE];
37 } __packed;
39 struct iser_tx_desc {
40 struct iser_hdr iser_header;
41 struct iscsi_hdr iscsi_header;
42 enum isert_desc_type type;
43 u64 dma_addr;
44 struct ib_sge tx_sg[2];
45 int num_sge;
46 struct isert_cmd *isert_cmd;
47 struct ib_send_wr send_wr;
48 } __packed;
50 struct fast_reg_descriptor {
51 struct list_head list;
52 struct ib_mr *data_mr;
53 struct ib_fast_reg_page_list *data_frpl;
54 bool valid;
57 struct isert_rdma_wr {
58 struct list_head wr_list;
59 struct isert_cmd *isert_cmd;
60 enum iser_ib_op_code iser_ib_op;
61 struct ib_sge *ib_sge;
62 struct ib_sge s_ib_sge;
63 int num_sge;
64 struct scatterlist *sge;
65 int send_wr_num;
66 struct ib_send_wr *send_wr;
67 struct ib_send_wr s_send_wr;
68 u32 cur_rdma_length;
69 struct fast_reg_descriptor *fr_desc;
72 struct isert_cmd {
73 uint32_t read_stag;
74 uint32_t write_stag;
75 uint64_t read_va;
76 uint64_t write_va;
77 u64 pdu_buf_dma;
78 u32 pdu_buf_len;
79 u32 read_va_off;
80 u32 write_va_off;
81 u32 rdma_wr_num;
82 struct isert_conn *conn;
83 struct iscsi_cmd *iscsi_cmd;
84 struct iser_tx_desc tx_desc;
85 struct isert_rdma_wr rdma_wr;
86 struct work_struct comp_work;
89 struct isert_device;
91 struct isert_conn {
92 enum iser_conn_state state;
93 int post_recv_buf_count;
94 atomic_t post_send_buf_count;
95 u32 responder_resources;
96 u32 initiator_depth;
97 u32 max_sge;
98 char *login_buf;
99 char *login_req_buf;
100 char *login_rsp_buf;
101 u64 login_req_dma;
102 u64 login_rsp_dma;
103 unsigned int conn_rx_desc_head;
104 struct iser_rx_desc *conn_rx_descs;
105 struct ib_recv_wr conn_rx_wr[ISERT_MIN_POSTED_RX];
106 struct iscsi_conn *conn;
107 struct list_head conn_accept_node;
108 struct completion conn_login_comp;
109 struct iser_tx_desc conn_login_tx_desc;
110 struct rdma_cm_id *conn_cm_id;
111 struct ib_pd *conn_pd;
112 struct ib_mr *conn_mr;
113 struct ib_qp *conn_qp;
114 struct isert_device *conn_device;
115 struct work_struct conn_logout_work;
116 struct mutex conn_mutex;
117 struct completion conn_wait;
118 struct completion conn_wait_comp_err;
119 struct kref conn_kref;
120 struct list_head conn_frwr_pool;
121 int conn_frwr_pool_size;
122 /* lock to protect frwr_pool */
123 spinlock_t conn_lock;
124 bool disconnect;
127 #define ISERT_MAX_CQ 64
129 struct isert_cq_desc {
130 struct isert_device *device;
131 int cq_index;
132 struct work_struct cq_rx_work;
133 struct work_struct cq_tx_work;
136 struct isert_device {
137 int use_frwr;
138 int cqs_used;
139 int refcount;
140 int cq_active_qps[ISERT_MAX_CQ];
141 struct ib_device *ib_device;
142 struct ib_pd *dev_pd;
143 struct ib_mr *dev_mr;
144 struct ib_cq *dev_rx_cq[ISERT_MAX_CQ];
145 struct ib_cq *dev_tx_cq[ISERT_MAX_CQ];
146 struct isert_cq_desc *cq_desc;
147 struct list_head dev_node;
148 struct ib_device_attr dev_attr;
149 int (*reg_rdma_mem)(struct iscsi_conn *conn,
150 struct iscsi_cmd *cmd,
151 struct isert_rdma_wr *wr);
152 void (*unreg_rdma_mem)(struct isert_cmd *isert_cmd,
153 struct isert_conn *isert_conn);
156 struct isert_np {
157 struct semaphore np_sem;
158 struct rdma_cm_id *np_cm_id;
159 struct mutex np_accept_mutex;
160 struct list_head np_accept_list;
161 struct completion np_login_comp;