[qca-nss-clients] Fix for GRE tos inherit config of IPv6.

Change-Id: Idc6568e8daa3399671386ef3694826e27643f815
Signed-off-by: Suruchi Suman <surusuma@codeaurora.org>
diff --git a/gre/nss_connmgr_gre.c b/gre/nss_connmgr_gre.c
index 5e32b61..d8c72d3 100644
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -911,13 +911,6 @@
 			goto release_ref;
 		}
 
-		/*
-		 * Set per packet DSCP configuration if needed
-		 */
-		if (cfg->dscp_valid) {
-			cmsg->flags |= NSS_GRE_CONFIG_DSCP_VALID;
-		}
-
 		cmsg->flags |= NSS_GRE_CONFIG_NEXT_NODE_AVAILABLE;
 	}
 
@@ -940,6 +933,13 @@
 	}
 
 	/*
+	 * Set per packet DSCP configuration if needed
+	 */
+	if (cfg->dscp_valid) {
+		cmsg->flags |= NSS_GRE_CONFIG_DSCP_VALID;
+	}
+
+	/*
 	 * Register net_device
 	 */
 	ret = register_netdevice(dev);
@@ -1286,6 +1286,15 @@
 	 * TODO:Disallow key for standard GRE TAP/TUN.
 	 */
 	if (cfg->iseq_valid || cfg->oseq_valid || cfg->icsum_valid || cfg->ocsum_valid) {
+		nss_connmgr_gre_info("Bad config, seq and csum are not supported.\n");
+		return false;
+	}
+
+	/*
+	 * Validate DSCP and ToS inherit flags.
+	 */
+	if (cfg->dscp_valid && cfg->tos_inherit) {
+		nss_connmgr_gre_info("Bad config, Both DSCP and ToS inherit flags are set.\n");
 		return false;
 	}
 
@@ -1800,7 +1809,6 @@
 	}
 
 	if (!nss_connmgr_gre_validate_config(cfg)) {
-		nss_connmgr_gre_info("No support for Csum/Sequence number\n");
 		*err_code = GRE_ERR_UNSUPPORTED_CFG;
 		return NULL;
 	}
diff --git a/gre/nss_connmgr_gre_v6.c b/gre/nss_connmgr_gre_v6.c
index 8c399e8..374827e 100644
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -276,7 +276,10 @@
 	memcpy(t->parms.laddr.s6_addr, &cfg->src_ip, 16);
 	memcpy(t->parms.raddr.s6_addr, &cfg->dest_ip, 16);
 
-	t->parms.flowinfo = 0;
+	t->parms.flowinfo = cfg->tos << 2;
+	if (cfg->tos_inherit) {
+		t->parms.flowinfo |= 0x1;
+	}
 
 	t->parms.hop_limit = cfg->ttl;
 	if (cfg->ttl_inherit) {
@@ -330,13 +333,13 @@
 	 */
 	cmsg->flags |= nss_connmgr_gre_get_nss_config_flags(t->parms.o_flags,
 								     t->parms.i_flags,
-								     0x1,
+								     t->parms.flowinfo,
 								     t->parms.hop_limit, 0);
 
 	cmsg->ikey = t->parms.i_key;
 	cmsg->okey = t->parms.o_key;
 	cmsg->ttl = t->parms.hop_limit;
-	cmsg->tos = t->parms.flowinfo;
+	cmsg->tos = t->parms.flowinfo >> 2;
 
 	/*
 	 * fill in MAC addresses