/****************************************************************************** Copyright (c) 2016, 2017 Intel Corporation ******************************************************************************/ /***************************************************************************** Copyright (c) 2012, 2014, 2015 Lantiq Deutschland GmbH For licensing information, see the file 'LICENSE' in the root folder of this software module. ******************************************************************************/ #ifndef _LANTIQ_GSW_ROUTE_H_ #define _LANTIQ_GSW_ROUTE_H_ #include "gsw_types.h" /** \defgroup PAE_API GSWIP-Routing/PAE specific APIs \brief GSWIP-Routing (PAE) APIs definition applicable to GSWIP-3.0 only. */ /** \addtogroup PAE_API */ /*@{*/ /** \brief Unused flag status conveyed through value of Zero */ #define GSW_ROUTE_F_NO_STATUS 0 /** \brief Flag to indicate existent Entry got swapped to allow High-Priority entry creation */ #define GSW_ROUTE_F_SWAP_OUT 1 /** \brief Error Code indicating no availability in MTU Table */ #define GSW_ROUTE_ERROR_MTU_FULL -20 /** \brief Error Code indicating no availability in PPPoE Table */ #define GSW_ROUTE_ERROR_PPPOE_FULL -21 /** \brief Error Code indicating no availability in RTP Assignment Table */ #define GSW_ROUTE_ERROR_RTP_FULL -22 /** \brief Error Code indicating no availability in IP Address Table */ #define GSW_ROUTE_ERROR_IP_FULL -23 /** \brief Error Code indicating no availability in MAC Address Table */ #define GSW_ROUTE_ERROR_MAC_FULL -24 /** \brief Error Code indicating no availability in Routing Session Table */ #define GSW_ROUTE_ERROR_RT_SESS_FULL -25 /** \brief Error Code indicating no availability in Collision List */ #define GSW_ROUTE_ERROR_RT_COLL_FULL -26 #define GSW_ROUTE_F_SWAP_OUT_ERR -27 /*! \brief This is the data structure for PAE 6rd tunnel interface - Outer IPv4. */ typedef struct { GSW_IP_t nSrcIP4Addr; /*!< 6rd tunnel Source IPv4 address */ GSW_IP_t nDstIP4Addr; /*!< 6rd tunnel Dest IPv4 address */ } GSW_ROUTE_Tunnel_6rd; /*! \brief This is the data structure for PAE DSLite tunnel interface - Outer IPv6. */ typedef struct { GSW_IP_t nSrcIP6Addr; /*!< DS-Lite tunnel Source IPv6 address */ GSW_IP_t nDstIP6Addr; /*!< DS-Lite tunnel Dest IPv6 address */ } GSW_ROUTE_Tunnel_DSLite; /*! \brief This is the data structure for PAE Tunnel type selector. Used by \ref GSW_ROUTE_Session_action_t. */ typedef enum { GSW_ROUTE_TUNL_NULL = 0, /*!< Session routing tunnel type is No Tunnel action */ GSW_ROUTE_TUNL_6RD = 1, /*!< Session routing tunnel type is 6rd */ GSW_ROUTE_TUNL_DSLITE = 2, /*!< Session routing tunnel type is DSlite */ GSW_ROUTE_TUNL_L2TP = 3, /*!< Session routing tunnel type is L2TP */ GSW_ROUTE_TUNL_IPSEC = 4, /*!< Session routing tunnel type is IPsec */ } GSW_ROUTE_Session_Tunmode_t; /*! \brief This is the data structure for GSWIP Tunnel entry configuration Interface. */ typedef struct { /*@{*/ GSW_ROUTE_Session_Tunmode_t eTunnelType; /*!< Tunnel type enum for DSLite, 6RD, IPSec, L2TP */ /*@}*/ /** * @name Union tunnel */ /*@{*/ union { GSW_ROUTE_Tunnel_6rd tun6RD; /*!< 6RD tunnel configuration */ u32 nTunL2TP; /*!< L2TP tunnel configuration. Just a placeholder in union, since PAE only supports L2TP detunneling only */ u32 nTunIPsec; /*!< IPsec crypto context configuration. GSWIP action not defined */ GSW_ROUTE_Tunnel_DSLite tunDSlite; /*!< DSlite tunnel configuration */ } t; /*@}*/ } GSW_ROUTE_Tunnel_t; /*! \brief This is the data structure for GSWIP Routing Session Direction. Used by \ref GSW_ROUTE_Session_action_t. */ typedef enum { GSW_ROUTE_DIRECTION_DNSTREAM = 0, /*!< Session is LAN egress i.e WAN Downstream */ GSW_ROUTE_DIRECTION_UPSTREAM = 1, /*!< Session is LAN ingress i.e. WAN Upstream session */ } GSW_ROUTE_Session_Direction_t; /*! \brief This is the data structure for GSWIP Routing mode. Used by \ref GSW_ROUTE_Session_action_t. */ typedef enum { GSW_ROUTE_MODE_NULL = 0, /*!< Session routing type NULL. Can be used for Bridge sessions in RT table. */ GSW_ROUTE_MODE_ROUTING = 1, /*!< Session routing type plain routing without NAT/NAPT*/ GSW_ROUTE_MODE_NAT = 2, /*!< Session routing type is Src IP address NAT*/ GSW_ROUTE_MODE_NAPT = 3, /*!< Session routing type is Src IP/Port NAT */ } GSW_ROUTE_Session_Routmode_t; /*! \brief This is the data structure for GSWIP Routing Outer DSCP remarking action. Used by \ref GSW_ROUTE_Session_action_t. */ typedef enum { GSW_ROUTE_OUT_DSCP_NULL = 0, /*!< Session routing no outer DSCP remarking action */ GSW_ROUTE_OUT_DSCP_INNER = 1, /*!< Session routing outer DSCP from inner IP header */ GSW_ROUTE_OUT_DSCP_SESSION = 2, /*!< Session routing outer DSCP from session action table */ GSW_ROUTE_OUT_DSCP_RES = 3, /*!< Session routing outer DSCP action reserved */ } GSW_ROUTE_Session_Outer_DSCP_Remarking_t; /** \brief Routing Session selection for IP Address - IPv4/IPv6/Unused. Used by \ref GSW_PCE_pattern_t. */ typedef enum { GSW_RT_IP_DISABLED = 0, /*!< Routing IP selection disabled. */ GSW_RT_IP_V4 = 1, /*!< Routing IP selection type is IPv4. */ GSW_RT_IP_V6 = 2 /*!< Routing IP selection type is IPv6. */ } GSW_RT_IP_t; /*! \brief This is the data structure for GSWIP Routing Session Pattern Interface. SrcIP, DstIP, SrcPort, DstPort & RoutingExtensionId together is used as input keys for lookup of Routing sessions. Except RoutingExtensionId other fields in pattern are optional and decided through PCE rule - IP and Port Compare Selector. */ typedef struct { GSW_RT_IP_t eIpType; /*!< IP Address Type - IPv4 or IPv6 or Unused */ GSW_IP_t nSrcIP; /*!< The session source IPv4/v6 address used for hash computation. Internally this gets mapped to Routing IP Addr table. */ GSW_IP_t nDstIP; /*!< The session destination IPv4/v6 address for hash computation. Internally this gets mapped to Routing IP Addr table. */ u16 nSrcPort; /*!< TCP/UDP source port information - used in hash computation*/ u16 nDstPort; /*!< TCP/UDP destination port information - used in hash computation*/ u8 nRoutExtId; /*!< Routing extension Id from Flow Table action. Valid value any 8-bit integer also matching to output of Flow rule. Used in hash index computation */ ltq_bool_t bValid; /*!< Indicate, if a particular routing entry is valid or not */ } GSW_ROUTE_Session_pattern_t; /*! \brief This is the data structure for GSWIP Routing Session Action Interface. */ typedef struct { u32 nDstPortMap; /*!< Session destination port map specified in form of bitmask. E.g. Starting with least significant - 0th Bit position denotes port no. 0, 1st bit position denotes port no. 1 and so on. Bit vale of 1 indicates port is specified and 0 indicates port is not specified*/ u16 nDstSubIfId; /*!< Session destination sub-interace Id. For multicast stream this field's GroupIndex part may carry the corresponding Group Id value. */ GSW_RT_IP_t eIpType; /*!< IP Address Type - IPv4 or IPv6 or Unused */ GSW_IP_t nNATIPaddr; /*!< Session new IP address after NAT for eIPType. */ u16 nTcpUdpPort; /*!< Session new TCP/UDP port number. Used if eSessionRoutingMode is NAPT */ u16 nMTUvalue; /*!< Session MTU value.*/ ltq_bool_t bMAC_SrcEnable; /*!< Source MAC address used */ u8 nSrcMAC[6]; /*!< New source MAC address for the session. */ ltq_bool_t bMAC_DstEnable; /*!< Destination MAC address used */ u8 nDstMAC[6]; /*!< New destination MAC address for the session */ ltq_bool_t bPPPoEmode; /*!< Session PPPoE mode. Value 0:PPPoE Mode transparent. 1:PPPoE Mode Termination*/ u16 nPPPoESessId; /*!< Session PPPoE Session Identifier used */ ltq_bool_t bTunnel_Enable; /*!< Tunnel used selector */ GSW_ROUTE_Session_Tunmode_t eTunType; /*!< Session Tunnel type used*/ u8 nTunnelIndex; /*!< Preconfigured tunnel Index. The tunnel Index maps to Tunnel table. First configure Tunnel entry and then set Index here (0..15) */ ltq_bool_t bMeterAssign; /*!< MeterId assignment action. Value 0:Assignment disabled. 1:Assignment Enabled */ u8 nMeterId; /*!< Meter Id used for the session. The metering configuration can be done using differnt switch api function */ ltq_bool_t bRTPMeasEna; /*!< RTP Multicast session's sequence number counter Action. Value 0:Counting Disabled . 1:Counting Enabled */ u16 nRTPSeqNumber; /*!< 16 bit RTP sequence number for which the multicast packet will be counted */ u16 nRTPSessionPktCnt; /*!< 16 bit RTP packet Rolling Counter. R-O */ u8 nFID; /*!< Session FID. Value 0-63, Session FID is used for Egress VLAN action */ u8 nFlowId; /*!< Flow Id value. Value 0-255. Default value is 0. */ GSW_ROUTE_Session_Outer_DSCP_Remarking_t eOutDSCPAction; /*!< Outer DSCP remarking action - Valid for Tunnel associated entries */ ltq_bool_t bInnerDSCPRemark; /*!< Session routing inner DSCP remarking action. Value 0: No remarking. 1: remarking based on session */ u8 nDSCP; /*!< DSCP remarking value for the session */ ltq_bool_t bTCremarking; /*!< Routing session traffic class remarking action. Value 0: No remarking. 1: TC remarking enabled */ u8 nTrafficClass; /*!< Traffic class remarking value for the session */ u32 nSessionCtrs; /*!< Session MIB Counters. - R-O */ GSW_ROUTE_Session_Direction_t eSessDirection; /*!