Align the iser code to use the actual maximal number of scsi commands
set for that session when allocating IB FMR resources instead of the
default max

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

---
done against Linus tree of commit 036a98263a30930a329e7bb184d5e77f27358e40
compile tested only, will be able to test that later this week

To set lower cmds_max, edit the iscsi initiator config file,
e.g /etc/iscsi/iscsid.conf (on EL based distros, the SLES based
have similar file) and change node.session.cmds_max say to 32 or 64

# To control how many commands the session will queue set
# node.session.cmds_max to an integer between 2 and 2048 that is also
# a power of 2. The default is 128.
node.session.cmds_max = 128

 drivers/infiniband/ulp/iser/iscsi_iser.c |    2 +-
 drivers/infiniband/ulp/iser/iser_verbs.c |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 8db008d..1cdc8f0 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -445,7 +445,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
         * because we preallocate so many resources
         */
        cls_session = iscsi_session_setup(&iscsi_iser_transport, shost,
-                                         ISCSI_DEF_XMIT_CMDS_MAX, 0,
+                                         cmds_max, 0,
                                          sizeof(struct iscsi_iser_task),
                                          initial_cmdsn, 0);
        if (!cls_session)
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c 
b/drivers/infiniband/ulp/iser/iser_verbs.c
index 9876865..259e5e1 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -157,6 +157,7 @@ static int iser_create_ib_conn_res(struct iser_conn 
*ib_conn)
        struct ib_qp_init_attr  init_attr;
        int                     ret = -ENOMEM;
        struct ib_fmr_pool_param params;
+       struct iscsi_session    *session = 
ib_conn->iser_conn->iscsi_conn->session;

        BUG_ON(ib_conn->device == NULL);

@@ -184,8 +185,8 @@ static int iser_create_ib_conn_res(struct iser_conn 
*ib_conn)
        params.max_pages_per_fmr = ISCSI_ISER_SG_TABLESIZE + 1;
        /* make the pool size twice the max number of SCSI commands *
         * the ML is expected to queue, watermark for unmap at 50%  */
-       params.pool_size         = ISCSI_DEF_XMIT_CMDS_MAX * 2;
-       params.dirty_watermark   = ISCSI_DEF_XMIT_CMDS_MAX;
+       params.pool_size         = session->scsi_cmds_max * 2;
+       params.dirty_watermark   = session->scsi_cmds_max;
        params.cache             = 0;
        params.flush_function    = NULL;
        params.access            = (IB_ACCESS_LOCAL_WRITE  |

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to