view usr/src/uts/sun4v/sys/nxge/nxge_mac.h @ 3156:30109e935ec8

FWARC/2006/175 MD definition for N2 CWQ FWARC/2006/201 sun4v error handling update FWARC/2006/425 NCS HV API Update 2 FWARC/2006/429 Niagara2 Perf Regs HV API FWARC/2006/474 pci io hv iommu attributes update FWARC/2006/481 Niagara-2 Random Number Generator API FWARC/2006/524 Niagara2 Network Interface Unit Hypervisor API FWARC/2006/556 NIU/SIU Device Tree Bindings and Machine Description Definitions FWARC/2006/567 Niagara Crypto & RNG compatible property update PSARC/2006/459 Huron 1u/2u Platform Support PSARC/2006/520 Niagara 2 Random Number Generator PSARC/2006/521 Niagara 2 Cryptographic Provider PSARC/2006/645 Niagara II NIU 10Gbit Ethernet Driver 6477049 ON support for UltraSPARC-T2 processor 6375797 Add support for SUN4V IOMMU extensions 6480942 Crypto support for UltraSPARC-T2 processor 6480959 NIU support for UltraSPARC-T2 processor 6483040 ON platform support for Huron (SPARC-Enterprise-T5120 & SPARC-Enterprise-T5220)
author girish
date Wed, 22 Nov 2006 11:47:19 -0800
parents
children 291de731dfdf
line wrap: on
line source

/*
 * 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
 * or http://www.opensolaris.org/os/licensing.
 * 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_MAC_H
#define	_SYS_NXGE_NXGE_MAC_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#include <nxge_mac_hw.h>
#include <npi_mac.h>

#define	NXGE_MTU_DEFAULT_MAX	1522	/* 0x5f2 */

#define	NXGE_XMAC_TX_INTRS	(ICFG_XMAC_TX_ALL & \
					~(ICFG_XMAC_TX_FRAME_XMIT |\
					ICFG_XMAC_TX_BYTE_CNT_EXP |\
					ICFG_XMAC_TX_FRAME_CNT_EXP))
#define	NXGE_XMAC_RX_INTRS	(ICFG_XMAC_RX_ALL & \
					~(ICFG_XMAC_RX_FRAME_RCVD |\
					ICFG_XMAC_RX_OCT_CNT_EXP |\
					ICFG_XMAC_RX_HST_CNT1_EXP |\
					ICFG_XMAC_RX_HST_CNT2_EXP |\
					ICFG_XMAC_RX_HST_CNT3_EXP |\
					ICFG_XMAC_RX_HST_CNT4_EXP |\
					ICFG_XMAC_RX_HST_CNT5_EXP |\
					ICFG_XMAC_RX_HST_CNT6_EXP |\
					ICFG_XMAC_RX_BCAST_CNT_EXP |\
					ICFG_XMAC_RX_MCAST_CNT_EXP |\
					ICFG_XMAC_RX_HST_CNT7_EXP))
#define	NXGE_BMAC_TX_INTRS	(ICFG_BMAC_TX_ALL & \
					~(ICFG_BMAC_TX_FRAME_SENT |\
					ICFG_BMAC_TX_BYTE_CNT_EXP |\
					ICFG_BMAC_TX_FRAME_CNT_EXP))
#define	NXGE_BMAC_RX_INTRS	(ICFG_BMAC_RX_ALL & \
					~(ICFG_BMAC_RX_FRAME_RCVD |\
					ICFG_BMAC_RX_FRAME_CNT_EXP |\
					ICFG_BMAC_RX_BYTE_CNT_EXP))

/* Common MAC statistics */

typedef	struct _nxge_mac_stats {
	/*
	 * MTU size
	 */
	uint32_t	mac_mtu;
	uint16_t	rev_id;

	/*
	 * Transciever state informations.
	 */
	uint32_t	xcvr_inits;
	xcvr_inuse_t	xcvr_inuse;
	uint32_t	xcvr_portn;
	uint32_t	xcvr_id;
	uint32_t	serdes_inits;
	uint32_t	serdes_portn;
	uint32_t	cap_autoneg;
	uint32_t	cap_10gfdx;
	uint32_t	cap_10ghdx;
	uint32_t	cap_1000fdx;
	uint32_t	cap_1000hdx;
	uint32_t	cap_100T4;
	uint32_t	cap_100fdx;
	uint32_t	cap_100hdx;
	uint32_t	cap_10fdx;
	uint32_t	cap_10hdx;
	uint32_t	cap_asmpause;
	uint32_t	cap_pause;

	/*
	 * Advertised capabilities.
	 */
	uint32_t	adv_cap_autoneg;
	uint32_t	adv_cap_10gfdx;
	uint32_t	adv_cap_10ghdx;
	uint32_t	adv_cap_1000fdx;
	uint32_t	adv_cap_1000hdx;
	uint32_t	adv_cap_100T4;
	uint32_t	adv_cap_100fdx;
	uint32_t	adv_cap_100hdx;
	uint32_t	adv_cap_10fdx;
	uint32_t	adv_cap_10hdx;
	uint32_t	adv_cap_asmpause;
	uint32_t	adv_cap_pause;

	/*
	 * Link partner capabilities.
	 */
	uint32_t	lp_cap_autoneg;
	uint32_t	lp_cap_10gfdx;
	uint32_t	lp_cap_10ghdx;
	uint32_t	lp_cap_1000fdx;
	uint32_t	lp_cap_1000hdx;
	uint32_t	lp_cap_100T4;
	uint32_t	lp_cap_100fdx;
	uint32_t	lp_cap_100hdx;
	uint32_t	lp_cap_10fdx;
	uint32_t	lp_cap_10hdx;
	uint32_t	lp_cap_asmpause;
	uint32_t	lp_cap_pause;

	/*
	 * Physical link statistics.
	 */
	uint32_t	link_T4;
	uint32_t	link_speed;
	uint32_t	link_duplex;
	uint32_t	link_asmpause;
	uint32_t	link_pause;
	uint32_t	link_up;

	/* Promiscous mode */
	boolean_t	promisc;
} nxge_mac_stats_t;

