+static inline void
+gre_mk_key4 (ip4_address_t src,
+ ip4_address_t dst,
+ u32 fib_index, u8 ttype, u16 session_id, gre_tunnel_key4_t * key)
+{
+ key->gtk_src = src;
+ key->gtk_dst = dst;
+ key->gtk_fidx_ssid_type = ttype |
+ (fib_index << GTK_FIB_INDEX_SHIFT) | (session_id << GTK_SESSION_ID_SHIFT);
+}
+
+static inline int
+gre_match_key4 (const gre_tunnel_key4_t * key1,
+ const gre_tunnel_key4_t * key2)
+{
+ return ((key1->gtk_as_u64 == key2->gtk_as_u64) &&
+ (key1->gtk_fidx_ssid_type == key2->gtk_fidx_ssid_type));
+}
+
+static inline void
+gre_mk_key6 (const ip6_address_t * src,
+ const ip6_address_t * dst,
+ u32 fib_index, u8 ttype, u16 session_id, gre_tunnel_key6_t * key)
+{
+ key->gtk_src = *src;
+ key->gtk_dst = *dst;
+ key->gtk_fidx_ssid_type = ttype |
+ (fib_index << GTK_FIB_INDEX_SHIFT) | (session_id << GTK_SESSION_ID_SHIFT);
+}
+
+static inline int
+gre_match_key6 (const gre_tunnel_key6_t * key1,
+ const gre_tunnel_key6_t * key2)
+{
+ return ((key1->gtk_src.as_u64[0] == key2->gtk_src.as_u64[0]) &&
+ (key1->gtk_src.as_u64[1] == key2->gtk_src.as_u64[1]) &&
+ (key1->gtk_dst.as_u64[0] == key2->gtk_dst.as_u64[0]) &&
+ (key1->gtk_dst.as_u64[1] == key2->gtk_dst.as_u64[1]) &&
+ (key1->gtk_fidx_ssid_type == key2->gtk_fidx_ssid_type));
+}
+
+static inline void
+gre_mk_sn_key (const gre_tunnel_t * gt, gre_sn_key_t * key)
+{
+ key->src = gt->tunnel_src;
+ key->dst = gt->tunnel_dst.fp_addr;
+ key->fib_index = gt->outer_fib_index;
+}
+