/*******************************************************************************
* 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 2014 QLogic Corporation
* The contents of this file are subject to the terms of the
* QLogic End User License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing permissions
* and limitations under the License.
*
******************************************************************************/
#ifndef _LM_DEFS_H
#define _LM_DEFS_H
#include "bcmtype.h"
/*******************************************************************************
* Simple constants.
******************************************************************************/
#ifndef TRUE
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL ((void *) 0)
#endif
/* Signatures for integrity checks. */
/* This macro rounds the given value to the next word boundary if it
* is not already at a word boundary. */
/* This macro determines the delta to the next alignment which is
* either 1, 2, 4, 8, 16, 32, etc. */
/* This macro returns the pointer to the next alignment if the pointer
* is not currently on the indicated alignment boundary. */
/*******************************************************************************
* Status codes.
******************************************************************************/
typedef enum
{
LM_STATUS_SUCCESS = 0,
} lm_status_t;
/*******************************************************************************
* Receive filter masks.
******************************************************************************/
/*******************************************************************************
* Flow control.
******************************************************************************/
/* This value can be or-ed with RECEIVE_PAUSE and TRANSMIT_PAUSE. If the
* auto-negotiation is disabled and the RECEIVE_PAUSE and TRANSMIT_PAUSE
* bits are set, then flow control is enabled regardless of link partner's
* flow control capability. Otherwise, if this bit is set, then flow
* is negotiated with the link partner. Values 0x80000000 and 0x80000003 are
* equivalent. */
/*******************************************************************************
* EEE control.
******************************************************************************/
// values match the registry values for EeeCtrlMode . Default is MED ("Balanced")
typedef enum
{
/*******************************************************************************
* media type.
******************************************************************************/
#define SET_MEDIUM_TYPE(m, t) \
(m) = ((m) & ~LM_MEDIUM_TYPE_MASK) | (t)
#define LM_MEDIUM_IS_LOOPBACK(_medium) (((GET_MEDIUM_TYPE(_medium)) == LM_MEDIUM_TYPE_BMAC_LOOPBACK) || \
#define SET_MEDIUM_SPEED(m, s) \
(m) = ((m) & ~LM_MEDIUM_SPEED_MASK) | (s)
#define SET_MEDIUM_DUPLEX(m, d) \
(m) = ((m) & ~LM_MEDIUM_HALF_DUPLEX) | (d)
typedef struct _lm_link_settings_t
{
/*******************************************************************************
* Power state.
******************************************************************************/
typedef enum
{
LM_POWER_STATE_D0 = 0,
/*******************************************************************************
* offloading.
******************************************************************************/
/*******************************************************************************
* RSS Hash Types
******************************************************************************/
/*******************************************************************************
* Chip reset reasons.
******************************************************************************/
typedef enum
{
LM_REASON_NONE = 0,
} lm_reason_t;
/*******************************************************************************
* Wake up mode.
******************************************************************************/
#define LM_WAKE_UP_MODE_NONE 0
/*******************************************************************************
* Event code.
******************************************************************************/
typedef enum
{
/*******************************************************************************
* Transmit control flags.
******************************************************************************/
/**
* If this flag is set, the firmware will ignore global
* configuration (except Outer VLAN)and will handle inner Vlan
* only according to driver instructions on the bd:
* 1. LM_TX_FLAG_VLAN_TAG_EXISTS.
* 2. LM_TX_FLAG_INSERT_VLAN_TAG.
* Note that if set the firmware will not handle default vlan /
* NIV tag / DCB.
*/
/* Encapsulated packet offload flags. */
typedef struct _lm_pkt_tx_info_t
{
/* Everest only fields. */
/* Encapsulated packet offsets. These fields are only valid when
* LM_TX_FLAG_IS_ENCAP_PACKET is set. */
/*******************************************************************************
* Receive control flags.
******************************************************************************/
typedef struct _lm_pkt_rx_info_t
{
/* Virtual address corresponding to the first byte of the first SGL entry.
* This is the starting location of the packet which may begin with some
* control information. */
/* these fields only valid when LM_RX_FLAG_START_RSC_TPA is set */
/* if the packet is RSC, this field will hold the total size of the
* RSC SCU */
/*******************************************************************************
* various type of counters.
******************************************************************************/
typedef enum
{
} lm_stats_t;
/*******************************************************************************
* 64-bit value.
******************************************************************************/
typedef union _lm_u64_t
{
struct _lm_u64_as_u32_t
{
#ifdef BIG_ENDIAN_HOST
#else
#endif
} as_u32;
void *as_ptr;
} lm_u64_t;
/* 64-bit increment. The second argument is a 32-bit value. */
{ \
\
{ \
} \
}
/* 64-bit decrement. The second argument is a 32-bit value. */
{ \
\
{ \
} \
}
/*******************************************************************************
* IP4 and TCP offload stats.
******************************************************************************/
typedef struct _lm_ip4_offload_stats_t
{
typedef struct _lm_tcp_offload_stats_t
{
/*******************************************************************************
* Host to network order conversion.
******************************************************************************/
#ifdef BIG_ENDIAN_HOST
#ifndef HTON16
#endif
#ifndef HTON32
#ifndef NTOH16
#endif
#endif
#ifndef NTOH32
#endif
#else
#ifndef HTON16
#endif
#ifndef HTON32
#endif
#ifndef NTOH16
#endif
#ifndef NTOH32
#endif
#endif
/*******************************************************************************
* Fragment structure.
******************************************************************************/
typedef struct _lm_frag_t
{
#if defined(_WIN64) /* mirror the SCATTER_GATHER_ELEMENT structure. */
#else
#endif
} lm_frag_t;
typedef struct _lm_frag_list_t
{
#if defined(_WIN64) /* mirror the SCATTER_GATHER_LIST structure. */
#else
#endif
/* a macro for declaring 'lm_frag_list_t' with various array sizes. */
typedef struct _##_FRAG_LIST_TYPE_NAME \
{ \
/*******************************************************************************
* DCBX indicate event parameters.
******************************************************************************/
typedef enum _dcb_condition_selector_t
{
typedef enum _action_selector_t
{
typedef struct _dcb_classif_elem_t
{
typedef enum _dcb_classif_version_t
{
typedef struct _dcb_classif_params_t
{
void *classif_table;
typedef struct _dcb_pfc_param_t
{
typedef enum _tsa_assignment
{
typedef struct _dcb_ets_tsa_param_t
{
typedef struct _dcb_indicate_event_params_t
{
/*******************************************************************************
* Macro fore calculating the address of the base of the structure given its
* type, and an address of a field within the structure.
******************************************************************************/
/*******************************************************************************
* Simple macros.
******************************************************************************/
(((unsigned char *) (eth_addr))[0] == ((unsigned char) 0xff))
(((unsigned char *) (eth_addr))[0] & ((unsigned char) 0x01))
((((unsigned char *) (eth_addr1))[0] == \
((unsigned char *) (eth_addr2))[0]) && \
(((unsigned char *) (eth_addr1))[1] == \
((unsigned char *) (eth_addr2))[1]) && \
(((unsigned char *) (eth_addr1))[2] == \
((unsigned char *) (eth_addr2))[2]) && \
(((unsigned char *) (eth_addr1))[3] == \
((unsigned char *) (eth_addr2))[3]) && \
(((unsigned char *) (eth_addr1))[4] == \
((unsigned char *) (eth_addr2))[4]) && \
(((unsigned char *) (eth_addr1))[5] == \
((unsigned char *) (eth_addr2))[5]))
#endif /* _LM_DEFS_H */