Merge "[qca-nss-drv] Added support to set nexthop"
diff --git a/exports/nss_if.h b/exports/nss_if.h
index cd9b26e..853f9bd 100644
--- a/exports/nss_if.h
+++ b/exports/nss_if.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, 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.
@@ -47,6 +47,7 @@
 	NSS_IF_PAUSE_ON_OFF,
 	NSS_IF_VSI_ASSIGN,
 	NSS_IF_VSI_UNASSIGN,
+	NSS_IF_SET_NEXTHOP,
 	NSS_IF_MAX_MSG_TYPES = 9999,
 };
 
@@ -176,6 +177,14 @@
 };
 
 /**
+ * nss_if_set_nexthop
+ *	Message to set nexthop for an interface.
+ */
+struct nss_if_set_nexthop {
+	uint32_t nexthop;	/**< Nexthop interface number. */
+};
+
+/**
  * nss_if_msgs
  *	Information for physical NSS interface command messages.
  */
@@ -204,6 +213,8 @@
 			/**< Assign the VSI. */
 	struct nss_if_vsi_unassign vsi_unassign;
 			/**< Remove the VSI assignment. */
+	struct nss_if_set_nexthop set_nexthop;
+			/**< Set nexthop of interface. */
 };
 
 /**
@@ -299,6 +310,22 @@
 nss_tx_status_t nss_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim);
 
 /**
+ * nss_phys_if_set_nexthop
+ *	Configure nexthop for an interface.
+ *
+ * @datatypes
+ * nss_ctx_instance
+ *
+ * @param[in] nss_ctx  Pointer to the NSS context.
+ * @param[in] if_num   Network physical or virtual interface number.
+ * @param[in] nexthop   Network physical or virtual interface number.
+ *
+ * @return
+ * Status of the Tx operation.
+ */
+nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop);
+
+/**
  * @}
  */
 
diff --git a/nss_phys_if.c b/nss_phys_if.c
index 9c0ff00..7c35938 100644
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -544,6 +544,24 @@
 }
 
 /*
+ * nss_phys_if_set_nexthop()
+ *	Configures nexthop for an interface
+ */
+nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop)
+{
+	struct nss_phys_if_msg nim;
+
+	NSS_VERIFY_CTX_MAGIC(nss_ctx);
+	nss_info("%p: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num);
+
+	nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_SET_NEXTHOP,
+				sizeof(struct nss_if_set_nexthop), nss_phys_if_callback, NULL);
+	nim.msg.if_msg.set_nexthop.nexthop = nexthop;
+
+	return nss_phys_if_msg_sync(nss_ctx, &nim);
+}
+
+/*
  * nss_get_state()
  *	Return the NSS initialization state
  */
diff --git a/nss_phys_if.h b/nss_phys_if.h
index da381f6..06386c9 100644
--- a/nss_phys_if.h
+++ b/nss_phys_if.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, 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.
@@ -120,6 +120,7 @@
 	NSS_PHYS_IF_PAUSE_ON_OFF = NSS_IF_PAUSE_ON_OFF,
 	NSS_PHYS_IF_VSI_ASSIGN = NSS_IF_VSI_ASSIGN,
 	NSS_PHYS_IF_VSI_UNASSIGN = NSS_IF_VSI_UNASSIGN,
+	NSS_PHYS_IF_SET_NEXTHOP = NSS_IF_SET_NEXTHOP,
 	NSS_PHYS_IF_EXTENDED_STATS_SYNC = NSS_IF_MAX_MSG_TYPES + 1,
 	NSS_PHYS_IF_MAX_MSG_TYPES
 };