#ifndef IP1811DS_H
|
#define IP1811DS_H
|
|
#include "ip1811.h"
|
#include "include/list.h"
|
|
/*typedef unsigned char u8;
|
typedef unsigned short u16;
|
typedef unsigned long u32;*/
|
|
struct GeneralSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int gdata;
|
};
|
|
struct PortMemberSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long member;
|
};
|
|
struct ByPortSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int port;
|
int pdata;
|
};
|
|
struct ByPortSetting32
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int port;
|
unsigned long pdata;
|
};
|
|
struct AllPortsSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int apdata[MAX_PHY_NUM];
|
};
|
|
struct PortmapSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long portmap;
|
int pmdata;
|
};
|
|
struct PortMaskSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long portmap;
|
int mask;
|
};
|
|
/*--------------- Special Data Structures for PTP ---------------*/
|
struct PTPReadSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned char addr; //0-15
|
char in_out; //1:egress, 0:ingress
|
int port; //1-12
|
unsigned long long second;
|
unsigned long nanosecond;
|
};
|
|
struct PTPPortTSSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long portmap;
|
char in_out; //1:egress, 0:ingress
|
char pmdata; //set:OP_FUNC_ENABLE/DISABLE
|
//get:always enable
|
};
|
|
struct PTPTimeSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long long second;
|
unsigned long nanosecond;
|
};
|
|
struct PTPFrequencySetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
char type; //1:add 0:sub
|
unsigned long frequency;
|
unsigned long clockcycle;
|
unsigned long period_time; //nanosecond
|
};
|
|
struct PTPFrequencyPPMSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
char type; //1:add 0:sub
|
unsigned long ppm_h;
|
unsigned long ppm_l;
|
};
|
/*--------------- Special Data Structures for SMI ---------------*/
|
struct LinkStatusSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int port;
|
unsigned int link;
|
unsigned int speed;
|
unsigned int duplex;
|
unsigned int pause;
|
unsigned int asym;
|
unsigned int an;
|
unsigned int fiber;
|
};
|
|
/*--------------- Special Data Structures for L2 Protocol ---------------*/
|
struct CapActSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int protocol;
|
int act;
|
};
|
|
/*--------------- Special Data Structures for Storm ---------------*/
|
struct StormGeneralSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned char storm;
|
long sdata;
|
};
|
|
/*--------------- Special Data Structures for Loop Detect ---------------*/
|
struct LDDASetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned char da[6];
|
};
|
|
/*--------------- Special Data Structures for Special Tag ---------------*/
|
struct STagTypeLenSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int length;
|
unsigned int type;
|
};
|
|
/*--------------- Special Data Structures for MISC ---------------*/
|
struct RegSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned char page;
|
unsigned char reg;
|
unsigned short val;
|
};
|
/*--------------- Special Data Structures for MISC PHY ---------------*/
|
struct PhySetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned char phy;
|
unsigned char page;
|
unsigned char reg;
|
unsigned short val;
|
unsigned char all;
|
};
|
|
/*--------------- Special Data Structures for STP ---------------*/
|
struct StpByFPSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int fid;
|
int port;
|
int pstate;
|
};
|
|
struct StpAllPortsSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int fid;
|
int pstate[MAX_PHY_NUM-1];
|
};
|
|
/*--------------- Special Data Structures for LACP ---------------*/
|
struct TrunkMemberSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long portmask;
|
unsigned long tstate;
|
};
|
|
struct TrunkCombineSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long tgrps;
|
int cen;
|
};
|
|
/*--------------- Special Data Structures for LUT ---------------*/
|
struct IP1811LUTEntry
|
{
|
unsigned char cfg;
|
unsigned char mac[6];
|
unsigned char fid;
|
unsigned char srcport;
|
unsigned char aging;
|
unsigned char priority;
|
struct{
|
unsigned short drop: 1;
|
unsigned short snif: 1;
|
unsigned short sflow: 1;
|
unsigned short reserve: 13;
|
}flag;
|
};
|
|
struct IP1811LUTSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long retval;
|
unsigned char action;
|
unsigned long tarports;
|
unsigned short index;
|
unsigned char block;
|
struct IP1811LUTEntry entry;
|
unsigned short data[6];
|
};
|
|
struct IP1811LUTReg
|
{
|
unsigned short data[6];
|
unsigned char block;
|
struct list_head list;
|
};
|
|
/*--------------- Special Data Structures for IGMP ---------------*/
|
|
struct mt_rule{
|
unsigned char group[4];
|
unsigned char fid;
|
unsigned long port_mem;
|
unsigned char pri;
|
unsigned char slt_index;
|
unsigned char flag;
|
};
|
|
struct MtRuleSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int index;
|
struct mt_rule mt_data;
|
};
|
|
struct slt_rule{
|
unsigned char type; //4:ipv4, 6:ipv6, define in ip1811op.h
|
union slt_para{
|
struct slt_ipv4{
|
unsigned char ip[6][4];
|
unsigned int used_port[6];
|
}ipv4;
|
|
struct slt_ipv6{
|
unsigned short ip[2][8];
|
unsigned int used_port[2];
|
}ipv6;
|
}data;
|
unsigned int port_filter_mode;
|
};
|
|
struct SltRuleSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int index;
|
struct slt_rule slt_data;
|
};
|
|
struct IgmpPacketRule{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int packet_type;
|
unsigned int rule;
|
};
|
|
struct IgmpRouterListSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int portmask;
|
unsigned int tstate;
|
};
|
|
/*--------------- Special Data Structures for IMP ---------------*/
|
struct IP1811IMPEntry
|
{
|
unsigned char ip[16];
|
unsigned char mac[6];
|
unsigned char srcport;
|
unsigned char priority;
|
struct{
|
unsigned int valid: 1;
|
unsigned int ip_type: 1;
|
unsigned int check_ip: 1;
|
unsigned int check_mac: 1;
|
unsigned int check_port: 1;
|
unsigned int filter: 1;
|
unsigned int sniff2: 1;
|
unsigned int reserved: 9;
|
}flag;
|
};
|
|
struct IP1811IMPSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned long retval;
|
unsigned char action;
|
unsigned char index;
|
struct IP1811IMPEntry entry;
|
};
|
|
/*--------------- Special Data Structures for VLAN ---------------*/
|
struct VlanSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int vtype;
|
unsigned int vdata;
|
};
|
|
struct MACVlanSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int index;
|
unsigned int mvdata;
|
};
|
|
/*--------------- Special Data Structures for MAC ---------------*/
|
struct MACSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
char mac[6];
|
};
|
|
/*--------------- Special Data Structures for TCP Flag ---------------*/
|
struct TcpFlagSetting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int index;
|
int fdata;
|
};
|
|
/*--------------- Special Data Structures for IPv6 ---------------*/
|
struct IPv6Setting{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int header;
|
int act;
|
};
|
|
/*--------------- Special Data Structures for MIB Counter ---------------*/
|
#define NUM_MIB_COUNTER_RX 24
|
#define NUM_MIB_COUNTER_TX 20
|
|
struct MIBCounterData{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int port;
|
int dir;
|
int idx;
|
unsigned long counter;
|
};
|
|
struct MIBCounterEntry{
|
unsigned long RX_counter[NUM_MIB_COUNTER_RX];
|
unsigned long TX_counter[NUM_MIB_COUNTER_TX];
|
};
|
|
struct MIBCounterEntry_all{
|
struct MIBCounterEntry entry[MAX_PHY_NUM];
|
};
|
|
/*--------------- Special Data Structures for QOS ---------------*/
|
struct qos_dscp_setting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned char dscpentry;
|
unsigned char dscpvalue;
|
unsigned char dscpqueue;
|
};
|
|
struct qos_modesettings
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int groupnum;
|
int queuenum;
|
int modesettings;
|
};
|
|
struct qos_remap
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int port;
|
unsigned char queue;
|
unsigned char remap;
|
};
|
/*--------------- Special Data Structures for ACL ---------------*/
|
struct acl_man {
|
struct list_head rule_list;
|
|
int num_used_rules;
|
int num_used_entries;
|
|
// IP1811 has 64 entries
|
unsigned short used_entry_mask[4];
|
};
|
|
#define ACL_RULE_FUNC_USED_ACL BIT(0)
|
#define ACL_RULE_FUNC_USED_MCP BIT(1)
|
#define ACL_RULE_FUNC_USED_SNOOP BIT(2)
|
#define ACL_RULE_FUNC_USED_DOS BIT(3)
|
|
struct acl_man_rule {
|
struct list_head rule_entry;
|
int start_block;
|
int start_index;
|
int num_entries;
|
int rule_index;
|
unsigned int func_used; // bit 0 : acl
|
// bit 1 : mcp
|
// bit 2 : dhcp snooping
|
};
|
|
enum {
|
ACL_SELECT_MODE_0001 = 1,
|
ACL_SELECT_MODE_0010,
|
ACL_SELECT_MODE_0100 = 4,
|
ACL_SELECT_MODE_0101,
|
ACL_SELECT_MODE_0110,
|
ACL_SELECT_MODE_0111,
|
ACL_SELECT_MODE_1x00,
|
ACL_SELECT_MODE_1x01,
|
ACL_SELECT_MODE_1x10,
|
ACL_SELECT_MODE_1x11,
|
};
|
#define ACL_SELECT_MODE_BIT_0010 BIT(ACL_SELECT_MODE_0010)
|
#define ACL_SELECT_MODE_BIT_0100 BIT(ACL_SELECT_MODE_0100)
|
#define ACL_SELECT_MODE_BIT_0101 BIT(ACL_SELECT_MODE_0101)
|
#define ACL_SELECT_MODE_BIT_0110 BIT(ACL_SELECT_MODE_0110)
|
#define ACL_SELECT_MODE_BIT_0111 BIT(ACL_SELECT_MODE_0111)
|
#define ACL_SELECT_MODE_BIT_1x00 BIT(ACL_SELECT_MODE_1x00)
|
#define ACL_SELECT_MODE_BIT_1x01 BIT(ACL_SELECT_MODE_1x01)
|
#define ACL_SELECT_MODE_BIT_1x10 BIT(ACL_SELECT_MODE_1x10)
|
#define ACL_SELECT_MODE_BIT_1x11 BIT(ACL_SELECT_MODE_1x11)
|
enum {
|
ACL_LINK_TYPE_00 = 0,
|
ACL_LINK_TYPE_01,
|
ACL_LINK_TYPE_10,
|
ACL_LINK_TYPE_11,
|
};
|
|
#define ACL_RULE_VALID_SMAC BIT(0)
|
#define ACL_RULE_VALID_DMAC BIT(1)
|
#define ACL_RULE_VALID_SIP BIT(2)
|
#define ACL_RULE_VALID_SIP_MASK BIT(3)
|
#define ACL_RULE_VALID_DIP BIT(4)
|
#define ACL_RULE_VALID_DIP_MASK BIT(5)
|
#define ACL_RULE_VALID_SIP6 BIT(6)
|
#define ACL_RULE_VALID_SIP6_MASK BIT(7)
|
#define ACL_RULE_VALID_DIP6 BIT(8)
|
#define ACL_RULE_VALID_DIP6_MASK BIT(9)
|
#define ACL_RULE_VALID_ETH_TYPE BIT(10)
|
#define ACL_RULE_VALID_VLAN BIT(11)
|
#define ACL_RULE_VALID_COS BIT(12)
|
#define ACL_RULE_VALID_SP_R BIT(13)
|
#define ACL_RULE_VALID_DP_R BIT(14)
|
#define ACL_RULE_VALID_DSCP BIT(15)
|
#define ACL_RULE_VALID_IP_PROT BIT(16)
|
#define ACL_RULE_VALID_INGRESS_PORT BIT(17)
|
#define ACL_RULE_VALID_USERDEF_OFFSET BIT(18)
|
|
#define ACL_RULE_RVS_SMAC BIT(0)
|
#define ACL_RULE_RVS_DMAC BIT(1)
|
#define ACL_RULE_RVS_SIP BIT(2)
|
#define ACL_RULE_RVS_SIP_MASK BIT(3)
|
#define ACL_RULE_RVS_DIP BIT(4)
|
#define ACL_RULE_RVS_DIP_MASK BIT(5)
|
#define ACL_RULE_RVS_SIP6 BIT(6)
|
#define ACL_RULE_RVS_SIP6_MASK BIT(7)
|
#define ACL_RULE_RVS_DIP6 BIT(8)
|
#define ACL_RULE_RVS_DIP6_MASK BIT(9)
|
#define ACL_RULE_RVS_ETH_TYPE BIT(10)
|
#define ACL_RULE_RVS_VLAN BIT(11)
|
#define ACL_RULE_RVS_COS BIT(12)
|
#define ACL_RULE_RVS_SP_R BIT(13)
|
#define ACL_RULE_RVS_DP_R BIT(14)
|
#define ACL_RULE_RVS_DSCP BIT(15)
|
#define ACL_RULE_RVS_IP_PROT BIT(16)
|
#define ACL_RULE_RVS_INGRESS_PORT BIT(17)
|
#define ACL_RULE_RVS_USERDEF_OFFSET BIT(18)
|
|
#define ACL_ACT_VALID_REDIR BIT(0)
|
#define ACL_ACT_VALID_PRI BIT(1)
|
#define ACL_ACT_VALID_DSCP BIT(2)
|
#define ACL_ACT_VALID_CPU BIT(3)
|
#define ACL_ACT_VALID_SNIFFER BIT(4)
|
#define ACL_ACT_VALID_PTP BIT(5)
|
#define ACL_ACT_VALID_SFLOW BIT(6)
|
#define ACL_ACT_VALID_CTAG BIT(7)
|
#define ACL_ACT_VALID_STAG BIT(8)
|
#define ACL_ACT_VALID_BW BIT(9)
|
#define ACL_ACT_VALID_STORM BIT(10)
|
#define ACL_ACT_VALID_MIB_COUNTER BIT(11)
|
|
#define ACL_ACT_TYPE_3 3
|
|
struct acl_rule
|
{
|
// rule
|
unsigned long rule_valid; // bit 0 : smac
|
// bit 1 : dmac
|
// bit 2 : sip
|
// bit 3 : sip_mask
|
// bit 4 : dip
|
// bit 5 : dip_mask
|
// bit 6 : sip6
|
// bit 7 : sip6_mask
|
// bit 8 : dip6
|
// bit 9 : dip6_mask
|
// bit 10: eth_type
|
// bit 11: vlan
|
// bit 12: cos
|
// bit 13: sp_range
|
// bit 14: dp_range
|
// bit 15: dscp
|
// bit 16: ip_prot
|
// bit 17: ingress_port
|
// reverse
|
unsigned long rule_rvs; // bit 0 : smac
|
// bit 1 : dmac
|
// bit 2 : sip
|
// bit 3 : sip_mask
|
// bit 4 : dip
|
// bit 5 : dip_mask
|
// bit 6 : sip6
|
// bit 7 : sip6_mask
|
// bit 8 : dip6
|
// bit 9 : dip6_mask
|
// bit 10: eth_type
|
// bit 11: vlan
|
// bit 12: cos
|
// bit 13: sp_range
|
// bit 14: dp_range
|
// bit 15: dscp
|
// bit 16: ip_prot
|
// bit 17: ingress_port
|
|
unsigned char smac[6];
|
unsigned char dmac[6];
|
|
union{
|
unsigned long sip4;
|
unsigned short sip6[8];
|
}sip;
|
#define sip4_addr sip.sip4
|
#define sip6_addr16 sip.sip6
|
unsigned char sip_mask;
|
// IPv4 0 - FF:FF:FF:FF IPv6 0 - FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF(0x00)
|
// 1 - FF:FF:FF:00 1 - FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:0000:0000(0x3C)
|
// 2 - FF:FF:00:00 2 - FFFF:FFFF:FFFF:FFFF:0000:0000:0000:0000(0x3D)
|
// 4 - FF:00:00:00 3 - FFFF:FFFF:0000:0000:0000:0000:0000:0000(0x3F)
|
// 8 - F0:00:00:00 4 - FFFF:0000:0000:0000:0000:0000:0000:0000(0xFF)
|
union{
|
unsigned long dip4;
|
unsigned short dip6[8];
|
}dip;
|
#define dip4_addr dip.dip4
|
#define dip6_addr16 dip.dip6
|
unsigned char dip_mask;
|
|
unsigned short eth_type;
|
unsigned short vlan;
|
unsigned short cos;
|
unsigned short sp_hi;
|
unsigned short sp_lo;
|
unsigned short dp_hi;
|
unsigned short dp_lo;
|
unsigned char r_dscp;
|
unsigned char ip_prot;
|
unsigned char ingress_port;
|
|
// action
|
int act_type; // value = 0 ~ 2, type 3 need a acl entry
|
// 0 for drop
|
// 1 for Act_0 = b'0
|
// 2 for Act_1 = b'1
|
// 3 for Act_0001
|
|
unsigned long act_valid; // bit 0 : redir
|
// bit 1 : pri
|
// bit 2 : dscp
|
// bit 3 : cpu
|
// bit 4 : mirror
|
// bit 5 : ptp
|
// bit 6 : sflow
|
// bit 7 : ctag
|
// bit 8 : stag
|
// bit 9 : bw
|
// bit 10: storm
|
// bit 11: mib_counter
|
unsigned int redir:5;
|
unsigned int pri:3;
|
unsigned int a_dscp:3;
|
unsigned int cpu:1;
|
unsigned int mirror:1;
|
unsigned int ptp:1;
|
unsigned int sflow:1;
|
unsigned short ctag;
|
unsigned short stag;
|
unsigned short bw;
|
unsigned short storm;
|
unsigned short mib_counter;
|
|
/* User define 64 bytes offset */
|
//one bit for 2 bytes offset
|
unsigned short location1; //[4:0] user0
|
//[9:5] user1
|
unsigned short location2; //[4:0] user2
|
//[9:5] user3
|
|
unsigned short usr0;
|
unsigned short usr0_start;
|
unsigned short usr1;
|
unsigned short usr1_start;
|
unsigned short usr2;
|
unsigned short usr3;
|
|
unsigned short mask0;
|
unsigned short mask1;
|
unsigned short mask2;
|
unsigned short mask3;
|
};
|
|
struct AclRuleSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned int find_index_blockn; // find index start from block n and return used block actually.
|
unsigned int find_index_rvs; // in block, find index in reverse or not
|
unsigned int rule_index;
|
unsigned int func_used;
|
int rule_index_res;
|
struct acl_rule rule;
|
unsigned long reserved; // show the used entry numbers for ip1811
|
};
|
|
struct AclGeneralSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int index;
|
int data;
|
};
|
|
struct AclEntryMaskGetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned short mask[4];
|
};
|
|
struct AclTableCleanSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
int rule_idx;
|
int func_used;
|
};
|
|
/*--------------- Special Data Structures for EEPROM ---------------*/
|
struct EepromSetting
|
{
|
void *nextcmd;
|
unsigned long size_nextcmd;
|
unsigned long cmdid;
|
unsigned short addr;
|
unsigned char value;
|
};
|
|
#endif /* IP1811DS_H */
|