From 7c89187ab2d165ccffed627742e7cb72cce375ef Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Sun, 12 Jul 2020 22:49:30 +0200
Subject: [PATCH] kernel-5.4-support-gre

---
 gre/nss_connmgr_gre.c    | 16 +++++++---------
 gre/nss_connmgr_gre_v6.c |  4 ++--
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/gre/nss_connmgr_gre.c b/gre/nss_connmgr_gre.c
index 52203b1..6de8f6e 100644
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -88,7 +88,7 @@ static int nss_connmgr_gre_dev_init(struct net_device *dev)
 		u64_stats_init(&stats->syncp);
 	}
 
-	if ((dev->priv_flags & IFF_GRE_V4_TAP) || (dev->type == ARPHRD_IPGRE)) {
+	if ((dev->priv_flags_qca_ecm & IFF_QCA_ECM_GRE_V4_TAP) || (dev->type == ARPHRD_IPGRE)) {
 		dev->needed_headroom = sizeof(struct iphdr) + sizeof(struct ethhdr) + MAX_WIFI_HEADROOM + append;
 		dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - append;
 		dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA;
@@ -169,7 +169,7 @@ fail:
  * nss_connmgr_gre_dev_stats64()
  *	Netdev ops function to retrieve stats.
  */
-struct rtnl_link_stats64 *nss_connmgr_gre_dev_stats64(struct net_device *dev,
+void nss_connmgr_gre_dev_stats64(struct net_device *dev,
 						struct rtnl_link_stats64 *tot)
 {
 	uint64_t rx_packets, rx_bytes, tx_packets, tx_bytes;
@@ -202,8 +202,6 @@ struct rtnl_link_stats64 *nss_connmgr_gre_dev_stats64(struct net_device *dev,
 		tot->rx_dropped = dev->stats.rx_dropped;
 		tot->tx_dropped = dev->stats.tx_dropped;
 	}
-
-	return tot;
 }
 
 /*
@@ -390,7 +388,7 @@ static int32_t nss_connmgr_gre_prepare_config_cmd(struct net_device *dev,
 {
 	struct nss_gre_config_msg *cmsg = &req->msg.cmsg;
 
-	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags & IFF_GRE_V4_TAP)) {
+	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags_qca_ecm & IFF_QCA_ECM_GRE_V4_TAP)) {
 		cmsg->mode = NSS_GRE_MODE_TAP;
 		cmsg->ip_type = NSS_GRE_IP_IPV4;
 		if (enable_unalign) {
@@ -399,7 +397,7 @@ static int32_t nss_connmgr_gre_prepare_config_cmd(struct net_device *dev,
 		return nss_connmgr_gre_v4_get_config(dev, req, next_dev, hold);
 	}
 
-	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags & IFF_GRE_V6_TAP)) {
+	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags_qca_ecm & IFF_QCA_ECM_GRE_V6_TAP)) {
 		cmsg->mode = NSS_GRE_MODE_TAP;
 		cmsg->ip_type = NSS_GRE_IP_IPV6;
 		if (enable_unalign) {
@@ -605,7 +603,7 @@ static bool nss_connmgr_gre_is_gre(struct net_device *dev)
 {
 	if ((dev->type == ARPHRD_IPGRE) ||
 	      (dev->type == ARPHRD_IP6GRE) || ((dev->type == ARPHRD_ETHER) &&
-	      (dev->priv_flags & (IFF_GRE_V4_TAP | IFF_GRE_V6_TAP)))) {
+	      (dev->priv_flags_qca_ecm & (IFF_QCA_ECM_GRE_V4_TAP | IFF_QCA_ECM_GRE_V6_TAP)))) {
 		return true;
 	}
 
@@ -692,10 +690,10 @@ static struct net_device *__nss_connmgr_gre_create_interface(struct nss_connmgr_
 		nss_connmgr_gre_tap_setup(dev);
 
 		if (cfg->is_ipv6) {
-			dev->priv_flags |= IFF_GRE_V6_TAP;
+			dev->priv_flags_qca_ecm |= IFF_QCA_ECM_GRE_V6_TAP;
 			ret = nss_connmgr_gre_v6_set_config(dev, cfg);
 		} else {
-			dev->priv_flags |= IFF_GRE_V4_TAP;
+			dev->priv_flags_qca_ecm |= IFF_QCA_ECM_GRE_V4_TAP;
 			ret = nss_connmgr_gre_v4_set_config(dev, cfg);
 		}
 		break;
diff --git a/gre/nss_connmgr_gre_v6.c b/gre/nss_connmgr_gre_v6.c
index f9a8e58..e93c7e4 100644
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -46,7 +46,7 @@ static struct net_device *nss_connmgr_gre_v6_get_tx_dev(uint8_t *dest_ip)
 	struct net_device *dev;
 
 	memcpy(ipv6_addr.s6_addr, dest_ip, 16);
-	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, 0);
+	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, NULL, 0);
 	if (!rt) {
 		return NULL;
 	}
@@ -92,7 +92,7 @@ static int nss_connmgr_gre_v6_get_mac_address(uint8_t *src_ip, uint8_t *dest_ip,
 	 * Find dest MAC address
 	 */
 	memcpy(ipv6_addr.s6_addr, dest_ip, 16);
-	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, 0);
+	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, NULL, 0);
 	if (!rt) {
 		return GRE_ERR_NEIGH_LOOKUP;
 	}
-- 
2.27.0

