nxge.h revision 0dc2366f7b9f9f36e10909b1e95edbf2a261c2ac
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_NXGE_NXGE_H
#define _SYS_NXGE_NXGE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <nxge_mac.h>
#include <nxge_ipp.h>
#include <nxge_fflp.h>
/*
* NXGE diagnostics IOCTLS.
*/
#define NXGE_OK 0
#define NXGE_ERROR 0x40000000
#define NXGE_DDI_FAILED 0x20000000
#define NXGE_GET_PORT_NUM(n) n
/*
* Definitions for module_info.
*/
#define NXGE_IDNUM (0) /* module ID number */
#define NXGE_MINPSZ (0) /* min packet size */
#define NXGE_LOWAT_MIN (1)
#ifndef D_HOTPLUG
#define D_HOTPLUG 0x00
#endif
#define NXGE_CHECK_TIMER (5000)
#define KT_NIU_COMPATIBLE "SUNW,niusl-kt"
typedef enum {
typedef enum {
/*
* Named Dispatch Parameter Management Structure
*/
#define NXGE_PARAM_READ 0x00000001ULL
#define NXGE_PARAM_WRITE 0x00000002ULL
#define NXGE_PARAM_SHARED 0x00000004ULL
#define NXGE_PARAM_PRIV 0x00000008ULL
#define NXGE_PARAM_RXDMA 0x00000010ULL
#define NXGE_PARAM_TXDMA 0x00000020ULL
#define NXGE_PARAM_CLASS_GEN 0x00000040ULL
#define NXGE_PARAM_MAC 0x00000080ULL
#define NXGE_PARAM_CLASS NXGE_PARAM_CLASS_HEX
#define NXGE_PARAM_CMPLX 0x00010000ULL
#define NXGE_PARAM_NDD_WR_OK 0x00020000ULL
#define NXGE_PARAM_INIT_ONLY 0x00040000ULL
#define NXGE_PARAM_INIT_CONFIG 0x00080000ULL
#define NXGE_PARAM_READ_PROP 0x00100000ULL
#define NXGE_PARAM_PROP_ARR32 0x00200000ULL
#define NXGE_PARAM_PROP_ARR64 0x00400000ULL
#define NXGE_PARAM_PROP_STR 0x00800000ULL
#define NXGE_PARAM_BASE_DEC 0x00000000ULL
#define NXGE_PARAM_BASE_BIN 0x10000000ULL
#define NXGE_PARAM_BASE_HEX 0x20000000ULL
#define NXGE_PARAM_BASE_STR 0x40000000ULL
#define NXGE_PARAM_DONT_SHOW 0x80000000ULL
#define NXGE_PARAM_ARRAY_CNT_MASK 0x0000ffff00000000ULL
#define NXGE_PARAM_ARRAY_CNT_SHIFT 32ULL
#define NXGE_PARAM_ARRAY_ALLOC_MASK 0xffff000000000000ULL
#define NXGE_PARAM_ARRAY_ALLOC_SHIFT 48ULL
typedef struct _nxge_param_t {
int (*getf)();
int (*setf)(); /* null for read only */
char *fcode_name;
char *name;
/*
* Do not change the order of the elements of this enum as that will
* break the driver code.
*/
typedef enum {
} nxge_lb_t;
enum nxge_mac_state {
NXGE_MAC_STOPPED = 0,
};
/*
* Private DLPI full dlsap address format.
*/
typedef struct _nxge_dladdr_t {
typedef struct _mc_addr_t {
} mc_addr_t, *p_mc_addr_t;
typedef struct _mc_bucket_t {
} mc_bucket_t, *p_mc_bucket_t;
typedef struct _mc_table_t {
} mc_table_t, *p_mc_table_t;
typedef struct _filter_t {
} filter_t, *p_filter_t;
typedef struct _nxge_port_stats_t {
/*
* Overall structure size
*/
/*
*/
/*
* MIB II variables
*/
/*
* Lets the user know the MTU currently in use by
* the physical MAC port.
*/
/*
* Tx Statistics.
*/
/*
* Rx Statistics.
*/
/*
* Receive buffer management statistics.
*/
/*
* Receive flow statistics
*/
/*
* PCI-E Bus Statistics.
*/
/*
* Some statistics added to support bringup, these
* should be removed.
*/
typedef struct _nxge_stats_t {
/*
* Overall structure size
*/
typedef struct _nxge_intr_t {
int intr_types; /* interrupt types supported */
int intr_type; /* interrupt type to add */
int max_int_cnt; /* max MSIX/INT HW supports */
int start_inum; /* start inum (in sequence?) */
int msi_intx_cnt; /* # msi/intx ints returned */
int intr_added; /* # ints actually needed */
int intr_cap; /* interrupt capabilities */
/* Add interrupt number for each interrupt vector */
int pri;
} nxge_intr_t, *p_nxge_intr_t;
typedef struct _nxge_ldgv_t {
} nxge_ldgv_t, *p_nxge_ldgv_t;
typedef enum {
NXGE_TRANSMIT_GROUP, /* Legacy transmit group */
NXGE_RECEIVE_GROUP, /* Legacy receive group */
NXGE_VR_GROUP, /* Virtualization Region group */
EXT_TRANSMIT_GROUP, /* External (Crossbow) transmit group */
EXT_RECEIVE_GROUP /* External (Crossbow) receive group */
typedef uint8_t nxge_channel_t;
typedef struct nxge_grp {
int sequence; /* When it was created. */
int index; /* nxge_grp_set_t.group[index] */
} nxge_grp_t;
typedef struct {
} lg_data_t;
typedef struct {
} dc_data_t;
typedef struct {
int sequence; /* To order groups in time. */
/* These are this instance's logical groups. */
/*
* Transmit Ring Group
* TX groups will be used exclusively for the purpose of Hybrid I/O. From
* the point of view of the nxge driver, the groups will be software
* constructs which will be used to establish the relationship between TX
* rings and shares.
*
* Receive Ring Group
* One of the advanced virtualization features is the ability to bundle
* multiple Receive Rings in a single group. One or more MAC addresses may
* be assigned to a group. Incoming packets destined to the group's MAC
* address(es) are delivered to any ring member, according to a programmable
* or predefined RTS policy. Member rings can be polled individually.
* RX ring groups can come with a predefined set of member rings, or they
*/
typedef struct _nxge_ring_group_t {
int gindex;
int sindex;
int rdctbl;
int n_mac_addrs;
/*
* Ring Handle
*/
typedef struct _nxge_ring_handle_t {
int index; /* port-wise */
/*
* Share Handle
*/
typedef struct _nxge_share_handle_t {
int index;
void *vrp;
int rxgroup;
/*
* Neptune Device instance state information.
*
* Each instance is dynamically allocated on first attach.
*/
struct _nxge_t {
int instance; /* instance number */
int function_num; /* device function number */
int nports; /* # of ports on this device */
int board_ver; /* Board Version */
int use_partition; /* partition is enabled */
enum nxge_mac_state nxge_mac_state;
param_pad_to_32:27;
/* Logical device and group data structures. */
/*
* Blocks of memory may be pre-allocated by the
* partition manager or the driver. They may include
* blocks for configuration and buffers. The idea is
* to preallocate big blocks of contiguous areas in
* system memory (i.e. with IOMMU). These blocks then
* will be broken up to a fixed number of blocks with
* each block having the same block size (4K, 8K, 16K or
* 32K) in the case of buffer blocks. For systems that
* do not support DVMA, more than one big block will be
* allocated.
*/
/* Receive buffer block ring and completion ring. */
/* Transmit descriptors rings */
int suspended;
void (*mii_read)();
void (*mii_write)();
void (*mii_poll)();
int fm_capabilities; /* FMA capabilities */
#if defined(sun4v)
#endif
int link_check_count;
#define NXGE_MAGIC 0x3ab434e3
int soft_lso_enable;
/* The following fields are LDOMs-specific additions. */
struct nxge_hio_vr *hio_vr;
/* Ring Handles */
/*
* KT-NIU:
* KT family will have up to 4 NIUs per system.
* SerDes, Hypervisor interfaces,
* additional NIU classification features.
*/
};
/*
* Driver state flags.
*/
#define STOP_POLL_THRESH 9
#define START_POLL_THRESH 2
typedef struct _nxge_port_kstat_t {
/*
* Transciever state informations.
*/
/*
* Link partner capabilities.
*/
/*
* Shared link setup.
*/
/*
* Lets the user know the MTU currently in use by
* the physical MAC port.
*/
/*
* Misc MAC statistics.
*/
/*
* Some statistics added to support bringup, these
* should be removed.
*/
typedef struct _nxge_rdc_kstat {
/*
* Receive DMA channel statistics.
*/
typedef struct _nxge_rdc_sys_kstat {
/*
* Receive DMA system statistics.
*/
typedef struct _nxge_tdc_kstat {
/*
* Transmit DMA channel statistics.
*/
/* used to in the common (per port) counter */
typedef struct _nxge_txc_kstat {
/*
* Transmit port TXC block statistics.
*/
typedef struct _nxge_ipp_kstat {
/*
* Receive port IPP block statistics.
*/
typedef struct _nxge_zcp_kstat {
/*
* ZCP statistics.
*/
typedef struct _nxge_mac_kstat {
/*
* Transmit MAC statistics.
*/
/*
* Receive MAC statistics.
*/
typedef struct _nxge_xmac_kstat {
/*
* XMAC statistics.
*/
typedef struct _nxge_bmac_kstat {
/*
* BMAC statistics.
*/
typedef struct _nxge_fflp_kstat {
/*
* FFLP statistics.
*/
typedef struct _nxge_mmac_kstat {
/*
* Prototype definitions.
*/
void nxge_uninit(p_nxge_t);
typedef void (*fptrv_t)();
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NXGE_NXGE_H */