nxge_common.h revision 2d17280b54ae99042345312e1d825acc6d977fd5
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_NXGE_NXGE_COMMON_H
#define _SYS_NXGE_NXGE_COMMON_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define NXGE_DMA_START B_TRUE
#define NXGE_DMA_STOP B_FALSE
/*
* Default DMA configurations.
*/
#define NXGE_TIMER_RESO 2
#define NXGE_TIMER_LDG 2
/*
* Receive and Transmit DMA definitions
*/
#if defined(sun4v) && defined(NIU_LP_WORKAROUND)
/*
* Hypervisor to set up the logical pages
* and the driver must use contiguous memory.
*/
#define NXGE_NIU_CONTIG_RBR_MAX (NXGE_NIU_MAX_ENTRY)
#define NXGE_NIU_CONTIG_RCR_MAX (NXGE_NIU_MAX_ENTRY)
#define NXGE_NIU_CONTIG_TX_MAX (NXGE_NIU_MAX_ENTRY)
#endif
#ifdef _DMA_USES_VIRTADDR
#ifdef NIU_PA_WORKAROUND
#else
#define NXGE_DMA_BLOCK 1
#endif
#else
#endif
#define NXGE_RBR_RBB_MIN (128)
#if defined(sun4v) && defined(NIU_LP_WORKAROUND)
#define NXGE_RBR_RBB_DEFAULT 512
#define NXGE_RBR_SPARE 0
#else
#define NXGE_RBR_SPARE 0
#endif
#if defined(sun4v) && defined(NIU_LP_WORKAROUND)
#define NXGE_RCR_MAX (NXGE_NIU_CONTIG_RCR_MAX)
#define NXGE_RCR_DEFAULT (512)
#define NXGE_TX_RING_DEFAULT (512)
#else
#ifndef NIU_PA_WORKAROUND
#if defined(_BIG_ENDIAN)
#else
#ifdef USE_RX_BIG_BUF
#else
#endif
#endif
#define NXGE_TX_RING_DEFAULT (1024)
#else
#define NXGE_RCR_DEFAULT (512)
#define NXGE_TX_RING_DEFAULT (512)
#define NXGE_RCR_MAX (1024)
#define NXGE_TX_RING_MAX (1024)
#endif
#endif
#define NXGE_TX_RECLAIM 32
/* per receive DMA channel configuration data structure */
typedef struct nxge_rdc_cfg {
struct nxge_hw_list *nxge_hw_p;
/* Partitioning, DMC function zero. */
/* WRED parameters, DMC function zero */
/* RXDMA configuration, DMC */
char *rdc_mbaddr_p; /* mailbox address */
/* Software Reserved Packet Buffer Offset, DMC */
/* RBR Configuration A */
/* RBR Configuration B */
#define RBR_BKSIZE_4K 0
#define RBR_BKSIZE_8K 1
#define RBR_BKSIZE_16K 2
#define RBR_BKSIZE_32K 3
#define RBR_BUFSZ2_2K 0
#define RBR_BUFSZ2_4K 1
#define RBR_BUFSZ2_8K 2
#define RBR_BUFSZ2_16K 3
#define RBR_BUFSZ1_1K 0
#define RBR_BUFSZ1_1K_BYTES 1024
#define RBR_BUFSZ1_2K 1
#define RBR_BUFSZ1_4K 2
#define RBR_BUFSZ1_8K 3
#define RBR_BUFSZ0_256B 0
#define RBR_BUFSZ0_256_BYTES 256
#define RBR_BUFSZ0_512B 1
#define RBR_BUFSZ0_512B_BYTES 512
#define RBR_BUFSZ0_1K 2
#define RBR_BUFSZ0_1K_BYTES (1024)
#define RBR_BUFSZ0_2K 3
/* Receive buffers added by the software */
/* Receive Completion Ring Configuration A */
/* Receive Completion Ring Configuration B */
/* Logical Device Group Number */
/* Receive DMA Channel Event Mask */
/* 32 bit (set to 1) or 64 bit (set to 0) addressing mode */
/*
* Per Transmit DMA Channel Configuration Data Structure (32 TDC)
*/
typedef struct nxge_tdc_cfg {
struct nxge_hw_list *nxge_hw_p;
/* partitioning, DMC function zero (All 0s for non-partitioning) */
/* Transmit Ring Configuration */
#define TX_MAX_BUF_SIZE 4096
/* TXDMA configuration, DMC */
char *tdc_mbaddr_p; /* mailbox address */
/* Logical Device Group Number */
/* TXDMA event flags */
/* Transmit threshold before reclamation */
/* For reclaim: a wrap-around counter (packets transmitted) */
/* last packet with the mark bit set */
#define RDC_TABLE_ENTRY_METHOD_SEQ 0
#define RDC_TABLE_ENTRY_METHOD_REP 1
/* per receive DMA channel table group data structure */
typedef struct nxge_rdc_grp {
/* Common RDC and TDC configuration of DMC */
typedef struct _nxge_dma_common_cfg_t {
/* Transmit Ring */
/*
* VLAN and MAC table configurations:
* Each VLAN ID should belong to at most one RDC group.
* Each port could own multiple RDC groups.
* Each MAC should belong to one RDC group.
*/
typedef struct nxge_mv_cfg {
typedef struct nxge_param_map {
#if defined(_BIG_ENDIAN)
#else
#endif
typedef struct nxge_rcr_param {
#if defined(_BIG_ENDIAN)
#else
#endif
/* Needs to have entries in the ndd table */
/*
* Hardware properties created by fcode.
* In order for those properties visible to the user
* command ndd, we need to add the following properties
* to the ndd defined parameter array and data structures.
*
* Use default static configuration for x86.
*/
typedef struct nxge_hw_pt_cfg {
/* Expand if we have more hardware or default configurations */
/* per port configuration */
typedef struct nxge_dma_pt_cfg {
/*
* Configuration for hardware initialization based on the
* hardware properties or the default properties.
*/
/* Receive DMA channel */
/* Add more stuff later */
/* classification configuration */
typedef struct nxge_class_pt_cfg {
/* MAC table */
/* VLAN table */
/* class config value */
/* per Neptune sharable resources among ports */
typedef struct nxge_common {
/* DMA Channels: RDC and TDC */
/* Layer 2/3/4 */
/* FCRAM (hashing) */
/*
*/
typedef struct nxge_part_cfg {
/* Flow Classification Partition (flow partition select register) */
/* bits [19:15} in Hash 1. */
/* Add more here */
#define FZC_SERVICE_ENTITY 0x01
#define FZC_READ_WRITE 0x02
#define FZC_READ_ONLY 0x04
typedef struct nxge_hw_list {
struct nxge_hw_list *next;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NXGE_NXGE_COMMON_H */