Эх сурвалжийг харах

IB/iser: Remove struct iscsi_iser_conn

The iscsi stack has existing mechanisms to link back and forth between
the iscsi connection and the iscsi transport (e.g iser/tcp) connection.

This is done through a dd_data pointer field in struct iscsi_conn
which can be set to point to the transport connection, etc.

The iscsi_iser_conn structure was used to get this linking done in
another way, which is uneeded and adds extra complication to the iser
code, so we just remove it.

Signed-off-by: Ariel Nahum <arieln@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Ariel Nahum 11 жил өмнө
parent
commit
4667f5dfb0

+ 18 - 27
drivers/infiniband/ulp/iser/iscsi_iser.c

@@ -146,8 +146,8 @@ static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
 int iser_initialize_task_headers(struct iscsi_task *task,
 int iser_initialize_task_headers(struct iscsi_task *task,
 						struct iser_tx_desc *tx_desc)
 						struct iser_tx_desc *tx_desc)
 {
 {
-	struct iscsi_iser_conn *iser_conn = task->conn->dd_data;
-	struct iser_device     *device    = iser_conn->ib_conn->device;
+	struct iser_conn       *ib_conn   = task->conn->dd_data;
+	struct iser_device     *device    = ib_conn->device;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	u64 dma_addr;
 	u64 dma_addr;
 
 
@@ -161,7 +161,7 @@ int iser_initialize_task_headers(struct iscsi_task *task,
 	tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
 	tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
 	tx_desc->tx_sg[0].lkey   = device->mr->lkey;
 	tx_desc->tx_sg[0].lkey   = device->mr->lkey;
 
 
-	iser_task->iser_conn		= iser_conn;
+	iser_task->ib_conn = ib_conn;
 	return 0;
 	return 0;
 }
 }
 /**
 /**
@@ -288,10 +288,9 @@ iscsi_iser_task_xmit(struct iscsi_task *task)
 static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 {
 {
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
-	struct iser_tx_desc	*tx_desc = &iser_task->desc;
-
-	struct iscsi_iser_conn *iser_conn = task->conn->dd_data;
-	struct iser_device     *device    = iser_conn->ib_conn->device;
+	struct iser_tx_desc    *tx_desc   = &iser_task->desc;
+	struct iser_conn       *ib_conn	  = task->conn->dd_data;
+	struct iser_device     *device	  = ib_conn->device;
 
 
 	ib_dma_unmap_single(device->ib_device,
 	ib_dma_unmap_single(device->ib_device,
 		tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE);
 		tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE);
@@ -323,9 +322,8 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
 {
 {
 	struct iscsi_conn *conn;
 	struct iscsi_conn *conn;
 	struct iscsi_cls_conn *cls_conn;
 	struct iscsi_cls_conn *cls_conn;
-	struct iscsi_iser_conn *iser_conn;
 
 
-	cls_conn = iscsi_conn_setup(cls_session, sizeof(*iser_conn), conn_idx);
+	cls_conn = iscsi_conn_setup(cls_session, 0, conn_idx);
 	if (!cls_conn)
 	if (!cls_conn)
 		return NULL;
 		return NULL;
 	conn = cls_conn->dd_data;
 	conn = cls_conn->dd_data;
@@ -336,10 +334,6 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
 	 */
 	 */
 	conn->max_recv_dlength = ISER_RECV_DATA_SEG_LEN;
 	conn->max_recv_dlength = ISER_RECV_DATA_SEG_LEN;
 
 
-	iser_conn = conn->dd_data;
-	conn->dd_data = iser_conn;
-	iser_conn->iscsi_conn = conn;
-
 	return cls_conn;
 	return cls_conn;
 }
 }
 
 
@@ -347,8 +341,7 @@ static void
 iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn)
 iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn)
 {
 {
 	struct iscsi_conn *conn = cls_conn->dd_data;
 	struct iscsi_conn *conn = cls_conn->dd_data;
-	struct iscsi_iser_conn *iser_conn = conn->dd_data;
-	struct iser_conn *ib_conn = iser_conn->ib_conn;
+	struct iser_conn *ib_conn = conn->dd_data;
 
 
 	iscsi_conn_teardown(cls_conn);
 	iscsi_conn_teardown(cls_conn);
 	/*
 	/*
@@ -357,7 +350,7 @@ iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn)
 	 * we free it here.
 	 * we free it here.
 	 */
 	 */
 	if (ib_conn) {
 	if (ib_conn) {
-		ib_conn->iser_conn = NULL;
+		ib_conn->iscsi_conn = NULL;
 		iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */
 		iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */
 	}
 	}
 }
 }
