Skip to content

Commit

Permalink
IB/iser: Have iSER data transaction object point to iSER conn
Browse files Browse the repository at this point in the history
iSER uses a data transaction object (struct iser_dto) as part
of its IB data descriptors (struct iser_desc) management.
It also uses a hierarchy of connection structures pointing to
each other. A DTO may exist even after the iscsi_iser connection
pointed by it is destroyed (eg one that is bound to a post
receive buffer which was flushed by the IB HW). Hence DTOs need
point to the lowest connection, which is struct iser_conn.

Signed-off-by: Erez Zilber <erezz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Erez Zilber authored and Roland Dreier committed Sep 28, 2006
1 parent ee30cb5 commit 87e8df7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions drivers/infiniband/ulp/iser/iscsi_iser.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn)
struct iscsi_iser_conn *iser_conn = conn->dd_data;

iscsi_conn_teardown(cls_conn);
if (iser_conn->ib_conn)
iser_conn->ib_conn->iser_conn = NULL;
kfree(iser_conn);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/iser/iscsi_iser.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct iser_regd_buf {

struct iser_dto {
struct iscsi_iser_cmd_task *ctask;
struct iscsi_iser_conn *conn;
struct iser_conn *ib_conn;
int notify_enable;

/* vector of registered buffers */
Expand Down
11 changes: 6 additions & 5 deletions drivers/infiniband/ulp/iser/iser_initiator.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static int iser_post_receive_control(struct iscsi_conn *conn)
}

recv_dto = &rx_desc->dto;
recv_dto->conn = iser_conn;
recv_dto->ib_conn = iser_conn->ib_conn;
recv_dto->regd_vector_len = 0;

regd_hdr = &rx_desc->hdr_regd_buf;
Expand Down Expand Up @@ -296,7 +296,7 @@ static void iser_create_send_desc(struct iscsi_iser_conn *iser_conn,
regd_hdr->virt_addr = tx_desc; /* == &tx_desc->iser_header */
regd_hdr->data_size = ISER_TOTAL_HEADERS_LEN;

send_dto->conn = iser_conn;
send_dto->ib_conn = iser_conn->ib_conn;
send_dto->notify_enable = 1;
send_dto->regd_vector_len = 0;

Expand Down Expand Up @@ -588,7 +588,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
unsigned long dto_xfer_len)
{
struct iser_dto *dto = &rx_desc->dto;
struct iscsi_iser_conn *conn = dto->conn;
struct iscsi_iser_conn *conn = dto->ib_conn->iser_conn;
struct iscsi_session *session = conn->iscsi_conn->session;
struct iscsi_cmd_task *ctask;
struct iscsi_iser_cmd_task *iser_ctask;
Expand Down Expand Up @@ -641,7 +641,8 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
void iser_snd_completion(struct iser_desc *tx_desc)
{
struct iser_dto *dto = &tx_desc->dto;
struct iscsi_iser_conn *iser_conn = dto->conn;
struct iser_conn *ib_conn = dto->ib_conn;
struct iscsi_iser_conn *iser_conn = ib_conn->iser_conn;
struct iscsi_conn *conn = iser_conn->iscsi_conn;
struct iscsi_mgmt_task *mtask;

Expand All @@ -652,7 +653,7 @@ void iser_snd_completion(struct iser_desc *tx_desc)
if (tx_desc->type == ISCSI_TX_DATAOUT)
kmem_cache_free(ig.desc_cache, tx_desc);

atomic_dec(&iser_conn->ib_conn->post_send_buf_count);
atomic_dec(&ib_conn->post_send_buf_count);

write_lock(conn->recv_lock);
if (conn->suspend_tx) {
Expand Down
8 changes: 5 additions & 3 deletions drivers/infiniband/ulp/iser/iser_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ void iser_conn_release(struct iser_conn *ib_conn)
/* on EVENT_ADDR_ERROR there's no device yet for this conn */
if (device != NULL)
iser_device_try_release(device);
if (ib_conn->iser_conn)
ib_conn->iser_conn->ib_conn = NULL;
kfree(ib_conn);
}

Expand Down Expand Up @@ -694,7 +696,7 @@ int iser_post_recv(struct iser_desc *rx_desc)
struct iser_dto *recv_dto = &rx_desc->dto;

/* Retrieve conn */
ib_conn = recv_dto->conn->ib_conn;
ib_conn = recv_dto->ib_conn;

iser_dto_to_iov(recv_dto, iov, 2);

Expand Down Expand Up @@ -727,7 +729,7 @@ int iser_post_send(struct iser_desc *tx_desc)
struct iser_conn *ib_conn;
struct iser_dto *dto = &tx_desc->dto;

ib_conn = dto->conn->ib_conn;
ib_conn = dto->ib_conn;

iser_dto_to_iov(dto, iov, MAX_REGD_BUF_VECTOR_LEN);

Expand Down Expand Up @@ -774,7 +776,7 @@ static void iser_comp_error_worker(void *data)
static void iser_handle_comp_error(struct iser_desc *desc)
{
struct iser_dto *dto = &desc->dto;
struct iser_conn *ib_conn = dto->conn->ib_conn;
struct iser_conn *ib_conn = dto->ib_conn;

iser_dto_buffs_release(dto);

Expand Down

0 comments on commit 87e8df7

Please sign in to comment.