浏览代码

totemiba: Check if configured MTU is allowed by HW

Solution use aproximation of totem structures. This needs to be
rewritten in proper way. Also MTU checking should be implemented for IP
transports.

Signed-off-by: Yevheniy Demchenko <zheka@uvt.cz>
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Yevheniy Demchenko 12 年之前
父节点
当前提交
3403fe06e8
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      exec/totemiba.c

+ 15 - 0
exec/totemiba.c

@@ -1042,6 +1042,7 @@ static int send_token_unbind (struct totemiba_instance *instance)
 static int recv_token_bind (struct totemiba_instance *instance)
 {
 	int res;
+	struct ibv_port_attr port_attr;
 
 	instance->listen_recv_token_channel = rdma_create_event_channel();
 	if (instance->listen_recv_token_channel == NULL) {
@@ -1063,6 +1064,20 @@ static int recv_token_bind (struct totemiba_instance *instance)
 		return (-1);
 	}
 
+	/*
+	 * Determine active_mtu of port and compare it with the configured one (160 is aproximation of all totem
+	 * structures.
+	 *
+	 * TODO: Implement MTU discovery also for IP and handle MTU correctly for all structures inside totemsrp,
+	 *       crypto, ...
+	 */
+	res = ibv_query_port (instance->listen_recv_token_cma_id->verbs, instance->listen_recv_token_cma_id->port_num, &port_attr);
+	if ( (1 << (port_attr.active_mtu + 7)) < instance->totem_config->net_mtu + 160) {
+		log_printf (LOGSYS_LEVEL_ERROR, "requested net_mtu is %d and is larger than the active port mtu %d\n",\
+				instance->totem_config->net_mtu + 160, (1 << (port_attr.active_mtu + 7)));
+		return (-1);
+	}
+
 	/*
 	 * Resolve the recv_token address into a GUID
 	 */