/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef included_vnet_flow_flow_h
#define included_vnet_flow_flow_h

#include <vppinfra/clib.h>
#include <vppinfra/pcap.h>
#include <vnet/l3_types.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/ethernet/packet.h>

#define foreach_flow_type \
  /* l2 flow*/ \
  _(ETHERNET, ethernet, "ethernet") \
  /* l4 flow*/ \
  _(IP4_N_TUPLE, ip4_n_tuple, "ipv4-n-tuple") \
  _(IP6_N_TUPLE, ip6_n_tuple, "ipv6-n-tuple") \
  _(IP4_N_TUPLE_TAGGED, ip4_n_tuple_tagged, "ipv4-n-tuple-tagged") \
  _(IP6_N_TUPLE_TAGGED, ip6_n_tuple_tagged, "ipv6-n-tuple-tagged") \
  /* IP tunnel flow */ \
  _(IP4_L2TPV3OIP, ip4_l2tpv3oip, "ipv4-l2tpv3oip") \
  _(IP4_IPSEC_ESP, ip4_ipsec_esp, "ipv4-ipsec-esp") \
  _(IP4_IPSEC_AH, ip4_ipsec_ah, "ipv4-ipsec-ah") \
  /* L4 tunnel flow*/ \
  _(IP4_VXLAN, ip4_vxlan, "ipv4-vxlan") \
  _(IP6_VXLAN, ip6_vxlan, "ipv6-vxlan") \
  _(IP4_GTPC, ip4_gtpc, "ipv4-gtpc") \
  _(IP4_GTPU, ip4_gtpu, "ipv4-gtpu") \
  _(IP4_GTPU_IP4, ip4_gtpu_ip4, "ipv4-gtpu-ipv4") \
  _(IP4_GTPU_IP6, ip4_gtpu_ip6, "ipv4-gtpu-ipv6") \
  _(IP6_GTPC, ip6_gtpc, "ipv6-gtpc") \
  _(IP6_GTPU, ip6_gtpu, "ipv6-gtpu") \
  _(IP6_GTPU_IP4, ip6_gtpu_ip4, "ipv6-gtpu-ipv4") \
  _(IP6_GTPU_IP6, ip6_gtpu_ip6, "ipv6-gtpu-ipv6")

#define foreach_flow_entry_ethernet \
  _fe(ethernet_header_t, eth_hdr)

#define foreach_flow_entry_ip4_n_tuple \
  _fe(ip4_address_and_mask_t, src_addr) \
  _fe(ip4_address_and_mask_t, dst_addr) \
  _fe(ip_port_and_mask_t, src_port) \
  _fe(ip_port_and_mask_t, dst_port) \
  _fe(ip_protocol_t, protocol)

#define foreach_flow_entry_ip6_n_tuple \
  _fe(ip6_address_and_mask_t, src_addr) \
  _fe(ip6_address_and_mask_t, dst_addr) \
  _fe(ip_port_and_mask_t, src_port) \
  _fe(ip_port_and_mask_t, dst_port) \
  _fe(ip_protocol_t, protocol)

#define foreach_flow_entry_ip4_n_tuple_tagged \
  _fe(ip4_address_and_mask_t, src_addr) \
  _fe(ip4_address_and_mask_t, dst_addr) \
  _fe(ip_port_and_mask_t, src_port) \
  _fe(ip_port_and_mask_t, dst_port) \
  _fe(ip_protocol_t, protocol)

#define foreach_flow_entry_ip6_n_tuple_tagged \
  _fe(ip6_address_and_mask_t, src_addr) \
  _fe(ip6_address_and_mask_t, dst_addr) \
  _fe(ip_port_and_mask_t, src_port) \
  _fe(ip_port_and_mask_t, dst_port) \
  _fe(ip_protocol_t, protocol)

#define foreach_flow_entry_ip4_l2tpv3oip \
  _fe(ip4_address_and_mask_t, src_addr) \
  _fe(ip4_address_and_mask_t, dst_addr) \
  _fe(ip_protocol_t, protocol)          \
  _fe(u32, session_id)

#define foreach_flow_entry_ip4_ipsec_esp \
  _fe(ip4_address_and_mask_t, src_addr) \
  _fe(ip4_address_and_mask_t, dst_addr) \
  _fe(ip_protocol_t, protocol)          \
  _fe(u32, spi)

