Commit 6a06a4b8 authored by Or Gerlitz's avatar Or Gerlitz Committed by James Bottomley

[SCSI] IB/iser: Add Discovery support

To run discovery over iSER we need to advertize the CAP_TEXT_NEGO capability
towards user space. Also need to make sure the login RX buffer is posted when
SendTargets TEXT PDUs are sent. For that end, we use a setting of the
ISCSI_PARAM_DISCOVERY_SESS iscsi param as an indication that this is
discovery session.
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent e1e819cc
...@@ -672,6 +672,7 @@ static umode_t iser_attr_is_visible(int param_type, int param) ...@@ -672,6 +672,7 @@ static umode_t iser_attr_is_visible(int param_type, int param)
case ISCSI_PARAM_TGT_RESET_TMO: case ISCSI_PARAM_TGT_RESET_TMO:
case ISCSI_PARAM_IFACE_NAME: case ISCSI_PARAM_IFACE_NAME:
case ISCSI_PARAM_INITIATOR_NAME: case ISCSI_PARAM_INITIATOR_NAME:
case ISCSI_PARAM_DISCOVERY_SESS:
return S_IRUGO; return S_IRUGO;
default: default:
return 0; return 0;
...@@ -701,7 +702,7 @@ static struct scsi_host_template iscsi_iser_sht = { ...@@ -701,7 +702,7 @@ static struct scsi_host_template iscsi_iser_sht = {
static struct iscsi_transport iscsi_iser_transport = { static struct iscsi_transport iscsi_iser_transport = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "iser", .name = "iser",
.caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T, .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_TEXT_NEGO,
/* session management */ /* session management */
.create_session = iscsi_iser_session_create, .create_session = iscsi_iser_session_create,
.destroy_session = iscsi_iser_session_destroy, .destroy_session = iscsi_iser_session_destroy,
......
...@@ -234,6 +234,7 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn) ...@@ -234,6 +234,7 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn)
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 iscsi_iser_conn *iser_conn = conn->dd_data;
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);
/* check if this is the last login - going to full feature phase */ /* check if this is the last login - going to full feature phase */
...@@ -248,7 +249,13 @@ static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) ...@@ -248,7 +249,13 @@ static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req)
WARN_ON(iser_conn->ib_conn->post_recv_buf_count != 1); 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(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0);
iser_dbg("Initially post: %d\n", ISER_MIN_POSTED_RX); if (session->discovery_sess) {
iser_info("Discovery session, re-using login RX buffer\n");
return 0;
} else
iser_info("Normal session, posting batch of RX %d buffers\n",
ISER_MIN_POSTED_RX);
/* Initial post receive buffers */ /* Initial post receive buffers */
if (iser_post_recvm(iser_conn->ib_conn, ISER_MIN_POSTED_RX)) if (iser_post_recvm(iser_conn->ib_conn, ISER_MIN_POSTED_RX))
return -ENOMEM; return -ENOMEM;
...@@ -425,6 +432,8 @@ int iser_send_control(struct iscsi_conn *conn, ...@@ -425,6 +432,8 @@ 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",
task->hdr->opcode, data_seg_len);
err = iser_post_recvl(iser_conn->ib_conn); err = iser_post_recvl(iser_conn->ib_conn);
if (err) if (err)
goto send_control_error; goto send_control_error;
......
...@@ -3170,6 +3170,7 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn, ...@@ -3170,6 +3170,7 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
{ {
struct iscsi_conn *conn = cls_conn->dd_data; struct iscsi_conn *conn = cls_conn->dd_data;
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
int val;
switch(param) { switch(param) {
case ISCSI_PARAM_FAST_ABORT: case ISCSI_PARAM_FAST_ABORT:
...@@ -3264,6 +3265,10 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn, ...@@ -3264,6 +3265,10 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: case ISCSI_PARAM_DISCOVERY_PARENT_TYPE:
return iscsi_switch_str_param(&session->discovery_parent_type, return iscsi_switch_str_param(&session->discovery_parent_type,
buf); buf);
case ISCSI_PARAM_DISCOVERY_SESS:
sscanf(buf, "%d", &val);
session->discovery_sess = !!val;
break;
default: default:
return -ENOSYS; return -ENOSYS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment