From 2dec526496a62c3aaf849f24ec1b5983a91827a9 Mon Sep 17 00:00:00 2001
From: Greg Rose <gvrose8192@gmail.com>
Date: Mon, 6 Jan 2020 13:36:34 -0800
Subject: [PATCH] compat: Include confirm_neigh parameter if needed

A change backported to the Linux 4.14.162 LTS kernel requires
a boolean parameter.  Check for the presence of the parameter
and adjust the caller in that case.

Passes check-kmod test with no regressions.

Passes Travis build here:
https://travis-ci.org/gvrose8192/ovs-experimental/builds/633461320

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
(fix acinclude.m4 patch conflict)
---
 acinclude.m4                      | 2 ++
 datapath/linux/compat/ip6_gre.c   | 4 ++++
 datapath/linux/compat/ip_tunnel.c | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/acinclude.m4 b/acinclude.m4
index a581e1ef2..ec1f027e9 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1005,6 +1005,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [OVS_DEFINE([HAVE_GRE_CALC_HLEN])])
   OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [ip_gre_calc_hlen],
                   [OVS_DEFINE([HAVE_IP_GRE_CALC_HLEN])])
+  OVS_GREP_IFELSE([$KSRC/include/net/dst_ops.h], [bool confirm_neigh],
+                  [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])])
 
   if cmp -s datapath/linux/kcompat.h.new \
             datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/linux/compat/ip6_gre.c b/datapath/linux/compat/ip6_gre.c
index afff817ec..7fd345309 100644
--- a/datapath/linux/compat/ip6_gre.c
+++ b/datapath/linux/compat/ip6_gre.c
@@ -1089,7 +1089,11 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
 
 	/* TooBig packet may have updated dst->dev's mtu */
 	if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu)
+#ifndef HAVE_DST_OPS_CONFIRM_NEIGH
 		dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu);
+#else
+		dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu, false);
+#endif
 
 	err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
 			   NEXTHDR_GRE);
diff --git a/datapath/linux/compat/ip_tunnel.c b/datapath/linux/compat/ip_tunnel.c
index 7dd57fee9..e7a039358 100644
--- a/datapath/linux/compat/ip_tunnel.c
+++ b/datapath/linux/compat/ip_tunnel.c
@@ -267,7 +267,12 @@ static int rpl_tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,
 		mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;
 
 	if (skb_valid_dst(skb))
+#ifndef HAVE_DST_OPS_CONFIRM_NEIGH
 		skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
+#else
+		skb_dst(skb)->ops->update_pmtu(skb_dst(skb),
+					       NULL, skb, mtu, false);
+#endif
 
 	if (skb->protocol == htons(ETH_P_IP)) {
 		if (!skb_is_gso(skb) &&
