Просмотр исходного кода

knet: Allow configuration of more params

knet_pmtud_interval &
knet_pong_count

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Christine Caulfield 9 лет назад
Родитель
Сommit
7cec6a131d
5 измененных файлов с 44 добавлено и 1 удалено
  1. 17 0
      exec/coroparse.c
  2. 10 0
      exec/totemconfig.c
  3. 6 1
      exec/totemknet.c
  4. 2 0
      include/corosync/totem/totem.h
  5. 9 0
      man/corosync.conf.5

+ 17 - 0
exec/coroparse.c

@@ -118,6 +118,8 @@ struct main_cp_cb_data {
 	int knet_ping_interval;
 	int knet_ping_timeout;
 	int knet_ping_precision;
+	int knet_pong_count;
+	int knet_pmtud_interval;
 
 	struct qb_list_head logger_subsys_items_head;
 	char *subsys;
@@ -614,6 +616,7 @@ static int main_config_parser_cb(const char *path,
 			    (strcmp(path, "totem.window_size") == 0) ||
 			    (strcmp(path, "totem.max_messages") == 0) ||
 			    (strcmp(path, "totem.miss_count_const") == 0) ||
+			    (strcmp(path, "totem.knet_pmtud_interval") == 0) ||
 			    (strcmp(path, "totem.netmtu") == 0)) {
 				val_type = ICMAP_VALUETYPE_UINT32;
 				if (safe_atoq(value, &val, val_type) != 0) {
@@ -755,6 +758,14 @@ static int main_config_parser_cb(const char *path,
 				data->knet_ping_precision = val;
 				add_as_string = 0;
 			}
+			if (strcmp(path, "totem.interface.knet_pong_count") == 0) {
+				val_type = ICMAP_VALUETYPE_UINT32;
+				if (safe_atoq(value, &val, val_type) != 0) {
+					goto atoi_error;
+				}
+				data->knet_pong_count = val;
+				add_as_string = 0;
+			}
 			break;
 		case MAIN_CP_CB_DATA_STATE_LOGGER_SUBSYS:
 			if (strcmp(key, "subsys") == 0) {
@@ -946,6 +957,7 @@ static int main_config_parser_cb(const char *path,
 			data->knet_ping_interval = -1;
 			data->knet_ping_timeout = -1;
 			data->knet_ping_precision = -1;
+			data->knet_pong_count = -1;
 			qb_list_init(&data->member_items_head);
 		};
 		if (strcmp(path, "totem") == 0) {
@@ -1065,6 +1077,11 @@ static int main_config_parser_cb(const char *path,
 						data->linknumber);
 				icmap_set_uint32_r(config_map, key_name, data->knet_ping_precision);
 			}
+			if (data->knet_pong_count > -1) {
+				snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.knet_pong_count",
+						data->linknumber);
+				icmap_set_uint32_r(config_map, key_name, data->knet_pong_count);
+			}
 
 			ii = 0;
 

+ 10 - 0
exec/totemconfig.c

@@ -78,6 +78,8 @@
 #define KNET_PING_INTERVAL                      1000
 #define KNET_PING_TIMEOUT                       2000
 #define KNET_PING_PRECISION                     2048
+#define KNET_PONG_COUNT                         5
+#define KNET_PMTUD_INTERVAL                     30
 
 #define DEFAULT_PORT				5405
 
@@ -121,6 +123,8 @@ static uint32_t *totem_get_param_by_name(struct totem_config *totem_config, cons
 		return &totem_config->max_messages;
 	if (strcmp(param_name, "totem.miss_count_const") == 0)
 		return &totem_config->miss_count_const;
+	if (strcmp(param_name, "totem.knet_pmtud_interval") == 0)
+		return &totem_config->knet_pmtud_interval;
 
 	return NULL;
 }
@@ -190,6 +194,7 @@ static void totem_volatile_config_read (struct totem_config *totem_config, const
 	totem_volatile_config_set_value(totem_config, "totem.max_messages", deleted_key, MAX_MESSAGES, 0);
 
 	totem_volatile_config_set_value(totem_config, "totem.miss_count_const", deleted_key, MISS_COUNT_CONST, 0);
+	totem_volatile_config_set_value(totem_config, "totem.knet_pmtud_interval", deleted_key, KNET_PMTUD_INTERVAL, 0);
 
 	totem_volatile_config_set_value(totem_config, "totem.token_retransmit", deleted_key,
 	   (int)(totem_config->token_timeout / (totem_config->token_retransmits_before_loss_const + 0.2)), 0);
@@ -1126,6 +1131,11 @@ extern int totem_config_read (
 		if (icmap_get_uint32(tmp_key, &u32) == CS_OK) {
 			totem_config->interfaces[linknumber].knet_ping_precision = u32;
 		}
+		totem_config->interfaces[linknumber].knet_pong_count = KNET_PONG_COUNT;
+		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.knet_pong_count", linknumber);
+		if (icmap_get_uint32(tmp_key, &u32) == CS_OK) {
+			totem_config->interfaces[linknumber].knet_pong_count = u32;
+		}
 
 		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.member.", linknumber);
 		member_iter = icmap_iter_init(tmp_key);

+ 6 - 1
exec/totemknet.c

@@ -643,7 +643,7 @@ int totemknet_initialize (
 		KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_CRIT, "knet_handle_new failed");
 		return (-1);
 	}
-	res = knet_handle_pmtud_setfreq(instance->knet_handle, 5);
+	res = knet_handle_pmtud_setfreq(instance->knet_handle, instance->totem_config->knet_pmtud_interval);
 	if (res) {
 		KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_WARNING, "knet_handle_pmtud_setfreq failed");
 	}
@@ -953,6 +953,11 @@ int totemknet_member_add (
 	if (err) {
 		KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_ping_timers for nodeid %d, link %d failed", member->nodeid, link_no);
 	}
+	err = knet_link_set_pong_count(instance->knet_handle, member->nodeid, link_no,
+				       instance->totem_config->interfaces[link_no].knet_pong_count);
+	if (err) {
+		KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_ERROR, "knet_link_set_pong_count for nodeid %d, link %d failed", member->nodeid, link_no);
+	}
 
 	err = knet_link_set_enable(instance->knet_handle, member->nodeid, link_no, 1);
 	if (err) {

+ 2 - 0
include/corosync/totem/totem.h

@@ -73,6 +73,7 @@ struct totem_interface {
 	int knet_ping_interval;
 	int knet_ping_timeout;
 	int knet_ping_precision;
+	int knet_pong_count;
 	struct totem_ip_address member_list[PROCESSOR_COUNT_MAX];
 };
 
@@ -128,6 +129,7 @@ struct totem_config {
 	unsigned int interface_count;
 	unsigned int node_id;
 	unsigned int clear_node_high_bit;
+	unsigned int knet_pmtud_interval;
 
 	/*
 	 * key information

+ 9 - 0
man/corosync.conf.5

@@ -101,6 +101,10 @@ knet_ping_precision
 How many values of latency are used to calculate
 the average link latency. (default 2048 samples)
 
+.TP
+knet_pong_count
+How many valid ping/pongs before a link is marked UP. (default 5)
+
 .TP
 bindnetaddr (udp only)
 This specifies the network address the corosync executive should bind
@@ -463,6 +467,11 @@ modern switches.
 
 The default is 5 messages.
 
+.TP
+knet_pmtud_interval
+How often the knet PMTUd runs to look for network MTU changes.
+Value in seconds, default: 60
+
 .PP
 Within the
 .B logging