#define foreach_flow_entry_ip4_ipsec_ah \
  _fe(ip4_address_and_mask_t, src_addr) \
  _fe(ip4_address_and_mask_t, dst_addr) \
  _fe(ip_protocol_t, protocol)          \
  _fe(u32, spi)

#define foreach_flow_entry_ip4_vxlan \
  _fe(ip4_address_t, src_addr) \
  _fe(ip4_address_t, dst_addr) \
  _fe(u16, dst_port) \
  _fe(u16, vni)

#define foreach_flow_entry_ip6_vxlan \
  _fe(ip6_address_t, src_addr) \
  _fe(ip6_address_t, dst_addr) \
  _fe(u16, dst_port) \
  _fe(u16, vni)

#define foreach_flow_entry_ip4_gtpc \
  foreach_flow_entry_ip4_n_tuple \
  _fe(u32, teid)

#define foreach_flow_entry_ip4_gtpu \
  foreach_flow_entry_ip4_n_tuple \
  _fe(u32, teid)

#define foreach_flow_entry_ip4_gtpu_ip4 \
  foreach_flow_entry_ip4_gtpu \
  _fe(ip4_address_and_mask_t, inner_src_addr) \
  _fe(ip4_address_and_mask_t, inner_dst_addr)

#define foreach_flow_entry_ip4_gtpu_ip6 \
  foreach_flow_entry_ip4_gtpu \
  _fe(ip6_address_and_mask_t, inner_src_addr) \
  _fe(ip6_address_and_mask_t, inner_dst_addr)

#define foreach_flow_entry_ip6_gtpc \
  foreach_flow_entry_ip6_n_tuple \
  _fe(u32, teid)

#define foreach_flow_entry_ip6_gtpu \
  foreach_flow_entry_ip6_n_tuple \
  _fe(u32, teid)

#define foreach_flow_entry_ip6_gtpu_ip4 \
  foreach_flow_entry_ip6_gtpu \
  _fe(ip4_address_and_mask_t, inner_src_addr) \
  _fe(ip4_address_and_mask_t, inner_dst_addr)

#define foreach_flow_entry_ip6_gtpu_ip6 \
  foreach_flow_entry_ip6_gtpu \
  _fe(ip6_address_and_mask_t, inner_src_addr) \
  _fe(ip6_address_and_mask_t, inner_dst_addr)

#define foreach_flow_action \
  _(0, COUNT, "count") \
  _(1, MARK, "mark") \
  _(2, BUFFER_ADVANCE, "buffer-advance") \
  _(3, REDIRECT_TO_NODE, "redirect-to-node") \
  _(4, REDIRECT_TO_QUEUE, "redirect-to-queue") \
  _(5, RSS, "rss") \
  _(6, DROP, "drop")

typedef enum
{
#define _(v,n,s)  VNET_FLOW_ACTION_##n = (1 << v),
  foreach_flow_action
#undef _
} vnet_flow_action_t;


#define foreach_flow_error \
  _( -1, NOT_SUPPORTED, "not supported")			\
  _( -2, ALREADY_DONE, "already done")				\
  _( -3, ALREADY_EXISTS, "already exists")			\
  _( -4, NO_SUCH_ENTRY, "no such entry")			\
  _( -5, NO_SUCH_INTERFACE, "no such interface")		\
  _( -6, INTERNAL, "internal error")

#define foreach_flow_rss_types                    \
  _(0, FRAG_IPV4,          "ipv4-frag")   \
  _(1, IPV4_TCP,           "ipv4-tcp")    \
  _(2, IPV4_UDP,           "ipv4-udp")    \
  _(3, IPV4_SCTP,          "ipv4-sctp")   \
  _(4, IPV4_OTHER,         "ipv4-other")  \
  _(5, IPV4,               "ipv4")        \
  _(6, IPV6_TCP_EX,        "ipv6-tcp-ex") \
  _(7, IPV6_UDP_EX,        "ipv6-udp-ex") \
  _(8, FRAG_IPV6,          "ipv6-frag")   \
  _(9, IPV6_TCP,           "ipv6-tcp")    \
  _(10, IPV6_UDP,          "ipv6-udp")    \
  _(11, IPV6_SCTP,         "ipv6-sctp")   \
  _(12, IPV6_OTHER,        "ipv6-other")  \
  _(13, IPV6_EX,           "ipv6-ex")     \
  _(14, IPV6,              "ipv6")        \
  _(15, L2_PAYLOAD,        "l2-payload")  \
  _(16, PORT,              "port")        \
  _(17, VXLAN,             "vxlan")       \
  _(18, GENEVE,            "geneve")      \
  _(19, NVGRE,             "nvgre")       \
  _(20, GTPU,              "gtpu")        \
  _(60, L4_DST_ONLY,       "l4-dst-only") \
  _(61, L4_SRC_ONLY,       "l4-src-only") \
  _(62, L3_DST_ONLY,       "l3-dst-only") \
  _(63, L3_SRC_ONLY,       "l3-src-only")