/* XMAC Statistics */

typedef	struct _nxge_xmac_stats {
	uint32_t tx_frame_cnt;
	uint32_t tx_underflow_err;
	uint32_t tx_maxpktsize_err;
	uint32_t tx_overflow_err;
	uint32_t tx_fifo_xfr_err;
	uint64_t tx_byte_cnt;
	uint32_t rx_frame_cnt;
	uint32_t rx_underflow_err;
	uint32_t rx_overflow_err;
	uint32_t rx_crc_err_cnt;
	uint32_t rx_len_err_cnt;
	uint32_t rx_viol_err_cnt;
	uint64_t rx_byte_cnt;
	uint64_t rx_hist1_cnt;
	uint64_t rx_hist2_cnt;
	uint64_t rx_hist3_cnt;
	uint64_t rx_hist4_cnt;
	uint64_t rx_hist5_cnt;
	uint64_t rx_hist6_cnt;
	uint64_t rx_hist7_cnt;
	uint64_t rx_broadcast_cnt;
	uint64_t rx_mult_cnt;
	uint32_t rx_frag_cnt;
	uint32_t rx_frame_align_err_cnt;
	uint32_t rx_linkfault_err_cnt;
	uint32_t rx_remotefault_err;
	uint32_t rx_localfault_err;
	uint32_t rx_pause_cnt;
	uint32_t tx_pause_state;
	uint32_t tx_nopause_state;
	uint32_t xpcs_deskew_err_cnt;
	uint32_t xpcs_ln0_symbol_err_cnt;
	uint32_t xpcs_ln1_symbol_err_cnt;
	uint32_t xpcs_ln2_symbol_err_cnt;
	uint32_t xpcs_ln3_symbol_err_cnt;
} nxge_xmac_stats_t, *p_nxge_xmac_stats_t;

/* BMAC Statistics */

typedef	struct _nxge_bmac_stats {
	uint64_t tx_frame_cnt;
	uint32_t tx_underrun_err;
	uint32_t tx_max_pkt_err;
	uint64_t tx_byte_cnt;
	uint64_t rx_frame_cnt;
	uint64_t rx_byte_cnt;
	uint32_t rx_overflow_err;
	uint32_t rx_align_err_cnt;
	uint32_t rx_crc_err_cnt;
	uint32_t rx_len_err_cnt;
	uint32_t rx_viol_err_cnt;
	uint32_t rx_pause_cnt;
	uint32_t tx_pause_state;
	uint32_t tx_nopause_state;
} nxge_bmac_stats_t, *p_nxge_bmac_stats_t;

typedef struct _hash_filter_t {
	uint_t hash_ref_cnt;
	uint16_t hash_filter_regs[NMCFILTER_REGS];
	uint32_t hash_bit_ref_cnt[NMCFILTER_BITS];
} hash_filter_t, *p_hash_filter_t;

typedef	struct _nxge_mac {
	uint8_t			portnum;
	nxge_port_t		porttype;
	nxge_port_mode_t	portmode;
	nxge_linkchk_mode_t	linkchkmode;
	boolean_t		is_jumbo;
	uint32_t		tx_config;
	uint32_t		rx_config;
	uint32_t		xif_config;
	uint32_t		tx_iconfig;
	uint32_t		rx_iconfig;
	uint32_t		ctl_iconfig;
	uint16_t		minframesize;
	uint16_t		maxframesize;
	uint16_t		maxburstsize;
	uint16_t		ctrltype;
	uint16_t		pa_size;
	uint8_t			ipg[3];
	struct ether_addr	mac_addr;
	struct ether_addr	alt_mac_addr[MAC_MAX_ALT_ADDR_ENTRY];
	struct ether_addr	mac_addr_filter;
	uint16_t		hashtab[MAC_MAX_HASH_ENTRY];
	hostinfo_t		hostinfo[MAC_MAX_HOST_INFO_ENTRY];
	nxge_mac_stats_t	*mac_stats;
	nxge_xmac_stats_t	*xmac_stats;
	nxge_bmac_stats_t	*bmac_stats;
} nxge_mac_t;

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_NXGE_NXGE_MAC_H */