From: Honggang Li <honli@xxxxxxxxxx> "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@xxxxxxxxxx> --- 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