nxge_txdma_hw.h revision 4496171313bed39e96f21bc2f9faf2868e267ae3
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_NXGE_NXGE_TXDMA_HW_H
#define _SYS_NXGE_NXGE_TXDMA_HW_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <nxge_defs.h>
#include <nxge_hw.h>
#if !defined(_BIG_ENDIAN)
#define SWAP(X) (X)
#else
#define SWAP(X) \
(((X >> 32) & 0x00000000ffffffff) | \
((X << 32) & 0xffffffff00000000))
#endif
/*
* Partitioning Suport: same as those defined for the RX
*/
/*
* TDC: Partitioning Support
* (Each of the following registers is for each TDC)
*/
#define TX_LOG_REG_SIZE 512
/* Transmit Addressing Mode: Set to 1 to select 32-bit addressing mode */
#define TX_ADDR_MD_SHIFT 0 /* bits 0:0 */
#define TX_ADDR_MD_MASK 0x0000000000000001ULL
typedef union _tx_addr_md_t {
struct {
#if defined(_BIG_ENDIAN)
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#if !defined(_BIG_ENDIAN)
#endif
} bits;
/* Transmit Packet Descriptor Structure */
#define TX_PKT_DESC_SAD_SHIFT 0 /* bits 43:0 */
#define TX_PKT_DESC_SAD_MASK 0x00000FFFFFFFFFFFULL
#define TX_PKT_DESC_TR_LEN_MASK 0x01FFF00000000000ULL
#define TX_PKT_DESC_NUM_PTR_MASK 0x3C00000000000000ULL
#define TX_PKT_DESC_MARK 0x4000000000000000ULL
#define TX_PKT_DESC_MARK_MASK 0x4000000000000000ULL
#define TX_PKT_DESC_SOP 0x8000000000000000ULL
#define TX_PKT_DESC_SOP_MASK 0x8000000000000000ULL
typedef union _tx_desc_t {
struct {
#if defined(_BIG_ENDIAN)
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#if !defined(_BIG_ENDIAN)
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
} bits;
} tx_desc_t, *p_tx_desc_t;
/* Transmit Ring Configuration (24 Channels) */
#if OLD
#endif
/* Transmit Ring Configuration */
#define TX_RNG_CFIG_STADDR_MASK 0x000000000007FFC0ULL
#define TX_RNG_CFIG_ADDR_MASK 0x00000FFFFFFFFFC0ULL
#define TX_RNG_CFIG_STADDR_BASE_MASK 0x00000FFFFFF80000ULL
#define TX_RNG_CFIG_LEN_MASK 0xFFF8000000000000ULL
#define TX_RNG_HEAD_TAIL_SHIFT 3
#define TX_RNG_HEAD_TAIL_WRAP_SHIFT 19
typedef union _tx_rng_cfig_t {
struct {
#if defined(_BIG_ENDIAN)
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
} bits;
/* Transmit Ring Head Low */
#define TX_RING_HDL_MASK 0x00000000FFFFFFF8ULL
typedef union _tx_ring_hdl_t {
struct {
#if defined(_BIG_ENDIAN)
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/* Transmit Ring Kick */
#define TX_RING_KICK_TAIL_MASK 0x000000FFFFFFFFFF8ULL
typedef union _tx_ring_kick_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/* Transmit Event Mask (DMC + 0x40020) */
#define TX_ENT_MSK_PKT_PRT_ERR_SHIFT 0 /* bit 0: 0 to flag */
#define TX_ENT_MSK_PKT_PRT_ERR_MASK 0x0000000000000001ULL
#define TX_ENT_MSK_CONF_PART_ERR_MASK 0x0000000000000002ULL
#define TX_ENT_MSK_NACK_PKT_RD_MASK 0x0000000000000004ULL
#define TX_ENT_MSK_NACK_PREF_MASK 0x0000000000000008ULL
#define TX_ENT_MSK_PREF_BUF_ECC_ERR_MASK 0x0000000000000010ULL
#define TX_ENT_MSK_TX_RING_OFLOW_MASK 0x0000000000000020ULL
#define TX_ENT_MSK_PKT_SIZE_ERR_MASK 0x0000000000000040ULL
#define TX_ENT_MSK_MBOX_ERR_MASK 0x0000000000000080ULL
#define TX_ENT_MSK_MK_MASK 0x0000000000008000ULL
#define TX_ENT_MSK_MK_ALL (TX_ENT_MSK_PKT_PRT_ERR_MASK | \
typedef union _tx_dma_ent_msk_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/* Transmit Control and Status (DMC + 0x40028) */
#define TX_CS_PKT_PRT_ERR_SHIFT 0 /* RO, bit 0 */
#define TX_CS_PKT_PRT_ERR_MASK 0x0000000000000001ULL
#define TX_CS_CONF_PART_ERR_MASK 0x0000000000000002ULL
#define TX_CS_NACK_PKT_RD_MASK 0x0000000000000004ULL
#define TX_CS_PREF_MASK 0x0000000000000008ULL
#define TX_CS_PREF_BUF_PAR_ERR_MASK 0x0000000000000010ULL
#define TX_CS_RING_OFLOW_MASK 0x0000000000000020ULL
#define TX_CS_PKT_SIZE_ERR_MASK 0x0000000000000040ULL
#define TX_CS_MMK_MASK 0x0000000000004000ULL
#define TX_CS_MK_MASK 0x0000000000008000ULL
#define TX_CS_SNG_MASK 0x0000000008000000ULL
#define TX_CS_STOP_N_GO_MASK 0x0000000010000000ULL
#define TX_CS_MB_MASK 0x0000000020000000ULL
#define TX_CS_RST_STATE_MASK 0x0000000040000000ULL
#define TX_CS_RST_MASK 0x0000000080000000ULL
#define TX_CS_LASTMARK_MASK 0x00000FFF00000000ULL
#define TX_CS_PKT_CNT_MASK 0x0FFF000000000000ULL
/* Trasnmit Control and Status */
typedef union _tx_cs_t {
struct {
#ifdef _BIG_ENDIAN
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
} bits;
/* Trasnmit Mailbox High (DMC + 0x40030) */
#define TXDMA_MBH_SHIFT 0 /* bit 11:0 */
#define TXDMA_MBH_MASK 0x0000000000000FFFULL
typedef union _txdma_mbh_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
} txdma_mbh_t, *p_txdma_mbh_t;
/* Trasnmit Mailbox Low (DMC + 0x40038) */
#define TXDMA_MBL_MASK 0x00000000FFFFFFC0ULL
typedef union _txdma_mbl_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
} txdma_mbl_t, *p_txdma_mbl_t;
/* Trasnmit Prefetch State High (DMC + 0x40040) */
#define TX_DMA_PREF_ST_SHIFT 0 /* bit 5:0 */
#define TX_DMA_PREF_ST_MASK 0x000000000000003FULL
typedef union _tx_dma_pre_st_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/* Trasnmit Ring Error Log High (DMC + 0x40048) */
#define TX_RNG_ERR_LOGH_ERR_ADDR_SHIFT 0 /* RO bit 11:0 */
#define TX_RNG_ERR_LOGH_ERR_ADDR_MASK 0x0000000000000FFFULL
#define TX_RNG_ERR_LOGH_ADDR_SHIFT 32
#define TX_RNG_ERR_LOGH_ERRCODE_MASK 0x000000003C000000ULL
#define TX_RNG_ERR_LOGH_MERR_MASK 0x0000000040000000ULL
#define TX_RNG_ERR_LOGH_ERR_MASK 0x0000000080000000ULL
/* Transmit Ring Error codes */
#define TXDMA_RING_PKT_PRT_ERR 0
#define TXDMA_RING_CONF_PART_ERR 0x01
#define TXDMA_RING_NACK_PKT_ERR 0x02
#define TXDMA_RING_NACK_PREF_ERR 0x03
#define TXDMA_RING_PREF_BUF_PAR_ERR 0x04
#define TXDMA_RING_TX_RING_OFLOW_ERR 0x05
#define TXDMA_RING_PKT_SIZE_ERR 0x06
typedef union _tx_rng_err_logh_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/* Trasnmit Ring Error Log Log (DMC + 0x40050) */
#define TX_RNG_ERR_LOGL_ERR_ADDR_SHIFT 0 /* RO bit 31:0 */
#define TX_RNG_ERR_LOGL_ERR_ADDR_MASK 0x00000000FFFFFFFFULL
typedef union _tx_rng_err_logl_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/*
* TDMC_INTR_RBG_REG (DMC + 0x40060)
*/
typedef union _tdmc_intr_dbg_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
/*
* TX_CS_DBG (DMC + 0x40068)
*/
typedef union _tx_cs_dbg_t {
struct {
#ifdef _BIG_ENDIAN
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
#endif
} bits;
} tx_cs_dbg_t, *p_tx_cs_dbg_t;
#define TXDMA_MAILBOX_BYTE_LENGTH 64
#define TXDMA_MAILBOX_UNUSED 24
typedef struct _txdma_mailbox_t {
#if OLD
/* Transmit Ring Scheduler (per port) */
#define TX_DMA_MAP_SHIFT 0 /* RO bit 31:0 */
#define TX_DMA_MAPMASK 0x00000000FFFFFFFFULL
typedef union _tx_dma_map_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
#endif
#if OLD
/* Transmit Ring Scheduler: DRR Weight (32 Channels) */
#define DRR_WT_SHIFT 0 /* RO bit 19:0 */
#define DRR_WT_MASK 0x00000000000FFFFFULL
typedef union _drr_wt_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
} drr_wt_t, *p_drr_wt_t;
#endif
#if OLD
/* Performance Monitoring (32 Channels) */
#define TXRNG_USE_CNT_SHIFT 0 /* RO bit 26:0 */
#define TXRNG_USE_CNT_MASK 0x0000000007FFFFFFULL
#define TXRNG_USE_OFLOW_SHIFT 0 /* RO bit 27 */
#define TXRNG_USE_OFLOW_MASK 0x0000000008000000ULL
typedef union _txrng_use_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
} txrng_use_t, *p_txrng_use_t;
#endif
/*
* Internal Transmit Packet Format (16 bytes)
*/
#define TX_PKT_HEADER_SIZE 16
#define TX_MAX_GATHER_POINTERS 15
#define TX_GATHER_POINTERS_THRESHOLD 8
/*
* There is bugs in the hardware
* and max sfter len is changed from 4096 to 4076.
*
* Jumbo from 9500 to 9216
*/
#define TX_MAX_TRANSFER_LENGTH 4076
#define TX_JUMBO_MTU 9216
#define TX_PKT_HEADER_PAD_SHIFT 0 /* bit 2:0 */
#define TX_PKT_HEADER_PAD_MASK 0x0000000000000007ULL
#define TX_PKT_HEADER_TOT_XFER_LEN_MASK 0x000000000000FFF8ULL
#define TX_PKT_HEADER_L4STUFF_MASK 0x0000003F00000000ULL
#define TX_PKT_HEADER_L4START_MASK 0x00003F0000000000ULL
#define TX_PKT_HEADER_TCP_UDP_CRC32C_SET 0x0200000000000000ULL
#define TX_PKT_HEADER_TCP_UDP_CRC32C_MASK 0x0200000000000000ULL
#define TX_PKT_HEADER_L4_PROTO_OP_MASK 0x0C00000000000000ULL
#define TX_PKT_HEADER_V4_HDR_CS_SET 0x1000000000000000ULL
#define TX_PKT_HEADER_V4_HDR_CS_MASK 0x1000000000000000ULL
#define TX_PKT_HEADER_IP_VER_MASK 0x2000000000000000ULL
#define TX_PKT_HEADER_PKT_TYPE_MASK 0x4000000000000000ULL
/* L4 Prototol Operations */
#define TX_PKT_L4_PROTO_OP_NOP 0x00
#define TX_PKT_L4_PROTO_OP_FULL_L4_CSUM 0x01
#define TX_PKT_L4_PROTO_OP_L4_PAYLOAD_CSUM 0x02
#define TX_PKT_L4_PROTO_OP_SCTP_CRC32 0x04
/* Transmit Packet Types */
#define TX_PKT_PKT_TYPE_NOP 0x00
#define TX_PKT_PKT_TYPE_TCP 0x01
#define TX_PKT_PKT_TYPE_UDP 0x02
#define TX_PKT_PKT_TYPE_SCTP 0x03
typedef union _tx_pkt_header_t {
struct {
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} hdw;
} bits;
typedef struct _tx_pkt_hdr_all_t {
/* Debug only registers */
#define TDMC_INJ_PAR_ERR_MASK 0x0000000000FFFFFFULL
#define TDMC_INJ_PAR_ERR_MASK_N2 0x000000000000FFFFULL
typedef union _tdmc_inj_par_err_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
typedef union _tdmc_inj_par_err_n2_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
#define TDMC_DBG_SEL_MASK 0x000000000000003FULL
typedef union _tdmc_dbg_sel_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
#define TDMC_TRAINING_MASK 0x00000000FFFFFFFFULL
typedef union _tdmc_training_t {
struct {
#ifdef _BIG_ENDIAN
#endif
struct {
#if defined(_BIT_FIELDS_HTOL)
#elif defined(_BIT_FIELDS_LTOH)
#endif
} ldw;
#ifndef _BIG_ENDIAN
#endif
} bits;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NXGE_NXGE_TXDMA_HW_H */