To run discovery over iSER we need to advetize the CAP_TEXT_NEGO capability 
along with making sure the login RX buffer is posted when the SendTargets 
TEXT PDU is sent. Use a setting of the new ISCSI_PARAM_DISCOVERY_SESS iscsi 
param as an indication that this is discovery session to allow for the above
behaviour to take place.

Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
---

To apply this patch need to pick these two patches

[PATCH V1 1/4] scsi_transport_iscsi: Exporting new attrs for iscsi session and 
connection in sysfs
http://marc.info/?l=linux-scsi&m=137225028829588&w=2

[PATCH V1 2/4] libiscsi: Exporting new attrs for iscsi session and connection 
in sysfs
http://marc.info/?l=linux-scsi&m=137225028829588&q=raw

 drivers/infiniband/ulp/iser/iscsi_iser.c     |   16 +++++++++++++++-
 drivers/infiniband/ulp/iser/iser_initiator.c |    7 +++++++
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 2e84ef8..3639d78 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -468,6 +468,8 @@ iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
                     enum iscsi_param param, char *buf, int buflen)
 {
        int value;
+       struct iscsi_conn *conn;
+       struct iscsi_session *session;
 
        switch (param) {
        case ISCSI_PARAM_MAX_RECV_DLENGTH:
@@ -501,6 +503,18 @@ iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
                        return -EPROTO;
                }
                break;
+       case ISCSI_PARAM_DISCOVERY_SESS:
+               sscanf(buf, "%d", &value);
+               conn = cls_conn->dd_data;
+               session = conn->session;
+               if (value) {
+                       session->discovery_sess = 1;
+                       iser_err("session is discovery!\n");
+               } else {
+                       session->discovery_sess = 0;
+                       iser_err("session is normal!\n");
+               }
+               break;
        default:
                return iscsi_set_param(cls_conn, param, buf, buflen);
        }
@@ -701,7 +715,7 @@ static struct scsi_host_template iscsi_iser_sht = {
 static struct iscsi_transport iscsi_iser_transport = {
        .owner                  = THIS_MODULE,
        .name                   = "iser",
-       .caps                   = CAP_RECOVERY_L0 | CAP_MULTI_R2T,
+       .caps                   = CAP_RECOVERY_L0 | CAP_MULTI_R2T | 
CAP_TEXT_NEGO,
        /* session management */
        .create_session         = iscsi_iser_session_create,
        .destroy_session        = iscsi_iser_session_destroy,
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c 
b/drivers/infiniband/ulp/iser/iser_initiator.c
index b6d81a8..d564192 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -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)
 {
        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);
        /* check if this is the last login - going to full feature phase */
@@ -248,6 +249,11 @@ 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(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0);
 
+       if (session->discovery_sess) {
+               iser_err("not posting small rx buffers\n");
+               return 0;
+       }
+
        iser_dbg("Initially post: %d\n", ISER_MIN_POSTED_RX);
        /* Initial post receive buffers */
        if (iser_post_recvm(iser_conn->ib_conn, ISER_MIN_POSTED_RX))
@@ -425,6 +431,7 @@ int iser_send_control(struct iscsi_conn *conn,
        }
 
        if (task == conn->login_task) {
+               iser_err("posting login buffer op %x dsl %x\n", 
task->hdr->opcode, data_seg_len);
                err = iser_post_recvl(iser_conn->ib_conn);
                if (err)
                        goto send_control_error;
-- 
1.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to