/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 NetXen, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _UNM_NIC_CMN_H_
#define _UNM_NIC_CMN_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef sun
#include "unm_nic_config.h"
#include "unm_compiler_defs.h"
#endif
/* Opcodes to be used with the commands */
/* The following opcodes are for IP checksum */
#define NETXEN_MAC_NOOP 0
/* The following opcodes are for internal consumption. */
enum {
};
#ifdef UNM_RSS
#endif
#define PORT1 0
#define DUMMY_BUF_INIT 0
/*
* Following are the states of the Phantom. Phantom will set them and
* Host will read to check if the fields are correct.
*/
/* Host writes the following to notify that it has done the init-handshake */
/* Following defines will be used in the status descriptor */
/* descriptor types */
#define RCV_DESC_NORMAL_CTXID 0
/*
* Following data structures describe the descriptors that will be used.
* Added fileds of tcpHdrSize and ipHdrSize, The driver needs to do it only when
* we are doing LSO (above the 1500 size packet) only.
* This is an overhead but we need it. Let me know if you have questions.
*/
/*
* the size of reference handle been changed to 16 bits to pass the MSS fields
* for the LSO packet
*/
#if UNM_CONF_PROCESSOR == UNM_CONF_X86
#ifndef U64
typedef unsigned long long U64;
#endif
#endif
/* define opcode for ctx_msg */
#define RX_PRODUCER 0
typedef struct __msg
{
typedef struct __int_msg
{
/* For use in CRB_MPORT_MODE */
typedef struct _RcvContext
{
{
/* one command ring */
/* three receive rings */
/* one status ring */
#ifdef UNM_RSS
/*
* RSS_SreInfo{} has the information for SRE to calculate the hash value
* Will be passed by the host=> as part of comd descriptor...
*/
#if UNM_CONF_PROCESSOR == UNM_CONF_X86
typedef struct _RSS_SreInfo {
#endif
/*
* The following Descriptor is used to send RSS commands to the
* PEG.... to be do the SRE registers..
*/
{
/*
* To keep the opcode at the same location as
* the cmdDescType0, we will have to breakup the key into
* 2 areas.... Dont like it but for now will do... FSL
*/
#if UNM_CONF_PROCESSOR == UNM_CONF_X86
HashKeySize:8,
Unused: 16,
opcode:8;
#else
HashKeySize:8,
Unused:16,
opcode:8;
#endif
#endif /* UNM_RSS */
{
union {
struct {
/* total number of segments (buffers */
/* for this packet. (could be more than 4) */
/* Total size of the packet */
}s1;
}u1;
union {
struct {
}s1;
}u2;
union {
struct {
/* changed to U16 to add mss */
/* passed by NDIS_PACKET for LSO */
/* LSO only : MAC+IP+TCP Hdr size */
/* IPSec offoad only */
}s1;
}u3;
union {
struct {
}s1;
}u4;
union {
struct {
}s1;
}u5;
union {
struct {
}s1;
}u6;
union {
struct {
}s1;
}u7;
/* Note: sizeof(rcvDesc) should always be a mutliple of 2 */
typedef struct rcvDesc
{
/* allocated buffer length (usually 2K) */
} rcvDesc_t;
/* for status field in statusDesc_t */
/* owner bits of statusDesc_t */
#define UNM_PROT_UNKNOWN (0)
/* LRO specific bits of statusDesc_t */
#define LRO_NORMAL_FRAG (0)
union {
struct {
/* initially to be used but noe now */
/* completion status may not have use */
/* NIC mode...no use yet */
/* handle for the associated packet */
/* handle for the associated packet */
/* Pkt protocol */
/*
* This indicates the num of descriptors part of this descriptor chain.
*/
union {
/*
* For LRO count is set
* Last LRO fragment is set when it is
* the last frag as the name says.
*/
/*
* Used to indicate direction in case
* of captured packets. Egress will
* contain EPG input, while ingress
* contains an skb copy.
*/
/*
* Currently for Legacy this is 0.
*/
}u11;
}s1;
}u1;
#ifdef UNM_IPSECOFFLOAD
/*
* IPSEC related structures and defines
*/
/* Values for DIrFlag in the ipsec_sa_t structure below: */
/* Values for Operation Field below: */
/* COnfidential Algorithm Types: */
/* Integrity algorithm (AH) types: */
#define UNM_IPSEC_INTEG_NONE 0
/*
* 8 bytes (64 bits) of ICV value for each block of DES_CBC
* at the begin of ESP payload
*/
#if UNM_CONF_PROCESSOR == UNM_CONF_X86
DirFlag:4,
IntegCtxInit:2,
ConfCtxInit:2,
No_of_keys:8,
Operation:8;
IntegKeyLen:8,
ConfAlg:8,
#else
DirFlag:4,
IntegCtxInit:2,
ConfCtxInit:2,
No_of_keys:8,
Operation:8;
IntegKeyLen:8,
ConfAlg:8,
/* to round up to 1K of structure */
#endif /* NOT-X86 */
/* Other common header formats that may be needed */
typedef struct _unm_ip_header_s {
typedef struct _unm_ah_header_s {
typedef struct _unm_esp_hdr_s {
#endif /* UNM_IPSECOFFLOAD */
/*
* Defines for various loop counts. These determine the behaviour of the
* system. The classic tradeoff between latency and throughput.
*/
/*
* MAX_DMA_LOOPCOUNT : After how many interations do we start the dma for
* the status descriptors.
*/
/*
* MAX_TX_DMA_LOOP_COUNT : After how many interations do we start the dma for
* the command descriptors.
*/
/*
*/
/*
* XXX;shouldnt be exposed in nic_cmn.h
* DMA_MAX_RCV_BUFS : Max number Rx packets that can be buffered before DMA
*/
/*
* XXX;shouldnt be exposed in nic_cmn.h
* MAX_DMA_ENTRIES : Max number Rx dma entries can be in dma list
*/
/*
* MAX_INTR_LOOPCOUNT : After how many iterations do we interrupt the
* host ?
*/
/*
* XMIT_LOOP_THRESHOLD : How many times do we spin before we process the
* transmit buffers.
*/
/*
* XMIT_DESC_THRESHOLD : How many descriptors pending before we process
* the descriptors.
*/
/*
* TX_DMA_THRESHOLD : When do we start the dma of the command descriptors.
* We need these number of command descriptors, or we need to exceed the
* loop count. P1 only.
*/
#if defined(UNM_IP_FILTER)
/*
* Commands. Must match the definitions in nic/Linux/include/unm_nic_ioctl.h
*/
enum {
};
typedef struct {
#endif /* UNM_IP_FILTER */
enum {
UNM_RCV_PEG_0 = 0,
};
#ifdef __cplusplus
}
#endif
#endif /* !_UNM_NIC_CMN_H_ */