From patchwork Wed Jan 17 18:02:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 862480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zMFLd4kxTz9t1t for ; Thu, 18 Jan 2018 05:03:05 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 64AD21135; Wed, 17 Jan 2018 18:02:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 460BD1141 for ; Wed, 17 Jan 2018 18:02:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 93DF6157 for ; Wed, 17 Jan 2018 18:02:34 +0000 (UTC) X-Originating-IP: 208.91.3.26 Received: from sigabrt.benpfaff.org (unknown [208.91.3.26]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id C9F25C5A79; Wed, 17 Jan 2018 19:02:31 +0100 (CET) From: Ben Pfaff To: dev@openvswitch.org Date: Wed, 17 Jan 2018 10:02:24 -0800 Message-Id: <20180117180225.25604-2-blp@ovn.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20180117180225.25604-1-blp@ovn.org> References: <20180117180225.25604-1-blp@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff , Eric Garver Subject: [ovs-dev] [PATCH v3 1/2] dpif-netlink-rtnl: Use 65000 instead of 65535 as tunnel MTU. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Most of the existing tunnels accept 65535 for MTU and internally reduce it to the maximum value actually supported. However, in RTM_SETLINK calls, at least GRE tunnels reject MTU larger than actually supported. This commit changes the MTU used in RTM_NEWLINK calls to use a value that should be acceptable to all tunnels and yet does not noticeably reduce performance. (This code doesn't actually use RTM_SETLINK to change MTU yet, but that's coming up.) Suggested-by: Eric Garver Suggested-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-January/343304.html Signed-off-by: Ben Pfaff Acked-by: Eric Garver --- lib/dpif-netlink-rtnl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c index fe9c8ed7104f..37451b80de0e 100644 --- a/lib/dpif-netlink-rtnl.c +++ b/lib/dpif-netlink-rtnl.c @@ -277,6 +277,15 @@ dpif_netlink_rtnl_create(const struct netdev_tunnel_config *tnl_cfg, const char *name, enum ovs_vport_type type, const char *kind, uint32_t flags) { + enum { + /* For performance, we want to use the largest MTU that the system + * supports. Most existing tunnels will accept UINT16_MAX, treating it + * as the actual max MTU, but some do not. Thus, we use a slightly + * smaller value, that should always be safe yet does not noticeably + * reduce performance. */ + MAX_MTU = 65000 + }; + size_t linkinfo_off, infodata_off; struct ifinfomsg *ifinfo; struct ofpbuf request; @@ -287,7 +296,7 @@ dpif_netlink_rtnl_create(const struct netdev_tunnel_config *tnl_cfg, ifinfo = ofpbuf_put_zeros(&request, sizeof(struct ifinfomsg)); ifinfo->ifi_change = ifinfo->ifi_flags = IFF_UP; nl_msg_put_string(&request, IFLA_IFNAME, name); - nl_msg_put_u32(&request, IFLA_MTU, UINT16_MAX); + nl_msg_put_u32(&request, IFLA_MTU, MAX_MTU); linkinfo_off = nl_msg_start_nested(&request, IFLA_LINKINFO); nl_msg_put_string(&request, IFLA_INFO_KIND, kind); infodata_off = nl_msg_start_nested(&request, IFLA_INFO_DATA);