@@ -368,7 +361,6 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
 		     int is_leading)
 		     int is_leading)
 {
 {
 	struct iscsi_conn *conn = cls_conn->dd_data;
 	struct iscsi_conn *conn = cls_conn->dd_data;
-	struct iscsi_iser_conn *iser_conn;
 	struct iscsi_session *session;
 	struct iscsi_session *session;
 	struct iser_conn *ib_conn;
 	struct iser_conn *ib_conn;
 	struct iscsi_endpoint *ep;
 	struct iscsi_endpoint *ep;
@@ -395,11 +387,11 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
 	/* binds the iSER connection retrieved from the previously
 	/* binds the iSER connection retrieved from the previously
 	 * connected ep_handle to the iSCSI layer connection. exchanges
 	 * connected ep_handle to the iSCSI layer connection. exchanges
 	 * connection pointers */
 	 * connection pointers */
-	iser_info("binding iscsi/iser conn %p %p to ib_conn %p\n",
-		  conn, conn->dd_data, ib_conn);
-	iser_conn = conn->dd_data;
-	ib_conn->iser_conn = iser_conn;
-	iser_conn->ib_conn  = ib_conn;
+	iser_info("binding iscsi conn %p to ib_conn %p\n", conn, ib_conn);
+
+	conn->dd_data = ib_conn;
+	ib_conn->iscsi_conn = conn;
+
 	iser_conn_get(ib_conn); /* ref iscsi/ib conn binding */
 	iser_conn_get(ib_conn); /* ref iscsi/ib conn binding */
 	return 0;
 	return 0;
 }
 }
@@ -408,8 +400,7 @@ static void
 iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
 iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
 {
 {
 	struct iscsi_conn *conn = cls_conn->dd_data;
 	struct iscsi_conn *conn = cls_conn->dd_data;
-	struct iscsi_iser_conn *iser_conn = conn->dd_data;
-	struct iser_conn *ib_conn = iser_conn->ib_conn;
+	struct iser_conn *ib_conn = conn->dd_data;
 
 
 	/*
 	/*
 	 * Userspace may have goofed up and not bound the connection or
 	 * Userspace may have goofed up and not bound the connection or
@@ -423,7 +414,7 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
 		 */
 		 */
 		iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */
 		iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */
 	}
 	}
-	iser_conn->ib_conn = NULL;
+	conn->dd_data = NULL;
 }
 }
 
 
 static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
 static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
@@ -661,7 +652,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
 	struct iser_conn *ib_conn;
 	struct iser_conn *ib_conn;
 
 
 	ib_conn = ep->dd_data;
 	ib_conn = ep->dd_data;
-	if (ib_conn->iser_conn)
+	if (ib_conn->iscsi_conn)
 		/*
 		/*
 		 * Must suspend xmit path if the ep is bound to the
 		 * Must suspend xmit path if the ep is bound to the
 		 * iscsi_conn, so we know we are not accessing the ib_conn
 		 * iscsi_conn, so we know we are not accessing the ib_conn
@@ -669,7 +660,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
 		 *
 		 *
 		 * This may not be bound if the ep poll failed.
 		 * This may not be bound if the ep poll failed.
 		 */
 		 */
-		iscsi_suspend_tx(ib_conn->iser_conn->iscsi_conn);
+		iscsi_suspend_tx(ib_conn->iscsi_conn);
 
 
 
 
 	iser_info("ib conn %p state %d\n", ib_conn, ib_conn->state);
 	iser_info("ib conn %p state %d\n", ib_conn, ib_conn->state);

+ 2 - 8
drivers/infiniband/ulp/iser/iscsi_iser.h

