[qca-nss-drv] Separate the tun6rd's inner/outer dynamic interfaces
Change-Id: If34c8c1b56808709d5b22c20a0db931b7ee73984
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
diff --git a/exports/nss_dynamic_interface.h b/exports/nss_dynamic_interface.h
index 97fafa8..e842513 100644
--- a/exports/nss_dynamic_interface.h
+++ b/exports/nss_dynamic_interface.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.
@@ -37,8 +37,8 @@
NSS_DYNAMIC_INTERFACE_TYPE_NONE,
NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR,
NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP,
- NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD,
NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_0,
+ NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_1,
NSS_DYNAMIC_INTERFACE_TYPE_WIFI,
NSS_DYNAMIC_INTERFACE_TYPE_VAP,
NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6,
@@ -68,6 +68,8 @@
NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INLINE_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_802_3_REDIR_N2H,
NSS_DYNAMIC_INTERFACE_TYPE_802_3_REDIR_H2N,
+ NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD_INNER,
+ NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_MAX
};
diff --git a/exports/nss_tun6rd.h b/exports/nss_tun6rd.h
index 7259916..58db231 100644
--- a/exports/nss_tun6rd.h
+++ b/exports/nss_tun6rd.h
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014, 2017-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.
@@ -51,6 +51,7 @@
uint32_t daddr; /**< Destination address of the tunnel. */
uint8_t tos; /**< Type Of Service field added to the outer header. */
uint8_t ttl; /**< Time-to-live value for the tunnel. */
+ uint32_t sibling_if_num; /**< Sibling interface number. */
uint16_t reserved; /**< Reserved field added for alignment. */
};
@@ -151,6 +152,7 @@
* net_device
*
* @param[in] if_num NSS interface number.
+ * @param[in] type NSS interface type.
* @param[in] tun6rd_callback Callback for the data.
* @param[in] msg_callback Callback for the message.
* @param[in] netdev Pointer to the associated network device.
@@ -159,7 +161,7 @@
* @return
* Pointer to the NSS core context.
*/
-extern struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, nss_tun6rd_callback_t tun6rd_callback,
+extern struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, uint32_t type, nss_tun6rd_callback_t tun6rd_callback,
nss_tun6rd_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features);
/**
diff --git a/nss_tun6rd.c b/nss_tun6rd.c
index 6b3c0a8..7f77200 100644
--- a/nss_tun6rd.c
+++ b/nss_tun6rd.c
@@ -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.
@@ -149,7 +149,7 @@
/*
* nss_register_tun6rd_if()
*/
-struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, nss_tun6rd_callback_t tun6rd_callback,
+struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, uint32_t type, nss_tun6rd_callback_t tun6rd_callback,
nss_tun6rd_msg_callback_t event_callback, struct net_device *netdev, uint32_t features)
{
struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tun6rd_handler_id];
@@ -158,6 +158,7 @@
nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < NSS_SPECIAL_IF_START));
nss_core_register_subsys_dp(nss_ctx, if_num, tun6rd_callback, NULL, NULL, netdev, features);
+ nss_ctx->subsys_dp_register[if_num].type = type;
nss_top_main.tun6rd_msg_callback = event_callback;
@@ -185,6 +186,7 @@
nss_assert(nss_is_dynamic_interface(if_num));
nss_core_unregister_subsys_dp(nss_ctx, if_num);
+ nss_ctx->subsys_dp_register[if_num].type = 0;
nss_top_main.tun6rd_msg_callback = NULL;