/**************************************************************************************** * * * Copyright (C) 2010 Ikanos Communications Inc. All rights reserved * * * * The information and source code contained herein is the exclusive property * * of Ikanos Communications and may not be disclosed, examined or reproduced in whole * * or in part without the explicit written authorization from Ikanos Communications. * * * ****************************************************************************************/ /**************************************************************************************** * * * File name : apflow_vx185.h * * Author : Ikanos Communications [ jpattar@ikanos.com ] * * Version : * * Date : 08th June 2010 * * Description : This file contains the route flowentry structure. This include * * fields to be compared with received packet and the fields which * * are used to modify the packet. * * * ****************************************************************************************/ /*_____________________________________Header Gaurd_____________________________________*/ #ifndef _APROUTEFLOWENTRY_H_ #define _APROUTEFLOWENTRY_H_ #include /*_________________________________________MACRO________________________________________*/ #define AP_MAX_FLOW_EGRESS 4 #ifndef AP_MAC_ADDR_LEN #define AP_MAC_ADDR_LEN 6 #endif /*_______________________________________Includes_______________________________________*/ /*_______________________________________Structures_____________________________________*/ /**************************************************************************************** * Structure Name: apCompare_s * * Description : The following structures are used to compare received packet with * * flow entry. * * * ****************************************************************************************/ typedef struct apCompare_s { unsigned int srcIP; unsigned int dstIP; union fields_s { struct ports_s { unsigned short srcPort; unsigned short dstPort; }ports; unsigned int SPI; unsigned int Flowlabel; unsigned int callID; unsigned char inMAC[AP_MAC_ADDR_LEN]; }fields; unsigned char protocol; unsigned short inSessionID; }apCompare_t; /**************************************************************************************** * Structure Name: apModify_s * * Description : The following structures are used to modify received packet with * * information available in these structure. * * * ****************************************************************************************/ typedef struct apModify_s { unsigned char dstMAC[AP_MAC_ADDR_LEN]; unsigned char srcMAC[AP_MAC_ADDR_LEN]; unsigned short etherType; unsigned short vlanID; unsigned short sessionID; unsigned int natIP; unsigned short natPort; unsigned int SPI; //dekumar: IPSec passthru unsigned char tosValue; }apModify_t; #if defined(WLAN_ETH_8023) && (WLAN_ETH_8023) /**************************************************************************************** * Structure Name: apWLANheader_t * * Description : The following structure is used to construct WLAN Header in AP * * * ****************************************************************************************/ typedef struct apWLANheader_s { unsigned char bssId[AP_MAC_ADDR_LEN]; unsigned char wlanFlags; #define AP_DO_WLAN_WEP_HDR_BIT 0x01 #define AP_DO_WLAN_QOS_HDR_BIT 0x02 #define AP_DO_WLAN_HDR_BIT 0x03 unsigned char secHdrLen; // security header space in the pkt }apWLANheader_t; #endif /*___________________________________Main Structure_____________________________________*/ /**************************************************************************************** * Structure Name: apFlowEntry_s * * Description : The following apFlowEntry_s structure contains what fields to be * * compared with received packet and the fields which are used to * * modify the packet. * * * ****************************************************************************************/ typedef struct apFlowEntry_s { struct apFlowEntry_s *pNextEntry; apEgressPort_t egressList[AP_MAX_FLOW_EGRESS]; //[AP_MAX_FLOW_EGRESS]; unsigned short operations; #define AP_ROUTE_VALID_BIT 0 /* Table entry is valid */ #define AP_DO_ETH_HDR_BIT 1 /* Final packet needs ethernet header */ #define AP_DO_SRC_NAT_BIT 2 /* Do source IP addr/port NAT */ #define AP_DO_DST_NAT_BIT 3 /* Do destination IP addr/port NAT */ #define AP_CHECK_PPPOE_BIT 4 /* Incoming packet must be PPPoE */ #define AP_ADD_PPPOE_HDR_BIT 5 /* Add PPPoE header to outgoing pkts */ #define AP_ADD_VLAN_HDR_BIT 6 /* Add VLAN header to outgoing ptks */ #define AP_CHANGE_TOS 7 /* Replace the IP ToS value */ #define AP_IPV4_TO_IPV6_TUNNEL_BIT 8 /* Tunnelling V4 -> V6 */ #define AP_IPV4_TO_IPV6_TRANSLATION_BIT 9 /* Translation V4 -> V6 */ #if defined(WLAN_ETH_8023) && (WLAN_ETH_8023) #define AP_ADD_WLAN_HDR_BIT 10 #endif #define AP_IPV6_TUNNEL_TO_IPV4_BIT 11 /* Tunnelling V4 -> V6 - decapsulation*/ #define AP_MULTICAST_ROUTE_BIT 12 /* = 1 if packet is routed multicast * = 0 if packet is unicast */ #define AP_CPY_APPREHDR_BIT 13 /* apPreHdr cpy to sdram by postClassifier */ #if defined(VENDOR_TAG) && (VENDOR_TAG) #define AP_VENDOR_RXTAG_PROCESS_BIT 14 /* compare and strip vendor tag of Rx pkts*/ #define AP_VENDOR_TXTAG_PROCESS_BIT 15 /* insert vendor tag to Tx pkts */ #endif #ifdef CONFIG_L2TP_AP_SUPPORT #define AP_DO_L2TP_ENCAP_EXT_BIT 0 #define AP_DO_L2TP_DECAP_EXT_BIT 1 unsigned short operationsExtended; #else unsigned short reserved; #endif unsigned short ops[OPTBL_MAX_OPERATIONS];//Contains PIO addr #if defined(MESH_NETWORK) && (MESH_NETWORK) void *expIface; //holds virtual/physical interface dev #endif #define APFLOWENTRY_INFOFLAG_USEDBIT 0 #define APFLOWENTRY_IPSEC_FUNC_BIT 1 // The packet should go via IPSec functionality #define APFLOWENTRY_IPSEC_HASH_BIT 2 // Hash should be calculated based on Src IP, Dst IP and SPI unsigned short infoFlag; unsigned short descAddr; unsigned int userHandle; apCompare_t apCompare; apModify_t apModify; //apPPPheader_t PPPheader; #if defined(WLAN_ETH_8023) && (WLAN_ETH_8023) apWLANheader_t WLANheader; #endif //apVendorTag_t vendorTag; } apFlowEntry_t; #ifdef AP_ASSEMBLER #define RT_PADDING_TILL_CLINE (CACHE_LINE_SIZE - (sizeof typedef apFlowEntry_t & (CACHE_LINE_SIZE - 1))) #else #define RT_PADDING_TILL_CLINE (CACHE_LINE_SIZE - (sizeof(apFlowEntry_t) & (CACHE_LINE_SIZE - 1))) #endif typedef struct apFlowEntry_s_chaligned { apFlowEntry_t apFlowEntryMain; unsigned char reserved[RT_PADDING_TILL_CLINE]; } apFlowEntry_t_chaligned; #ifdef AP_ASSEMBLER assert (sizeof typedef apFlowEntry_t_chaligned & (CACHE_LINE_SIZE - 1)), 0 #else // will do it later //assert (0 == (sizeof(apFlowEntry_t_chaligned) & (CACHE_LINE_SIZE - 1))); #endif void ap2apRouteFlowDelete(void *); #ifdef _LINUX_NETDEVICE_H int ap2apMcastRtUpdWlanIfs (struct net_device* dev,struct net_device** wlanDevArray); #endif /*_____________________________________Header Gaurd_____________________________________*/ #endif //_APROUTEFLOWENTRY_H_ end of header guard. #if 0 /*______________________________Structure Member Info___________________________________*/ structure: apFlowEntry_t MEMBER USED FOR _________________________________________________________________________________ pNext Next node of the flowentry linked list. This happens when two or more flow entry have same has vlaues. egressList This will contain information which all interface to send the classifed packet. It also contains VLAN information, MTU size etc. infoFlag This field is used to provide information form host to AP and also from AP to host. BITS USED FOR Usedbit Set by AP when FT entry used for packet flow. Cleared by host when entry time out happens. If its already cleared, then entry will be deleted. flowEntryType Gives what type of flow entry it is. This field will be compared with hash type of parser tag. actionFlag This flags information AP what to do with packet. For example, add/remove vlan, add/remove pppoe header etc. descAddr The descriptor location. Descriptors will be stored in an array of buffers at fixed point. userHandle Connects back to some of host information. Like, RFT entry to connect back to connection tracking entry. apCompare_s This structure will contain all required fields to compare with incoming packet’s fields. Once all the fields are matched then the flowentry will be used for modifying the packet. apModify_s This structure will contains the fields which are used in modifing the packet. PPPoEheader_s PPPoE header structure. Used while inserting PPPoE header. WLANheader_s Wireless LAN header information. vendorTag_s Vendor tag information. structure: apapModify_s MEMBER USED FOR _________________________________________________________________________________ srcMAC Source mac address dstMAC Destination mac address vlanID Vlan tag value 1. without CoS field. etherType Type of the packet. Used when new header is inserted. sessionID Session ID used in case of PPP packet. srcIP Source/destination IP address. srcPort Source/destination port number, used in case of NAT. tosValue ToS value in case of remarking. structure: apapCompare_s MEMBER USED FOR _________________________________________________________________________________ srcIP Source IP address, able to accommodate both IPv4 and IPv6 adresses. dstIP Destination IP address, able to accommodate both IPv4 and IPv6 adresses. Protocol Protocol type. srcPort Source port address dstPort Destination IP address flowLabel Flow label in IPv6 packet. SPI SPI value in case of AH/ESP header. #endif //End of structure member info