/* ===================================================================== * Copyright (C) 2006 Ikanos Communications * See IKANOS_PROP_LICENSE.txt for license information. * ===================================================================== */ /* =========================================================================== * File name : $RCSfile: apprehdr_vx185.h,v $ * Description : This describes the pre-header that exists at the start * of each data buffer. * =========================================================================== */ #ifndef _APPREHDR_185_H_ #define _APPREHDR_185_H_ #include "../apegressport.h" /* The most important part of the AP data path is the format of the * pre-header at the start of each buffer. * * This pre-header contains the information needed by each component of * the data path (AP and host CPU) to forward the packet towards its * ultimate destination. * * An AP buffer has the following general format * * * +--------+-------------+-------+-------+-----------------+-----------+ * + PreHdr | XXXX | L2Hdr | L3Hdr | Payload | YYYY | * +--------+-------------+-------+-------+-----------------+-----------+ * * PreHdr Pre-header * XXXX Unused space. Used when prepending information to the * packet. This is common when encapsulating for ATM * L2Hdr Header for layer 2 protocol (ie. ethernet) * L3Hdr Header for layer 3 protocol (ie. IP) * Payload The remainder of the packet * YYYY Unused space. USed when appending data to the packet. * Normally only done during security processing * * This include file specifies the format of the pre-header (at the start * of the packet), and the minimum sizes for the XXXX and YYYY unused * spaces when a packet first enters the datapath. * * This pre-header should be limited to a maximum of 64 bytes (burst16 * transfer) to avoid accesses needing more that a single AHB burst. * * Note that this "C" structure can be used directly by AP assembler * programs. See the AP assembler manual for details of structure use. * * In general the fields of the pre-header are filled in by the ingress * port (or main CPU). One exception to this is ATM Rx where the * buffer management AP fills in most of the fields after flow classification */ /* Constants that establish the length of "free" areas surrounding the * data in the packet */ #define AP_PRE_LEAD_UNUSED_LEN PARSER_HOLE1 // Initial minimum len of XXXX #define AP_PRE_TRAIL_UNUSED_LEN 128 // Initial minumum len of YYYY /************************************* * pFlowID bit fields for Ethernet AP * Bit 0 - 2 Priority * Bit 3 - 14 VLAN ID for Multicast packets * Bit 15 Tag/no-Tag for Multicast Vlan packets * Bit 16 - 18 pktQosPriority * Bit 19 - 29 MTU size * Bit 30 - reserved * Bit 31 - used for as AP_MCAST_SMAC_MOD_FLOWID_BIT * * pFlowID bit fields for ATM AP * Bit 0 - 4 Atm encapsulations types defined in atmhost.h * Bit 5 - 14 PVC connection Identifier ( received from ATM AP * while configuring VCC ) * Bit 14- 16 Priority * Bit 17- 28 VLAN ID for Multicast packets * Bit 29 Tag/no-Tag for Multicast Vlan packets * Bit 30 reserved * Bit 31 1 if SMAC has to change with AP Mac *************************************/ /* The structure that represents the header. The data in this structure * is in big-endian format, all addresses are AHB BUS addresses. */ typedef struct apPreHeader_s { /* Next buffer in a linked list. */ struct apPreHeader_s *pNext; /* The following items contain flags that describe the packet and * the information in this structure that is valid * * Note that the flags are split across multiple 16 bit items to * simplify handling by the AP code. */ unsigned short flags1; #define AP_FLAG1_IS_ETH_BIT 0 // Packet has ethernet header #define AP_FLAG1_IS_802_BIT 1 // Packet has 802.3 ethernet header #define AP_FLAG1_IS_VLAN_BIT 2 // Packet has VLAN header #define AP_FLAG1_IS_IP_BIT 3 // Packet has IP header // #define AP_FLAG1_IP_VER_4_BIT 8 // Packet is IPv4 #define AP_FLAG1_IS_PPPOE_BIT 8 // Packet is PPPoE #define AP_FLAG1_IP_VER_6_BIT 9 // Packet is IPv6 #define AP_FLAG1_TTL_ZERO_BIT 4 // Packet has zero TTL #define AP_FLAG1_IP_FRAG_BIT 10 // Packet is IP fragment #if defined(POLICY_BASED_VLAN) && (POLICY_BASED_VLAN) /* AP_FLAG1_IP_CSUM_BIT is not used in the code , so this bit is used to check for DHCP packets in bridge mode */ #define AP_FLAG1_BRIDGE_DHCP_PACKET_BIT 11 #endif //#define AP_FLAG1_IP_CSUM_BIT 11 // Packet has bad IP checksum #define AP_DECAPSULATED_PACKET_BIT 12 // Packet is decapsulated #define AP_FLAG1_IS_POLICY_VLAN_BIT 13 // packet is policy vlan classified #define AP_FLAG1_IS_TCP_UDP_BIT 5 // Packet is TCP/UDP #define AP_FLAG1_IS_IPSEC_BIT 6 // Packet has IPSec #define AP_FLAG1_IS_IPSEC_DECRYPTED_BIT 7 // Packet has been decrypted by Sec AP #define AP_FLAG1_BRIDGE_ROUTE_BIT 14 // Enable in case of bridge + routing #define AP_FLAG1_CLASSIFIED_BIT 15 // Packet has been classified into a // flow unsigned short flags2; #define AP_FLAG2_SRC_MAC_BIT 0 // Packet source MAC addr matched table #define AP_FLAG2_DST_MAC_BIT 1 // Packet destination MAC matched table #define AP_FLAG2_SRC_MOD_BIT 2 // Packet source addr/port modified #define AP_FLAG2_DST_MOD_BIT 3 // Packet destination addr/port modified //RVRV+ #define AP_FLAG2_BRIDGE_PKT_BIT 4 // Packet has been processed thru bridge #define AP_MULTICAST_PKT_BIT 5 // Packet is Multicast // Multicast routing #define AP_MCAST_SMAC_MOD_BIT 6 /* Modify Src mac of the packet (used in case of multicast routing) */ // This bit is a sign that outgoing packet is PPPoE // It's needed in case of PPPoE packet fragmentation #define AP_EGGRESS_PPPOE_BIT 7 // Outgoing packet is PPPoE #define AP_FLAG2_BAD_HOP_LIMIT_BIT 8 // Ipv6 packet: Hop limit is 1 (error) #define AP_FLAG2_ZERO_FLOW_LABEL_BIT 9 // Ipv6 packet: Flow Label is 0 (error) #if defined(VENDOR_TAG) && (VENDOR_TAG) #define AP_VENDOR_TXTAG_BIT 11 // the packet need to be tagged with vendor tag #define AP_VENDOR_RXTAG_BIT 12 // the packet has vendor tag #endif #if defined(PORT_MONITORING) && (PORT_MONITORING) #define AP_CLASSIFY_AFTER_TX_BIT 10 //classify pkt after transmission #endif #define VDSL_INCOMING_CHANNEL_RX_BIT 10 //indicate which VDSL channel it comes from.JXUJXU-Dec15,2011 #define AP_HOST_INDICATION_BIT 13 // Meaning for Host: Value 1 - Host wanted an indication // if packet has been transmitted SUCCESSFULLY or NOT. // If EgressList contained Host as end point, // the packet will be returned UNDISTURBED; // otherwise it isn't guarantee. #define AP_TX_STATUS_BIT 14 // Meaning for Host: This bit has a meaning if // AP_HOST_INDICATION_BIT has been set before transmit. // Value 0 is for SUCCESS; // Value 1 is for FAILURE due some error. // It can be because of wrong flowId, // wrong egressPort ( when egress list didn't // contain an apId of AP packet should be transmitted // from) or due txQ full situation. #define AP_TX_DONE_BIT 15 // Meaning for Host: packet returned to Host after // a transmition out by AP. AP will set this bit in case // if 1-st eggress inside of entry ISN'T Host; // Host SHOULD set this bit if it is filling egress list // with last element as Host, so AP(s) after transmition // will return a packet to Host thru IPC queue. #define HOST_PKT_PROCESSED_BIT AP_TX_DONE_BIT /* This entry is the "hash" value determined for the packet by the * ingress AP. The maximum hash length is 16 bits, but it may be shorter * to reduce the size of the hash table. */ unsigned short hash; /* Each chain is buffers represents a single packet, possibly split into * multiple clusters. * * For each cluster the following two offsets delimit the start and end of * valid data. */ unsigned short start; // Offset of first valid byte unsigned short end; // Offset of last valid byte + 1 /* The ingress AP knows how many bytes of data are contained within the L2 * header of the packet and records them here. * * Note that this value is only valid for the first cluster in a packet. * * It will be zero for packets that do not have a L2 header. */ unsigned short l2HeaderLen; /* The total packet length (bytes) is filled in by the ingess AP. * * Note that this value is only valid for the first cluster in a packet. */ unsigned short totalLength; /************************************************************* * * ATTENTION !!! Here is a hole of 2 bytes. * This space can be used later for any USEFUL info. * *************************************************************/ #ifdef CONFIG_L2TP_AP_SUPPORT #define AP_FLAG3_L2TP_DECAP_BIT 0 //this bit indicates that AP has decapsulated the packet unsigned short flags3; //bits in flags1 and flags2 are used, utilizing hole of 2 bytes for L2TP #endif /* The rxPortId is an identifier that identifies which "port" a packet was * received on. Some APs may suppory multiple logical ports (ie ATM * connections) so this is the pPortAddr port identifier * (ie. the physical space address of the input queue) plus some * connection identifier that has a small integer range. */ void *pRxPortId; /* The final part of this packet specifies the egress AP(s) for the * packet. * * To facilitate "flooding" with minimum copying requirements the * preheader allows a series of egress ports to be specified. * * When a egress port has sent the packet it then checks the list to find * the "next" egress port. If the next egress port has an address of zero, * or the number of entries in the list has been exceeded then the packet * should be deleted. * * Note that, in general, the egress AP should not modify the packet. One * obvious exception is that the Security AP is expected to modify the * data in the packet. */ #define AP_MAX_EGRESS_PORTS 4 apEgressPort_t egressList[AP_MAX_EGRESS_PORTS]; /* This element may contain specific information which can be used by AP or Host * according to "understanding" of this information. For example, if a packet * came from ATM AP this element will be "ATM encapsulation type" */ #define CONTROL_PKT_TYPE_BIT 15 #define TCP_ACK_PKT_TYPE_BIT 14 #define XFRM_PKT_TO_SECAP 13 // used by IPSec for indicating that packet // has to be forwarded to Security AP unsigned short specInfoElement; /* Incoming VLAN Id. It will be filled in case of VLAN traffic. * It's a valid info in case if AP_FLAG1_IS_VLAN_BIT is set in flags1 * element of apPreHeader. * It contains incoming VLAN Id and CoS information: * bits 15-13 - User priority * bit 12 - CFI (Canonical Format Indicator) * bits 11- 0 - VID (Vlan Identifier) */ unsigned short ingressVLAN; #define NO_MATCHED_ENTRY_FOUND 0 unsigned int matchedEntryAddr; #if defined(MESH_NETWORK) && (MESH_NETWORK) void *expIface; //holds virtual/physical interface dev #endif } apPreHeader_t; #if defined(CONFIG_IPSEC_AP_SUPPORT) && (CONFIG_IPSEC_AP_SUPPORT) typedef struct apIPSecInfo_s { apPreHeader_t apprehdr; void *ipsecSA; } apIPSecInfo_t; #endif #endif /* _APPREHDR_H_ */