#ifndef __IFX_PPA_API_H__20081031_1913__ #define __IFX_PPA_API_H__20081031_1913__ /******************************************************************************* ** ** FILE NAME : ifx_ppa_api.h ** PROJECT : PPA ** MODULES : PPA API (Routing/Bridging Acceleration APIs) ** ** DATE : 31 OCT 2008 ** AUTHOR : Xu Liang ** DESCRIPTION : PPA Protocol Stack Hook API Header File ** COPYRIGHT : Copyright (c) 2009 ** Lantiq Deutschland GmbH ** Am Campeon 3; 85579 Neubiberg, Germany ** ** For licensing information, see the file 'LICENSE' in the root folder of ** this software module. ** ** HISTORY ** $Date $Author $Comment ** 31 OCT 2008 Xu Liang Initiate Version *******************************************************************************/ /*! \file ifx_ppa_api.h \brief This file contains es. provide PPA API. */ /** \defgroup PPA_API PPA Kernel Hook and Userspace Function API \brief PPA is a loadable network module. Hence, it exports its API though function pointer hooks. Callers need to check that hooks are non-NULL before invoking them. The hooks are initialized when the PPA is initialized. Certain API which are control / configuration related are also exposed to user space applications through the ioctl API. The PPA Kernel and Userspace API are discussed in the following sections: */ /* @{*/ /** \defgroup PPA_IOCTL PPA Userspace API \brief The subset of PPA API which is exposed to userspace for control and configuration of the PPA is invoked through an ioctls()/system call interface as described in this section. The API is defined in the following two source files: - ifx_ppa_api.h: Header file for PPA API - ifx_ppa_api.c: C Implementation file for PPA API */ /** \defgroup PPA_HOOK_API PPA Hook API \brief PPA is a loadable network module. Hence, it exports its API though function pointer hooks. Callers need to check that hooks are non-NULL before invoking them. The hooks are initialized when the PPA is initialized. - ifx_ppa_hook.h: Header file for PPA API - ifx_ppa_hook.c: C Implementation file for PPA API */ /** \defgroup PPA_PWM_API PPA Power Management API \brief PPA Power Management API provide PPA Power Management and IOCTL API The API is defined in the following two source files - ifx_ppa_api_pwm.h: Header file for PPA API - ifx_ppa_api_pwm.c: C Implementation file for PPA Power management API - ifx_ppa_api_pwm_logic.c: C impelementation file for Powr management Logic and interface with PPE driver */ /** \defgroup PPA_API_DIRECTPATH PPA Direct Path API \brief This section describes the PPA DirectPath API that allows a driver on a CPU to bypass the protocol stack and send and receive packets directly from the PPA acceleration function. For a 2-CPU system, this API is used to communicate with devices whose drivers are running on the 2nd CPU (or Core 1) - usually Core 1 is not running any protocol stack, and all protocol stack intelligence is on Core 0. This API is not yet implemented for PPE D4 or A4 firmware. It is provided as advance information on the DirectPath interfaces.The PPA DirectPath aims to accelerate packet processing by reducing CPU load when the protocol stack processes the packet. It allows a CPU-bound driver to directly talk to the PPA and to the PPE engine bypassing the stack path and providing a short-cut. - ifx_ppa_api_directpath.h: Header file for PPA API - ifx_ppa_api_directpath.c: C Implementation file for PPA API */ /** \defgroup PPA_ADAPTATION_LAYER PPA Stack Adaptation API \brief PPA module aims for OS and Protocol stack independence, and the core PPA logic does not access any OS or Protocol stack implementation specific structures directly. The PPA Protocol Stack Adaptation layer provides API that allows for straight-forward and structured OS / protocol stack porting of the PPA just by porting the Adaptation Layer (AL) API. The AL API is defined in the following two source files - ifx_ppa_stack_al.h: Header file for AL layer - ifx_ppa_stack_al.c: C Implementation file for AL API */ /* @}*/ #include #include #include #ifdef __KERNEL__ #include #endif /* * #################################### * Definition * #################################### */ /*! \brief PPA_MAX_IFS_NUM */ #define PPA_MAX_IFS_NUM 10 /*!< Maximum interface number supported */ /*! \brief PPA_MAX_MC_IFS_NUM */ #define PPA_MAX_MC_IFS_NUM 8 /*!< Maximum number of Multicast supporting interfaces */ /*! \brief PPA_MAX_VLAN_FILTER */ #define PPA_MAX_VLAN_FILTER 32 /*!< Maximum number of VLAN fitler */ /*! \brief PPA_IOC_MAGIC */ #define PPA_IOC_MAGIC ((uint32_t)'p') /*!< Magic number to differentiate PPA ioctl commands */ /*! \brief IFX_SUCCESS */ #define IFX_SUCCESS 0 /*!< Operation was successful. */ /*! \brief IFX_FAILURE */ #define IFX_FAILURE -1 /*!< Operation failed */ /*! \brief IFX_EPERM */ #define IFX_EPERM -2 /*!< not permitted */ /*! \brief IFX_EIO */ #define IFX_EIO -5 /*!< I/O/Hardware/Firmware error */ /*! \brief IFX_EAGAIN */ #define IFX_EAGAIN -11 /*!< try again later */ /*! \brief IFX_ENOMEM */ #define IFX_ENOMEM -12 /*!< out of memory */ /*! \brief IFX_EACCESS */ #define IFX_EACCESS IFX_EPERM /*! \brief IFX_EFAULT */ #define IFX_EFAULT -14 /*!< bad address */ /*! \brief IFX_EBUSY */ #define IFX_EBUSY -16 /*!< busy */ /*! \brief IFX_EINVAL */ #define IFX_EINVAL -22 /*!< invalid argument */ /*! \brief IFX_ENOTAVAIL */ #define IFX_ENOTAVAIL -97 /*! \brief IFX_ENOTPOSSIBLE */ #define IFX_ENOTPOSSIBLE -98 /*! \brief IFX_ENOTIMPL */ #define IFX_ENOTIMPL -99 /*!< not implemented */ /*! \brief IFX_ENABLED */ #define IFX_ENABLED 1 /*!< Status enabled / Device was enabled */ /*! \brief IFX_DISABLED */ #define IFX_DISABLED 0 /*!< Status disabled / Device was disabled. */ /* * flags */ /*! \brief PPA_F_BEFORE_NAT_TRANSFORM \note PPA Routing Session add hook is called before NAT transform has taken place. \n In Linux OS, this NSFORM corresponds to the netfilter PREROUTING hook */ #define PPA_F_BEFORE_NAT_TRANSFORM 0x00000001 /*! \brief PPA_F_ACCEL_MODE \note notify PPA to enable or disable acceleration for one routing session. It is only for Hook/ioctl, not for PPE FW usage */ #define PPA_F_ACCEL_MODE 0x00000002 /*! \brief PPA_F_SESSION_ORG_DIR \note Packet in original direction of session i.e. the direction in which the session was established */ #define PPA_F_SESSION_ORG_DIR 0x00000010 /*! \brief PPA_F_SESSION_REPLY_DIR \note Packet in reply direction of session i.e. opposite to the direction in which session was initiated. */ #define PPA_F_SESSION_REPLY_DIR 0x00000020 /*! \brief PPA_F_SESSION_BIDIRECTIONAL \note For PPA Session add, add a bidirectional session, else unidirection session is assumed. */ #define PPA_F_SESSION_BIDIRECTIONAL (PPA_F_SESSION_ORG_DIR | PPA_F_SESSION_REPLY_DIR) /*! \brief PPA_F_BRIDGED_SESSION \note Denotes that the PPA session is bridged */ #define PPA_F_BRIDGED_SESSION 0x00000100 /*! \brief PPA_F_SESSION_NEW_DSCP \note Denotes that the PPA session has DSCP remarking enabled */ #define PPA_F_SESSION_NEW_DSCP 0x00001000 /*! \brief PPA_F_SESSION_VLAN \note Denotes that the PPA session has VLAN tagging enabled. */ #define PPA_F_SESSION_VLAN 0x00002000 /*! \brief PPA_F_MTU \note Denotes that the PPA session has a MTU limit specified */ #define PPA_F_MTU 0x00004000 /*! \brief PPA_F_SESSION_OUT_VLAN \note Denotes that the PPA session has Outer VLAN tagging enable */ #define PPA_F_SESSION_OUT_VLAN 0x00008000 /*! \brief PPA_F_BRIDGE_LOCAL \note Denotes that the PPA bridge session is for a flow terminated at the CPE (i.e. not bridged out). Such an entry will not be accelerated */ #define PPA_F_BRIDGE_LOCAL 0x00010000 /*! \brief PPA_F_LAN_IF \note Indicates that the interface is a LAN interface */ #define PPA_F_LAN_IF 0x01000000 /*! \brief PPA_F_STATIC_ENTRY \note Indicates that it is a static entry */ #define PPA_F_STATIC_ENTRY 0x20000000 /*! \brief PPA_F_DROP_PACKET \note Denotes that the PPA session has a drop action specified. In other words, this acts as a fast path \n packet filter drop action */ #define PPA_F_DROP_PACKET 0x40000000 /*! \brief PPA_F_BRIDGE_ACCEL_MODE \note Flag denoting that the PPA should accelerate bridging sessions. Reserved currently */ #define PPA_F_BRIDGE_ACCEL_MODE 0x80000000 /* * interface flags */ /*! \brief IFX_PPA_SESSION_NOT_ADDED */ #define IFX_PPA_SESSION_NOT_ADDED -1 /*!< PPA Session Add failed. This can happen either because the Session is not yet ready for addition or \n that PPA cannot accelerate the session because the packet is looped back */ /*! \brief IFX_PPA_SESSION_ADDED */ #define IFX_PPA_SESSION_ADDED 0 /*!< Indicates PPA was able to successfully add the session */ /*! \brief IFX_PPA_SESSION_EXISTS */ #define IFX_PPA_SESSION_EXISTS 1 /*!< Indicates PPA already has the session added. This is also a success indication */ /* * ifx_ppa_inactivity_status return value */ /*! \brief IFX_PPA_HIT \note PPA Session is active i.e. was hit with packets within the configured inactivity time inter */ #define IFX_PPA_HIT 0 /*! \brief IFX_PPA_TIMEOUT \note PPA Session is inactive and hence has timed out */ #define IFX_PPA_TIMEOUT 1 /*! \brief PPA_F_VLAN_FILTER_IFNAME */ #define PPA_F_VLAN_FILTER_IFNAME 0 /*!< Port based VLAN */ /*! \brief PPA_F_VLAN_FILTER_IP_SRC */ #define PPA_F_VLAN_FILTER_IP_SRC 1 /*!< SRC IP based VLAN */ /*! \brief PPA_F_VLAN_FILTER_ETH_PROTO */ #define PPA_F_VLAN_FILTER_ETH_PROTO 2 /*!< Ethernet Type based VLAN */ /*! \brief PPA_F_VLAN_FILTER_VLAN_TAG */ #define PPA_F_VLAN_FILTER_VLAN_TAG 3 /*!< Vlan tag based VLAN */ /*! \brief PPA_INVALID_QID */ #define PPA_INVALID_QID 0xFFFF /*!< Invalid VLAN ID. Note, it is used only in IOCTL */ /*! \brief PPA_VLAN_TAG_MASK */ #define PPA_VLAN_TAG_MASK 0xFFFF1FFF /*!< VLAN MASK to remove VLAN priority*/ /*! \brief MAX_HOOK_NAME_LEN */ #define MAX_HOOK_NAME_LEN 71 /*!< maximum hook name length */ /*! \brief PPA_PORT_MODE_ETH */ #define PPA_PORT_MODE_ETH 1 /*!< Ethernet Port */ /*! \brief PPA_PORT_MODE_DSL */ #define PPA_PORT_MODE_DSL 2 /*!< DSL Port */ /*! \brief PPA_PORT_MODE_EXT */ #define PPA_PORT_MODE_EXT 3 /*!< Extension Port, like USB/WLAN */ /*! \brief PPA_PORT_MODE_CPU */ #define PPA_PORT_MODE_CPU 4 /*!< CPU */ #define FLAG_PPE_CLK_CHANGE_ARG_AVM_DIRCT (1 << 1) #ifdef NO_DOXY #define VLAN_ID_SPLIT(full_id, pri, cfi, vid) pri=( (full_id) >> 13 ) & 7; cfi=( (full_id) >>12) & 1; vid= (full_id) & 0xFFF #define VLAN_ID_CONBINE(full_id, pri, cfi, vid) full_id =( ( (uint16_t)(pri) & 7) << 13 ) | ( ( (uint16_t)( cfi) & 1) << 12 ) | ((uint16_t) (vid) & 0xFFF ) /* * internal flag */ #define SESSION_INTERNAL_FLAG_BASE 0 #define SESSION_IS_REPLY 0x00000001 #define SESSION_BRIDGING_VCI_CHECK 0x00000002 #define SESSION_IS_TCP 0x00000004 #define SESSION_BYTE_STAMPING 0x00000008 //for PPA session management purse #define SESSION_ADDED_IN_HW 0x00000010 #define SESSION_NON_ACCE_MASK ~SESSION_ADDED_IN_HW //for ioctl only #define SESSION_CAN_NOT_ACCEL 0x00000020 // later may need to change the naming, so far it also used for sesson management #define SESSION_STATIC 0x00000040 #define SESSION_DROP 0x00000080 #define SESSION_VALID_NAT_IP 0x00000100 #define SESSION_VALID_NAT_PORT 0x00000200 #define SESSION_VALID_NAT_SNAT 0x00000400 // src IP is replaced, otherwise dest IP is replaced #define SESSION_NOT_ACCELABLE 0x00000800 //Session cannot be accelerated at all #define SESSION_VALID_VLAN_INS 0x00001000 #define SESSION_VALID_VLAN_RM 0x00002000 #define SESSION_VALID_OUT_VLAN_INS 0x00004000 #define SESSION_VALID_OUT_VLAN_RM 0x00008000 #define SESSION_VALID_PPPOE 0x00010000 #define SESSION_VALID_NEW_SRC_MAC 0x00020000 #define SESSION_VALID_SRC_MAC SESSION_VALID_NEW_SRC_MAC #define SESSION_VALID_MTU 0x00040000 #define SESSION_VALID_NEW_DSCP 0x00080000 #define SESSION_VALID_DSLWAN_QID 0x00100000 #define SESSION_TX_ITF_IPOA 0x00200000 #define SESSION_TX_ITF_PPPOA 0x00400000 #define SESSION_VALID_AVM_PORTMAP 0x00800000 #define SESSION_TX_ITF_IPOA_PPPOA_MASK (SESSION_TX_ITF_IPOA | SESSION_TX_ITF_PPPOA) #define SESSION_SRC_MAC_DROP_EN 0x01000000 #define SESSION_TUNNEL_6RD 0x02000000 #define SESSION_TUNNEL_DSLITE 0x04000000 #define SESSION_LAN_ENTRY 0x10000000 #define SESSION_WAN_ENTRY 0x20000000 #define SESSION_IS_IPV6 0x40000000 #endif #define WRAPROUND_24BITS 0xFFFFFF /*note, this value will be different with GRX500 platform */ #define SESSION_FLAGS_ARRAY static const char *session_flags_array[] = { \ "IS_REPLY", \ "BR_VCI_CHECK", \ "IS_TCP", \ "STAMPING", \ "ADDED_IN_HW", \ "CAN_NOT_ACCEL", \ "STATIC", \ "DROP", \ "VALID_NAT_IP", \ "VALID_NAT_PORT", \ "VALID_NAT_SNAT", \ "NOT_ACCELABLE", \ "VALID_VLAN_INS", \ "VALID_VLAN_RM", \ "VALID_OUT_VLAN_INS",\ "VALID_OUT_VLAN_RM", \ "VALID_PPPOE", \ "VALID_NEW_SRC_MAC", \ "VALID_MTU", \ "VALID_NEW_DSCP", \ "VALID_DSLWAN_QID", \ "TX_ITF_IPOA", \ "TX_ITF_PPPOA", \ "INVALID", \ "SRC_MAC_DROP_EN", \ "TUNNEL_6RD", \ "TUNNEL_DSLITE", \ "INVALID", \ "LAN_ENTRY", \ "WAN_ENTRY", \ "IPV6", \ "INVALID", \ } /* * #################################### * Data Type * #################################### */ /* -------------------------------------------------------------------------- */ /* Structure and Enumeration Type Defintions */ /* -------------------------------------------------------------------------- */ /** \addtogroup PPA_HOOK_API */ /*@{*/ /*! \brief This is the data structure for PPA Interface Info specification. */ typedef struct { PPA_IFNAME *ifname; /*!< Name of the stack interface */ uint32_t if_flags; /*!< Flags for Interface. Valid values are below: PPA_F_LAN_IF and PPA_F_WAN_IF */ uint32_t port; /*!< physical port id for this Interface. Valid values are below: 0 ~ */ } PPA_IFINFO; /*! \brief This is the data structure for PPA Packet header verification checks. */ typedef struct ppa_verify_checks { uint32_t f_ip_verify :1; /*!< Enable/Disable IP verification checks. Valid values are IFX_ENABLED or IFX_DISABLED */ uint32_t f_tcp_udp_verify :1; /*!< Enable/Disable TCP/UDP verification checks. Valid values are IFX_ENABLED or IFX_DISABLED */ uint32_t f_tcp_udp_err_drop :1; /*!< Enable/Disable drop packet if TCP/UDP checksum is wrong. \n If packet is not dropped, then it is forwarded to the control CPU. \n Valid values are IFX_ENABLED or IFX_DISABLED */ uint32_t f_drop_on_no_hit :1; /*!< Drop unicast packets on no hit, forward to MIPS/Control CPU otherwise (default). Valid values are IFX_ENABLED or IFX_DISABLED */ uint32_t f_mc_drop_on_no_hit :1; /*!< Drop multicast on no hit, forward to MIPS/Control CPU otherwise (default). Valid values are IFX_ENABLED or IFX_DISABLED */ } PPA_VERIFY_CHECKS; /*! \brief This is the data structure for PPA Initialization kernel hook function */ typedef struct { PPA_VERIFY_CHECKS lan_rx_checks; /*!< LAN Ingress packet checks */ PPA_VERIFY_CHECKS wan_rx_checks; /*!< WAN Ingress packet checks */ uint32_t num_lanifs; /*!< Number of LAN side interfaces */ PPA_IFINFO *p_lanifs; /*!< Pointer to array of LAN Interfaces. */ uint32_t num_wanifs; /*!< Number of WAN side interfaces */ PPA_IFINFO *p_wanifs; /*!< Pointer to array of WAN Interfaces. */ uint32_t max_lan_source_entries; /*!< Maximum Number of session entries with LAN source */ uint32_t max_wan_source_entries; /*!< Maximum Number of session entries with WAN source */ uint32_t max_mc_entries; /*!< Maximum Number of multicast sessions */ uint32_t max_bridging_entries; /*!< Maximum Number of bridging entries */ uint32_t add_requires_min_hits; /*!< Minimum number of calls to ppa_add_session() before session would be added in h/w - calls from the same hook position in stack. Currently, set to 1 */ } PPA_INIT_INFO; /*! \brief This is the data structure for additional session related information for the PPA. It specifies on a per session basis attributes like VLAN tagging, DSCP remarking etc. This structure depends on the PPE acceleration firmware capabilities. New versions of PPA will only support the capabilities as in PPE A4/D4 firmware, The current PPA driver (for PPE A4/D4 firmware) supports 2-level of VLANs (or stacked VLANs). The outer VLAN is the one used for separating LAN and WAN traffic on a switch (for Ethernet WAN). Inner VLAN tag is application specific VLAN. In case, there is no outer VLAN tag required (for LAN/WAN separation on the switch), then this field is not specified. */ typedef struct { uint32_t new_dscp :6; /*!< New DSCP code point value for the session.Valid values are 0-63. */ uint32_t dscp_remark :1; /*!< DSCP remarking needs to be carried out for the session.Valid values are:IFX_ENABLED and IFX_DISABLED */ uint32_t vlan_insert :1; /*!< If inner VLAN tag should be inserted into the frame at egress. Valid values are: IFX_ENABLED and IFX_DISABLED */ uint32_t vlan_remove :1; /*!< If inner VLAN untagging should be performed on the received frame. Untagging, if enabled, is \n carried out before any VLAN tag insert. Valid values are:IFX_ENABLED and IFX_DISABLED */ uint32_t out_vlan_insert :1; /*!< If outer VLAN tag should be inserted into the frame at egress. Valid values are: IFX_ENABLED and IFX_DISABLED */ uint32_t out_vlan_remove :1; /*!< If outer VLAN untagging should be performed on the received frame. Untagging, if enabled, is \n carried out before any VLAN tag insert. Valid values are:IFX_ENABLED and IFX_DISABLED */ uint16_t dslwan_qid_remark :1; /*!< if dslwan qid should be set. Valid values are: IFX_ENABLED and IFX_DISABLED */ uint32_t reserved1 :4; /*!< reserved */ uint32_t vlan_prio :3; /*!< 802.1p VLAN priority configuration. Valid values are 0-7. */ uint32_t vlan_cfi :1; /*!< lways set to 1 for Ethernet frames */ uint32_t vlan_id :12;/*!< VLAN Id to be used to tag the frame. Valid values are 0-4095. */ uint16_t mtu; /*!< MTU of frames classified to this session */ uint16_t dslwan_qid; /*!< dslwan_qid. Valid values are 0 ~ 16 */ uint32_t session_flags; /*!< Session flags used to identify which fields in the PPA_SESSION_EXTRA structure are valid in \n a call to the PPA Session Modify API. \n Valid values are one or more of: \n PPA_F_SESSION_NEW_DSCP \n PPA_F_SESSION_VLAN \n PPA_F_SESSION_OUT_VLAN \n PPA_F_MTU \n */ uint32_t out_vlan_tag; /*!< VLAN tag value including VLAN Id */ uint16_t accel_enable:1; /*!< to enable/disable acceleartion for one specified routing session. It will be used only in PPA API level, not HAL and PPE FW level */ } PPA_SESSION_EXTRA; /*! \brief This is the data structure which specifies an interface and its TTL value as applicable for multicast routing. */ typedef struct { PPA_IFNAME *ifname; /*!< Pointer to interface name. */ uint8_t ttl; /*!< Time to Live (TTL) value of interface which is used for multicast routing to decide if a packet can be routed onto that interface Note, it is not used at present. */ } IF_TTL_ENTRY; /*! \brief This is the data structure for basic IPV4/IPV6 address */ typedef union { uint32_t ip; /*!< ipv4 address */ uint32_t ip6[4]; /*!< ipv6 address */ }IP_ADDR; /*! \brief This is the data structure for complex IPV4/IPV6 address */ typedef struct { uint32_t f_ipv6; /*!< flag to specify the ipv4 version: 0---IPV4, 1 -- IPV6 */ IP_ADDR ip; /*!< multiple ip address format support */ } IP_ADDR_C; /*! \brief This is the data structure for PPA Multicast Group membership. It specifies the interfaces which are members of the specified IP Multicast Group address. Please see the discussion on outer and inner VLAN tags in the section on PPA_SESSION_EXTRA data structure. */ typedef struct { IP_ADDR_C ip_mc_group; /*!< Multicast IP address group */ int8_t num_ifs; /*!< Number of Interfaces which are member of this Multicast IP group address */ IF_TTL_ENTRY array_mem_ifs[PPA_MAX_MC_IFS_NUM]; /*!< Array of interface elements of maximum PPA_MAX_MC_IFS_NUM elements. Actual number of entries is specified by num_ifs */ uint8_t if_mask; /*!< Mask of Interfaces corresponding to num_ifs interfaces specified in array_mem_ifs. For internaly use only. */ PPA_IFNAME *src_ifname; /*!< the source interface of specified multicast IP address group */ uint32_t vlan_insert :1; /*!< If inner VLAN tag should be inserted into the frame at egress. Valid values are: IFX_ENABLED and IFX_DISABLED */ uint32_t vlan_remove :1; /*!< If inner VLAN untagging should be performed on the received frame. Untagging, if enabled, is carried out before any VLAN tag insert. Valid values are:IFX_ENABLED and IFX_DISABLED */ uint32_t out_vlan_insert :1; /*!< If outer VLAN tag should be inserted into the frame at egress. Valid values are: IFX_ENABLED and IFX_DISABLED */ uint32_t out_vlan_remove :1; /*!< If outer VLAN untagging should be performed on the received frame. Untagging, if enabled, is carried out before any VLAN tag insert. Valid values are:IFX_ENABLED and IFX_DISABLED */ uint32_t dslwan_qid_remark:1; /*!< not use at present */ uint32_t reserved1 :3; /*!< valid in A4/A5 */ uint32_t vlan_prio :3; /*!< 802.1p VLAN priority configuration. Valid values are 0-7. */ uint32_t vlan_cfi :1; /*!< Always set to 1 for Ethernet frames */ uint32_t vlan_id :12; /*!< VLAN Id to be used to tag the frame. Valid values are 0-4095 */ uint32_t out_vlan_tag; /*!< Outer VLAN tag value including VLAN Id. */ uint32_t new_dscp_en :1; /*!< If new dscp value should be set. Valid values are:IFX_ENABLED and IFX_DISABLED */ uint32_t res :15; /*!< reserved */ uint32_t new_dscp :16; /*!< New DSCP code point value for the session.Valid values are 0-63. */ uint16_t dslwan_qid; /*!< not use at present */ uint32_t bridging_flag; /*!< 0 - routing mode/igmp proxy, 1 - bridge mode/igmp snooping. */ uint8_t mac[PPA_ETH_ALEN]; /*!< reserved for future */ uint8_t SSM_flag; /*!< Set the flag if source specific forwarding is required default 0*/ PPA_IPADDR source_ip; /*!< source ip address */ } PPA_MC_GROUP; /*! \brief This data structure is an abstraction for unicast and multicast routing sessions. Pointer to any kind of PPA session */ typedef void PPA_U_SESSION; /*! \brief This is the data structure for standard packet and byte statistics for an interface. */ typedef struct { uint32_t tx_pkts; /*!< Number of transmitted packets through the interface */ uint32_t rx_pkts; /*!< Number of received packets through the interface */ uint32_t tx_discard_pkts; /*!< Number of packets discarded while transmitting through the interface. */ uint32_t tx_error_pkts; /*!< Number of transmit errors through the interface. */ uint32_t rx_discard_pkts; /*!< Number of received packets through the interface that were discarded */ uint32_t rx_error_pkts; /*!< Number of received errors through the interface. */ uint32_t tx_bytes; /*!< Number of transmit bytes through the interface */ uint32_t rx_bytes; /*!< Number of received bytes through the interface */ } PPA_IF_STATS; /*! \brief This is the data structure for PPA accelerated statistics for an interface. Depending on the platform and acceleration capabilities, some of the statistics may not be available. */ typedef struct { uint32_t fast_routed_tcp_pkts; /*!< Fastpath routed TCP unicast packets Tx */ uint32_t fast_routed_udp_pkts; /*!< Fastpath routed UDP unicast packets Tx */ uint32_t fast_routed_udp_mcast_pkts; /*!< Fastpath routed UDP multicast packets Tx */ uint32_t fast_drop_pkts; /*!< Fastpath ingress pkts dropped */ uint32_t fast_drop_bytes; /*!< Fastpath ingress bytes dropped */ uint32_t fast_ingress_cpu_pkts; /*!< Fastpath ingress CPU pkts */ uint32_t fast_ingress_cpu_bytes; /*!< Fastpath ingress CPU bytes */ uint32_t rx_pkt_errors; /*!< Fastpath packet error */ uint32_t fast_bridged_ucast_pkts; /*!< Fastpath bridged unicast pkts */ uint32_t fast_bridged_mcast_pkts; /*!< Fastpath bridged multicast pkts */ uint32_t fast_bridged_bcast_pkts; /*!< Fastpath bridged broadcast pkts */ uint32_t fast_bridged_bytes; /*!< Fastpath bridged bytes */ } PPA_ACCEL_STATS; /*! \brief This is the data structure for VLAN tag control on a per interface basis. It is currently supported only for bridging paths. For PPE A4 firmware, 2 levels of VLAN is configurable, while for older PPE D4 firmware, only inner VLAN tag is configurable. Please see discussion in section PPA_SESSION_EXTRA. Briefly, couter VLAN tag configuration is used for LAN and WAN isolation on the same external switch, while the other set of VLAN tag configuration is driven from application needs (i.e. not stripped off when the packet hits the wire). */ typedef struct { uint32_t unmodified :1; /*!< Indicates if there is no VLAN tag modification. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t insertion :1; /*!< Indicates if there is a VLAN tag inserted. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t remove :1; /*!< Indicates if there is a VLAN tag removed. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t replace :1; /*!< Indicates if there is a VLAN tag replaced. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t out_unmodified :1; /*!< Indicates if there is no outer VLAN tag modification. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t out_insertion :1; /*!< Indicates if there is a outer VLAN tag inserted. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t out_remove :1; /*!< Indicates if there is a outer VLAN tag removed. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t out_replace :1; /*!< Indicates if there is a outerVLAN tag replaced. Valid values are IFX_ENABLED and IFX_DISABLED */ } PPA_VLAN_TAG_CTRL; /*! \brief This is the data structure for VLAN configuration control on a per interface basis. It is currently supported only for bridging paths. */ typedef struct { uint32_t src_ip_based_vlan :1; /*!< Indicates if Source IP address filter based VLAN tagging is enabled for this interface. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t eth_type_based_vlan :1; /*!< Indicates if Ethernet header type based VLAN tagging is enabled for this interface. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t vlanid_based_vlan :1; /*!< Indicates if VLAN re-tagging is enabled based on existing VLAN Id of received frame. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t port_based_vlan :1; /*!< Indicates if port based VLAN tagging is enabled for this interface. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t vlan_aware :1; /*!< Indicates if bridge is VLAN aware and enforces VLAN based forwarding for this interface. Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t out_vlan_aware :1; /*!< Indicates if bridge is outer VLAN aware and enforces VLAN based forwarding for this interface. If this field is not enabled, then outer VLAN processing is don't care. interface. If this field is not enabled, then outer VLAN processing is don't care. Valid values are IFX_ENABLED and IFX_DISABLED */ } PPA_VLAN_CFG; /*! \brief Union of PPA VLAN filter criteria. */ typedef union { PPA_IFNAME *ifname; /*!< Pointer to interface name on which VLAN filter match is to be performed. */ IPADDR ip_src; /*!< IP source address of ingress frame for VLAN filter matching. */ uint32_t eth_protocol; /*!< Ethernet protocol as a match filter for VLAN filter matching */ uint32_t ingress_vlan_tag; /*!< Ingress frame VLAN tag as match criteria for VLAN filter matching */ } match_criteria_vlan; /*! \brief This data structure specifies the filter or match criteria for applying VLAN transforms based on rules. It is currently supported only for bridging paths. */ typedef struct { match_criteria_vlan match_field; /*!< Union of VLAN filter criteria */ uint32_t match_flags; /*!< Indicates which VLAN filter criteria is specified in this VLAN match entry. Valid values are one of the following: \n PPA_F_VLAN_FILTER_IFNAME \n PPA_F_VLAN_FILTER_IP_SRC \n PPA_F_VLAN_FILTER_ETH_PROTO \n PPA_F_VLAN_FILTER_VLAN_TAG \n */ } PPA_VLAN_MATCH_FIELD; /*! \brief This is the data structure for PPA VLAN configuration ioctl() on a per interface basis from userspace. It is currently supported only for bridging paths. */ typedef struct { uint16_t vlan_vci; /*!< VLAN Information including VLAN Id, 802.1p and CFI bits. */ uint16_t qid; /*!< queue index */ uint32_t out_vlan_id; /*!< out vlan id */ uint32_t inner_vlan_tag_ctrl;/*!< none(0)/remove(1)/insert(2)/replac(3), for vlan tag based only. */ uint32_t out_vlan_tag_ctrl; /*!< none(0)/remove(1)/insert(2)/replac(3), for vlan tag based only. */ uint16_t num_ifs; /*!< Number of interfaces in the array of PPA_IFINFO structures. */ PPA_IFINFO *vlan_if_membership; /*!< Pointer to array of interface info structures for each interface which is a member of this VLAN group. The number of entries is given by num_ifs. */ } PPA_VLAN_INFO; /*! \brief This is the data structure for PPA VLAN filter configuration. It is currently supported only for bridging paths */ typedef struct { PPA_VLAN_MATCH_FIELD match_field; /*!< VLAN Match field information */ PPA_VLAN_INFO vlan_info; /*!< VLAN Group and Membership Info */ } PPA_VLAN_FILTER_CONFIG; /*! \brief This is the data structure for cout information, like lan interface count, LAN acceleration count and so on */ typedef struct { uint32_t count; /*!< the number */ uint32_t flag; /*!< the flag */ } PPA_CMD_COUNT_INFO; /*! \brief This is the data structure for get some structure size */ typedef struct { uint32_t rout_session_size; /*!< the structure size of one routing session */ uint32_t mc_session_size; /*!< the structure size of one multicast session */ uint32_t br_session_size; /*!< the structure size of one bridge session */ uint32_t netif_size; /*!< the structure size of one network interface information*/ } PPA_CMD_SIZE_INFO; /*@}*/ /* PPA_HOOK_API */ /* * ioctl command structures */ /** \addtogroup PPA_IOCTL */ /*@{*/ /*! \brief This is the data structure for PPA Interface information used from the userspacef */ typedef struct { PPA_IFNAME ifname[PPA_IF_NAME_SIZE]; /*!< Name of the stack interface ( provide storage buffer ) */ uint32_t if_flags; /*!< Flags for Interface. Valid values are below: PPA_F_LAN_IF and PPA_F_WAN_IF */ } PPA_CMD_IFINFO; /*! \brief This is the data structure for PPA Init used from the userspace */ typedef struct { PPA_VERIFY_CHECKS lan_rx_checks; /*!< LAN Ingress checks */ PPA_VERIFY_CHECKS wan_rx_checks; /*!< WAN Ingress checks */ uint32_t num_lanifs; /*!< Number of LAN side interfaces */ PPA_CMD_IFINFO p_lanifs[PPA_MAX_IFS_NUM]; /*!< Array of LAN Interface Info structures (provides storage buffer). */ uint32_t num_wanifs; /*!< Number of WAN side interfaces */ PPA_CMD_IFINFO p_wanifs[PPA_MAX_IFS_NUM]; /*!< Array of WAN Interface Info structures (provides storage buffer). */ uint32_t max_lan_source_entries; /*!< Number of session entries with LAN source */ uint32_t max_wan_source_entries; /*!< Number of session entries with WAN source */ uint32_t max_mc_entries; /*!< Number of multicast sessions */ uint32_t max_bridging_entries; /*!< Number of bridging entries */ uint32_t add_requires_min_hits; /*!< Minimum number of calls to ppa_add before session would be added in h/w */ uint32_t mtu; /*!< specify PPA network internface's MTU size, default is 1500 */ uint32_t flags; /*!< Flags for PPA Initialization. Currently this field is reserved. */ } PPA_CMD_INIT_INFO; /*! \brief This is the data structure for PPA Acceleration Enable / Disable configuration */ typedef struct { uint32_t lan_rx_ppa_enable; /*!< lan Interface specific flags. Current Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t wan_rx_ppa_enable; /*!< wan Interface specific flags. Current Valid values are IFX_ENABLED and IFX_DISABLED */ uint32_t flags; /*!< Reserved currently */ } PPA_CMD_ENABLE_INFO; /*! \brief This is the data structure for MAC table entry used in PPA ioctl interface */ typedef struct { IP_ADDR_C mcast_addr; /*!< MC address of the entry */ IP_ADDR source_ip; /*!< source ip */ uint8_t SSM_flag; /*!< ssm flag */ PPA_SESSION_EXTRA mc_extra; /*!< Pointer to PPA Multicast session parameters like VLAN configuration, DSCP remarking */ uint32_t flags; /*!< Flags for the PPA Multicast entry info structure. Reserved currently. */ } PPA_CMD_MC_ENTRY; /*! \brief This is the data structure for learned MAC address used in PPA ioctl interface */ typedef struct { uint8_t mac_addr[PPA_ETH_ALEN]; /*!< MAC address learned */ PPA_IFNAME ifname[PPA_IF_NAME_SIZE]; /*!< The interface which learned the MAC address */ uint32_t flags; /*!< for future */ } PPA_CMD_MAC_ENTRY; /*! \brief This is the data structure for PPA VLAN configuration ioctl() on a per interface basis from userspace. It is currently supported only for bridging paths. */ typedef struct { PPA_IFNAME if_name[PPA_IF_NAME_SIZE]; /*!< Pointer to interface name for which VLAN related configuration is specified. */ PPA_VLAN_TAG_CTRL vlan_tag_ctrl; /*!< VLAN Tag Control structure for the interface */ PPA_VLAN_CFG vlan_cfg; /*!< VLAN Configuration control structure for the interface */ uint32_t flags; /*!< Flags field. Reserved currently and omitted in implementation. */ } PPA_CMD_BR_IF_VLAN_CONFIG; /*! \brief Union for VLAN filter matching criteria. */ typedef union { PPA_IFNAME ifname[PPA_IF_NAME_SIZE]; /*!< Pointer to interface name on which VLAN filter match is to be performed. */ IPADDR ip_src; /*!< IP source address of ingress frame for VLAN filter matching. */ uint32_t eth_protocol; /*!< Ethernet protocol as a match filter for VLAN filter matching. */ uint32_t ingress_vlan_tag; /*!< Ingress frame VLAN tag as match criteria for VLAN filter matching. */ } filter_criteria; /*! \brief This data structure specifies the filter or match criteria for applying VLAN transforms based on rules. It is currently supported only for bridging paths. */ typedef struct { filter_criteria match_field; /*!< Union for VLAN filter criteria. */ uint32_t match_flags; /*!< Indicates which VLAN filter criteria is specified in this VLAN match entry. \n Valid values are one of the following: \n - PPA_F_VLAN_FILTER_IFNAME \n - PPA_F_VLAN_FILTER_IP_SRC \n - PPA_F_VLAN_FILTER_ETH_PROTO \n - PPA_F_VLAN_FILTER_VLAN_TAG */ } PPA_CMD_VLAN_MATCH_FIELD; /*! \brief This is the data structure for PPA VLAN configuration ioctl() on a per interface basis from userspace. It is currently supported only for bridging paths. */ typedef struct { uint16_t vlan_vci; /*!< VLAN Information including VLAN Id, 802.1p and CFI bits */ uint16_t qid; /*!< dest_qos */ uint32_t out_vlan_id; /*!< new out vlan id */ uint32_t out_vlan_tag_ctrl; /*!< unmodify(0)/remove(1)/insert(2)/replac(3), for vlan tag based only. */ uint32_t inner_vlan_tag_ctrl;/*!< unmodify(0)/remove(1)/insert(2)/replac(3), for vlan tag based only. */ uint16_t num_ifs; /*!< Number of interfaces in the array of PPA_IFINFO structures. */ PPA_CMD_IFINFO vlan_if_membership[PPA_MAX_IFS_NUM]; /*!< Pointer to array of interface info structures for each interface which is a member of this VLAN group. The number of entries is given by num_ifs. */ } PPA_CMD_VLAN_INFO; /*! \brief This is the data structure for basic VLAN filter setting in PPA ioctl interface */ typedef struct { PPA_CMD_VLAN_MATCH_FIELD match_field; /*!< vlan filter match field */ PPA_CMD_VLAN_INFO vlan_info; /*!< vlan information */ } _PPA_CMD_VLAN_FILTER_CONFIG; /*! \brief This is the data structure for VLAN filter configure in PPA ioctl interface */ typedef struct { _PPA_CMD_VLAN_FILTER_CONFIG vlan_filter_cfg; /*!< vlan filter basc information */ uint32_t flags; /*!< flag */ } PPA_CMD_VLAN_FILTER_CONFIG; /*! \brief This is the data structure for PPA VLAN configuration as passed to the PPA ioctl() API from userspace. It is currently supported only for bridging paths. */ typedef struct { PPA_CMD_COUNT_INFO count_info; /*!< Number of filters returned in pointer to array of filters. */ PPA_CMD_VLAN_FILTER_CONFIG filters[1]; /*!< it is a dummy array. Userspace should apply storage buffer for it */ } PPA_CMD_VLAN_ALL_FILTER_CONFIG; /*! \brief This is the data structure for PPA accelerated statistics for an interface. Depending on the platform and acceleration capabilities, some of the statistics may not be available. */ typedef struct { PPA_IFNAME ifname[PPA_IF_NAME_SIZE]; /*!< interface name ( provides storage buffer) */ uint8_t mac[PPA_ETH_ALEN]; /*!< MAC address of the Ethernet Interface ( provides storage buffer) */ uint32_t flags; /*!< reserved for future */ } PPA_CMD_IF_MAC_INFO; /*! \brief This is the data structure for LAN/WAN interface setting */ typedef struct { uint32_t num_ifinfos; /*!< number of interface in the list */ PPA_CMD_IFINFO ifinfo[PPA_MAX_IFS_NUM]; /*!< buffer for storing network interface list */ } PPA_CMD_IFINFOS; /*! \brief This is the data structure for Multicast group related ioctl */ typedef struct { uint8_t mac[PPA_ETH_ALEN]; /*!< mac address of the multicast group, reserved for future */ PPA_IFNAME lan_ifname[PPA_MAX_MC_IFS_NUM][PPA_IF_NAME_SIZE]; /*!< downstream interface list buffer */ PPA_IFNAME src_ifname[PPA_IF_NAME_SIZE]; /*!< source interface which receive multicast streaming packet */ uint32_t num_ifs; /*!< downstream interface number */ uint32_t bridging_flag; /*!< IGMP Proxy/snooping flag: 0 - routing mode/igmp proxy, 1 - bring mode/igmp snooping. */ uint32_t new_dscp_en; /*!< dscp editing flag: 1 -- need to edit, 0 --unmodify */ PPA_CMD_MC_ENTRY mc; /*!< multicast group information */ } PPA_CMD_MC_GROUP_INFO; /*! \brief This is the data structure for get all Multicast group via ioctl */ typedef struct { PPA_CMD_COUNT_INFO count_info; /*!< the multicast counter */ PPA_CMD_MC_GROUP_INFO mc_group_list[1]; /*!< Note, here is a dummy array, user need to malloc memory accordingly to the session number */ } PPA_CMD_MC_GROUPS_INFO; /*! \brief This is the data structure contains PPA session information. */ typedef struct { uint16_t ip_proto; /*!< IP portocol TCP,UDP. */ uint16_t ip_tos; /*!< IP ToS value */ PPA_IPADDR src_ip; /*!< source IP address */ uint16_t src_port; /*!< source port */ PPA_IPADDR dst_ip; /*!< destination IP address */ uint16_t dst_port; /*!< destination port */ PPA_IPADDR nat_ip; /*!< IP address to be replaced by NAT if NAT applies */ uint16_t nat_port; /*!< Port to be replaced by NAT if NAT applies */ uint32_t new_dscp; /*!< If DSCP remarking required */ uint16_t new_vci; /*!< new vci ( in fact, it is new inner vlan id )*/ uint32_t out_vlan_tag; /*!< Out VLAN tag */ uint16_t dslwan_qid; /*!< WAN qid */ uint16_t dest_ifid; /*!< Destination interface */ uint32_t flags; /*!< Internal flag : SESSION_IS_REPLY, SESSION_IS_TCP, \n SESSION_ADDED_IN_HW, SESSION_CAN_NOT_ACCEL \n SESSION_VALID_NAT_IP, SESSION_VALID_NAT_PORT, \n SESSION_VALID_VLAN_INS, SESSION_VALID_VLAN_RM, \n SESSION_VALID_OUT_VLAN_INS, SESSION_VALID_OUT_VLAN_RM, \n SESSION_VALID_PPPOE, SESSION_VALID_NEW_SRC_MAC, \n SESSION_VALID_MTU, SESSION_VALID_NEW_DSCP, \n SESSION_VALID_DSLWAN_QID, \n SESSION_TX_ITF_IPOA, SESSION_TX_ITF_PPPOA \n SESSION_LAN_ENTRY, SESSION_WAN_ENTRY, */ PPA_IFNAME rx_if_name[PPA_IF_NAME_SIZE]; /*!< receive interface name. Note, in struct session_list_item, rx_if and tx_if is a pointer, so here we have to make a workaround for it. */ PPA_IFNAME tx_if_name[PPA_IF_NAME_SIZE]; /*!< txansmit interface name. */ uint64_t mips_bytes; /*!< bytes processed by the mips */ uint64_t hw_bytes; /*!< bytes proccesed by hareware acceleration unit*/ uint64_t prev_sess_bytes; /*!< last bytes proccesed by hareware acceleration unit or */ uint32_t session; /*!< PPA SESSION pointer. Note, here we just use its address to delete a session for ioctl*/ uint32_t collision_flag; /*!< 1 mean the entry is in collsion table or none-hashed, like ASE/Danubel*/ uint32_t priority; /*!< skb->priority*/ } PPA_CMD_SESSION_ENTRY; /*! \brief This is the data structure contains PPA session extra information. */ typedef struct { uint32_t session; /*!< PPA SESSION pointer. Note, here we just use its address to modify a session for ioctl*/ PPA_SESSION_EXTRA session_extra; /*!< PPA SESSION extra pointer. */ uint32_t flags; /*!< Internal flag : PPA_F_SESSION_NEW_DSCP \n PPA_F_MTU, PPA_F_SESSION_OUT_VLAN, PPA_F_ACCEL_MODE ....\n */ uint32_t lan_wan_flags; /*!< Internal flag : the flag to matcn LAN only, or WAN only or both \n The possible value is SESSION_WAN_ENTRY, SESSION_LAN_ENTRY */ }PPA_CMD_SESSION_EXTRA_ENTRY; typedef struct { uint32_t session; /*!< PPA SESSION pointer. Note, here we just use its address to modify a session for ioctl*/ int32_t timer_in_sec; /*!< PPA SESSION polling timer in seconds. */ uint32_t flags; /*!< Reserved for future */ }PPA_CMD_SESSION_TIMER; /*! \brief This is the data structure for routing session information */ typedef struct { PPA_CMD_COUNT_INFO count_info; /*!< session count */ PPA_CMD_SESSION_ENTRY session_list[1]; /*!< Note, here is a dummy array, user need to malloc memory accordingly to the session number */ } PPA_CMD_SESSIONS_INFO; /*! \brief This is the data structure for routing detail session information */ typedef struct { uint16_t ip_proto; /*!< IP portocol TCP,UDP. */ PPA_IPADDR src_ip; /*!< source IP address */ uint16_t src_port; /*!< source port */ PPA_IPADDR dst_ip; /*!< destination IP address */ uint16_t dst_port; /*!< destination port */ PPA_IPADDR nat_ip; /*!< IP address to be replaced by NAT if NAT applies */ uint16_t nat_port; /*!< Port to be replaced by NAT if NAT applies */ uint32_t new_dscp; /*!< If DSCP remarking required */ uint16_t in_vci_vlanid; /*!< new vci ( in fact, it is new inner vlan id )*/ uint32_t out_vlan_tag; /*!< Out VLAN tag */ uint16_t qid; /*!< WAN qid */ uint32_t flags; /*!< Internal flag : SESSION_IS_REPLY, SESSION_IS_TCP, \n SESSION_ADDED_IN_HW, SESSION_CAN_NOT_ACCEL \n SESSION_VALID_NAT_IP, SESSION_VALID_NAT_PORT, \n SESSION_VALID_VLAN_INS, SESSION_VALID_VLAN_RM, \n SESSION_VALID_OUT_VLAN_INS, SESSION_VALID_OUT_VLAN_RM, \n SESSION_VALID_PPPOE, SESSION_VALID_NEW_SRC_MAC, \n SESSION_VALID_MTU, SESSION_VALID_NEW_DSCP, \n SESSION_VALID_DSLWAN_QID, \n SESSION_TX_ITF_IPOA, SESSION_TX_ITF_PPPOA \n SESSION_LAN_ENTRY, SESSION_WAN_ENTRY, */ uint32_t dest_ifid; /*!< txansmit interface name. */ uint8_t src_mac[PPA_ETH_ALEN]; /*!< src mac addres */ uint8_t dst_mac[PPA_ETH_ALEN]; /*!< dst mac address */ uint16_t pppoe_session_id; /*!< pppoe session id */ uint32_t mtu; /*!< mtu */ }PPA_CMD_SESSIONS_DETAIL_INFO; /*! \brief This is the data structure for basic ppa Versions */ typedef struct { uint32_t index; /*!< index for PP32 */ uint32_t family; /*!< ppa version hardware family */ uint32_t type; /*!< ppa version hardware type */ uint32_t itf;/*!< ppa version itf */ uint32_t mode; /*!< ppa version mode */ uint32_t major; /*!< ppa version major version number */ uint32_t mid; /*!< ppa version mid version number */ uint32_t minor; /*!< ppa version minor version number */ } PPA_VERSION; /*! \brief This is the data structure for ppa wan mode information */ typedef struct{ uint32_t wan_port_map; /*!< wan port map information*/ uint32_t mixed; /*!< mixed flag */ } PPA_WAN_INFO; /*! \brief This is the data structure for ppa supported feature list information */ typedef struct{ uint8_t ipv6_en; /*!< ipv6 enable/disable status */ uint8_t qos_en; /*!< qos enable/disable status */ } PPA_FEATURE_INFO; /*! \brief This is the data structure for PPA subsystem Versions, like ppa subsystem, ppe fw, ppe driver and so on */ typedef struct { PPA_VERSION ppa_api_ver; /*!< PPA API verion */ PPA_VERSION ppa_stack_al_ver; /*!< PPA stack verion */ PPA_VERSION ppe_hal_ver; /*!< PPA HAL verion */ PPA_VERSION ppe_fw_ver[2]; /*!< PPA FW verion */ PPA_VERSION ppa_subsys_ver; /*!< PPA Subsystem verion */ PPA_WAN_INFO ppa_wan_info; /*!< PPA WAN INFO */ PPA_FEATURE_INFO ppe_fw_feature; /*!< PPE FW feature lists */ PPA_FEATURE_INFO ppa_feature; /*!< PPA Level feature lists */ } PPA_CMD_VERSION_INFO; /*! \brief This is the data structure for basic vlan range */ typedef struct { uint32_t start_vlan_range; /*!< WAN interface start vlan id */ uint32_t end_vlan_range; /*!< WAN interface end vlan id */ }PPA_VLAN_RANGE; /*! \brief This is the data structure VLAN range in mixed mode */ typedef struct { PPA_CMD_COUNT_INFO count_info; /*!< PPA Count info */ PPA_VLAN_RANGE ranges[1]; /*!< it is dummy array, need to malloc in userspace */ } PPA_CMD_VLAN_RANGES; /*! \brief This is the data structure for MAC INFO */ typedef struct { PPA_CMD_COUNT_INFO count_info; /*!< PPA Count info */ PPA_CMD_MAC_ENTRY session_list[1]; /*!< it is a dummy array, need to malloc bedore use it in userspace */ } PPA_CMD_ALL_MAC_INFO; /*! \brief This is the data structure for BRIGE MAC LEARNING ENABLE/DISABLE INFO */ typedef struct { uint32_t bridge_enable; /*!< enable/disable bridging mac address learning flag */ uint32_t flags; /*!< reserved for future */ } PPA_CMD_BRIDGE_ENABLE_INFO; typedef struct { uint32_t t; /*!< Time Tick */ uint32_t w; /*!< weight */ uint32_t s; /*!< burst */ uint32_t r; /*!< Replenish */ uint32_t d; /*!< ppe internal variable */ uint32_t tick_cnt; /*!< ppe internal variable */ uint32_t b; /*!< ppe internal variable */ /*For PPA Level only */ uint32_t reg_addr; /*!< register address */ uint32_t bit_rate_kbps; /*!< rate shaping in kbps */ uint32_t weight_level; /*!< internal wfq weight */ }PPA_QOS_INTERVAL; typedef struct { //struct wtx_qos_q_desc_cfg uint32_t threshold; /*!< qos wtx threshold */ uint32_t length; /*!< qos wtx length */ uint32_t addr; /*!< qos wtx address */ uint32_t rd_ptr; /*!< qos wtx read pointer */ uint32_t wr_ptr; /*!< qos wtx write pointer */ /*For PPA Level only */ uint32_t reg_addr; /*!< register address */ }PPA_QOS_DESC_CFG_INTERNAL; /*! \brief This is the data structure for PPA QOS to get the maximum queue number supported for one physical port */ typedef struct { uint32_t portid; /*!< the phisical port id which support qos queue */ uint32_t queue_num; /*!< the maximum queue number is supported */ uint32_t flags; /*!< Reserved currently */ } PPA_CMD_QUEUE_NUM_INFO; /*! \brief This is the data structure for PPA QOS MIB Counter */ typedef struct { uint32_t total_rx_pkt; /*!< all packets received by this queue */ uint32_t total_rx_bytes; /*!< all bytes received by thi queue */ uint32_t total_tx_pkt; /*!< all packets trasmitted by this queue */ uint32_t total_tx_bytes; /*!< all bytes trasmitted by thi queue */ uint32_t cpu_path_small_pkt_drop_cnt; /*!< all small packets dropped in CPU path for lack of TX DMA descriptor in the queue*/ uint32_t cpu_path_total_pkt_drop_cnt; /*!< all packets dropped in CPU path for lack of TX DMA descriptor in the queue*/ uint32_t fast_path_small_pkt_drop_cnt; /*!< all small packets dropped in fast path for lack of TX DMA descriptor */ uint32_t fast_path_total_pkt_drop_cnt; /*!< all packets dropped in fast path for lack of TX DMA descriptor */ } PPA_QOS_MIB; /*! \brief This is the data structure for PPA QOS to get the maximum queue number supported for one physical port */ typedef struct { uint32_t portid; /*!< the phisical port id which support qos queue */ uint32_t queueid; /*!< the queue id for the mib */ PPA_QOS_MIB mib; /*!< the mib information for the current specified queue */ uint32_t flags; /*!< Reserved currently */ } PPA_CMD_QOS_MIB_INFO; /*! \brief This is the data structure for PPA QOS to be enabled/disabled */ typedef struct { uint32_t portid; /*!< which support qos queue. */ uint32_t enable; /*!< enable/disable flag */ uint32_t flags; /*!< Reserved currently */ } PPA_CMD_QOS_CTRL_INFO; /*! \brief This is the data structure for PPA Rate Shapping Set/Get/Reset one queue's rate limit */ typedef struct { uint32_t portid; /*!< the phisical port id which support qos queue */ uint32_t queueid; /*!< the queu id. Now it only support 0 ~ 7 */ uint32_t rate; /*!< rate limit in kbps */ uint32_t burst; /*!< rate limit in bytes. Note: it is PPE FW QOS internal value. Normally there is no need to set this value or just set to default value zero */ uint32_t flags; /*!< Reserved currently */ } PPA_CMD_RATE_INFO; /*! \brief This is the data structure for PPA WFQ Set/Get/Reset one queue's weight */ typedef struct { uint32_t portid; /*!< the phisical port id which support qos queue */ uint32_t queueid; /*!< the queu id. Now it only support 0 ~ 7 */ uint32_t weight; /*!< WFQ weight. The value is from 0 ~ 100 */ uint32_t flags; /*!< Reserved currently */ } PPA_CMD_WFQ_INFO; #if defined(CONFIG_IFX_PMCU) || defined(CONFIG_IFX_PMCU_MODULE) /*! \brief Union of ppa power transitin watermark. */ union watermark { uint32_t ppa_pwm_wm1; /*!< Watermark value for PPE transition between D0 and D1 */ uint32_t ppa_pwm_wm2; /*!< Watermark value for PPE transition between D1 and D2 */ uint32_t ppa_pwm_wm3; /*!< Watermark value for PPE transition between D2 and D3 */ }; /*! \brief This is the data structure definition for PPA PWM states water mark */ typedef struct { int16_t flag; /*!< flag indicating if watermark type. flag=1: watermark is packet count; flag=2: watermark is byte count */ int32_t time_interval; /*!< time interval of watermarks in milliseconds. */ union watermark WM; /*!< Watermark value for PPE transition */ }WM_t; /*! \brief This is the data structure for PPA Power management basic watermark configuration */ typedef struct { WM_t ppa_pwm_wm1; /*!< Watermark value for PPE transition between D0 and D1 */ WM_t ppa_pwm_wm2; /*!< Watermark value for PPE transition between D1 and D2*/ WM_t ppa_pwm_wm3; /*!< Watermark value for PPE transition between D2 and D3*/ }PPA_PWM_WM_t; /*! \brief This is the data structure for PPA Power management configuration */ typedef struct { uint8_t ppa_pwm; /*!< PPA power management mode: 0/1-OFF/ON */ PPA_PWM_WM_t ppa_pwm_wm_up; /*!< Watermark value for PPE transition for various states. */ PPA_PWM_WM_t ppa_pwm_wm_down; /*!< Watermark value for PPE transition for various states. */ PPA_PWM_STATE_t e_ppa_pwm_init_state; /*!< Initial power/performance state for PPE */ uint32_t flag; /*!< reserved.*/ }PPA_PWM_CONFIG_t; #endif //end of CONFIG_IFX_PMCU /*! \brief This is the data structure for Mutiple Field Based Classification And VLAN Assigment feature's basic auto-learning VLAN related information. */ typedef struct { PPA_IFNAME tx_ifname[PPA_IF_NAME_SIZE]; /*!< destination interface name, like eth0.3. If blank, then match all interface */ PPA_IFNAME rx_ifname[PPA_IF_NAME_SIZE]; /*!< receiving interface name, like eth1.2, If blank, then match all interface */ }PPA_MULTIFIELD_VLAN_INFO_AUTO; /*! \brief This is the data structure for Mutiple Field Based Classification And VLAN Assigment's manual-learning VLAN information based on default key selection. */ typedef struct { uint8_t tx_if_id; /*!< physical destination interface id match, like 0 for eth0, 1 for eth1. It is part of key 14 */ uint8_t rx_if_id; /*!< physical destination interface id match, like 0 for eth0, 1 for eth1. It is part of key 15 */ uint8_t is_vlan; /*!< VLAN Flag match. 1: only match single vlan, 2: match double vlan, 0: match no vlan packet. It is part of key14 */ uint8_t is_vlan_mask; /*!< VLAN Flag mask*/ uint8_t out_vlan_pri; /*!< outer vlan priority ( 3 bits only) match. Based on PPA default Key Selection, it is part of key 8/l2_off14 */ uint8_t out_vlan_pri_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t out_vlan_cfi; /*!< outer vlan cfi ( 1 bits only) match. Based on PPA default Key Selection, it is part of key 8/l2_off14 */ uint8_t out_vlan_cfi_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint16_t out_vlan_vid; /*!< outer vlan id ( 1 bits only) match. Based on PPA default Key Selection, it is part of key 8 and 9/l2_off14-15 */ uint16_t out_vlan_vid_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t in_vlan_pri; /*!< inner vlan priority ( 3 bits only) match. Based on PPA default Key Selection, it is part of key 12/l2_off18 */ uint8_t in_vlan_pri_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t in_vlan_cfi; /*!< inner vlan cfi ( 1 bits only) match. Based on PPA default Key Selection, it is part of key 12/l2_off18 */ uint8_t in_vlan_cfi_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint16_t in_vlan_vid; /*!< inner vlan id ( 1 bits only) match. Based on PPA default Key Selection, it is part of key 12 and 13/l2_off18-19 */ uint16_t in_vlan_vid_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t action_out_vlan_insert; /*!< out vlan insert action */ uint8_t action_in_vlan_insert; /*!< inner vlan insert action */ uint8_t action_out_vlan_remove; /*!< out vlan remove action */ uint8_t action_in_vlan_remove; /*!< inner vlan remove action */ uint8_t new_out_vlan_pri; /*!< action: new out vlan priority */ uint8_t new_out_vlan_cfi; /*!< action:new out vlan cfi */ uint8_t new_in_vlan_pri; /*!< action:new inner vlan priority */ uint8_t new_in_vlan_cfi; /*!< action:new inner vlan cfi */ uint16_t new_out_vlan_vid; /*!< action:new out vlan id */ uint16_t new_in_vlan_vid; /*!< action:new inner vlan id */ uint16_t new_out_vlan_tpid; /*!< action:new out vlan tpid */ }PPA_MULTIFIELD_VLAN_INFO_MANUAL; /*! \brief This is the data structure for Mutiple Field Based Classification And VLAN Assigment's VLAN KEY/MASK/ACTION based on default key selection. */ typedef struct { uint8_t bfauto; /*!< flag to use simple autoway to add a multiple field editing flow. It is used by PPA API level and hook/ppacmd only*/ PPA_MULTIFIELD_VLAN_INFO_AUTO vlan_info_auto; /*!< auto-learn vlan key/mask/action. Note, it is only for add/delete a rule, not for get commands */ PPA_MULTIFIELD_VLAN_INFO_MANUAL vlan_info_manual; /*!< munually provide vlan key/mask/action. Even vlan_info_auto is used, ppa will set vlan_info_manual structure for PPE driver */ }PPA_MULTIFIELD_VLAN_INFO; /*! \brief This is the data structure for Mutiple Field Based Classification And VLAN Assigment's configuration based on default key selection. */ typedef struct { uint16_t ether_type; /*!< ethernet type match, like 0x0800. Based on PPA default Key Selection, it is key0_1*/ uint16_t ether_type_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t dscp; /*!< dscp(tos) match. 1: key of dscp in ip header, like 0x08. Based on PPA default Key Selection, it is key2*/ uint8_t dscp_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t pkt_length; /*!< packet length ( less than) match. Its value is got from ethernet packet length /64. Based on PPA default Key Selection, it is key3*/ uint8_t pkt_length_mask; /*!< packet length mask.*/ uint32_t s_ip; /*!< source ip match, like 0x0a000009 ( 10.0.0.9) . Based on PPA default Key Selection, it is key4 ~ Key7*/ uint32_t s_ip_mask; /*!< match mask to specify the bits to match. Note, 0 means need to match and 1 means not to match*/ uint8_t l3_off0; /*!< L3 Offset 0 match. Baed on PPA default key selection, it is key10 */ uint8_t l3_off0_mask; /*!< L3 Offset 0 mask */ uint8_t l3_off1; /*!< L3 Offset 1 match. Baed on PPA default key selection, it is key11 */ uint8_t l3_off1_mask; /*!< L3 Offset 1 mask */ uint8_t ipv4; /*!< ipv4 match ( 1 bit). 1: match only ipv4. 0: match none ipv4 packet. It is part of key15. */ uint8_t ipv4_mask; /*!< ipv4 mask. 0 -need to match, 1-no need to match */ uint8_t ipv6; /*!< < ipv6 match ( 1 bit). 1: match only ipv6. 0: match none ipv6 packet. 1: match only ipv6, 0: match none ipv6 packet. It is part of key15 */ uint8_t ipv6_mask; /*!< ipv6 mask. 0 -need to match, 1-no need to match */ uint8_t pppoe_session; /*!< pppoe session flag match: 1: match pppoe session only. 0-- match none pppoe session packet. It is part of key14 */ uint8_t pppoe_session_mask; /*!< pppoe session flag mask. 0 -need to match, 1-no need to match */ uint8_t fwd_cpu; /*!< action: forward packet to CPU or not. \n 1: forward to CPU. 0: forward to its original destination port\n */ uint8_t queue_id; /*!< action: which queue assign for the current flow. */ PPA_MULTIFIELD_VLAN_INFO vlan_info; /*!< specify vlan key/mask/action. Based on PPA default Key Selection. It relates to key8/key9, key 12/key13 and key14/key15 and part of vlan action*/ } PPA_MULTIFIELD_DEFAULT_INFO; /*! \brief This is the data structure for Mutiple Field Based Classification And VLAN Assigment's configuration based on second default key selection. \note, for future only now */ typedef struct { }PPA_MULTIFIELD_DEFAULT2_INFO; /*! \brief This is the data structure for Mutiple Field Based Classification And VLAN Assigment's configuration based on different key selection. \note More key selection based configuration will be implemented. Note, different key selectoin may have different configuration. \n PPA should parse the cfg according to current key selection mode */ typedef union { PPA_MULTIFIELD_DEFAULT_INFO cfg0; /*!< multiple field configuration based on default key selection. */ PPA_MULTIFIELD_DEFAULT2_INFO cfg2; /*!< multiple field configuration based on second default key selection. */ }PPA_MULTIFIELD_FLOW_INFO; /*! \brief This is the data structure for IOCTL of Mutiple Field Based Classification And VLAN Assigment's configuration. */ typedef struct { int32_t index; /*!< for get command, it is input, for add command, it is input. for del, it is input ( index must be valid in this case, -1 means delete all flow ) */ int32_t last_index; /*!< for get command. It will be used in ppacmd.c only */ uint32_t flag; /*!< Most time, it is input only. But for PPA_CMD_GET_MULTIFIELD_STATUS, it is input/ouput */ PPA_MULTIFIELD_FLOW_INFO flow; /*!< the Mutiple Field Based Classification And VLAN Assigment configuration/information */ } PPA_CMD_MULTIFIELD_FLOW_INFO ; /*! \brief This is the data structure for IOCTL to enable/disable Mutiple Field Based Classification And VLAN Assigment. */ typedef struct PPA_CMD_ENABLE_MULTIFIELD_INFO { uint32_t enable_multifield; /*!< flag of enable/disable the Mutiple Field Based Classification And VLAN Assigment feature */ uint32_t flag; /*!< reserved for future */ } PPA_CMD_ENABLE_MULTIFIELD_INFO; /*! \brief This is the data structure for getting all exported PPA hooks. */ typedef struct { uint8_t hookname[MAX_HOOK_NAME_LEN]; /*!< hook name */ uint32_t hook_addr; /*!< hook address */ uint32_t real_func; /*!< hook pointer to real function*/ uint8_t hook_flag; /*!< hooked flag: 0-disabled, 1-enabled */ }PPA_HOOK_INFO; /*! \brief This is the data structure for PPA hooks list */ typedef struct PPA_HOOK_INFO_LIST { PPA_HOOK_INFO info; /*!< ppa hook info */ struct PPA_HOOK_INFO_LIST *next; /*!< point to next ppa hook info */ } PPA_HOOK_INFO_LIST; /*! \brief This is the data structure for getting all exported PPA hooks. */ typedef struct { uint32_t hook_count; /*!< hook counter */ uint32_t flag; /*!< reserved for future */ PPA_HOOK_INFO list[1]; /*!< it is a dummy array. Userspace should apply storage buffer for it. */ }PPA_CMD_HOOK_LIST_INFO; /*! \brief This is the data structure for enable/disable ppa hook */ typedef struct { uint8_t hookname[MAX_HOOK_NAME_LEN]; /*!< hook name */ uint32_t enable; /*!< enable/disable ppa hook */ uint32_t flag; /*!< reserved for future */ }PPA_HOOK_ENABLE_INFO; /*! \brief This is the data structure for IOCTL to enable/disable ppa hook */ typedef PPA_HOOK_ENABLE_INFO PPA_CMD_HOOK_ENABLE_INFO; /*! \brief This is the data structure to get the memory value. */ typedef struct { uint32_t addr; /*!< The memory adddress to read */ uint32_t addr_mapped; /*!< The mapped memory adddress to read */ uint32_t shift; /*!< the bits to shitf */ uint32_t size; /*!< size of bits to read*/ uint32_t repeat; /*!< read repeat times */ uint32_t flag; /*!< reserved for future */ uint32_t buffer[1]; /*!< the buffer to store the value. it is a dummy array. Userspace should apply storage buffer for it. Its size should be at least size * sizeof (uint32_t) */ }PPA_READ_MEM_INFO; #ifdef NO_DOXY typedef PPA_READ_MEM_INFO PPA_CMD_READ_MEM_INFO; /*! \brief This is the data structure to set the memory value. */ typedef struct { uint32_t addr; /*!< The memory adddress to set */ uint32_t addr_mapped; /*!< The mapped memory adddress to read */ uint32_t shift; /*!< the bits to shitf */ uint32_t size; /*!< size of bits */ uint32_t value; /*!< value of the data*/ uint32_t repeat; /*!< set repeat times*/ uint32_t flag; /*!< reserved for future */ }PPA_SET_MEM_INFO; /*! \brief This is the data structure to set the memory value for IOCTL. */ typedef PPA_SET_MEM_INFO PPA_CMD_SET_MEM_INFO; #endif /*! \brief This is the data structure to get the maximum entries, like lan/wan/mc/bridging */ typedef struct { uint32_t max_lan_entries; /*!< Maximum LAN session entries */ uint32_t max_wan_entries; /*!< Maximum WAN session entries */ uint32_t max_lan_collision_entries; /*!< Maximum LAN session entries */ uint32_t max_wan_collision_entries; /*!< Maximum WAN session entries */ uint32_t max_mc_entries; /*!< Maximum Multicast session entries */ uint32_t max_bridging_entries;/*!< Maximum Bridge session entries */ uint32_t max_ipv6_addr_entries; /*!< Maximum IPV6 address entries */ uint32_t max_fw_queue; /*!< Maximum PPE FW queue number */ uint32_t max_6rd_entries; /*! #endif /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ /* * returns ret: * ret == 0: setup qos queues successful * ret < 0: setup qos queue failure */ extern int (*vcc_set_nr_qos_queues)(struct atm_vcc *, unsigned int); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ /* * returns ret: * ret == 0: success * ret != 0: failure */ extern int (*vcc_map_skb_prio_qos_queue)(struct atm_vcc *, unsigned int, unsigned int); #endif // __IFX_PPA_API_H__20081031_1913__