@@ -214,7 +214,6 @@ struct iser_data_buf {
 /* fwd declarations */
 /* fwd declarations */
 struct iser_device;
 struct iser_device;
 struct iser_cq_desc;
 struct iser_cq_desc;
-struct iscsi_iser_conn;
 struct iscsi_iser_task;
 struct iscsi_iser_task;
 struct iscsi_endpoint;
 struct iscsi_endpoint;
 
 
@@ -319,7 +318,7 @@ struct fast_reg_descriptor {
 };
 };
 
 
 struct iser_conn {
 struct iser_conn {
-	struct iscsi_iser_conn       *iser_conn; /* iser conn for upcalls  */
+	struct iscsi_conn	     *iscsi_conn;
 	struct iscsi_endpoint	     *ep;
 	struct iscsi_endpoint	     *ep;
 	enum iser_ib_conn_state	     state;	    /* rdma connection state   */
 	enum iser_ib_conn_state	     state;	    /* rdma connection state   */
 	atomic_t		     refcount;
 	atomic_t		     refcount;
@@ -358,14 +357,9 @@ struct iser_conn {
 	};
 	};
 };
 };
 
 
-struct iscsi_iser_conn {
-	struct iscsi_conn            *iscsi_conn;/* ptr to iscsi conn */
-	struct iser_conn             *ib_conn;   /* iSER IB conn      */
-};
-
 struct iscsi_iser_task {
 struct iscsi_iser_task {
 	struct iser_tx_desc          desc;
 	struct iser_tx_desc          desc;
-	struct iscsi_iser_conn	     *iser_conn;
+	struct iser_conn	     *ib_conn;
 	enum iser_task_status 	     status;
 	enum iser_task_status 	     status;
 	struct scsi_cmnd	     *sc;
 	struct scsi_cmnd	     *sc;
 	int                          command_sent;  /* set if command  sent  */
 	int                          command_sent;  /* set if command  sent  */

+ 25 - 29
drivers/infiniband/ulp/iser/iser_initiator.c

@@ -49,7 +49,7 @@ static int iser_prepare_read_cmd(struct iscsi_task *task,
 
 
 {
 {
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
-	struct iser_device  *device = iser_task->iser_conn->ib_conn->device;
+	struct iser_device  *device = iser_task->ib_conn->device;
 	struct iser_regd_buf *regd_buf;
 	struct iser_regd_buf *regd_buf;
 	int err;
 	int err;
 	struct iser_hdr *hdr = &iser_task->desc.iser_header;
 	struct iser_hdr *hdr = &iser_task->desc.iser_header;
@@ -77,7 +77,7 @@ static int iser_prepare_read_cmd(struct iscsi_task *task,
 		iser_err("Total data length: %ld, less than EDTL: "
 		iser_err("Total data length: %ld, less than EDTL: "
 			 "%d, in READ cmd BHS itt: %d, conn: 0x%p\n",
 			 "%d, in READ cmd BHS itt: %d, conn: 0x%p\n",
 			 iser_task->data[ISER_DIR_IN].data_len, edtl,
 			 iser_task->data[ISER_DIR_IN].data_len, edtl,
-			 task->itt, iser_task->iser_conn);
+			 task->itt, iser_task->ib_conn);
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
 
 
@@ -110,7 +110,7 @@ iser_prepare_write_cmd(struct iscsi_task *task,
 		       unsigned int edtl)
 		       unsigned int edtl)
 {
 {
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
-	struct iser_device  *device = iser_task->iser_conn->ib_conn->device;
+	struct iser_device  *device = iser_task->ib_conn->device;
 	struct iser_regd_buf *regd_buf;
 	struct iser_regd_buf *regd_buf;
 	int err;
 	int err;
 	struct iser_hdr *hdr = &iser_task->desc.iser_header;
 	struct iser_hdr *hdr = &iser_task->desc.iser_header;
@@ -349,7 +349,7 @@ free_login_buf:
 
 
 static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req)
 static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req)
 {
 {
-	struct iscsi_iser_conn *iser_conn = conn->dd_data;
+	struct iser_conn *ib_conn = conn->dd_data;
 	struct iscsi_session *session = conn->session;
 	struct iscsi_session *session = conn->session;
 
 
 	iser_dbg("req op %x flags %x\n", req->opcode, req->flags);
 	iser_dbg("req op %x flags %x\n", req->opcode, req->flags);
@@ -362,19 +362,18 @@ static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req)
 	 * response) and no posted send buffers left - they must have been
 	 * response) and no posted send buffers left - they must have been
 	 * consumed during previous login phases.
 	 * consumed during previous login phases.
 	 */
 	 */
-	WARN_ON(iser_conn->ib_conn->post_recv_buf_count != 1);
-	WARN_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0);
+	WARN_ON(ib_conn->post_recv_buf_count != 1);
+	WARN_ON(atomic_read(&ib_conn->post_send_buf_count) != 0);
 
 
 	if (session->discovery_sess) {
 	if (session->discovery_sess) {
 		iser_info("Discovery session, re-using login RX buffer\n");
 		iser_info("Discovery session, re-using login RX buffer\n");
 		return 0;
 		return 0;
 	} else
 	} else
 		iser_info("Normal session, posting batch of RX %d buffers\n",
 		iser_info("Normal session, posting batch of RX %d buffers\n",
-			  iser_conn->ib_conn->min_posted_rx);
+			  ib_conn->min_posted_rx);
 
 
 	/* Initial post receive buffers */
 	/* Initial post receive buffers */
-	if (iser_post_recvm(iser_conn->ib_conn,
-			    iser_conn->ib_conn->min_posted_rx))
+	if (iser_post_recvm(ib_conn, ib_conn->min_posted_rx))
 		return -ENOMEM;
 		return -ENOMEM;
 
 
 	return 0;
 	return 0;
@@ -386,7 +385,7 @@ static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req)
 int iser_send_command(struct iscsi_conn *conn,
 int iser_send_command(struct iscsi_conn *conn,
 		      struct iscsi_task *task)
 		      struct iscsi_task *task)
 {
 {
-	struct iscsi_iser_conn *iser_conn = conn->dd_data;
+	struct iser_conn *ib_conn = conn->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	unsigned long edtl;
 	unsigned long edtl;
 	int err;
 	int err;
@@ -399,7 +398,7 @@ int iser_send_command(struct iscsi_conn *conn,
 
 
 	/* build the tx desc regd header and add it to the tx desc dto */
 	/* build the tx desc regd header and add it to the tx desc dto */
 	tx_desc->type = ISCSI_TX_SCSI_COMMAND;
 	tx_desc->type = ISCSI_TX_SCSI_COMMAND;
-	iser_create_send_desc(iser_conn->ib_conn, tx_desc);
+	iser_create_send_desc(ib_conn, tx_desc);
 
 
 	if (hdr->flags & ISCSI_FLAG_CMD_READ) {
 	if (hdr->flags & ISCSI_FLAG_CMD_READ) {
 		data_buf = &iser_task->data[ISER_DIR_IN];
 		data_buf = &iser_task->data[ISER_DIR_IN];
@@ -438,7 +437,7 @@ int iser_send_command(struct iscsi_conn *conn,
 
 
 	iser_task->status = ISER_TASK_STATUS_STARTED;
 	iser_task->status = ISER_TASK_STATUS_STARTED;
 
 
-	err = iser_post_send(iser_conn->ib_conn, tx_desc);
+	err = iser_post_send(ib_conn, tx_desc);
 	if (!err)
 	if (!err)
 		return 0;
 		return 0;
 
 
@@ -454,7 +453,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
 		       struct iscsi_task *task,
 		       struct iscsi_task *task,
 		       struct iscsi_data *hdr)
 		       struct iscsi_data *hdr)
 {
 {
-	struct iscsi_iser_conn *iser_conn = conn->dd_data;
+	struct iser_conn *ib_conn = conn->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iser_tx_desc *tx_desc = NULL;
 	struct iser_tx_desc *tx_desc = NULL;
 	struct iser_regd_buf *regd_buf;
 	struct iser_regd_buf *regd_buf;
@@ -503,7 +502,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
 		 itt, buf_offset, data_seg_len);
 		 itt, buf_offset, data_seg_len);
 
 
 
 
-	err = iser_post_send(iser_conn->ib_conn, tx_desc);
+	err = iser_post_send(ib_conn, tx_desc);
 	if (!err)
 	if (!err)
 		return 0;
 		return 0;
 
 
@@ -516,19 +515,18 @@ send_data_out_error:
 int iser_send_control(struct iscsi_conn *conn,
 int iser_send_control(struct iscsi_conn *conn,
 		      struct iscsi_task *task)
 		      struct iscsi_task *task)
 {
 {
-	struct iscsi_iser_conn *iser_conn = conn->dd_data;
+	struct iser_conn *ib_conn = conn->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iscsi_iser_task *iser_task = task->dd_data;
 	struct iser_tx_desc *mdesc = &iser_task->desc;
 	struct iser_tx_desc *mdesc = &iser_task->desc;
 	unsigned long data_seg_len;
 	unsigned long data_seg_len;
 	int err = 0;
 	int err = 0;
 	struct iser_device *device;
 	struct iser_device *device;
-	struct iser_conn *ib_conn = iser_conn->ib_conn;
 
 
 	/* build the tx desc regd header and add it to the tx desc dto */
 	/* build the tx desc regd header and add it to the tx desc dto */
 	mdesc->type = ISCSI_TX_CONTROL;
 	mdesc->type = ISCSI_TX_CONTROL;
-	iser_create_send_desc(iser_conn->ib_conn, mdesc);
+	iser_create_send_desc(ib_conn, mdesc);
 
 
-	device = iser_conn->ib_conn->device;
+	device = ib_conn->device;
 
 
 	data_seg_len = ntoh24(task->hdr->dlength);
 	data_seg_len = ntoh24(task->hdr->dlength);
 
 
@@ -543,14 +541,13 @@ int iser_send_control(struct iscsi_conn *conn,
 			ib_conn->login_req_dma, task->data_count,
 			ib_conn->login_req_dma, task->data_count,
 			DMA_TO_DEVICE);
 			DMA_TO_DEVICE);
 
 
-		memcpy(iser_conn->ib_conn->login_req_buf, task->data,
-							task->data_count);
+		memcpy(ib_conn->login_req_buf, task->data, task->data_count);
 
 
 		ib_dma_sync_single_for_device(device->ib_device,
 		ib_dma_sync_single_for_device(device->ib_device,
 			ib_conn->login_req_dma, task->data_count,
 			ib_conn->login_req_dma, task->data_count,
 			DMA_TO_DEVICE);
 			DMA_TO_DEVICE);
 
 
-		tx_dsg->addr    = iser_conn->ib_conn->login_req_dma;
+		tx_dsg->addr    = ib_conn->login_req_dma;
 		tx_dsg->length  = task->data_count;
 		tx_dsg->length  = task->data_count;
 		tx_dsg->lkey    = device->mr->lkey;
 		tx_dsg->lkey    = device->mr->lkey;
 		mdesc->num_sge = 2;
 		mdesc->num_sge = 2;
@@ -559,7 +556,7 @@ int iser_send_control(struct iscsi_conn *conn,
 	if (task == conn->login_task) {
 	if (task == conn->login_task) {
 		iser_dbg("op %x dsl %lx, posting login rx buffer\n",
 		iser_dbg("op %x dsl %lx, posting login rx buffer\n",
 			 task->hdr->opcode, data_seg_len);
 			 task->hdr->opcode, data_seg_len);
-		err = iser_post_recvl(iser_conn->ib_conn);
+		err = iser_post_recvl(ib_conn);
 		if (err)
 		if (err)
 			goto send_control_error;
 			goto send_control_error;
 		err = iser_post_rx_bufs(conn, task->hdr);
 		err = iser_post_rx_bufs(conn, task->hdr);
@@ -567,7 +564,7 @@ int iser_send_control(struct iscsi_conn *conn,
 			goto send_control_error;
 			goto send_control_error;
 	}
 	}
 
 
-	err = iser_post_send(iser_conn->ib_conn, mdesc);
+	err = iser_post_send(ib_conn, mdesc);
 	if (!err)
 	if (!err)
 		return 0;
 		return 0;
 
 
@@ -583,7 +580,6 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
 			 unsigned long rx_xfer_len,
 			 unsigned long rx_xfer_len,
 			 struct iser_conn *ib_conn)
 			 struct iser_conn *ib_conn)
 {
 {
-	struct iscsi_iser_conn *conn = ib_conn->iser_conn;
 	struct iscsi_hdr *hdr;
 	struct iscsi_hdr *hdr;
 	u64 rx_dma;
 	u64 rx_dma;
 	int rx_buflen, outstanding, count, err;
 	int rx_buflen, outstanding, count, err;
@@ -605,17 +601,17 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
 	iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode,
 	iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode,
 			hdr->itt, (int)(rx_xfer_len - ISER_HEADERS_LEN));
 			hdr->itt, (int)(rx_xfer_len - ISER_HEADERS_LEN));
 
 
-	iscsi_iser_recv(conn->iscsi_conn, hdr,
-		rx_desc->data, rx_xfer_len - ISER_HEADERS_LEN);
+	iscsi_iser_recv(ib_conn->iscsi_conn, hdr, rx_desc->data,
+			rx_xfer_len - ISER_HEADERS_LEN);
 
 
 	ib_dma_sync_single_for_device(ib_conn->device->ib_device, rx_dma,
 	ib_dma_sync_single_for_device(ib_conn->device->ib_device, rx_dma,
-			rx_buflen, DMA_FROM_DEVICE);
+				      rx_buflen, DMA_FROM_DEVICE);
 
 
 	/* decrementing conn->post_recv_buf_count only --after-- freeing the   *
 	/* decrementing conn->post_recv_buf_count only --after-- freeing the   *
 	 * task eliminates the need to worry on tasks which are completed in   *
 	 * task eliminates the need to worry on tasks which are completed in   *
 	 * parallel to the execution of iser_conn_term. So the code that waits *
 	 * parallel to the execution of iser_conn_term. So the code that waits *
 	 * for the posted rx bufs refcount to become zero handles everything   */
 	 * for the posted rx bufs refcount to become zero handles everything   */
-	conn->ib_conn->post_recv_buf_count--;
+	ib_conn->post_recv_buf_count--;
 
 
 	if (rx_dma == ib_conn->login_resp_dma)
 	if (rx_dma == ib_conn->login_resp_dma)
 		return;
 		return;
@@ -676,7 +672,7 @@ void iser_task_rdma_init(struct iscsi_iser_task *iser_task)
 
 
 void iser_task_rdma_finalize(struct iscsi_iser_task *iser_task)
 void iser_task_rdma_finalize(struct iscsi_iser_task *iser_task)
 {
 {
-	struct iser_device *device = iser_task->iser_conn->ib_conn->device;
+	struct iser_device *device = iser_task->ib_conn->device;
 	int is_rdma_data_aligned = 1;
 	int is_rdma_data_aligned = 1;
 	int is_rdma_prot_aligned = 1;
 	int is_rdma_prot_aligned = 1;
 	int prot_count = scsi_prot_sg_count(iser_task->sc);
 	int prot_count = scsi_prot_sg_count(iser_task->sc);

+ 10 - 10
drivers/infiniband/ulp/iser/iser_memory.c

@@ -49,7 +49,7 @@ static int iser_start_rdma_unaligned_sg(struct iscsi_iser_task *iser_task,
 					struct iser_data_buf *data_copy,
 					struct iser_data_buf *data_copy,
 					enum iser_data_dir cmd_dir)
 					enum iser_data_dir cmd_dir)
 {
 {
-	struct ib_device *dev = iser_task->iser_conn->ib_conn->device->ib_device;
+	struct ib_device *dev = iser_task->ib_conn->device->ib_device;
 	struct scatterlist *sgl = (struct scatterlist *)data->buf;
 	struct scatterlist *sgl = (struct scatterlist *)data->buf;
 	struct scatterlist *sg;
 	struct scatterlist *sg;
 	char *mem = NULL;
 	char *mem = NULL;
@@ -116,7 +116,7 @@ void iser_finalize_rdma_unaligned_sg(struct iscsi_iser_task *iser_task,
 	struct ib_device *dev;
 	struct ib_device *dev;
 	unsigned long  cmd_data_len;
 	unsigned long  cmd_data_len;
 
 
-	dev = iser_task->iser_conn->ib_conn->device->ib_device;
+	dev = iser_task->ib_conn->device->ib_device;
 
 
 	ib_dma_unmap_sg(dev, &data_copy->sg_single, 1,
 	ib_dma_unmap_sg(dev, &data_copy->sg_single, 1,
 			(cmd_dir == ISER_DIR_OUT) ?
 			(cmd_dir == ISER_DIR_OUT) ?
@@ -322,7 +322,7 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task,
 	struct ib_device *dev;
 	struct ib_device *dev;
 
 
 	iser_task->dir[iser_dir] = 1;
 	iser_task->dir[iser_dir] = 1;
-	dev = iser_task->iser_conn->ib_conn->device->ib_device;
+	dev = iser_task->ib_conn->device->ib_device;
 
 
 	data->dma_nents = ib_dma_map_sg(dev, data->buf, data->size, dma_dir);
 	data->dma_nents = ib_dma_map_sg(dev, data->buf, data->size, dma_dir);
 	if (data->dma_nents == 0) {
 	if (data->dma_nents == 0) {
@@ -337,7 +337,7 @@ void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task,
 {
 {
 	struct ib_device *dev;
 	struct ib_device *dev;
 
 
-	dev = iser_task->iser_conn->ib_conn->device->ib_device;
+	dev = iser_task->ib_conn->device->ib_device;
 	ib_dma_unmap_sg(dev, data->buf, data->size, DMA_FROM_DEVICE);
 	ib_dma_unmap_sg(dev, data->buf, data->size, DMA_FROM_DEVICE);
 }
 }
 
 
@@ -348,7 +348,7 @@ static int fall_to_bounce_buf(struct iscsi_iser_task *iser_task,
 			      enum iser_data_dir cmd_dir,
 			      enum iser_data_dir cmd_dir,
 			      int aligned_len)
 			      int aligned_len)
 {
 {
-	struct iscsi_conn    *iscsi_conn = iser_task->iser_conn->iscsi_conn;
+	struct iscsi_conn    *iscsi_conn = iser_task->ib_conn->iscsi_conn;
 
 
 	iscsi_conn->fmr_unalign_cnt++;
 	iscsi_conn->fmr_unalign_cnt++;
 	iser_warn("rdma alignment violation (%d/%d aligned) or FMR not supported\n",
 	iser_warn("rdma alignment violation (%d/%d aligned) or FMR not supported\n",
@@ -377,7 +377,7 @@ static int fall_to_bounce_buf(struct iscsi_iser_task *iser_task,
 int iser_reg_rdma_mem_fmr(struct iscsi_iser_task *iser_task,
 int iser_reg_rdma_mem_fmr(struct iscsi_iser_task *iser_task,
 			  enum iser_data_dir cmd_dir)
 			  enum iser_data_dir cmd_dir)
 {
 {
-	struct iser_conn     *ib_conn = iser_task->iser_conn->ib_conn;
+	struct iser_conn     *ib_conn = iser_task->ib_conn;
 	struct iser_device   *device = ib_conn->device;
 	struct iser_device   *device = ib_conn->device;
 	struct ib_device     *ibdev = device->ib_device;
 	struct ib_device     *ibdev = device->ib_device;
 	struct iser_data_buf *mem = &iser_task->data[cmd_dir];
 	struct iser_data_buf *mem = &iser_task->data[cmd_dir];
@@ -533,7 +533,7 @@ iser_reg_sig_mr(struct iscsi_iser_task *iser_task,
 		struct fast_reg_descriptor *desc, struct ib_sge *data_sge,
 		struct fast_reg_descriptor *desc, struct ib_sge *data_sge,
 		struct ib_sge *prot_sge, struct ib_sge *sig_sge)
 		struct ib_sge *prot_sge, struct ib_sge *sig_sge)
 {
 {
-	struct iser_conn *iser_conn = iser_task->iser_conn->ib_conn;
+	struct iser_conn *ib_conn = iser_task->ib_conn;
 	struct iser_pi_context *pi_ctx = desc->pi_ctx;
 	struct iser_pi_context *pi_ctx = desc->pi_ctx;
 	struct ib_send_wr sig_wr, inv_wr;
 	struct ib_send_wr sig_wr, inv_wr;
 	struct ib_send_wr *bad_wr, *wr = NULL;
 	struct ib_send_wr *bad_wr, *wr = NULL;
@@ -579,7 +579,7 @@ iser_reg_sig_mr(struct iscsi_iser_task *iser_task,
 	else
 	else
 		wr->next = &sig_wr;
 		wr->next = &sig_wr;
 
 
-	ret = ib_post_send(iser_conn->qp, wr, &bad_wr);
+	ret = ib_post_send(ib_conn->qp, wr, &bad_wr);
 	if (ret) {
 	if (ret) {
 		iser_err("reg_sig_mr failed, ret:%d\n", ret);
 		iser_err("reg_sig_mr failed, ret:%d\n", ret);
 		goto err;
 		goto err;
@@ -609,7 +609,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task,
 			    struct ib_sge *sge)
 			    struct ib_sge *sge)
 {
 {
 	struct fast_reg_descriptor *desc = regd_buf->reg.mem_h;
 	struct fast_reg_descriptor *desc = regd_buf->reg.mem_h;
-	struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn;
+	struct iser_conn *ib_conn = iser_task->ib_conn;
 	struct iser_device *device = ib_conn->device;
 	struct iser_device *device = ib_conn->device;
 	struct ib_device *ibdev = device->ib_device;
 	struct ib_device *ibdev = device->ib_device;
 	struct ib_mr *mr;
 	struct ib_mr *mr;
@@ -700,7 +700,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task,
 int iser_reg_rdma_mem_fastreg(struct iscsi_iser_task *iser_task,
 int iser_reg_rdma_mem_fastreg(struct iscsi_iser_task *iser_task,
 			      enum iser_data_dir cmd_dir)
 			      enum iser_data_dir cmd_dir)
 {
 {
-	struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn;
+	struct iser_conn *ib_conn = iser_task->ib_conn;
 	struct iser_device *device = ib_conn->device;
 	struct iser_device *device = ib_conn->device;
 	struct ib_device *ibdev = device->ib_device;
 	struct ib_device *ibdev = device->ib_device;
 	struct iser_data_buf *mem = &iser_task->data[cmd_dir];
 	struct iser_data_buf *mem = &iser_task->data[cmd_dir];

+ 4 - 5
drivers/infiniband/ulp/iser/iser_verbs.c

@@ -745,9 +745,8 @@ static int iser_disconnected_handler(struct rdma_cm_id *cma_id)
 	 * terminated asynchronously from the iSCSI layer's perspective.  */
 	 * terminated asynchronously from the iSCSI layer's perspective.  */
 	if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
 	if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
 					ISER_CONN_TERMINATING)){
 					ISER_CONN_TERMINATING)){
-		if (ib_conn->iser_conn)
-			iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
-					   ISCSI_ERR_CONN_FAILED);
+		if (ib_conn->iscsi_conn)
+			iscsi_conn_failure(ib_conn->iscsi_conn, ISCSI_ERR_CONN_FAILED);
 		else
 		else
 			iser_err("iscsi_iser connection isn't bound\n");
 			iser_err("iscsi_iser connection isn't bound\n");
 	}
 	}
@@ -951,7 +950,7 @@ void iser_unreg_mem_fastreg(struct iscsi_iser_task *iser_task,
 			    enum iser_data_dir cmd_dir)
 			    enum iser_data_dir cmd_dir)
 {
 {
 	struct iser_mem_reg *reg = &iser_task->rdma_regd[cmd_dir].reg;
 	struct iser_mem_reg *reg = &iser_task->rdma_regd[cmd_dir].reg;
-	struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn;
+	struct iser_conn *ib_conn = iser_task->ib_conn;
 	struct fast_reg_descriptor *desc = reg->mem_h;
 	struct fast_reg_descriptor *desc = reg->mem_h;
 
 
 	if (!reg->is_mr)
 	if (!reg->is_mr)
@@ -1061,7 +1060,7 @@ static void iser_handle_comp_error(struct iser_tx_desc *desc,
 		 * perspective.                                             */
 		 * perspective.                                             */
 		if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
 		if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
 		    ISER_CONN_TERMINATING))
 		    ISER_CONN_TERMINATING))
-			iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
+			iscsi_conn_failure(ib_conn->iscsi_conn,
 					   ISCSI_ERR_CONN_FAILED);
 					   ISCSI_ERR_CONN_FAILED);
 
 
 		/* no more non completed posts to the QP, complete the
 		/* no more non completed posts to the QP, complete the