hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/infiniband/ulp/isert/ib_isert.h
....@@ -59,11 +59,17 @@
5959 ISERT_MAX_TX_MISC_PDUS + \
6060 ISERT_MAX_RX_MISC_PDUS)
6161
62
-#define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \
63
- (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \
64
- sizeof(struct ib_cqe) + sizeof(bool)))
62
+/*
63
+ * RX size is default of 8k plus headers, but data needs to align to
64
+ * 512 boundary, so use 1024 to have the extra space for alignment.
65
+ */
66
+#define ISER_RX_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024)
6567
66
-#define ISCSI_ISER_SG_TABLESIZE 256
68
+/* Minimum I/O size is 512KB */
69
+#define ISCSI_ISER_MIN_SG_TABLESIZE 128
70
+
71
+/* Maximum support is 16MB I/O size */
72
+#define ISCSI_ISER_MAX_SG_TABLESIZE 4096
6773
6874 enum isert_desc_type {
6975 ISCSI_TX_CONTROL,
....@@ -80,19 +86,39 @@
8086 };
8187
8288 struct iser_rx_desc {
83
- struct iser_ctrl iser_header;
84
- struct iscsi_hdr iscsi_header;
85
- char data[ISCSI_DEF_MAX_RECV_SEG_LEN];
89
+ char buf[ISER_RX_SIZE];
8690 u64 dma_addr;
8791 struct ib_sge rx_sg;
8892 struct ib_cqe rx_cqe;
8993 bool in_use;
90
- char pad[ISER_RX_PAD_SIZE];
91
-} __packed;
94
+};
9295
9396 static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe)
9497 {
9598 return container_of(cqe, struct iser_rx_desc, rx_cqe);
99
+}
100
+
101
+static void *isert_get_iser_hdr(struct iser_rx_desc *desc)
102
+{
103
+ return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN;
104
+}
105
+
106
+static size_t isert_get_hdr_offset(struct iser_rx_desc *desc)
107
+{
108
+ return isert_get_iser_hdr(desc) - (void *)desc->buf;
109
+}
110
+
111
+static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc)
112
+{
113
+ return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl);
114
+}
115
+
116
+static void *isert_get_data(struct iser_rx_desc *desc)
117
+{
118
+ void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN;
119
+
120
+ WARN_ON((uintptr_t)data & 511);
121
+ return data;
96122 }
97123
98124 struct iser_tx_desc {
....@@ -141,9 +167,8 @@
141167 u32 responder_resources;
142168 u32 initiator_depth;
143169 bool pi_support;
144
- struct iser_rx_desc *login_req_buf;
170
+ struct iser_rx_desc *login_desc;
145171 char *login_rsp_buf;
146
- u64 login_req_dma;
147172 int login_req_len;
148173 u64 login_rsp_dma;
149174 struct iser_rx_desc *rx_descs;
....@@ -155,6 +180,8 @@
155180 struct iser_tx_desc login_tx_desc;
156181 struct rdma_cm_id *cm_id;
157182 struct ib_qp *qp;
183
+ struct ib_cq *cq;
184
+ u32 cq_size;
158185 struct isert_device *device;
159186 struct mutex mutex;
160187 struct kref kref;
....@@ -163,22 +190,6 @@
163190 bool snd_w_inv;
164191 wait_queue_head_t rem_wait;
165192 bool dev_removed;
166
-};
167
-
168
-#define ISERT_MAX_CQ 64
169
-
170
-/**
171
- * struct isert_comp - iSER completion context
172
- *
173
- * @device: pointer to device handle
174
- * @cq: completion queue
175
- * @active_qps: Number of active QPs attached
176
- * to completion context
177
- */
178
-struct isert_comp {
179
- struct isert_device *device;
180
- struct ib_cq *cq;
181
- int active_qps;
182193 };
183194
184195 struct isert_device {