[qca-nss-drv] Update GRE Tunnel using new Dynamic Interfaces
Update gre tunnel so each direction, encap/decap, will have
seperate dynamic interfaces
Change-Id: I86eb55e3b0353067f127712ccba4276474f361a3
Signed-off-by: Thomas Wu <wthomas@codeaurora.org>
diff --git a/exports/nss_dynamic_interface.h b/exports/nss_dynamic_interface.h
index ca41ef2..3aa7803 100644
--- a/exports/nss_dynamic_interface.h
+++ b/exports/nss_dynamic_interface.h
@@ -49,7 +49,8 @@
NSS_DYNAMIC_INTERFACE_TYPE_PORTID,
NSS_DYNAMIC_INTERFACE_TYPE_DTLS,
NSS_DYNAMIC_INTERFACE_TYPE_MAP_T,
- NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL,
+ NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER,
+ NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE,
NSS_DYNAMIC_INTERFACE_TYPE_VLAN,
NSS_DYNAMIC_INTERFACE_TYPE_GRE,
diff --git a/exports/nss_gre_tunnel.h b/exports/nss_gre_tunnel.h
index 0bb30fa..0b54244 100644
--- a/exports/nss_gre_tunnel.h
+++ b/exports/nss_gre_tunnel.h
@@ -88,6 +88,8 @@
NSS_GRE_TUNNEL_ERR_ENCRYPT_IDX_INVALID = 7,
NSS_GRE_TUNNEL_ERR_NOMEM = 8,
NSS_GRE_TUNNEL_ERR_PROTO_TEB_INVALID = 9,
+ NSS_GRE_TUNNEL_ERR_SIBLING_IF = 10,
+ NSS_GRE_TUNNEL_ERR_CRYPTO_NODE_ID = 11,
NSS_GRE_TUNNEL_ERR_MAX,
};
@@ -103,12 +105,14 @@
uint32_t dest_ip[4]; /**< Destination IPv4 or IPv6 address. */
uint16_t src_port; /**< GRE plus UDP only for the source. */
uint16_t dest_port; /**< GRE plus UDP only for the destination. */
+ uint32_t crypto_node_id; /**< Cryto node identifier. */
uint32_t crypto_idx_encrypt; /**< Crypto index for encryption. */
uint32_t crypto_idx_decrypt; /**< Crypto index for decryption. */
uint32_t word0; /**< Word0 header. */
uint8_t iv_val[16]; /**< Initialization vector value. */
uint8_t ttl; /**< Time-to-live value of the IP header. */
uint8_t mh_version; /**< Meta header version */
+ uint32_t sibling_if; /**< Sibling interface number. */
};
/**
diff --git a/nss_gre_tunnel.c b/nss_gre_tunnel.c
index cdff637..c6ff894 100644
--- a/nss_gre_tunnel.c
+++ b/nss_gre_tunnel.c
@@ -42,13 +42,12 @@
*/
static bool nss_gre_tunnel_verify_if_num(uint32_t if_num)
{
- if (nss_is_dynamic_interface(if_num) == false)
- return false;
+ uint32_t type = nss_dynamic_interface_get_type(nss_gre_tunnel_get_ctx(), if_num);
+ if ((type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER) || (type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_OUTER)) {
+ return true;
+ }
- if (nss_dynamic_interface_get_type(nss_gre_tunnel_get_ctx(), if_num) != NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL)
- return false;
-
- return true;
+ return false;
}
/*
diff --git a/nss_hal/nss_hal.c b/nss_hal/nss_hal.c
index d0959e9..6655d42 100644
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -457,7 +457,8 @@
if (npd->gre_tunnel_enabled == NSS_FEATURE_ENABLED) {
nss_top->gre_tunnel_handler_id = nss_dev->id;
- nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL] = nss_dev->id;
+ nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER] = nss_dev->id;
+ nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_OUTER] = nss_dev->id;
}
if (npd->portid_enabled == NSS_FEATURE_ENABLED) {