bnxe.h revision d14abf155341d55053c76eeec58b787a456b753b
/*
* 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 2014 QLogic Corporation
* The contents of this file are subject to the terms of the
* QLogic End User License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing permissions
* and limitations under the License.
*/
/*
*/
#ifndef BNXE_H
#define BNXE_H
#include <sys/mac_provider.h>
#include <sys/sysmacros.h>
#include <sys/ethernet.h>
/*
* This really ticks me off! We use 'u' for naming unions
* within structures. Why is 'u' a reserved word!?!?!?
* This undef has been moved to bnxe_debug.h.
*/
//#undef u
#include "version.h"
#include "debug.h"
#include "bcmtype.h"
#include "lm_defs.h"
#include "listq.h"
#include "lm5710.h"
#include "lm.h"
#include "bd_chain.h"
#if !defined(__SunOS_MDB)
#include "command.h"
#endif
#include "bnxe_binding.h"
#if !defined(DBG) && !defined(__SunOS_MDB)
#include "bnxe_debug.h" /* wasn't included by debug.h */
#endif
#ifndef VLAN_TAGSZ
#define VLAN_TAGSZ 4
#endif
#define BNXE_RINGS
#define RSS_ID_NONE -1
#define USER_OPTION_CKSUM_NONE 0x0
#define USER_OPTION_CKSUM_L3 0x1
#define USER_OPTION_CKSUM_L3_L4 0x2
#define USER_OPTION_MTU_MIN 60
#define USER_OPTION_MTU_MAX 9216
#define USER_OPTION_MTU_DEFAULT 1500
#define USER_OPTION_NUM_RINGS_MIN 0
#define USER_OPTION_NUM_RINGS_DEFAULT_MF 1
#define USER_OPTION_NUM_RINGS_DEFAULT_SF 4
#define USER_OPTION_NUM_RINGS_DEFAULT 0
#define USER_OPTION_RX_RING_GROUPS_MIN 1
#define USER_OPTION_RX_RING_GROUPS_MAX 1
#define USER_OPTION_RX_RING_GROUPS_DEFAULT 1
#define USER_OPTION_BDS_MIN 1
#define USER_OPTION_BDS_MAX 32767
#define USER_OPTION_RX_BDS_DEFAULT 1024
#define USER_OPTION_TX_BDS_DEFAULT 1024
#define USER_OPTION_MF_BDS_DIVISOR 4
#define USER_OPTION_INTR_COALESCE_MAX 1000
#define USER_OPTION_INTR_COALESCE_RX_DEFAULT 20
#define USER_OPTION_INTR_COALESCE_TX_DEFAULT 40
#define USER_OPTION_TX_MAX_FREE_DEFAULT 32
#define USER_OPTION_RX_MAX_FREE_DEFAULT 32
//#define USER_OPTION_RX_DCOPY_THRESH_DEFAULT 0xffffffff
#define USER_OPTION_RX_DCOPY_THRESH_DEFAULT 128
//#define USER_OPTION_TX_DCOPY_THRESH_DEFAULT 0
#define USER_OPTION_TX_DCOPY_THRESH_DEFAULT 512
//#define BNXE_IP_MAXLEN 65535
#define BNXE_PKTHDR_LEN (sizeof(struct ether_vlan_header) + sizeof(struct ip) + sizeof(struct tcphdr) + BNXE_OPTION_LEN)
#define BNXE_LSO_MAXLEN (BNXE_IP_MAXLEN + sizeof(struct ether_vlan_header) - BNXE_PKTHDR_LEN) /* maximum payload */
#define BNXE_MAGIC 0x0feedead
#define BNXE_MEM_CHECK_LEN 16
#define BNXE_STR_SIZE 32
#define BNXEF_NAME "bnxef"
#ifdef __sparc
#define BNXE_DMA_ALIGNMENT 0x2000UL
#else
#define BNXE_DMA_ALIGNMENT 0x1000UL
#endif
/*
* Adding a two byte offset to the receive buffer aligns the IP header on a
* 16 byte boundary and it would put the TCP payload (assuming a 20 byte IP
* header and 20 byte TCP header) on an 8 byte boundary.
*/
#define BNXE_DMA_RX_OFFSET 2
/*
* The following two defines are used for defining limits on Tx packets.
* BNXE_MAX_DMA_HANDLES_PER_PKT is the maximum number of DMA handles that are
* pre-allocated for every Tx buffer descriptor. These DMA handles are used
* for mapping each mblk in the chain when not double copying the packet data
* into the copy buffer. BNXE_MAX_DMA_FRAGS_PER_PKT is based on the hardware
* and represents the maximum number of fragments an outgoing packet can have.
* Note that a single DMA handle can be comprised of multiple fragments which
* is very likely with LSO.
*
* As seen below BNXE_MAX_DMA_FRAGS_PER_PKT is set to 10. The actual firmware
* limit is 13 but 10 is chosen specifically for the case of LSO packets that
* are broken up across a long mblk chain. The firmware utilizes a sliding
* window on a packet's assigned buffer descriptors for LSO. The window is 10
* bds and each window (i.e. bds 1-10, 2-11, 3-12, etc), except the window
* containing the last bd, must contains at least MSS bytes. There are 'rare'
* cases where a packet sent down by the stack will not satisfy this window
* size requirement. Therefore, setting the frag limit to 10 results in any
* long chained packet (i.e. greater than 10 mblks), the trailing mblks will
* get double copied into a single copy buffer and will be pointed to by the
* last bd. This simple change will ensure the sliding window requirement is
* always satisfied. Note, LSO packets with long mblk chains are a rare
* occurance (nicdrv test01 can trigger it).
*/
#define BNXE_PDWM_THRESHOLD 8
#define BNXE_TX_RESOURCES_NO_CREDIT 0x01
#define BNXE_TX_RESOURCES_NO_DESC 0x02
#define BNXE_TX_RESOURCES_NO_OS_DMA_RES 0x08 /* Unable to allocate DMA resources. (e.g. bind error) */
#define BNXE_TX_RESOURCES_TOO_MANY_FRAGS 0x10
#define BNXE_TX_GOODXMIT 0
#define BNXE_TX_LINKDOWN 1
#define BNXE_TX_DEFERPKT 2
#define BNXE_TX_HDWRFULL 3
#define BNXE_TX_PKTERROR 4
#define BNXE_ROUTE_RING_NONE 0
#define BNXE_ROUTE_RING_TCPUDP 1
#define BNXE_ROUTE_RING_DEST_MAC 2
#define BNXE_ROUTE_RING_MSG_PRIO 3
typedef struct _BnxeDevParams
{
int checksum;
typedef struct _BnxeLinkCfg
{
} BnxeLinkCfg;
typedef struct _BnxePhyCfg
{
} BnxePhyCfg;
typedef struct _BnxeProps
{
} BnxeProps;
typedef struct _BnxeMemBlock
{
void * pBuf;
char fileName[128];
} BnxeMemBlock;
typedef struct _BnxeMemDma
{
void * pDmaVirt;
char fileName[128];
} BnxeMemDma;
typedef struct _BnxeMemRegion
{
typedef struct _um_txpacket_t
{
typedef struct _TxQueue
{
void * pUM; /* backpointer to um_device_t */
} TxQueue;
typedef struct _um_rxpacket_t
{
void * pUM; /* backpointer to um_device_t for free routine */
int idx; /* chain index used by the free routine */
typedef struct _RxQueue
{
void * pUM; /* backpointer to um_device_t */
volatile u32_t inPollMode;
} RxQueue;
typedef struct _RxQueueGroup
{
void * pUM; /* backpointer to um_device_t */
} RxQueueGroup;
typedef struct _KstatRingMap
{
void * pUM; /* reference back to um_device_t */
} KstatRingMap;
typedef struct _BnxeFcoeState
{
typedef struct _BnxeClientStats
{
typedef struct _BnxeFcoeData
{
dev_info_t * pDev;
} BnxeFcoeData;
typedef struct _BnxeIntrBlock
{
int intrCount;
int intrCapability;
typedef struct _BnxeWorkQueueInstance
{
void * pUM;
char taskqName[BNXE_STR_SIZE];
typedef struct _BnxeWorkQueues
{
/* the following are used against the clientState variable in um_device_t */
#define CLIENT_FLG_DEVI 0x001
#define CLIENT_FLG_BIND 0x002
#define CLIENT_FLG_HW 0x004
(((client) == LM_CLI_IDX_NDIS) ? \
typedef struct _um_device
{
dev_info_t * pDev;
#ifdef BNXE_DEBUG_DMA_LIST
#endif
int instance;
char devName[BNXE_STR_SIZE];
char version[BNXE_STR_SIZE];
char versionLM[BNXE_STR_SIZE];
char versionFW[BNXE_STR_SIZE];
char versionBC[BNXE_STR_SIZE];
char chipName[BNXE_STR_SIZE];
char chipID[BNXE_STR_SIZE];
char intrAlloc[BNXE_STR_SIZE];
char bus_dev_func[BNXE_STR_SIZE];
char vendor_device[BNXE_STR_SIZE];
volatile u32_t timerEnabled;
volatile u32_t intrEnabled;
/* the arrays below = LM_SB_CNT() + 1 = 17 */
int intrType;
#ifndef LM_MAX_UC_TABLE_SIZE
#endif
int fmCapabilities; /* FMA capabilities */
} um_device_t;
/* mioc[ack|nak] return values from ioctl subroutines */
enum ioc_reply
{
IOC_DONE, /* OK, reply sent */
IOC_ACK, /* OK, just send ACK */
IOC_REPLY, /* OK, just send reply */
IOC_RESTART_ACK, /* OK, restart & ACK */
IOC_RESTART_REPLY /* OK, restart & reply */
};
#define GIOCBNXELLDP (BNXE_IOC_BASE + 0)
/* IOCTLs for edebug and firmware upgrade */
struct bnxe_reg_data
{
};
struct bnxe_nvram_data
{
};
/* bnxe_cfg.c */
/* bnxe_mm.c */
int cli_idx);
/* bnxe_gld.c */
/* bnxe_hw.c */
int cid);
int cliIdx,
int cliIdx,
const uint8_t * pMcastAddr,
int cliIdx,
#if (DEVO_REV > 3)
#endif
/* bnxe_intr.c */
/* bnxe_kstat.c */
/* bnxe_rr.c */
/* bnxe_rx.c */
int cliIdx);
int idx,
int numBytes);
int cliIdx);
int cliIdx);
int cliIdx);
int cliIdx);
/* bnxe_tx.c */
int idx,
int idx);
int idx,
int cliIdx);
int cliIdx);
int cliIdx);
/* bnxe_timer.c */
/* bnxe_workq.c */
void * pWorkData,
void (*pWorkCbk)(um_device_t *, void *),
void * pWorkData);
void (*pWorkCbkGeneric)(um_device_t *));
void * pWorkData,
void (*pWorkCbk)(um_device_t *, void *),
void * pWorkData,
void (*pWorkCbkGeneric)(um_device_t *),
/* bnxe_fcoe.c */
int cmd,
void * pData,
int dataLen);
void * wqes[],
int wqeCnt);
void ** ppMap,
void * pMap,
/* bnxe_main.c */
char * BnxeDevName(void * pDev);
extern kmutex_t bnxeLoaderMutex;
extern u32_t bnxeNumPlumbed;
extern BnxeLinkCfg bnxeLinkCfg;
/* undefine this to help with dtrace analysis */
#define BNXE_LOCKS_INLINE
#ifdef BNXE_LOCKS_INLINE
#else /* not BNXE_LOCKS_INLINE */
#endif /* BNXE_LOCKS_INLINE */
}
char * pTag,
char * pTag,
/* XXX yuck (beware return strings lengths with kstat and mdb) */
{
}
{
else { return "None"; }
}
{
else { return "None"; }
}
{
else { return "None"; }
}
#endif /* BNXE_H */