linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [rdma-core patch v2] srp_daemon: Use maximum initiator to target IU size
@ 2019-10-25 13:23 Honggang LI
  2019-10-29  6:51 ` Honggang LI
  0 siblings, 1 reply; 2+ messages in thread
From: Honggang LI @ 2019-10-25 13:23 UTC (permalink / raw)
  To: bvanassche, dledford, jgg; +Cc: linux-rdma, Honggang Li

From: Honggang Li <honli@redhat.com>

"ib_srp.ko" module with immediate data support use (8 * 1024)
as default immediate data size. When immediate data support enabled
for "ib_srp.ko" client, the default maximum initiator to target IU
size will greater than (8 * 1024). That means it also greater than
the default maximum initiator to target IU size set by old
"ib_srpt.ko" module, which does not support immediate data.

Signed-off-by: Honggang Li <honli@redhat.com>
---
 srp_daemon/srp_daemon.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index f0bcf923..7783b18f 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -402,6 +402,26 @@ static int is_enabled_by_rules_file(struct target_details *target)
 }
 
 
+static bool use_imm_data(void)
+{
+	bool ret = false;
+	char flag = 0;
+	int cnt;
+	int fd = open("/sys/module/ib_srp/parameters/has_max_it_iu_size", O_RDONLY);
+
+	if (fd < 0)
+		return false;
+	cnt = read(fd, &flag, 1);
+	if (cnt != 1) {
+		close(fd);
+		return false;
+	}
+
+	if (!strncmp(&flag, "Y", 1))
+		ret = true;
+	close(fd);
+	return ret;
+}
 
 static int add_non_exist_target(struct target_details *target)
 {
@@ -581,6 +601,19 @@ static int add_non_exist_target(struct target_details *target)
 		}
 	}
 
+	if (use_imm_data()) {
+		len += snprintf(target_config_str+len,
+			sizeof(target_config_str) - len,
+			",max_it_iu_size=%d",
+			be32toh(target->ioc_prof.send_size));
+
+		if (len >= sizeof(target_config_str)) {
+			pr_err("Target config string is too long, ignoring target\n");
+			closedir(dir);
+			return -1;
+		}
+	}
+
 	target_config_str[len] = '\0';
 
 	pr_cmd(target_config_str, not_connected);
@@ -1360,6 +1393,10 @@ static void print_config(struct config_t *conf)
 		printf(" Print initiator_ext\n");
 	else
 		printf(" Do not print initiator_ext\n");
+	if (use_imm_data())
+		printf(" Print maximum initiator to target IU size\n");
+	else
+		printf(" Do not print maximum initiator to target IU size\n");
 	if (conf->recalc_time)
 		printf(" Performs full target rescan every %d seconds\n", conf->recalc_time);
 	else
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [rdma-core patch v2] srp_daemon: Use maximum initiator to target IU size
  2019-10-25 13:23 [rdma-core patch v2] srp_daemon: Use maximum initiator to target IU size Honggang LI
@ 2019-10-29  6:51 ` Honggang LI
  0 siblings, 0 replies; 2+ messages in thread
From: Honggang LI @ 2019-10-29  6:51 UTC (permalink / raw)
  To: bvanassche, dledford, jgg; +Cc: linux-rdma

Drop this patch as depended kernel patch has been rejected.
I rewrite this patch and file a pull request on github for v3.

https://github.com/linux-rdma/rdma-core/pull/598

Thanks


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-29  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 13:23 [rdma-core patch v2] srp_daemon: Use maximum initiator to target IU size Honggang LI
2019-10-29  6:51 ` Honggang LI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).