[qca-nss-ecm] Add nexthop number in NSS rule create message

Change-Id: I05aa72ac4f3872537722d93ed890bf977484f778
Signed-off-by: Shyam Sunder <ssunder@codeaurora.org>
diff --git a/frontends/nss/ecm_nss_non_ported_ipv4.c b/frontends/nss/ecm_nss_non_ported_ipv4.c
index b2a3d15..9f614ab 100644
--- a/frontends/nss/ecm_nss_non_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv4.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014-2016 The Linux Foundation.  All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation.  All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -497,11 +497,24 @@
 	}
 
 	/*
+	 * Get NSS interface ID of the top interface in heirarchy
+	 */
+	from_nss_iface = from_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	to_nss_iface = to_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	nircm->nexthop_rule.flow_nexthop = ecm_db_iface_ae_interface_identifier_get(from_nss_iface);
+	nircm->nexthop_rule.return_nexthop = ecm_db_iface_ae_interface_identifier_get(to_nss_iface);
+
+	/*
 	 * New rule being created
 	 */
 	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_CONN_VALID;
 
 	/*
+	 * Set Nexthop interface number valid flag
+	 */
+	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_NEXTHOP_VALID;
+
+	/*
 	 * Set interface numbers involved in accelerating this connection.
 	 * These are the outer facing addresses from the heirarchy interface lists we got above.
 	 * These may be overridden later if we detect special interface types e.g. ipsec.
@@ -1060,6 +1073,8 @@
 			"to_mac: %pM\n"
 			"src_iface_num: %u\n"
 			"dest_iface_num: %u\n"
+			"src_nexthop_num: %u\n"
+			"dest_nexthop_num: %u\n"
 			"ingress_inner_vlan_tag: %u\n"
 			"egress_inner_vlan_tag: %u\n"
 			"ingress_outer_vlan_tag: %u\n"
@@ -1087,6 +1102,8 @@
 			nircm->conn_rule.return_mac,
 			nircm->conn_rule.flow_interface_num,
 			nircm->conn_rule.return_interface_num,
+			nircm->nexthop_rule.flow_nexthop,
+			nircm->nexthop_rule.return_nexthop,
 			nircm->vlan_primary_rule.ingress_vlan_tag,
 			nircm->vlan_primary_rule.egress_vlan_tag,
 			nircm->vlan_secondary_rule.ingress_vlan_tag,
diff --git a/frontends/nss/ecm_nss_non_ported_ipv6.c b/frontends/nss/ecm_nss_non_ported_ipv6.c
index 6d1e506..036d245 100644
--- a/frontends/nss/ecm_nss_non_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv6.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014-2016 The Linux Foundation.  All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation.  All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -426,11 +426,24 @@
 	}
 
 	/*
+	 * Get NSS interface ID of the top interface in heirarchy
+	 */
+	from_nss_iface = from_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	to_nss_iface = to_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	nircm->nexthop_rule.flow_nexthop = ecm_db_iface_ae_interface_identifier_get(from_nss_iface);
+	nircm->nexthop_rule.return_nexthop = ecm_db_iface_ae_interface_identifier_get(to_nss_iface);
+
+	/*
 	 * New rule being created
 	 */
 	nircm->valid_flags |= NSS_IPV6_RULE_CREATE_CONN_VALID;
 
 	/*
+	 * Set Nexthop interface number valid flag
+	 */
+	nircm->valid_flags |= NSS_IPV6_RULE_CREATE_NEXTHOP_VALID;
+
+	/*
 	 * Set interface numbers involved in accelerating this connection.
 	 * These are the outer facing addresses from the heirarchy interface lists we got above.
 	 * These may be overridden later if we detect special interface types e.g. ipsec.
@@ -907,6 +920,8 @@
 			"to_mac: %pM\n"
 			"src_iface_num: %u\n"
 			"dest_iface_num: %u\n"
+			"src_nexthop_num: %u\n"
+			"dest_nexthop_num: %u\n"
 			"ingress_inner_vlan_tag: %u\n"
 			"egress_inner_vlan_tag: %u\n"
 			"ingress_outer_vlan_tag: %u\n"
@@ -932,6 +947,8 @@
 			nircm->conn_rule.return_mac,
 			nircm->conn_rule.flow_interface_num,
 			nircm->conn_rule.return_interface_num,
+			nircm->nexthop_rule.flow_nexthop,
+			nircm->nexthop_rule.return_nexthop,
 			nircm->vlan_primary_rule.ingress_vlan_tag,
 			nircm->vlan_primary_rule.egress_vlan_tag,
 			nircm->vlan_secondary_rule.ingress_vlan_tag,
diff --git a/frontends/nss/ecm_nss_ported_ipv4.c b/frontends/nss/ecm_nss_ported_ipv4.c
index 2f41998..83e3673 100644
--- a/frontends/nss/ecm_nss_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_ported_ipv4.c
@@ -426,11 +426,24 @@
 	}
 
 	/*
+	 * Get NSS interface ID of the top interface in heirarchy
+	 */
+	from_nss_iface = from_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	to_nss_iface = to_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	nircm->nexthop_rule.flow_nexthop = ecm_db_iface_ae_interface_identifier_get(from_nss_iface);
+	nircm->nexthop_rule.return_nexthop = ecm_db_iface_ae_interface_identifier_get(to_nss_iface);
+
+	/*
 	 * New rule being created
 	 */
 	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_CONN_VALID;
 
 	/*
+	 * Set Nexthop interface number valid flag
+	 */
+	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_NEXTHOP_VALID;
+
+	/*
 	 * Set interface numbers involved in accelerating this connection.
 	 * These are the outer facing addresses from the heirarchy interface lists we got above.
 	 * These may be overridden later if we detect special interface types e.g. ipsec.
@@ -1050,6 +1063,8 @@
 			"to_mac: %pM\n"
 			"src_iface_num: %u\n"
 			"dest_iface_num: %u\n"
+			"src_nexthop_num: %u\n"
+			"dest_nexthop_num: %u\n"
 			"ingress_inner_vlan_tag: %u\n"
 			"egress_inner_vlan_tag: %u\n"
 			"ingress_outer_vlan_tag: %u\n"
@@ -1085,6 +1100,8 @@
 			nircm->conn_rule.return_mac,
 			nircm->conn_rule.flow_interface_num,
 			nircm->conn_rule.return_interface_num,
+			nircm->nexthop_rule.flow_nexthop,
+			nircm->nexthop_rule.return_nexthop,
 			nircm->vlan_primary_rule.ingress_vlan_tag,
 			nircm->vlan_primary_rule.egress_vlan_tag,
 			nircm->vlan_secondary_rule.ingress_vlan_tag,
diff --git a/frontends/nss/ecm_nss_ported_ipv6.c b/frontends/nss/ecm_nss_ported_ipv6.c
index 80a0516..00f0074 100644
--- a/frontends/nss/ecm_nss_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_ported_ipv6.c
@@ -428,11 +428,24 @@
 	}
 
 	/*
+	 * Get NSS interface ID of the top interface in heirarchy
+	 */
+	from_nss_iface = from_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	to_nss_iface = to_ifaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1];
+	nircm->nexthop_rule.flow_nexthop = ecm_db_iface_ae_interface_identifier_get(from_nss_iface);
+	nircm->nexthop_rule.return_nexthop = ecm_db_iface_ae_interface_identifier_get(to_nss_iface);
+
+	/*
 	 * New rule being created
 	 */
 	nircm->valid_flags |= NSS_IPV6_RULE_CREATE_CONN_VALID;
 
 	/*
+	 * Set Nexthop interface number valid flag
+	 */
+	nircm->valid_flags |= NSS_IPV6_RULE_CREATE_NEXTHOP_VALID;
+
+	/*
 	 * Set interface numbers involved in accelerating this connection.
 	 * These are the outer facing addresses from the heirarchy interface lists we got above.
 	 * These may be overridden later if we detect special interface types e.g. ipsec.
@@ -954,6 +967,8 @@
 			"to_mac: %pM\n"
 			"src_iface_num: %u\n"
 			"dest_iface_num: %u\n"
+			"src_nexthop_num: %u\n"
+			"dest_nexthop_num: %u\n"
 			"ingress_inner_vlan_tag: %u\n"
 			"egress_inner_vlan_tag: %u\n"
 			"ingress_outer_vlan_tag: %u\n"
@@ -979,6 +994,8 @@
 			nircm->conn_rule.return_mac,
 			nircm->conn_rule.flow_interface_num,
 			nircm->conn_rule.return_interface_num,
+			nircm->nexthop_rule.flow_nexthop,
+			nircm->nexthop_rule.return_nexthop,
 			nircm->vlan_primary_rule.ingress_vlan_tag,
 			nircm->vlan_primary_rule.egress_vlan_tag,
 			nircm->vlan_secondary_rule.ingress_vlan_tag,