19a5557fdSlucy wang - Sun Microsystems - Beijing China /* 29a5557fdSlucy wang - Sun Microsystems - Beijing China * CDDL HEADER START 39a5557fdSlucy wang - Sun Microsystems - Beijing China * 49a5557fdSlucy wang - Sun Microsystems - Beijing China * The contents of this file are subject to the terms of the 59a5557fdSlucy wang - Sun Microsystems - Beijing China * Common Development and Distribution License (the "License"). 69a5557fdSlucy wang - Sun Microsystems - Beijing China * You may not use this file except in compliance with the License. 79a5557fdSlucy wang - Sun Microsystems - Beijing China * 89a5557fdSlucy wang - Sun Microsystems - Beijing China * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99a5557fdSlucy wang - Sun Microsystems - Beijing China * or http://www.opensolaris.org/os/licensing. 109a5557fdSlucy wang - Sun Microsystems - Beijing China * See the License for the specific language governing permissions 119a5557fdSlucy wang - Sun Microsystems - Beijing China * and limitations under the License. 129a5557fdSlucy wang - Sun Microsystems - Beijing China * 139a5557fdSlucy wang - Sun Microsystems - Beijing China * When distributing Covered Code, include this CDDL HEADER in each 149a5557fdSlucy wang - Sun Microsystems - Beijing China * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159a5557fdSlucy wang - Sun Microsystems - Beijing China * If applicable, add the following below this CDDL HEADER, with the 169a5557fdSlucy wang - Sun Microsystems - Beijing China * fields enclosed by brackets "[]" replaced with your own identifying 179a5557fdSlucy wang - Sun Microsystems - Beijing China * information: Portions Copyright [yyyy] [name of copyright owner] 189a5557fdSlucy wang - Sun Microsystems - Beijing China * 199a5557fdSlucy wang - Sun Microsystems - Beijing China * CDDL HEADER END 209a5557fdSlucy wang - Sun Microsystems - Beijing China */ 2193833965Sjing xiong ERI-SUN 229a5557fdSlucy wang - Sun Microsystems - Beijing China /* 239a5557fdSlucy wang - Sun Microsystems - Beijing China * Copyright 2008 NetXen, Inc. All rights reserved. 249a5557fdSlucy wang - Sun Microsystems - Beijing China * Use is subject to license terms. 259a5557fdSlucy wang - Sun Microsystems - Beijing China */ 2693833965Sjing xiong ERI-SUN 2793833965Sjing xiong ERI-SUN #ifndef _UNM_NIC_CMN_H_ 2893833965Sjing xiong ERI-SUN #define _UNM_NIC_CMN_H_ 2993833965Sjing xiong ERI-SUN 3093833965Sjing xiong ERI-SUN #ifdef __cplusplus 3193833965Sjing xiong ERI-SUN extern "C" { 3293833965Sjing xiong ERI-SUN #endif 339a5557fdSlucy wang - Sun Microsystems - Beijing China 349a5557fdSlucy wang - Sun Microsystems - Beijing China #ifndef sun 359a5557fdSlucy wang - Sun Microsystems - Beijing China #include "unm_nic_config.h" 369a5557fdSlucy wang - Sun Microsystems - Beijing China #include "unm_compiler_defs.h" 379a5557fdSlucy wang - Sun Microsystems - Beijing China #endif 389a5557fdSlucy wang - Sun Microsystems - Beijing China 399a5557fdSlucy wang - Sun Microsystems - Beijing China #define IP_ALIGNMENT_BYTES 2 /* make ip aligned on 16byteaddr */ 409a5557fdSlucy wang - Sun Microsystems - Beijing China #define P2_MAX_MTU (8000) 419a5557fdSlucy wang - Sun Microsystems - Beijing China #define P3_MAX_MTU (9600) 429a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_ETHERMTU 1500 439a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_MAX_ETHERHDR 32 /* This contains some padding */ 449a5557fdSlucy wang - Sun Microsystems - Beijing China 459a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_RX_NORMAL_BUF_MAX_LEN (NX_MAX_ETHERHDR + NX_ETHERMTU) 469a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_P2_RX_JUMBO_BUF_MAX_LEN (NX_MAX_ETHERHDR + P2_MAX_MTU) 479a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_P3_RX_JUMBO_BUF_MAX_LEN (NX_MAX_ETHERHDR + P3_MAX_MTU) 489a5557fdSlucy wang - Sun Microsystems - Beijing China 499a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_RX_LRO_BUFFER_LENGTH ((8*1024) - 512) 509a5557fdSlucy wang - Sun Microsystems - Beijing China #define RX_LRO_DMA_MAP_LEN (MAX_RX_LRO_BUFFER_LENGTH -\ 519a5557fdSlucy wang - Sun Microsystems - Beijing China IP_ALIGNMENT_BYTES) 529a5557fdSlucy wang - Sun Microsystems - Beijing China 539a5557fdSlucy wang - Sun Microsystems - Beijing China /* Opcodes to be used with the commands */ 549a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_ETHER_PKT 0x01 559a5557fdSlucy wang - Sun Microsystems - Beijing China /* The following opcodes are for IP checksum */ 569a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_TCP_PKT 0x02 579a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_UDP_PKT 0x03 589a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_IP_PKT 0x04 599a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_TCP_LSO 0x05 609a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_IPSEC 0x06 619a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_IPSEC_CMD 0x07 629a5557fdSlucy wang - Sun Microsystems - Beijing China 639a5557fdSlucy wang - Sun Microsystems - Beijing China #define NETXEN_MAC_NOOP 0 649a5557fdSlucy wang - Sun Microsystems - Beijing China #define NETXEN_MAC_ADD 1 659a5557fdSlucy wang - Sun Microsystems - Beijing China #define NETXEN_MAC_DEL 2 669a5557fdSlucy wang - Sun Microsystems - Beijing China 679a5557fdSlucy wang - Sun Microsystems - Beijing China /* The following opcodes are for internal consumption. */ 689a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_CONTROL_OP 0x10 699a5557fdSlucy wang - Sun Microsystems - Beijing China #define PEGNET_REQUEST 0x11 709a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_HOST_REQUEST 0x13 719a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_NIC_REQUEST 0x14 729a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_NIC_LRO_REQUEST 0x15 739a5557fdSlucy wang - Sun Microsystems - Beijing China 749a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_MAC_EVENT 0x1 759a5557fdSlucy wang - Sun Microsystems - Beijing China 769a5557fdSlucy wang - Sun Microsystems - Beijing China enum { 779a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_START = 0, 789a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_CONFIG_RSS, 799a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_CONFIG_RSS_TBL, 809a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_CONFIG_INTR_COALESCE, 819a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_CONFIG_LED, 829a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_CONFIG_PROMISCUOUS, 839a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_CONFIG_L2_MAC, 849a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_LRO_REQUEST, 859a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_GET_SNMP_STATS, 869a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_PROXY_START_REQUEST, 879a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_PROXY_STOP_REQUEST, 889a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_PROXY_SET_MTU, 899a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE, 909a5557fdSlucy wang - Sun Microsystems - Beijing China NX_H2P_OPCODE_GET_FINGER_PRINT_REQUEST, 919a5557fdSlucy wang - Sun Microsystems - Beijing China NX_H2P_OPCODE_INSTALL_LICENSE_REQUEST, 929a5557fdSlucy wang - Sun Microsystems - Beijing China NX_H2P_OPCODE_GET_LICENSE_CAPABILITY_REQUEST, 939a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_GET_NET_STATS, 949a5557fdSlucy wang - Sun Microsystems - Beijing China NX_NIC_H2C_OPCODE_LAST 959a5557fdSlucy wang - Sun Microsystems - Beijing China }; 969a5557fdSlucy wang - Sun Microsystems - Beijing China 979a5557fdSlucy wang - Sun Microsystems - Beijing China #define VPORT_MISS_MODE_DROP 0 /* drop all unmatched */ 989a5557fdSlucy wang - Sun Microsystems - Beijing China #define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */ 999a5557fdSlucy wang - Sun Microsystems - Beijing China #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ 1009a5557fdSlucy wang - Sun Microsystems - Beijing China 1019a5557fdSlucy wang - Sun Microsystems - Beijing China #ifdef UNM_RSS 1029a5557fdSlucy wang - Sun Microsystems - Beijing China #define RSS_CNTRL_CMD 0x20 1039a5557fdSlucy wang - Sun Microsystems - Beijing China #endif 1049a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_NUM_CARDS 4 1059a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_NUM_PORTS 4 /* Deprecated. donot use this */ 1069a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_NIU_PORTS MAX_NUM_PORTS 1079a5557fdSlucy wang - Sun Microsystems - Beijing China #define PORT1 0 1089a5557fdSlucy wang - Sun Microsystems - Beijing China #define PORT2 1 1099a5557fdSlucy wang - Sun Microsystems - Beijing China #define PORT3 2 1109a5557fdSlucy wang - Sun Microsystems - Beijing China #define PORT4 3 1119a5557fdSlucy wang - Sun Microsystems - Beijing China 1129a5557fdSlucy wang - Sun Microsystems - Beijing China 1139a5557fdSlucy wang - Sun Microsystems - Beijing China #define DESC_CHAIN 0xFF /* descriptor command continuation */ 1149a5557fdSlucy wang - Sun Microsystems - Beijing China 1159a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_BUFFERS_PER_CMD 16 1169a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_BUFFERS_PER_DESC 4 1179a5557fdSlucy wang - Sun Microsystems - Beijing China 1189a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_P2_C0 0x24 1199a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_P2_C1 0x25 1209a5557fdSlucy wang - Sun Microsystems - Beijing China 1219a5557fdSlucy wang - Sun Microsystems - Beijing China #define DUMMY_BUF_UNINIT 0x55555555 1229a5557fdSlucy wang - Sun Microsystems - Beijing China #define DUMMY_BUF_INIT 0 1239a5557fdSlucy wang - Sun Microsystems - Beijing China 1249a5557fdSlucy wang - Sun Microsystems - Beijing China /* 1259a5557fdSlucy wang - Sun Microsystems - Beijing China * Following are the states of the Phantom. Phantom will set them and 1269a5557fdSlucy wang - Sun Microsystems - Beijing China * Host will read to check if the fields are correct. 1279a5557fdSlucy wang - Sun Microsystems - Beijing China */ 1289a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHAN_INITIALIZE_START 0xff00 1299a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHAN_INITIALIZE_FAILED 0xffff 1309a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHAN_INITIALIZE_COMPLETE 0xff01 1319a5557fdSlucy wang - Sun Microsystems - Beijing China 1329a5557fdSlucy wang - Sun Microsystems - Beijing China /* Host writes the following to notify that it has done the init-handshake */ 1339a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHAN_INITIALIZE_ACK 0xf00f 1349a5557fdSlucy wang - Sun Microsystems - Beijing China 1359a5557fdSlucy wang - Sun Microsystems - Beijing China /* Following defines will be used in the status descriptor */ 1369a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_ETHER_PKT_COMPLETE 0xB /* same for both commands */ 1379a5557fdSlucy wang - Sun Microsystems - Beijing China 1389a5557fdSlucy wang - Sun Microsystems - Beijing China #define NUM_RCV_DESC_RINGS 3 /* No of Rcv Descriptor contexts */ 1399a5557fdSlucy wang - Sun Microsystems - Beijing China 1409a5557fdSlucy wang - Sun Microsystems - Beijing China /* descriptor types */ 1419a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_NORMAL 0x01 1429a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_JUMBO 0x02 1439a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_LRO 0x04 1449a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_NORMAL_CTXID 0 1459a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_JUMBO_CTXID 1 1469a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_LRO_CTXID 2 1479a5557fdSlucy wang - Sun Microsystems - Beijing China 1489a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_TYPE(ID) \ 1499a5557fdSlucy wang - Sun Microsystems - Beijing China ((ID == RCV_DESC_JUMBO_CTXID) ? RCV_DESC_JUMBO : \ 1509a5557fdSlucy wang - Sun Microsystems - Beijing China ((ID == RCV_DESC_LRO_CTXID) ? RCV_DESC_LRO : (RCV_DESC_NORMAL))) 1519a5557fdSlucy wang - Sun Microsystems - Beijing China 1529a5557fdSlucy wang - Sun Microsystems - Beijing China #define RCV_DESC_TYPE_NAME(ID) \ 1539a5557fdSlucy wang - Sun Microsystems - Beijing China ((ID == RCV_DESC_JUMBO_CTXID) ? "Jumbo" : \ 1549a5557fdSlucy wang - Sun Microsystems - Beijing China (ID == RCV_DESC_LRO_CTXID) ? "LRO" : \ 1559a5557fdSlucy wang - Sun Microsystems - Beijing China (ID == RCV_DESC_NORMAL_CTXID) ? "Normal" : "Unknown") 1569a5557fdSlucy wang - Sun Microsystems - Beijing China 1579a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_CMD_DESCRIPTORS 4096 1589a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_CMD_DESCRIPTORS_HOST (MAX_CMD_DESCRIPTORS / 4) 1599a5557fdSlucy wang - Sun Microsystems - Beijing China 1609a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_RCV_DESCRIPTORS 8192 1619a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_JUMBO_RCV_DESCRIPTORS 1024 1629a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_LRO_RCV_DESCRIPTORS 16 1639a5557fdSlucy wang - Sun Microsystems - Beijing China 1649a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_MAX_SUPPORTED_RDS_SIZE (32 * 1024) 1659a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_MAX_SUPPORTED_JUMBO_RDS_SIZE (4 * 1024) 1669a5557fdSlucy wang - Sun Microsystems - Beijing China 1679a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHAN_PEG_RCV_INITIALIZED 0xff01 1689a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHAN_PEG_RCV_START_INITIALIZE 0xff00 1699a5557fdSlucy wang - Sun Microsystems - Beijing China 1709a5557fdSlucy wang - Sun Microsystems - Beijing China #define get_next_index(index, length) ((((index) + 1) == length)?0:(index) +1) 1719a5557fdSlucy wang - Sun Microsystems - Beijing China 1729a5557fdSlucy wang - Sun Microsystems - Beijing China #define get_index_range(index, length, count) \ 1739a5557fdSlucy wang - Sun Microsystems - Beijing China ((((index) + (count)) >= length)? \ 1749a5557fdSlucy wang - Sun Microsystems - Beijing China (((index) + (count))-(length)):((index) + (count))) 1759a5557fdSlucy wang - Sun Microsystems - Beijing China 1769a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_FLOW_TICKS_PER_SEC 2048 1779a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_FLOW_TO_TV_SHIFT_SEC 11 1789a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_FLOW_TO_TV_SHIFT_USEC 9 1799a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_FLOW_TICK_USEC (1000000ULL/UNM_FLOW_TICKS_PER_SEC) 1809a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_GLOBAL_TICKS_PER_SEC (4*UNM_FLOW_TICKS_PER_SEC) 1819a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_GLOBAL_TICK_USEC (1000000ULL/UNM_GLOBAL_TICKS_PER_SEC) 1829a5557fdSlucy wang - Sun Microsystems - Beijing China 1839a5557fdSlucy wang - Sun Microsystems - Beijing China 1849a5557fdSlucy wang - Sun Microsystems - Beijing China /* 1859a5557fdSlucy wang - Sun Microsystems - Beijing China * Following data structures describe the descriptors that will be used. 1869a5557fdSlucy wang - Sun Microsystems - Beijing China * Added fileds of tcpHdrSize and ipHdrSize, The driver needs to do it only when 1879a5557fdSlucy wang - Sun Microsystems - Beijing China * we are doing LSO (above the 1500 size packet) only. 1889a5557fdSlucy wang - Sun Microsystems - Beijing China * This is an overhead but we need it. Let me know if you have questions. 1899a5557fdSlucy wang - Sun Microsystems - Beijing China */ 1909a5557fdSlucy wang - Sun Microsystems - Beijing China 1919a5557fdSlucy wang - Sun Microsystems - Beijing China /* 1929a5557fdSlucy wang - Sun Microsystems - Beijing China * the size of reference handle been changed to 16 bits to pass the MSS fields 1939a5557fdSlucy wang - Sun Microsystems - Beijing China * for the LSO packet 1949a5557fdSlucy wang - Sun Microsystems - Beijing China */ 1959a5557fdSlucy wang - Sun Microsystems - Beijing China 196*dda0720aSjing xiong ERI-SUN #define FLAGS_MCAST 0x01 1979a5557fdSlucy wang - Sun Microsystems - Beijing China #define FLAGS_LSO_ENABLED 0x02 1989a5557fdSlucy wang - Sun Microsystems - Beijing China #define FLAGS_IPSEC_SA_ADD 0x04 1999a5557fdSlucy wang - Sun Microsystems - Beijing China #define FLAGS_IPSEC_SA_DELETE 0x08 2009a5557fdSlucy wang - Sun Microsystems - Beijing China #define FLAGS_VLAN_TAGGED 0x10 2019a5557fdSlucy wang - Sun Microsystems - Beijing China 2029a5557fdSlucy wang - Sun Microsystems - Beijing China #if UNM_CONF_PROCESSOR == UNM_CONF_X86 2039a5557fdSlucy wang - Sun Microsystems - Beijing China 2049a5557fdSlucy wang - Sun Microsystems - Beijing China #ifndef U64 2059a5557fdSlucy wang - Sun Microsystems - Beijing China typedef unsigned long long U64; 2069a5557fdSlucy wang - Sun Microsystems - Beijing China typedef uint32_t U32; 2079a5557fdSlucy wang - Sun Microsystems - Beijing China typedef uint16_t U16; 2089a5557fdSlucy wang - Sun Microsystems - Beijing China typedef uint8_t U8; 2099a5557fdSlucy wang - Sun Microsystems - Beijing China #endif 2109a5557fdSlucy wang - Sun Microsystems - Beijing China 2119a5557fdSlucy wang - Sun Microsystems - Beijing China #endif 2129a5557fdSlucy wang - Sun Microsystems - Beijing China 2139a5557fdSlucy wang - Sun Microsystems - Beijing China #define NUM_SUPPORTED_RINGSETS 4 2149a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_RING_CTX 4 2159a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_CTX_SIGNATURE 0xdee0 2169a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_CTX_RESET 0xbad0 2179a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_CTX_D3_RESET 0xacc0 2189a5557fdSlucy wang - Sun Microsystems - Beijing China 2199a5557fdSlucy wang - Sun Microsystems - Beijing China /* define opcode for ctx_msg */ 2209a5557fdSlucy wang - Sun Microsystems - Beijing China #define RX_PRODUCER 0 2219a5557fdSlucy wang - Sun Microsystems - Beijing China #define RX_PRODUCER_JUMBO 1 2229a5557fdSlucy wang - Sun Microsystems - Beijing China #define RX_PRODUCER_LRO 2 2239a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_PRODUCER 3 2249a5557fdSlucy wang - Sun Microsystems - Beijing China #define UPDATE_STATUS_CONSUMER 4 2259a5557fdSlucy wang - Sun Microsystems - Beijing China #define RESET_CTX 5 2269a5557fdSlucy wang - Sun Microsystems - Beijing China 2279a5557fdSlucy wang - Sun Microsystems - Beijing China #define NUM_DB_CODE 6 2289a5557fdSlucy wang - Sun Microsystems - Beijing China 2299a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_RCV_PRODUCER(ringid) (ringid) 2309a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_CMD_PRODUCER TX_PRODUCER 2319a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_RCV_STATUS_CONSUMER UPDATE_STATUS_CONSUMER 2329a5557fdSlucy wang - Sun Microsystems - Beijing China 2339a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct __msg 2349a5557fdSlucy wang - Sun Microsystems - Beijing China { 23593833965Sjing xiong ERI-SUN __uint32_t PegId:2, /* 0x2 for tx and 01 for rx */ 23693833965Sjing xiong ERI-SUN privId:1, /* must be 1 */ 23793833965Sjing xiong ERI-SUN Count:15, /* for doorbell */ 23893833965Sjing xiong ERI-SUN CtxId:10, /* Ctx_id */ 2399a5557fdSlucy wang - Sun Microsystems - Beijing China Opcode:4; /* opcode */ 2409a5557fdSlucy wang - Sun Microsystems - Beijing China }ctx_msg, CTX_MSG, *PCTX_MSG; 2419a5557fdSlucy wang - Sun Microsystems - Beijing China 2429a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct __int_msg 2439a5557fdSlucy wang - Sun Microsystems - Beijing China { 24493833965Sjing xiong ERI-SUN __uint32_t Count:18, /* INT */ 2459a5557fdSlucy wang - Sun Microsystems - Beijing China ConsumerIdx:10, 24693833965Sjing xiong ERI-SUN CtxId:4; /* Ctx_id */ 2479a5557fdSlucy wang - Sun Microsystems - Beijing China 2489a5557fdSlucy wang - Sun Microsystems - Beijing China }int_msg, INT_MSG, *PINT_MSG; 2499a5557fdSlucy wang - Sun Microsystems - Beijing China 2509a5557fdSlucy wang - Sun Microsystems - Beijing China /* For use in CRB_MPORT_MODE */ 2519a5557fdSlucy wang - Sun Microsystems - Beijing China #define MPORT_SINGLE_FUNCTION_MODE 0x1111 2529a5557fdSlucy wang - Sun Microsystems - Beijing China #define MPORT_MULTI_FUNCTION_MODE 0x2222 2539a5557fdSlucy wang - Sun Microsystems - Beijing China 2549a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct _RcvContext 2559a5557fdSlucy wang - Sun Microsystems - Beijing China { 2569a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t RcvRingAddrLo; 2579a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t RcvRingAddrHi; 2589a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t RcvRingSize; 2599a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t Rsrv; 2609a5557fdSlucy wang - Sun Microsystems - Beijing China }RcvContext; 2619a5557fdSlucy wang - Sun Microsystems - Beijing China 2629a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct PREALIGN(64) _RingContext 2639a5557fdSlucy wang - Sun Microsystems - Beijing China { 2649a5557fdSlucy wang - Sun Microsystems - Beijing China 2659a5557fdSlucy wang - Sun Microsystems - Beijing China /* one command ring */ 2669a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t CMD_CONSUMER_OFFSET; 2679a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t CmdRingAddrLo; 2689a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t CmdRingAddrHi; 2699a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t CmdRingSize; 2709a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t Rsrv; 2719a5557fdSlucy wang - Sun Microsystems - Beijing China 2729a5557fdSlucy wang - Sun Microsystems - Beijing China /* three receive rings */ 2739a5557fdSlucy wang - Sun Microsystems - Beijing China RcvContext RcvContext[3]; 2749a5557fdSlucy wang - Sun Microsystems - Beijing China 2759a5557fdSlucy wang - Sun Microsystems - Beijing China /* one status ring */ 2769a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t StsRingAddrLo; 2779a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t StsRingAddrHi; 2789a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t StsRingSize; 2799a5557fdSlucy wang - Sun Microsystems - Beijing China 2809a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t CtxId; 2819a5557fdSlucy wang - Sun Microsystems - Beijing China 2829a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t D3_STATE_REGISTER; 2839a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t DummyDmaAddrLo; 2849a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t DummyDmaAddrHi; 2859a5557fdSlucy wang - Sun Microsystems - Beijing China 2869a5557fdSlucy wang - Sun Microsystems - Beijing China }POSTALIGN(64) RingContext, RING_CTX, *PRING_CTX; 2879a5557fdSlucy wang - Sun Microsystems - Beijing China 2889a5557fdSlucy wang - Sun Microsystems - Beijing China #ifdef UNM_RSS 2899a5557fdSlucy wang - Sun Microsystems - Beijing China /* 2909a5557fdSlucy wang - Sun Microsystems - Beijing China * RSS_SreInfo{} has the information for SRE to calculate the hash value 2919a5557fdSlucy wang - Sun Microsystems - Beijing China * Will be passed by the host=> as part of comd descriptor... 2929a5557fdSlucy wang - Sun Microsystems - Beijing China */ 2939a5557fdSlucy wang - Sun Microsystems - Beijing China 2949a5557fdSlucy wang - Sun Microsystems - Beijing China #if UNM_CONF_PROCESSOR == UNM_CONF_X86 2959a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct _RSS_SreInfo { 2969a5557fdSlucy wang - Sun Microsystems - Beijing China U32 HashKeySize; 2979a5557fdSlucy wang - Sun Microsystems - Beijing China U32 HashInformation; 2989a5557fdSlucy wang - Sun Microsystems - Beijing China char key[40]; 2999a5557fdSlucy wang - Sun Microsystems - Beijing China }RSS_SreInfo; 3009a5557fdSlucy wang - Sun Microsystems - Beijing China #endif 3019a5557fdSlucy wang - Sun Microsystems - Beijing China 3029a5557fdSlucy wang - Sun Microsystems - Beijing China /* 3039a5557fdSlucy wang - Sun Microsystems - Beijing China * The following Descriptor is used to send RSS commands to the 3049a5557fdSlucy wang - Sun Microsystems - Beijing China * PEG.... to be do the SRE registers.. 3059a5557fdSlucy wang - Sun Microsystems - Beijing China */ 3069a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct PREALIGN(64) _rssCmdDesc 3079a5557fdSlucy wang - Sun Microsystems - Beijing China { 3089a5557fdSlucy wang - Sun Microsystems - Beijing China 3099a5557fdSlucy wang - Sun Microsystems - Beijing China /* 3109a5557fdSlucy wang - Sun Microsystems - Beijing China * To keep the opcode at the same location as 3119a5557fdSlucy wang - Sun Microsystems - Beijing China * the cmdDescType0, we will have to breakup the key into 3129a5557fdSlucy wang - Sun Microsystems - Beijing China * 2 areas.... Dont like it but for now will do... FSL 3139a5557fdSlucy wang - Sun Microsystems - Beijing China */ 3149a5557fdSlucy wang - Sun Microsystems - Beijing China 3159a5557fdSlucy wang - Sun Microsystems - Beijing China #if UNM_CONF_PROCESSOR == UNM_CONF_X86 3169a5557fdSlucy wang - Sun Microsystems - Beijing China U8 Key0[16]; 3179a5557fdSlucy wang - Sun Microsystems - Beijing China 3189a5557fdSlucy wang - Sun Microsystems - Beijing China U64 HashMethod:32, 3199a5557fdSlucy wang - Sun Microsystems - Beijing China HashKeySize:8, 3209a5557fdSlucy wang - Sun Microsystems - Beijing China Unused: 16, 3219a5557fdSlucy wang - Sun Microsystems - Beijing China opcode:8; 3229a5557fdSlucy wang - Sun Microsystems - Beijing China 3239a5557fdSlucy wang - Sun Microsystems - Beijing China U8 Key1[24]; 3249a5557fdSlucy wang - Sun Microsystems - Beijing China U64 Unused1; 3259a5557fdSlucy wang - Sun Microsystems - Beijing China U64 Unused2; 3269a5557fdSlucy wang - Sun Microsystems - Beijing China #else 3279a5557fdSlucy wang - Sun Microsystems - Beijing China 3289a5557fdSlucy wang - Sun Microsystems - Beijing China unm_msgword_t Key0[2]; 3299a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t HashMethod; 3309a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t 3319a5557fdSlucy wang - Sun Microsystems - Beijing China HashKeySize:8, 3329a5557fdSlucy wang - Sun Microsystems - Beijing China Unused:16, 3339a5557fdSlucy wang - Sun Microsystems - Beijing China opcode:8; 3349a5557fdSlucy wang - Sun Microsystems - Beijing China 3359a5557fdSlucy wang - Sun Microsystems - Beijing China unm_msgword_t Key1[3]; 3369a5557fdSlucy wang - Sun Microsystems - Beijing China unm_msgword_t Unused1; 3379a5557fdSlucy wang - Sun Microsystems - Beijing China unm_msgword_t Unused2; 3389a5557fdSlucy wang - Sun Microsystems - Beijing China 3399a5557fdSlucy wang - Sun Microsystems - Beijing China #endif 3409a5557fdSlucy wang - Sun Microsystems - Beijing China 3419a5557fdSlucy wang - Sun Microsystems - Beijing China } POSTALIGN(64) rssCmdDesc_t; 3429a5557fdSlucy wang - Sun Microsystems - Beijing China 3439a5557fdSlucy wang - Sun Microsystems - Beijing China 3449a5557fdSlucy wang - Sun Microsystems - Beijing China #endif /* UNM_RSS */ 3459a5557fdSlucy wang - Sun Microsystems - Beijing China 3469a5557fdSlucy wang - Sun Microsystems - Beijing China 3479a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct PREALIGN(64) cmdDescType0 3489a5557fdSlucy wang - Sun Microsystems - Beijing China { 3499a5557fdSlucy wang - Sun Microsystems - Beijing China union { 3509a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 3519a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t tcpHdrOffset:8, /* For LSO only */ 35293833965Sjing xiong ERI-SUN ipHdrOffset:8, /* For LSO only */ 3539a5557fdSlucy wang - Sun Microsystems - Beijing China flags:7, /* as defined above */ 3549a5557fdSlucy wang - Sun Microsystems - Beijing China /* This location/size must not change... */ 3559a5557fdSlucy wang - Sun Microsystems - Beijing China opcode:6, 3569a5557fdSlucy wang - Sun Microsystems - Beijing China Unused:3; 3579a5557fdSlucy wang - Sun Microsystems - Beijing China /* total number of segments (buffers */ 3589a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t numOfBuffers:8, 3599a5557fdSlucy wang - Sun Microsystems - Beijing China /* for this packet. (could be more than 4) */ 3609a5557fdSlucy wang - Sun Microsystems - Beijing China 3619a5557fdSlucy wang - Sun Microsystems - Beijing China /* Total size of the packet */ 3629a5557fdSlucy wang - Sun Microsystems - Beijing China totalLength:24; 3639a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 3649a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word0; 3659a5557fdSlucy wang - Sun Microsystems - Beijing China }u1; 3669a5557fdSlucy wang - Sun Microsystems - Beijing China 3679a5557fdSlucy wang - Sun Microsystems - Beijing China union { 3689a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 3699a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrLowPart2; 3709a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrHighPart2; 3719a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 3729a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t AddrBuffer2; 3739a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word1; 3749a5557fdSlucy wang - Sun Microsystems - Beijing China }u2; 3759a5557fdSlucy wang - Sun Microsystems - Beijing China 3769a5557fdSlucy wang - Sun Microsystems - Beijing China union { 3779a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 3789a5557fdSlucy wang - Sun Microsystems - Beijing China /* changed to U16 to add mss */ 3799a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t referenceHandle:16, 3809a5557fdSlucy wang - Sun Microsystems - Beijing China /* passed by NDIS_PACKET for LSO */ 3819a5557fdSlucy wang - Sun Microsystems - Beijing China mss:16; 3829a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t port:4, 3839a5557fdSlucy wang - Sun Microsystems - Beijing China ctx_id:4, 3849a5557fdSlucy wang - Sun Microsystems - Beijing China /* LSO only : MAC+IP+TCP Hdr size */ 3859a5557fdSlucy wang - Sun Microsystems - Beijing China totalHdrLength:8, 3869a5557fdSlucy wang - Sun Microsystems - Beijing China /* IPSec offoad only */ 3879a5557fdSlucy wang - Sun Microsystems - Beijing China connID:16; 3889a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 3899a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word2; 3909a5557fdSlucy wang - Sun Microsystems - Beijing China }u3; 3919a5557fdSlucy wang - Sun Microsystems - Beijing China 3929a5557fdSlucy wang - Sun Microsystems - Beijing China union { 3939a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 3949a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrLowPart3; 3959a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrHighPart3; 3969a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 3979a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t AddrBuffer3; 3989a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word3; 3999a5557fdSlucy wang - Sun Microsystems - Beijing China }u4; 4009a5557fdSlucy wang - Sun Microsystems - Beijing China 4019a5557fdSlucy wang - Sun Microsystems - Beijing China union { 4029a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 4039a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrLowPart1; 4049a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrHighPart1; 4059a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 4069a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t AddrBuffer1; 4079a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word4; 4089a5557fdSlucy wang - Sun Microsystems - Beijing China }u5; 4099a5557fdSlucy wang - Sun Microsystems - Beijing China 4109a5557fdSlucy wang - Sun Microsystems - Beijing China union { 4119a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 4129a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t buffer1Length:16, 4139a5557fdSlucy wang - Sun Microsystems - Beijing China buffer2Length:16; 4149a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t buffer3Length:16, 4159a5557fdSlucy wang - Sun Microsystems - Beijing China buffer4Length:16; 4169a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 4179a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word5; 4189a5557fdSlucy wang - Sun Microsystems - Beijing China }u6; 4199a5557fdSlucy wang - Sun Microsystems - Beijing China 4209a5557fdSlucy wang - Sun Microsystems - Beijing China union { 4219a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 4229a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrLowPart4; 4239a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t AddrHighPart4; 4249a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 4259a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t AddrBuffer4; 4269a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t word6; 4279a5557fdSlucy wang - Sun Microsystems - Beijing China }u7; 4289a5557fdSlucy wang - Sun Microsystems - Beijing China 429*dda0720aSjing xiong ERI-SUN __uint64_t mcastAddr; 4309a5557fdSlucy wang - Sun Microsystems - Beijing China 4319a5557fdSlucy wang - Sun Microsystems - Beijing China } POSTALIGN(64) cmdDescType0_t; 4329a5557fdSlucy wang - Sun Microsystems - Beijing China 4339a5557fdSlucy wang - Sun Microsystems - Beijing China /* Note: sizeof(rcvDesc) should always be a mutliple of 2 */ 4349a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct rcvDesc 4359a5557fdSlucy wang - Sun Microsystems - Beijing China { 4369a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t referenceHandle:16, 4379a5557fdSlucy wang - Sun Microsystems - Beijing China flags:16; 4389a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t 4399a5557fdSlucy wang - Sun Microsystems - Beijing China /* allocated buffer length (usually 2K) */ 4409a5557fdSlucy wang - Sun Microsystems - Beijing China bufferLength:32; 4419a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t AddrBuffer; 4429a5557fdSlucy wang - Sun Microsystems - Beijing China } rcvDesc_t; 4439a5557fdSlucy wang - Sun Microsystems - Beijing China 4449a5557fdSlucy wang - Sun Microsystems - Beijing China /* for status field in statusDesc_t */ 4459a5557fdSlucy wang - Sun Microsystems - Beijing China #define STATUS_NEED_CKSUM (1) 4469a5557fdSlucy wang - Sun Microsystems - Beijing China #define STATUS_CKSUM_OK (2) 4479a5557fdSlucy wang - Sun Microsystems - Beijing China #define STATUS_CKSUM_NOT_OK (3) 4489a5557fdSlucy wang - Sun Microsystems - Beijing China 4499a5557fdSlucy wang - Sun Microsystems - Beijing China /* owner bits of statusDesc_t */ 4509a5557fdSlucy wang - Sun Microsystems - Beijing China #define STATUS_OWNER_HOST (1ULL) 4519a5557fdSlucy wang - Sun Microsystems - Beijing China #define STATUS_OWNER_PHANTOM (2ULL) 4529a5557fdSlucy wang - Sun Microsystems - Beijing China #define HOST_STATUS_DESC ((STATUS_OWNER_HOST) << 48) 4539a5557fdSlucy wang - Sun Microsystems - Beijing China #define PHANTOM_STATUS_DESC ((STATUS_OWNER_PHANTOM) << 48) 4549a5557fdSlucy wang - Sun Microsystems - Beijing China 4559a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_PROT_IP (1) 4569a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_PROT_UNKNOWN (0) 4579a5557fdSlucy wang - Sun Microsystems - Beijing China 4589a5557fdSlucy wang - Sun Microsystems - Beijing China /* LRO specific bits of statusDesc_t */ 4599a5557fdSlucy wang - Sun Microsystems - Beijing China #define LRO_LAST_FRAG (1) 4609a5557fdSlucy wang - Sun Microsystems - Beijing China #define LRO_NORMAL_FRAG (0) 4619a5557fdSlucy wang - Sun Microsystems - Beijing China #define LRO_LAST_FRAG_DESC ((LRO_LAST_FRAG)<<63) 4629a5557fdSlucy wang - Sun Microsystems - Beijing China #define LRO_NORMAL_FRAG_DESC ((LRO_NORMAL_FRAG)<<63) 4639a5557fdSlucy wang - Sun Microsystems - Beijing China 4649a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct PREALIGN(16) statusDesc { 4659a5557fdSlucy wang - Sun Microsystems - Beijing China union { 4669a5557fdSlucy wang - Sun Microsystems - Beijing China struct { 4679a5557fdSlucy wang - Sun Microsystems - Beijing China /* initially to be used but noe now */ 4689a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t port:4, 4699a5557fdSlucy wang - Sun Microsystems - Beijing China /* completion status may not have use */ 4709a5557fdSlucy wang - Sun Microsystems - Beijing China status:4, 4719a5557fdSlucy wang - Sun Microsystems - Beijing China /* type/index of descriptor ring */ 4729a5557fdSlucy wang - Sun Microsystems - Beijing China type:4, 4739a5557fdSlucy wang - Sun Microsystems - Beijing China /* NIC mode...no use yet */ 4749a5557fdSlucy wang - Sun Microsystems - Beijing China totalLength:16, 4759a5557fdSlucy wang - Sun Microsystems - Beijing China /* handle for the associated packet */ 4769a5557fdSlucy wang - Sun Microsystems - Beijing China referenceHandle_lo:4; 4779a5557fdSlucy wang - Sun Microsystems - Beijing China /* handle for the associated packet */ 4789a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t referenceHandle_hi:12, 4799a5557fdSlucy wang - Sun Microsystems - Beijing China /* Pkt protocol */ 4809a5557fdSlucy wang - Sun Microsystems - Beijing China prot:4, 4819a5557fdSlucy wang - Sun Microsystems - Beijing China pkt_offset:5, 4829a5557fdSlucy wang - Sun Microsystems - Beijing China /* 4839a5557fdSlucy wang - Sun Microsystems - Beijing China * This indicates the num of descriptors part of this descriptor chain. 4849a5557fdSlucy wang - Sun Microsystems - Beijing China */ 4859a5557fdSlucy wang - Sun Microsystems - Beijing China descCnt:3, 4869a5557fdSlucy wang - Sun Microsystems - Beijing China owner:2, 4879a5557fdSlucy wang - Sun Microsystems - Beijing China opcode:6; 4889a5557fdSlucy wang - Sun Microsystems - Beijing China 4899a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t HashValue; 4909a5557fdSlucy wang - Sun Microsystems - Beijing China __uint16_t vlan; 4919a5557fdSlucy wang - Sun Microsystems - Beijing China __uint8_t HashType; 4929a5557fdSlucy wang - Sun Microsystems - Beijing China 4939a5557fdSlucy wang - Sun Microsystems - Beijing China union { 4949a5557fdSlucy wang - Sun Microsystems - Beijing China /* 4959a5557fdSlucy wang - Sun Microsystems - Beijing China * For LRO count is set 4969a5557fdSlucy wang - Sun Microsystems - Beijing China * Last LRO fragment is set when it is 4979a5557fdSlucy wang - Sun Microsystems - Beijing China * the last frag as the name says. 4989a5557fdSlucy wang - Sun Microsystems - Beijing China */ 4999a5557fdSlucy wang - Sun Microsystems - Beijing China __uint8_t lro_frag:7, last_lro_frag:1; 5009a5557fdSlucy wang - Sun Microsystems - Beijing China 5019a5557fdSlucy wang - Sun Microsystems - Beijing China /* 5029a5557fdSlucy wang - Sun Microsystems - Beijing China * Used to indicate direction in case 5039a5557fdSlucy wang - Sun Microsystems - Beijing China * of captured packets. Egress will 5049a5557fdSlucy wang - Sun Microsystems - Beijing China * contain EPG input, while ingress 5059a5557fdSlucy wang - Sun Microsystems - Beijing China * contains an skb copy. 5069a5557fdSlucy wang - Sun Microsystems - Beijing China */ 5079a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_CAP_DIRN_OUT 1 5089a5557fdSlucy wang - Sun Microsystems - Beijing China #define NX_CAP_DIRN_IN 2 5099a5557fdSlucy wang - Sun Microsystems - Beijing China __uint8_t direction; 5109a5557fdSlucy wang - Sun Microsystems - Beijing China 5119a5557fdSlucy wang - Sun Microsystems - Beijing China /* 5129a5557fdSlucy wang - Sun Microsystems - Beijing China * Currently for Legacy this is 0. 5139a5557fdSlucy wang - Sun Microsystems - Beijing China */ 5149a5557fdSlucy wang - Sun Microsystems - Beijing China __uint8_t nr_frags; 5159a5557fdSlucy wang - Sun Microsystems - Beijing China }u11; 5169a5557fdSlucy wang - Sun Microsystems - Beijing China 5179a5557fdSlucy wang - Sun Microsystems - Beijing China }s1; 5189a5557fdSlucy wang - Sun Microsystems - Beijing China __uint64_t body[2]; 5199a5557fdSlucy wang - Sun Microsystems - Beijing China }u1; 5209a5557fdSlucy wang - Sun Microsystems - Beijing China 5219a5557fdSlucy wang - Sun Microsystems - Beijing China } POSTALIGN(16) statusDesc_t; 5229a5557fdSlucy wang - Sun Microsystems - Beijing China 5239a5557fdSlucy wang - Sun Microsystems - Beijing China 5249a5557fdSlucy wang - Sun Microsystems - Beijing China #define STATUS_OWNER_NAME(sd) \ 5259a5557fdSlucy wang - Sun Microsystems - Beijing China (((sd)->u1.s1.owner == STATUS_OWNER_HOST) ? "Host" : "Phantom") 5269a5557fdSlucy wang - Sun Microsystems - Beijing China 5279a5557fdSlucy wang - Sun Microsystems - Beijing China #ifdef UNM_IPSECOFFLOAD 5289a5557fdSlucy wang - Sun Microsystems - Beijing China 5299a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_IPSEC_SAS 1024 5309a5557fdSlucy wang - Sun Microsystems - Beijing China #define RECEIVE_IPSEC_SA_BASE 0x8000 5319a5557fdSlucy wang - Sun Microsystems - Beijing China 5329a5557fdSlucy wang - Sun Microsystems - Beijing China /* 5339a5557fdSlucy wang - Sun Microsystems - Beijing China * IPSEC related structures and defines 5349a5557fdSlucy wang - Sun Microsystems - Beijing China */ 5359a5557fdSlucy wang - Sun Microsystems - Beijing China 5369a5557fdSlucy wang - Sun Microsystems - Beijing China /* Values for DIrFlag in the ipsec_sa_t structure below: */ 5379a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_SA_DIR_INBOUND 1 5389a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_SA_DIR_OUTBOUND 2 5399a5557fdSlucy wang - Sun Microsystems - Beijing China 5409a5557fdSlucy wang - Sun Microsystems - Beijing China /* Values for Operation Field below: */ 5419a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_SA_AUTHENTICATE 1 5429a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_SA_ENDECRYPT 2 5439a5557fdSlucy wang - Sun Microsystems - Beijing China 5449a5557fdSlucy wang - Sun Microsystems - Beijing China /* COnfidential Algorithm Types: */ 5459a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_CONF_NONE 0 // NULL encryption? 5469a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_CONF_DES 1 5479a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_CONF_RESERVED 2 5489a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_CONF_3DES 3 5499a5557fdSlucy wang - Sun Microsystems - Beijing China 5509a5557fdSlucy wang - Sun Microsystems - Beijing China /* Integrity algorithm (AH) types: */ 5519a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_INTEG_NONE 0 5529a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_INTEG_MD5 1 5539a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_IPSEC_INTEG_SHA1 2 5549a5557fdSlucy wang - Sun Microsystems - Beijing China 5559a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_PROTOCOL_OFFSET 0x9 // from ip header begin, in bytes 5569a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_PKT_TYPE_AH 0x33 5579a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_PKT_TYPE_ESP 0x32 5589a5557fdSlucy wang - Sun Microsystems - Beijing China 5599a5557fdSlucy wang - Sun Microsystems - Beijing China 5609a5557fdSlucy wang - Sun Microsystems - Beijing China /* 96 bits of output for MD5/SHA1 algorithms */ 5619a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_AHOUTPUT_LENGTH 12 5629a5557fdSlucy wang - Sun Microsystems - Beijing China /* 5639a5557fdSlucy wang - Sun Microsystems - Beijing China * 8 bytes (64 bits) of ICV value for each block of DES_CBC 5649a5557fdSlucy wang - Sun Microsystems - Beijing China * at the begin of ESP payload 5659a5557fdSlucy wang - Sun Microsystems - Beijing China */ 5669a5557fdSlucy wang - Sun Microsystems - Beijing China #define UNM_DES_ICV_LENGTH 8 5679a5557fdSlucy wang - Sun Microsystems - Beijing China 5689a5557fdSlucy wang - Sun Microsystems - Beijing China #if UNM_CONF_PROCESSOR == UNM_CONF_X86 5699a5557fdSlucy wang - Sun Microsystems - Beijing China 5709a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct PREALIGN(512) s_ipsec_sa { 5719a5557fdSlucy wang - Sun Microsystems - Beijing China U32 SrcAddr; 5729a5557fdSlucy wang - Sun Microsystems - Beijing China U32 SrcMask; 5739a5557fdSlucy wang - Sun Microsystems - Beijing China U32 DestAddr; 5749a5557fdSlucy wang - Sun Microsystems - Beijing China U32 DestMask; 5759a5557fdSlucy wang - Sun Microsystems - Beijing China U32 Protocol:8, 5769a5557fdSlucy wang - Sun Microsystems - Beijing China DirFlag:4, 5779a5557fdSlucy wang - Sun Microsystems - Beijing China IntegCtxInit:2, 5789a5557fdSlucy wang - Sun Microsystems - Beijing China ConfCtxInit:2, 5799a5557fdSlucy wang - Sun Microsystems - Beijing China No_of_keys:8, 5809a5557fdSlucy wang - Sun Microsystems - Beijing China Operation:8; 5819a5557fdSlucy wang - Sun Microsystems - Beijing China U32 IntegAlg:8, 5829a5557fdSlucy wang - Sun Microsystems - Beijing China IntegKeyLen:8, 5839a5557fdSlucy wang - Sun Microsystems - Beijing China ConfAlg:8, 5849a5557fdSlucy wang - Sun Microsystems - Beijing China ConfAlgKeyLen:8; 5859a5557fdSlucy wang - Sun Microsystems - Beijing China U32 SAIndex; 5869a5557fdSlucy wang - Sun Microsystems - Beijing China U32 SPI_Id; 5879a5557fdSlucy wang - Sun Microsystems - Beijing China U64 Key1[124]; 5889a5557fdSlucy wang - Sun Microsystems - Beijing China } POSTALIGN(512) unm_ipsec_sa_t; 5899a5557fdSlucy wang - Sun Microsystems - Beijing China 5909a5557fdSlucy wang - Sun Microsystems - Beijing China #else 5919a5557fdSlucy wang - Sun Microsystems - Beijing China 5929a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct PREALIGN(512) s_ipsec_sa { 5939a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t SrcAddr; 5949a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t SrcMask; 5959a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t DestAddr; 5969a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t DestMask; 5979a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t Protocol:8, 5989a5557fdSlucy wang - Sun Microsystems - Beijing China DirFlag:4, 5999a5557fdSlucy wang - Sun Microsystems - Beijing China IntegCtxInit:2, 6009a5557fdSlucy wang - Sun Microsystems - Beijing China ConfCtxInit:2, 6019a5557fdSlucy wang - Sun Microsystems - Beijing China No_of_keys:8, 6029a5557fdSlucy wang - Sun Microsystems - Beijing China Operation:8; 6039a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t IntegAlg:8, 6049a5557fdSlucy wang - Sun Microsystems - Beijing China IntegKeyLen:8, 6059a5557fdSlucy wang - Sun Microsystems - Beijing China ConfAlg:8, 6069a5557fdSlucy wang - Sun Microsystems - Beijing China ConfAlgKeyLen:8; 6079a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t SAIndex:32; 6089a5557fdSlucy wang - Sun Microsystems - Beijing China unm_halfmsgword_t SPI_Id:32; 6099a5557fdSlucy wang - Sun Microsystems - Beijing China /* to round up to 1K of structure */ 6109a5557fdSlucy wang - Sun Microsystems - Beijing China unm_msgword_t Key1[124]; 6119a5557fdSlucy wang - Sun Microsystems - Beijing China } POSTALIGN(512) unm_ipsec_sa_t; 6129a5557fdSlucy wang - Sun Microsystems - Beijing China 6139a5557fdSlucy wang - Sun Microsystems - Beijing China #endif /* NOT-X86 */ 6149a5557fdSlucy wang - Sun Microsystems - Beijing China 6159a5557fdSlucy wang - Sun Microsystems - Beijing China /* Other common header formats that may be needed */ 6169a5557fdSlucy wang - Sun Microsystems - Beijing China 6179a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct _unm_ip_header_s { 6189a5557fdSlucy wang - Sun Microsystems - Beijing China U32 HdrVer:8, 6199a5557fdSlucy wang - Sun Microsystems - Beijing China diffser:8, 6209a5557fdSlucy wang - Sun Microsystems - Beijing China TotalLength:16; 6219a5557fdSlucy wang - Sun Microsystems - Beijing China U32 ipId:16, 6229a5557fdSlucy wang - Sun Microsystems - Beijing China flagfrag:16; 6239a5557fdSlucy wang - Sun Microsystems - Beijing China U32 TTL:8, 6249a5557fdSlucy wang - Sun Microsystems - Beijing China Protocol:8, 6259a5557fdSlucy wang - Sun Microsystems - Beijing China Chksum:16; 6269a5557fdSlucy wang - Sun Microsystems - Beijing China U32 srcaddr; 6279a5557fdSlucy wang - Sun Microsystems - Beijing China U32 destaddr; 6289a5557fdSlucy wang - Sun Microsystems - Beijing China } unm_ip_header_t; 6299a5557fdSlucy wang - Sun Microsystems - Beijing China 6309a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct _unm_ah_header_s { 6319a5557fdSlucy wang - Sun Microsystems - Beijing China U32 NextProto:8, 6329a5557fdSlucy wang - Sun Microsystems - Beijing China length:8, 6339a5557fdSlucy wang - Sun Microsystems - Beijing China reserved:16; 6349a5557fdSlucy wang - Sun Microsystems - Beijing China U32 SPI; 6359a5557fdSlucy wang - Sun Microsystems - Beijing China U32 seqno; 6369a5557fdSlucy wang - Sun Microsystems - Beijing China U16 ICV; 6379a5557fdSlucy wang - Sun Microsystems - Beijing China U16 ICV1; 6389a5557fdSlucy wang - Sun Microsystems - Beijing China U16 ICV2; 6399a5557fdSlucy wang - Sun Microsystems - Beijing China U16 ICV3; 6409a5557fdSlucy wang - Sun Microsystems - Beijing China U16 ICV4; 6419a5557fdSlucy wang - Sun Microsystems - Beijing China U16 ICV5; 6429a5557fdSlucy wang - Sun Microsystems - Beijing China } unm_ah_header_t; 6439a5557fdSlucy wang - Sun Microsystems - Beijing China 6449a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct _unm_esp_hdr_s { 6459a5557fdSlucy wang - Sun Microsystems - Beijing China U32 SPI; 6469a5557fdSlucy wang - Sun Microsystems - Beijing China U32 seqno; 6479a5557fdSlucy wang - Sun Microsystems - Beijing China } unm_esp_hdr_t; 6489a5557fdSlucy wang - Sun Microsystems - Beijing China 6499a5557fdSlucy wang - Sun Microsystems - Beijing China #endif /* UNM_IPSECOFFLOAD */ 6509a5557fdSlucy wang - Sun Microsystems - Beijing China 6519a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6529a5557fdSlucy wang - Sun Microsystems - Beijing China * Defines for various loop counts. These determine the behaviour of the 6539a5557fdSlucy wang - Sun Microsystems - Beijing China * system. The classic tradeoff between latency and throughput. 6549a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6559a5557fdSlucy wang - Sun Microsystems - Beijing China 6569a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6579a5557fdSlucy wang - Sun Microsystems - Beijing China * MAX_DMA_LOOPCOUNT : After how many interations do we start the dma for 6589a5557fdSlucy wang - Sun Microsystems - Beijing China * the status descriptors. 6599a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6609a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_DMA_LOOPCOUNT (32) 6619a5557fdSlucy wang - Sun Microsystems - Beijing China 6629a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6639a5557fdSlucy wang - Sun Microsystems - Beijing China * MAX_TX_DMA_LOOP_COUNT : After how many interations do we start the dma for 6649a5557fdSlucy wang - Sun Microsystems - Beijing China * the command descriptors. 6659a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6669a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_TX_DMA_LOOP_COUNT 1000 6679a5557fdSlucy wang - Sun Microsystems - Beijing China 6689a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6699a5557fdSlucy wang - Sun Microsystems - Beijing China * MAX_RCV_BUFS : Max number Rx packets that can be buffered before DMA/INT 6709a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6719a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_RCV_BUFS (4096) 6729a5557fdSlucy wang - Sun Microsystems - Beijing China 6739a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6749a5557fdSlucy wang - Sun Microsystems - Beijing China * XXX;shouldnt be exposed in nic_cmn.h 6759a5557fdSlucy wang - Sun Microsystems - Beijing China * DMA_MAX_RCV_BUFS : Max number Rx packets that can be buffered before DMA 6769a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6779a5557fdSlucy wang - Sun Microsystems - Beijing China #define DMA_MAX_RCV_BUFS (4096) 6789a5557fdSlucy wang - Sun Microsystems - Beijing China 6799a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6809a5557fdSlucy wang - Sun Microsystems - Beijing China * XXX;shouldnt be exposed in nic_cmn.h 6819a5557fdSlucy wang - Sun Microsystems - Beijing China * MAX_DMA_ENTRIES : Max number Rx dma entries can be in dma list 6829a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6839a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_DMA_ENTRIES (4096) 6849a5557fdSlucy wang - Sun Microsystems - Beijing China 6859a5557fdSlucy wang - Sun Microsystems - Beijing China 6869a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6879a5557fdSlucy wang - Sun Microsystems - Beijing China * MAX_INTR_LOOPCOUNT : After how many iterations do we interrupt the 6889a5557fdSlucy wang - Sun Microsystems - Beijing China * host ? 6899a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6909a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_INTR_LOOPCOUNT (1024) 6919a5557fdSlucy wang - Sun Microsystems - Beijing China 6929a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6939a5557fdSlucy wang - Sun Microsystems - Beijing China * XMIT_LOOP_THRESHOLD : How many times do we spin before we process the 6949a5557fdSlucy wang - Sun Microsystems - Beijing China * transmit buffers. 6959a5557fdSlucy wang - Sun Microsystems - Beijing China */ 6969a5557fdSlucy wang - Sun Microsystems - Beijing China #define XMIT_LOOP_THRESHOLD 0x20 6979a5557fdSlucy wang - Sun Microsystems - Beijing China 6989a5557fdSlucy wang - Sun Microsystems - Beijing China /* 6999a5557fdSlucy wang - Sun Microsystems - Beijing China * XMIT_DESC_THRESHOLD : How many descriptors pending before we process 7009a5557fdSlucy wang - Sun Microsystems - Beijing China * the descriptors. 7019a5557fdSlucy wang - Sun Microsystems - Beijing China */ 7029a5557fdSlucy wang - Sun Microsystems - Beijing China #define XMIT_DESC_THRESHOLD 0x4 7039a5557fdSlucy wang - Sun Microsystems - Beijing China 7049a5557fdSlucy wang - Sun Microsystems - Beijing China /* 7059a5557fdSlucy wang - Sun Microsystems - Beijing China * TX_DMA_THRESHOLD : When do we start the dma of the command descriptors. 7069a5557fdSlucy wang - Sun Microsystems - Beijing China * We need these number of command descriptors, or we need to exceed the 7079a5557fdSlucy wang - Sun Microsystems - Beijing China * loop count. P1 only. 7089a5557fdSlucy wang - Sun Microsystems - Beijing China */ 7099a5557fdSlucy wang - Sun Microsystems - Beijing China #define TX_DMA_THRESHOLD 16 7109a5557fdSlucy wang - Sun Microsystems - Beijing China 7119a5557fdSlucy wang - Sun Microsystems - Beijing China #if defined(UNM_IP_FILTER) 7129a5557fdSlucy wang - Sun Microsystems - Beijing China /* 7139a5557fdSlucy wang - Sun Microsystems - Beijing China * Commands. Must match the definitions in nic/Linux/include/unm_nic_ioctl.h 7149a5557fdSlucy wang - Sun Microsystems - Beijing China */ 7159a5557fdSlucy wang - Sun Microsystems - Beijing China enum { 7169a5557fdSlucy wang - Sun Microsystems - Beijing China UNM_IP_FILTER_CLEAR = 1, 7179a5557fdSlucy wang - Sun Microsystems - Beijing China UNM_IP_FILTER_ADD, 7189a5557fdSlucy wang - Sun Microsystems - Beijing China UNM_IP_FILTER_DEL, 7199a5557fdSlucy wang - Sun Microsystems - Beijing China UNM_IP_FILTER_SHOW 7209a5557fdSlucy wang - Sun Microsystems - Beijing China }; 7219a5557fdSlucy wang - Sun Microsystems - Beijing China 7229a5557fdSlucy wang - Sun Microsystems - Beijing China #define MAX_FILTER_ENTRIES 16 7239a5557fdSlucy wang - Sun Microsystems - Beijing China 7249a5557fdSlucy wang - Sun Microsystems - Beijing China typedef struct { 7259a5557fdSlucy wang - Sun Microsystems - Beijing China __int32_t count; 7269a5557fdSlucy wang - Sun Microsystems - Beijing China __uint32_t ip_addr[15]; 7279a5557fdSlucy wang - Sun Microsystems - Beijing China } unm_ip_filter_t; 7289a5557fdSlucy wang - Sun Microsystems - Beijing China #endif /* UNM_IP_FILTER */ 7299a5557fdSlucy wang - Sun Microsystems - Beijing China 7309a5557fdSlucy wang - Sun Microsystems - Beijing China enum { 7319a5557fdSlucy wang - Sun Microsystems - Beijing China UNM_RCV_PEG_0 = 0, 7329a5557fdSlucy wang - Sun Microsystems - Beijing China UNM_RCV_PEG_1 7339a5557fdSlucy wang - Sun Microsystems - Beijing China }; 7349a5557fdSlucy wang - Sun Microsystems - Beijing China 73593833965Sjing xiong ERI-SUN #ifdef __cplusplus 73693833965Sjing xiong ERI-SUN } 73793833965Sjing xiong ERI-SUN #endif 73893833965Sjing xiong ERI-SUN 73993833965Sjing xiong ERI-SUN #endif /* !_UNM_NIC_CMN_H_ */ 740