myri10ge_var.h revision 04b6cca3fef9f6205a9aa479c48d196116193dd9
/*
* 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-2009 Myricom, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef MYRI10GE_VAR_H
#define MYRI10GE_VAR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/ethernet.h>
#include <sys/mac_provider.h>
#define MAC_CAPAB_POLL 0
#define MC_RESOURCES 0
#include <sys/mac_ether.h>
#ifndef MYRICOM_PRIV
#endif
#ifdef MYRICOM_PRIV
#endif
#include "myri10ge_mcp.h"
#include "myri10ge_version.h"
#define MYRI10GE_EEPROM_STRINGS_SIZE 256
#define MYRI10GE_HIGHPART_TO_U32(X) \
#define MYRI10GE_LOWPART_TO_U32(X) ((uint32_t)(X))
#define MYRI10GE_DDI_REG_SET_32_BIT_MEMORY_SPACE 2
#define MYRI10GE_DDI_REG_SET_64_BIT_MEMORY_SPACE 3
/*
* Max descriptors a TSO send can use; worst case is every descriptor
* crosses a 2KB boundary, as do the headers
*/
#ifdef MYRICOM_PRIV
#define VLAN_TAGSZ 4
#endif
#if defined DDI_INTR_IS_MSI_OR_MSIX
#define MYRI10GE_USE_MSI 1
#else
#define MYRI10GE_USE_MSI 0
#endif
struct myri10ge_dma_stuff {
};
typedef struct myri10ge_mblkq {
struct myri10ge_priv *mgp;
unsigned long cnt;
typedef struct {
struct myri10ge_dma_stuff dma;
int cnt;
int idx;
typedef struct
{
struct myri10ge_pci_saved_state {
};
struct myri10ge_jpool_entry;
struct myri10ge_jpool_entry {
struct myri10ge_jpool_entry *next;
struct myri10ge_slice_state *ss;
};
#define MYRI10GE_CPU_CACHE_SZ 64
struct myri10ge_per_cpu_jpool {
struct myri10ge_jpool_entry *head;
};
#define MYRI10GE_MAX_CPUS 64
struct myri10ge_jpool_stuff {
struct myri10ge_jpool_entry *head;
int num_alloc;
int low_water;
};
struct myri10ge_tx_ring_stats
{
};
struct myri10ge_rx_ring_stats
{
};
struct myri10ge_tx_ring_entry_stats
{
};
struct myri10ge_tx_pkt_stats {
union {
struct myri10ge_tx_ring_entry_stats s;
} un;
};
struct myri10ge_tx_dma_handle {
struct myri10ge_tx_dma_handle *next;
};
struct myri10ge_tx_dma_handle_head {
struct myri10ge_tx_dma_handle *head;
struct myri10ge_tx_dma_handle *tail;
};
struct myri10ge_rx_buffer_state {
struct myri10ge_jpool_entry *j;
};
struct myri10ge_tx_buffer_state {
mblk_t *m;
struct myri10ge_tx_dma_handle *handle;
struct myri10ge_tx_pkt_stats stat;
};
struct myri10ge_nic_stat {
struct kstat_named dma_force_physical;
struct kstat_named dma_read_bw_MBs;
struct kstat_named dma_write_bw_MBs;
struct kstat_named dma_read_write_bw_MBs;
struct kstat_named lanes;
struct kstat_named dropped_bad_crc32;
struct kstat_named dropped_bad_phy;
struct kstat_named dropped_link_overflow;
struct kstat_named dropped_no_big_buffer;
struct kstat_named dropped_no_small_buffer;
struct kstat_named dropped_overrun;
struct kstat_named dropped_pause;
struct kstat_named dropped_runt;
struct kstat_named dropped_unicast_filtered;
struct kstat_named link_changes;
struct kstat_named link_up;
};
struct myri10ge_slice_stat {
struct kstat_named lro_bad_csum;
struct kstat_named lro_flushed;
struct kstat_named lro_queued;
struct kstat_named rx_big;
struct kstat_named rx_bigbuf_firmware;
struct kstat_named rx_bigbuf_pool;
struct kstat_named rx_bigbuf_smalls;
struct kstat_named rx_copy;
struct kstat_named rx_small;
struct kstat_named rx_big_nobuf;
struct kstat_named rx_small_nobuf;
struct kstat_named tx_activate;
struct kstat_named tx_done;
struct kstat_named tx_handles_alloced;
struct kstat_named tx_req;
struct kstat_named xmit_err;
struct kstat_named xmit_lowbuf;
struct kstat_named xmit_lsobadflags;
struct kstat_named xmit_pullup;
struct kstat_named xmit_pullup_first;
struct kstat_named xmit_sched;
struct kstat_named xmit_stall;
struct kstat_named xmit_stall_early;
struct kstat_named xmit_stall_late;
struct kstat_named xmit_zero_len;
};
struct myri10ge_info {
struct kstat_named driver_version;
struct kstat_named firmware_version;
struct kstat_named firmware_name;
struct kstat_named interrupt_type;
struct kstat_named product_code;
struct kstat_named serial_number;
};
#define MYRI10GE_NIC_STAT_INC(field) \
#define MYRI10GE_SLICE_STAT_INC(field) \
#define MYRI10GE_SLICE_STAT_DEC(field) \
#define MYRI10GE_ATOMIC_SLICE_STAT_INC(field) \
atomic_add_long(&(((struct myri10ge_slice_stat *) \
#define MYRI10GE_ATOMIC_SLICE_STAT_DEC(field) \
atomic_add_long(&(((struct myri10ge_slice_stat *) \
#define MYRI10GE_SLICE_STAT(field) \
struct myri10ge_tx_copybuf
{
int len;
struct myri10ge_dma_stuff dma;
};
typedef struct
{
struct myri10ge_rx_buffer_state *info;
int cnt;
int alloc_fail;
int mask; /* number of rx slots -1 */
typedef struct
{
char *go; /* doorbell to poll sendq */
char *stop; /* doorbell to !poll sendq */
struct myri10ge_tx_buffer_state *info;
struct myri10ge_tx_copybuf *cp;
int req; /* transmits submitted */
int mask; /* number of transmit slots -1 */
int done; /* transmits completed */
int pkt_done; /* packets completed */
int active;
int sched;
struct myri10ge_tx_ring_stats stats;
int watchdog_req;
int watchdog_done;
unsigned long activate;
struct myri10ge_tx_dma_handle *free_tx_handles;
struct lro_entry;
struct lro_entry
{
int timestamp;
};
struct myri10ge_mblk_list
{
int cnt;
};
struct myri10ge_priv;
struct myri10ge_slice_state {
struct myri10ge_priv *mgp;
struct myri10ge_jpool_stuff jpool;
struct myri10ge_rx_ring_stats rx_stats;
struct lro_entry *lro_active;
struct myri10ge_dma_stuff fw_stats_dma;
int jbufs_for_smalls;
struct myri10ge_jpool_entry *small_jpool;
int j_rx_cnt;
int rx_token;
int watchdog_rx_copy;
};
struct myri10ge_priv {
struct myri10ge_slice_state *ss;
int max_intr_slots;
int num_slices;
int tx_boundary;
int watchdog_rx_pause;
int running; /* running? */
int csum_flag; /* rx_csums? */
int sram_size;
unsigned long board_span;
unsigned long iomem_base;
volatile uint32_t *irq_deassert;
char *mac_addr_string;
struct myri10ge_dma_stuff cmd_dma;
int msi_enabled;
int link_state;
int rdma_tags_available;
int intr_coal_delay;
volatile uint32_t *intr_coal_delay_ptr;
int down_cnt;
int watchdog_resets;
unsigned char *eth_z8e;
unsigned int eth_z8e_length;
int intr_size;
int intr_cnt;
int intr_cap;
unsigned int intr_pri;
int ddi_intr_type;
int pause;
int vso;
char fw_version[128];
char name[32];
char *fw_name;
char *intr_type;
char *sn_str;
char *pc_str;
int max_read_request_4k;
struct myri10ge_priv *next;
int reg_set;
int features;
int macaddr_cnt;
};
/* features bitmask */
#define MYRI10GE_TSO 1
#if defined(__GNUC__)
#define unlikely(x) __builtin_expect((x), 0)
#else
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* defined(__GNUC__) */
#define mb membar_producer
void myri10ge_put_instance(struct myri10ge_priv *);
extern int myri10ge_lro_max_aggr;
extern int myri10ge_mtu;
#ifndef ETHERNET_HEADER_SIZE
#define ETHERNET_HEADER_SIZE 14
#endif
#define MYRI10GE_POLL_NULL INT_MAX
/*
* This file uses MyriGE driver indentation.
*
* Local Variables:
* c-file-style:"sun"
* tab-width:8
* End:
*/
#ifdef __cplusplus
}
#endif
#endif /* MYRI10GE_VAR_H */