diff options
author | Yifeng Sun <pkusunyifeng@gmail.com> | 2018-07-06 08:28:27 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-07-06 13:38:01 -0700 |
commit | def5b366a3626fddc87a449e8447f79a6957d55f (patch) | |
tree | 572d416fc3dbc81deaf8a6c0d4500a553c2d0a95 /lib | |
parent | 9c937ec56fd2387d7e175bff0379aec9fa08a2b2 (diff) | |
download | openvswitch-def5b366a3626fddc87a449e8447f79a6957d55f.tar.gz |
dpif-netlink-rtnl: Retry smaller MTU when default MAX_MTU is too large.
When MAX_MTU is larger than hw supported max MTU,
dpif_netlink_rtnl_create will fail. This leads to
testing failure '11: datapath - ping over gre tunnel'
in 'make check-kmod'.
This patch fixes this issue by retrying a smaller MTU
when MAX_MTU is too large.
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpif-netlink-rtnl.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c index bec3fce91..2e23a8c14 100644 --- a/lib/dpif-netlink-rtnl.c +++ b/lib/dpif-netlink-rtnl.c @@ -282,6 +282,19 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg, } static int +rtnl_set_mtu(const char *name, uint32_t mtu, struct ofpbuf *request) +{ + ofpbuf_clear(request); + nl_msg_put_nlmsghdr(request, 0, RTM_SETLINK, + NLM_F_REQUEST | NLM_F_ACK); + ofpbuf_put_zeros(request, sizeof(struct ifinfomsg)); + nl_msg_put_string(request, IFLA_IFNAME, name); + nl_msg_put_u32(request, IFLA_MTU, mtu); + + return nl_transact(NETLINK_ROUTE, request, NULL); +} + +static int 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) @@ -354,15 +367,13 @@ dpif_netlink_rtnl_create(const struct netdev_tunnel_config *tnl_cfg, type == OVS_VPORT_TYPE_IP6GRE)) { /* Work around a bug in kernel GRE driver, which ignores IFLA_MTU in * RTM_NEWLINK, by setting the MTU again. See - * https://bugzilla.redhat.com/show_bug.cgi?id=1488484. */ - ofpbuf_clear(&request); - nl_msg_put_nlmsghdr(&request, 0, RTM_SETLINK, - NLM_F_REQUEST | NLM_F_ACK); - ofpbuf_put_zeros(&request, sizeof(struct ifinfomsg)); - nl_msg_put_string(&request, IFLA_IFNAME, name); - nl_msg_put_u32(&request, IFLA_MTU, MAX_MTU); - - int err2 = nl_transact(NETLINK_ROUTE, &request, NULL); + * https://bugzilla.redhat.com/show_bug.cgi?id=1488484. + * + * In case of MAX_MTU exceeds hw max MTU, retry a smaller value. */ + int err2 = rtnl_set_mtu(name, MAX_MTU, &request); + if (err2) { + err2 = rtnl_set_mtu(name, 1450, &request); + } if (err2) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); |