[ovs-dev] [PATCH v3 1/2] dpif-netlink-rtnl: Use 65000 instead of 65535 as tunnel MTU.

Eric Garver e at erig.me
Thu Jan 18 13:36:30 UTC 2018


On Wed, Jan 17, 2018 at 10:02:24AM -0800, Ben Pfaff wrote:
> 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 <e at erig.me>
> Suggested-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-January/343304.html
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---
>  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);
> -- 
> 2.10.2

Thanks Ben!

Acked-by: Eric Garver <e at erig.me>


More information about the dev mailing list