[stgt] [PATCH V1] iser: add CQ vector param

Roi Dayan roid at mellanox.com
Sun Feb 24 14:00:10 CET 2013


Different vector means different EQ which means different IRQ
which will let us do affinity to different CPU set.
Default vector is modulus of the control port and max vector allowed.

Signed-off-by: Roi Dayan <roid at mellanox.com>
---

Hi,

fixed the warnings.

Thanks,
Roi

 usr/iscsi/iser.c |   24 +++++++++++++++++++++++-
 usr/iscsi/iser.h |    2 ++
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/usr/iscsi/iser.c b/usr/iscsi/iser.c
index e4fcd92..3c07276 100644
--- a/usr/iscsi/iser.c
+++ b/usr/iscsi/iser.c
@@ -97,6 +97,7 @@ struct iscsi_sense_data {
 } __packed;
 
 static size_t buf_pool_sz_mb = DEFAULT_POOL_SIZE_MB;
+static int cq_vector = -1;
 
 static int membuf_num;
 static size_t membuf_size = RDMA_TRANSFER_SIZE;
@@ -3264,8 +3265,18 @@ static int iser_device_init(struct iser_device *dev)
 		goto out;
 	}
 
+	/* verify cq_vector */
+	if (cq_vector < 0)
+		cq_vector = control_port % dev->ibv_ctxt->num_comp_vectors;
+	else if (cq_vector >= dev->ibv_ctxt->num_comp_vectors) {
+		eprintf("Bad CQ vector. max: %d\n",
+			dev->ibv_ctxt->num_comp_vectors);
+		goto out;
+	}
+	dprintf("CQ vector: %d\n", cq_vector);
+
 	dev->cq = ibv_create_cq(dev->ibv_ctxt, cqe_num, NULL,
-				dev->cq_channel, 0);
+				dev->cq_channel, cq_vector);
 	if (dev->cq == NULL) {
 		eprintf("ibv_create_cq failed\n");
 		goto out;
@@ -3479,6 +3490,7 @@ static const char *lld_param_nop = "nop";
 static const char *lld_param_on = "on";
 static const char *lld_param_off = "off";
 static const char *lld_param_pool_sz_mb = "pool_sz_mb";
+static const char *lld_param_cq_vector = "cq_vector";
 
 static int iser_param_parser(char *p)
 {
@@ -3517,6 +3529,16 @@ static int iser_param_parser(char *p)
 			buf_pool_sz_mb = atoi(q);
 			if (buf_pool_sz_mb < 128)
 				buf_pool_sz_mb = 128;
+		} else if (!strncmp(p, lld_param_cq_vector,
+				    strlen(lld_param_cq_vector))) {
+			q = p + strlen(lld_param_cq_vector) + 1;
+			cq_vector = atoi(q);
+			if (cq_vector < 0) {
+				eprintf("unsupported value for param: %s\n",
+					lld_param_cq_vector);
+				err = -EINVAL;
+				break;
+			}
 		} else {
 			dprintf("unsupported param:%s\n", p);
 			err = -EINVAL;
diff --git a/usr/iscsi/iser.h b/usr/iscsi/iser.h
index 0749f50..4e4c8f2 100644
--- a/usr/iscsi/iser.h
+++ b/usr/iscsi/iser.h
@@ -25,6 +25,8 @@
 
 #include "iscsid.h"
 
+extern short control_port;
+
 /*
  * The IB-extended version from the kernel.  Stags and VAs are in
  * big-endian format.
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list