From b947dc7161427b8c84f47b0a97861a36557f5748 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 17 Mar 2009 18:15:19 -0700 Subject: ib-verbs recv-size and send-size argument takes SIZET arguments now. With this patch, to specify recv-size and send-size of ib-verbs to KB, we need not give the option as integer value of 'n * 1024' value. This is neater to do deployments. Signed-off-by: Anand V. Avati --- transport/ib-verbs/src/ib-verbs.c | 37 +++++++++++++++++++++++++++---------- transport/ib-verbs/src/ib-verbs.h | 5 ++++- 2 files changed, 31 insertions(+), 11 deletions(-) (limited to 'transport') diff --git a/transport/ib-verbs/src/ib-verbs.c b/transport/ib-verbs/src/ib-verbs.c index b0ac22563..9a21b8a8f 100644 --- a/transport/ib-verbs/src/ib-verbs.c +++ b/transport/ib-verbs/src/ib-verbs.c @@ -268,8 +268,8 @@ __ib_verbs_ioq_churn_entry (ib_verbs_peer_t *peer, ib_verbs_ioq_t *entry) if (len >= (options->send_size + 2048)) { gf_log ("transport/ib-verbs", GF_LOG_CRITICAL, "increase value of option 'transport.ib-verbs." - "work-request-send-size' (given=> %d) to send " - "bigger (%d) messages", + "work-request-send-size' (given=> %"PRId64") " + "to send bigger (%d) messages", (options->send_size + 2048), len); return -1; } @@ -1251,11 +1251,12 @@ ib_verbs_options_init (transport_t *this) ib_verbs_options_t *options = &priv->options; int32_t mtu; data_t *temp; + int ret = 0; /* TODO: validate arguments from options below */ - options->send_size = 1048576; - options->recv_size = 1048576; + options->send_size = 1048576; /* 1 MB */ + options->recv_size = 1048576; /* 1 MB */ options->send_count = 16; options->recv_count = 16; @@ -1271,13 +1272,29 @@ ib_verbs_options_init (transport_t *this) temp = dict_get (this->xl->options, "transport.ib-verbs.work-request-send-size"); - if (temp) - options->send_size = data_to_int32 (temp); + if (temp) { + ret = gf_string2bytesize (temp->data, &options->send_size); + if (ret != 0) { + gf_log ("ib-verbs", GF_LOG_ERROR, + "invalid number format \"%s\" of " + "\"option request-send-size\"", + temp->data); + options->send_size = 1 * GF_UNIT_MB; + } + } temp = dict_get (this->xl->options, "transport.ib-verbs.work-request-recv-size"); - if (temp) - options->recv_size = data_to_int32 (temp); + if (temp) { + ret = gf_string2bytesize (temp->data, &options->recv_size); + if (ret != 0) { + gf_log ("ib-verbs", GF_LOG_ERROR, + "invalid number format \"%s\" of " + "\"option request-recv-size\"", + temp->data); + options->recv_size = 1 * GF_UNIT_MB; + } + } options->port = 1; temp = dict_get (this->xl->options, @@ -2351,11 +2368,11 @@ struct volume_options options[] = { }, { .key = {"transport.ib-verbs.work-request-send-size", "ib-verbs-work-request-send-size"}, - .type = GF_OPTION_TYPE_INT, + .type = GF_OPTION_TYPE_SIZET, }, { .key = {"transport.ib-verbs.work-request-recv-size", "ib-verbs-work-request-recv-size"}, - .type = GF_OPTION_TYPE_INT, + .type = GF_OPTION_TYPE_SIZET, }, { .key = {"transport.ib-verbs.work-request-send-count", "ib-verbs-work-request-send-count"}, diff --git a/transport/ib-verbs/src/ib-verbs.h b/transport/ib-verbs/src/ib-verbs.h index 26d7799d3..2aa39c0a4 100644 --- a/transport/ib-verbs/src/ib-verbs.h +++ b/transport/ib-verbs/src/ib-verbs.h @@ -45,7 +45,10 @@ struct _ib_verbs_options { int32_t port; char *device_name; enum ibv_mtu mtu; - int32_t send_count, send_size, recv_count, recv_size; + int32_t send_count; + int32_t recv_count; + uint64_t recv_size; + uint64_t send_size; }; typedef struct _ib_verbs_options ib_verbs_options_t; -- cgit