#define foreach_rss_function           \
  _(DEFAULT, "default")                \
  _(TOEPLITZ, "toeplitz")              \
  _(SIMPLE_XOR, "simple_xor")          \
  _(SYMMETRIC_TOEPLITZ, "symmetric_toeplitz")

typedef enum
{
  VNET_FLOW_NO_ERROR = 0,
#define _(v,n,s)  VNET_FLOW_ERROR_##n = v,
  foreach_flow_error
#undef _
} vnet_flow_error_t;

typedef struct
{
  u16 port, mask;
} ip_port_and_mask_t;

typedef enum
{
  VNET_FLOW_TYPE_UNKNOWN,
#define _(a,b,c) VNET_FLOW_TYPE_##a,
  foreach_flow_type
#undef _
    VNET_FLOW_N_TYPES,
} vnet_flow_type_t;

typedef enum
{
#define _(a,b) VNET_RSS_FUNC_##a,
  foreach_rss_function
#undef _
    VNET_RSS_N_TYPES,
} vnet_rss_function_t;

/*
 * Create typedef struct vnet_flow_XXX_t
 */
#define _fe(a, b) a b;
#define _(a,b,c) \
typedef struct { \
int foo; \
foreach_flow_entry_##b \
} vnet_flow_##b##_t;
foreach_flow_type;
#undef _
#undef _fe

/* main flow struct */
typedef struct
{
  /* flow type */
  vnet_flow_type_t type;

  /* flow index */
  u32 index;

  /* bitmap of flow actions (VNET_FLOW_ACTION_*) */
  u32 actions;

  /* flow id for VNET_FLOW_ACTION_MARK */
  u32 mark_flow_id;

  /* node index and next index for VNET_FLOW_ACTION_REDIRECT_TO_NODE */
  u32 redirect_node_index;
  u32 redirect_device_input_next_index;

  /* queue for VNET_FLOW_ACTION_REDIRECT_TO_QUEUE */
  u32 redirect_queue;

  /* buffer offset for VNET_FLOW_ACTION_BUFFER_ADVANCE */
  i32 buffer_advance;

  /* RSS types, including IPv4/IPv6/TCP/UDP... */
  u64 rss_types;

  /* RSS functions, including IPv4/IPv6/TCP/UDP... */
  vnet_rss_function_t rss_fun;

  union
  {
#define _(a,b,c) vnet_flow_##b##_t b;
    foreach_flow_type
#undef _
  };

  /* per-interface private data */
  uword *private_data;
} vnet_flow_t;

int vnet_flow_get_range (vnet_main_t * vnm, char *owner, u32 count,
			 u32 * start);
int vnet_flow_add (vnet_main_t * vnm, vnet_flow_t * flow, u32 * flow_index);
int vnet_flow_enable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index);
int vnet_flow_disable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index);
int vnet_flow_del (vnet_main_t * vnm, u32 flow_index);
vnet_flow_t *vnet_get_flow (u32 flow_index);

typedef struct
{
  u32 start;
  u32 count;
  u8 *owner;
} vnet_flow_range_t;

typedef struct
{
  /* pool of device flow entries */
  vnet_flow_t *global_flow_pool;

  /* flow ids allocated */
  u32 flows_used;

  /* vector of flow ranges */
  vnet_flow_range_t *ranges;

} vnet_flow_main_t;

extern vnet_flow_main_t flow_main;

format_function_t format_flow_actions;
format_function_t format_flow_enabled_hw;

#endif /* included_vnet_flow_flow_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
