lm5710.h revision d14abf155341d55053c76eeec58b787a456b753b
/*******************************************************************************
* 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.
*
*
* Module Description:
*
*
* History:
* 10/10/01 Hav Khauv Inception.
******************************************************************************/
#ifndef _LM5710_H
#define _LM5710_H
//migrated from 5706_reg.h
#ifndef __BIG_ENDIAN
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN
#endif
#else
#ifndef BIG_ENDIAN
#define BIG_ENDIAN
#endif
#ifndef BIG_ENDIAN_HOST
#define BIG_ENDIAN_HOST
#endif
#endif
#ifndef INLINE
#if DBG
#define INLINE
#else
#endif
#endif
#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
#error "Missing either LITTLE_ENDIAN or BIG_ENDIAN definition."
#endif
#define ECORE_NIV
#ifdef __LINUX
#endif
#include "bcmtype.h"
#include "debug.h"
#include "igu_def.h"
#include "microcode_constants.h"
#include "fcoe_constants.h"
#include "toe_constants.h"
#include "tcp_constants.h"
#include "eth_constants.h"
//this is the included HSI
#include "5710_hsi.h"
#include "lm5710_hsi.h"
#include "pcics_reg_driver.h"
#include "bigmac_addresses.h"
#include "misc_bits.h"
#include "emac_reg_driver.h"
#include "dmae_clients.h"
#include "prs_flags.h"
#include "57712_reg.h"
#include "grc_addr.h"
#include "bd_chain_st.h"
#include "lm_sp_req_mgr.h"
#include "license.h"
#include "mcp_shmem.h"
#include "lm_dcbx_mp.h"
#ifndef elink_dev
#define elink_dev _lm_device_t
#endif
#include "clc.h"
//#include "status_code.h"
// TODO - we will add ou rown shmem
//#include "shmem.h"
//
#define DEVICE_TYPE_PF 0
#define DEVICE_TYPE_VF 1
/* Virtualization types (vt) */
#define VT_NONE 0
#define VT_BASIC_VF 1
#define VT_CHANNEL_VF 2
#define VT_ASSIGNED_TO_VM_PF 3
#define VT_HW_CHANNEL_TYPE 0
#define VT_SW_CHANNEL_TYPE 1
#define IS_CHANNEL_VFDEV(pdev) (((pdev)->params.device_type == DEVICE_TYPE_VF) && ((pdev)->params.virtualization_type == VT_CHANNEL_VF))
#define IS_BASIC_VIRT_MODE_MASTER_PFDEV(pdev) (((pdev)->params.device_type == DEVICE_TYPE_PF) && ((pdev)->params.virtualization_type == VT_BASIC_VF))
#define IS_CHANNEL_VIRT_MODE_MASTER_PFDEV(pdev) (((pdev)->params.device_type == DEVICE_TYPE_PF) && ((pdev)->params.virtualization_type == VT_CHANNEL_VF))
#define IS_ASSIGNED_TO_VM_PFDEV(pdev) (((pdev)->params.device_type == DEVICE_TYPE_PF) && ((pdev)->params.virtualization_type == VT_ASSIGNED_TO_VM_PF))
#define IS_HW_CHANNEL_VIRT_MODE(pdev) (((pdev)->params.virtualization_type == VT_CHANNEL_VF) && ((pdev)->params.channel_type == VT_HW_CHANNEL_TYPE))
#define IS_SW_CHANNEL_VIRT_MODE(pdev) (((pdev)->params.virtualization_type == VT_CHANNEL_VF) && ((pdev)->params.channel_type == VT_SW_CHANNEL_TYPE))
#define LM_VF_MAX_RVFID_SIZE 6
#define LM_MAX_VF_CID_WND_SIZE 4
#define LM_VF_CID_WND_SIZE(_pdev) (((_pdev)->hw_info.sriov_info.max_chains_per_vf) ? (_pdev)->hw_info.sriov_info.vf_cid_wnd_size : LM_MAX_VF_CID_WND_SIZE)
#define LM_VF_CHAINS_PER_PF(_pdev) (((_pdev)->hw_info.sriov_info.max_chains_per_vf) ? (_pdev)->hw_info.sriov_info.max_chains_per_vf : LM_MAX_VF_CHAINS_PER_PF)
#define VF_BAR0_DB_SIZE 512
/* multi function mode is supported on (5711+5711E FPGA+EMUL) and on (5711E ASIC) and on 5712E and 5713E */
(CHIP_IS_E3(pdev)))
/* Macro for triggering PCIE analyzer: write to 0x2000 */
#define LM_TRIGGER_PCIE(_pdev) \
{ \
}
// Send an attention on this Function.
#define LM_GENERAL_ATTN_INTERRUPT_SET(_pdev,_func) REG_WR((_pdev),MISC_REG_AEU_GENERAL_ATTN_12 + 4*(_func),0x1)
/*******************************************************************************
* Constants.
******************************************************************************/
#define MAX_PATH_NUM 2
#define E2_MAX_NUM_OF_VFS 64
#define E1H_FUNC_MAX 8
#define MAX_VNIC_NUM 4
#define MAX_NDSB HC_SB_MAX_SB_E2
typedef enum
{
LM_CLI_IDX_NDIS = 0,
//LM_CLI_IDX_RDMA = 1,
LM_CLI_IDX_ISCSI, /* iSCSI idx must be after ndis+rdma */
LM_CLI_IDX_FCOE, /* FCOE idx must be after ndis+rdma */
} lm_cli_idx_t;
typedef enum
{
// LM_RESOURCE_RDMA = LM_CLI_IDX_RDMA,
struct sq_pending_command
{
#define SQ_PEND_RELEASE_MEM 0x1
#define SQ_PEND_COMP_CALLED 0x2
struct slow_path_element command;
};
#include "lm_desc.h"
#include "listq.h"
#include "lm.h"
#include "mm.h"
#include "ecore_sp_verbs.h"
#ifdef VF_INVOLVED
#include "lm_vf.h"
#endif
#include "lm_stats.h"
#include "lm_dmae.h"
#if !defined(_B10KD_EXT)
#include "bcm_utils.h"
#endif
#define EVEREST 1
/* non rss chains - ISCSI, FCOE, FWD, ISCSI OOO */
#define MAX_NON_RSS_CHAINS (4)
/* which of the non-rss chains need fw clients - ISCSI, FCOE*/
#define MAX_NON_RSS_FW_CLIENTS (4)
#ifndef VF_INVOLVED
#define MAX_VF_ETH_CONS 0
#endif
#else
#endif
#define ILT_NUM_PAGE_ENTRIES 3072
#define ILT_NUM_PAGE_ENTRIES_PER_FUNC 384
/* According to the PCI-E Init document */
#define SEARCHER_TOTAL_MEM_REQUIRED_PER_CON 64
#define TIMERS_TOTAL_MEM_REQUIRED_PER_CON 8
/* Number of bits must be 10 to 25. */
#ifndef LM_PAGE_BITS
#endif
/* Number of bits must be 10 to 25. */
* in which page needs to be aligned to page-size
*/
#if !defined(_VBD_CMD_)
#else
#define LM_CID_RETURN_TIME 0
#define LM_CID_RETURN_TIME_EMUL 0
#endif
// TODO add for ASIC
/*
#define LM_FREE_CID_DELAY_TIME(pdev) (CHIP_REV(pdev) == CHIP_REV_FPGA || CHIP_REV(pdev) == CHIP_REV_EMUL) ? LM_CID_RETURN_TIME_EMUL : LM_CID_RETURN_TIME;
*/
#define LM_EMUL_FACTOR 2000
#define LM_FPGA_FACTOR 200
#ifndef CACHE_LINE_SIZE_MASK
#define CACHE_LINE_SIZE_MASK 0x3f
#endif
/*need to know from where can I take these values */
#define NVRAM_PAGE_SIZE 256
/* Number of packets per indication in calls to mm_indicate_rx/tx. */
#ifndef MAX_PACKETS_PER_INDICATION
#define MAX_PACKETS_PER_INDICATION 50
#endif
// TODO - adjust to our needs - the limitation of the PBF
#ifndef MAX_FRAG_CNT
#define MAX_FRAG_CNT 33
#endif
#ifndef MAX_FRAG_CNT_PER_TB
/* MichalS TODO - do we want to leave it like this or calculate it according to connection params. */
#endif
/* The maximum is actually 0xffff which can be described by a BD. */
// TODO - adjust to our needs
#define MAX_FRAGMENT_SIZE 0xf000
/* Maximum Packet Size: max jumbo frame: 9600 + ethernet-header+llc-snap+vlan+crc32 */
#define MAXIMUM_PACKET_SIZE 9632
// TODO - adjust to our needs
/* Buffer size of the statistics block. */
#define CHIP_STATS_BUFFER_SIZE ((sizeof(statistics_block_t) + \
CACHE_LINE_SIZE_MASK) & \
// Status blocks type per storm - used for initialization
#define STATUS_BLOCK_INVALID_TYPE 0
#define STATUS_BLOCK_SP_SL_TYPE 1
#define STATUS_BLOCK_NORMAL_TYPE 2
#define STATUS_BLOCK_NORMAL_SL_TYPE 3
#define LM_DEF_NO_EVENT_ACTIVE 0x00000000
#define LM_DEF_ATTN_ACTIVE (1L<<0)
#define LM_SP_ACTIVE (LM_DEF_USTORM_ACTIVE | LM_DEF_CSTORM_ACTIVE | LM_DEF_XSTORM_ACTIVE | LM_DEF_TSTORM_ACTIVE)
#define LM_DEF_EVENT_MASK 0xffff
#define LM_NON_DEF_EVENT_MASK 0xffff0000
#define ATTN_HARD_WIRED_MASK 0xff00
#define HC_SEG_ACCESS_DEF 0 /*Driver decision 0-3*/
#define HC_SEG_ACCESS_ATTN 4
#define HC_SEG_ACCESS_NORM 0 /*Driver decision 0-1*/
//Buffer size of the status block. This is the same for host_def_status_block, they are the same size.
//TODO: check the cache line issue! do we need it as in Teton?
#define E2_STATUS_BLOCK_BUFFER_SIZE ((sizeof(struct host_hc_status_block_e2) + \
CACHE_LINE_SIZE_MASK) & \
#define E1X_STATUS_BLOCK_BUFFER_SIZE ((sizeof(struct host_hc_status_block_e1x) + \
CACHE_LINE_SIZE_MASK) & \
#define DEF_STATUS_BLOCK_BUFFER_SIZE ((sizeof(struct host_sp_status_block) + \
CACHE_LINE_SIZE_MASK) & \
/* This is the def and non-def status block ID format according to spec --> used for debugging purpose only */
#define DBG_DEF_SB_ID(port,stormID,vnicID) (((port) << 7) | ((stormID) << 5) | (0x10+vnicID)) /* the ID is for debugging purposes, it's not looked at by hw/fw*/
//#define SB_INDEX_OF_CSTORM(pdev, index) ((pdev)->vars.c_hc_ack[index])
//_________________________________________________________________________________________________--
#define DEF_STATUS_BLOCK_IGU_INDEX 16 //MAX_NDSB //this is where the default status block lies (that is VBD's static index of default status block)
#define DEF_STATUS_BLOCK_INDEX HC_SP_SB_ID //this is where the default status block lies (that is VBD's static index of default status block)
#define MAX_DYNAMIC_ATTN_GRPS 8 //this is the 8 non hard-wired groups configured by the driver (exc. PXP,NIG)
#define MAX_NUM_VF_BAR 3
#define BAR_0 0 //index for BAR0
/* HW RSS configuration */
/* RX BD to RX CQE size ratio */
/*******************************************************************************
* Macros.
******************************************************************************/
#ifndef OFFSETOF
#endif
/* warning NOT side effect safe dont use this with CEIL_DIV( a++,b) */
#define CEIL_DIV( a, b ) ((a / b) + ( (a % b) ? 1 : 0))
/**
* @description
* Should be moved to a common place.
* Find the next power of 2 that is larger than "num".
* @param num - The variable to find a power of 2 that is
* larger.
* @param num_bits_supported - The largest number of bits
* supported
*
* @return u32_t - The next power of 2 that is larger than
* "num".
*/
/*
The attention lines works with the state machine below for parallel computation:
cols: 0 1 2 3 4 5 6 7
_________________________
Attn_bits 0 0 1 1 0 0 1 1
Attn_ack 0 1 0 1 0 1 0 1
State 0 0 0 0 1 1 1 1
cols: 0,1,6,7 - NOP
cols: 3,4 - ASSERT
cols: 2 - Assertion procedure
cols: 5 - Deassertion procedure
*/
#define GET_ATTN_CHNG_GROUPS(_pdev, _attn_bits, _attn_ack, _asserted_grps_ptr, _deasserted_grps_ptr) \
{ \
\
\
}
/* Finds out whether a specific unicore interrupt has caused the NIG attn to get asserted.
* If this is the case, need to adjust the portion of bits of the NIG config status interrupt register
* to the value read from the unicore interrupt register.
* We use here a "bit overwrite" instead of just a "bit flip" since the value read from the
* unicore interrupt register might be spread over more than a single bit!
*/
#define HANDLE_UNICORE_INT_ASSERTED(_pdev, _nig_reg_name, _unicore_intr_val_ptr, _unicore_intr_name, _nig_status_port_ptr, _is_unicore_assrtd_ptr, _unicore_intr_size) \
{ \
*(_is_unicore_assrtd_ptr) = ( ( *(_unicore_intr_val_ptr) << _unicore_intr_size) ^ (*(_nig_status_port_ptr) & _unicore_intr_name)); \
\
if (*(_is_unicore_assrtd_ptr)) \
{ \
*(_nig_status_port_ptr) = (*(_nig_status_port_ptr) & ~(_unicore_intr_name)) | (*(_unicore_intr_val_ptr) << _unicore_intr_size); \
} \
}
// *(_nig_status_port_ptr) ^= ( 0x1 << _unicore_intr_size);
/*******************************************************************************
* Statistics.
******************************************************************************/
typedef struct _lm_rx_statistics_t
{
/*******************************************************************************
* Packet descriptor.
******************************************************************************/
typedef struct _lm_coalesce_buffer_t
{
typedef struct _lm_client_con_params_t
{
#define LM_CLIENT_ATTRIBUTES_RX (0x1)
#define LM_CLIENT_ATTRIBUTES_TPA (0x2)
#define LM_CLIENT_ATTRIBUTES_TX (0x4)
#define LM_CLIENT_ATTRIBUTES_REG_CLI (0x8)
typedef struct _lm_packet_t
{
/* Must be the first entry in this structure. */
union _lm_pkt_info_t
{
struct _lm_tx_pkt_info_t
{
// TODO - Do we want this stuff ????
#if DBG
struct eth_tx_bd *dbg_start_bd;
#endif
} tx;
struct _lm_rx_pkt_info_t
{
// bd ring address[0] + sge addresses[1] (optional)
// (currently one)
#if DBG
struct eth_rx_sge *dbg_sge;
#endif
union eth_sgl_or_raw_data sgl_or_raw_data; // currently used by OOO_CID. upper layer should handle endianity!
} rx;
} u1; // _lm_pkt_info_t
} lm_packet_t;
/*******************************************************************************
* Configurable parameters for the hardware dependent module.
******************************************************************************/
// I only want this enum for LLFC_TRAFFIC_TYPE_MAX value (should be HSI and fixed by FW)
typedef enum _driver_traafic_type_t
{
typedef struct _app_params_t
{
//Cos DCBX params
// This define is different than CLC, because CLC currently supports the Max number of COS
typedef struct _dcbx_cos_params_t
{
/**
* valid values are 0 - 5. 0 is highest strict priority.
* There can't be two COS's with the same pri. *
*/
#define DCBX_S_PRI_INVALID (DCBX_COS_MAX_NUM)
#define DCBX_S_PRI_COS_HIGHEST (0)
// (pdev) and is only for debugging CHIP_IS_E2E3(pdev)
typedef struct _pg_params_t
{
typedef struct _pfc_params_t
{
#define LM_DCBX_PFC_PRI_NON_PAUSE_MASK(_pdev) (_pdev->params.dcbx_port_params.pfc.priority_non_pauseable_mask)
#define LM_DCBX_PFC_PRI_MASK (0xFF)
#define LM_DCBX_PFC_PRI_GET_NON_PAUSE(_pdev,_pg_pri) (LM_DCBX_PFC_PRI_NON_PAUSE_MASK(_pdev) & _pg_pri)
#define LM_DCBX_IS_PFC_PRI_SOME_PAUSE(_pdev,_pg_pri) (0 != LM_DCBX_PFC_PRI_GET_PAUSE(_pdev,_pg_pri))
#define LM_DCBX_IS_PFC_PRI_ONLY_PAUSE(_pdev,_pg_pri) (_pg_pri == LM_DCBX_PFC_PRI_GET_PAUSE(_pdev,_pg_pri))
#define LM_DCBX_IS_PFC_PRI_ONLY_NON_PAUSE(_pdev,_pg_pri) (_pg_pri == LM_DCBX_PFC_PRI_GET_NON_PAUSE(_pdev,_pg_pri))
#define LM_DCBX_IS_PFC_PRI_MIX_PAUSE(_pdev,_pg_pri) (!(LM_DCBX_IS_PFC_PRI_ONLY_NON_PAUSE(_pdev,_pg_pri) || \
typedef struct _dcbx_port_params_t
{
typedef enum
{
typedef enum
{
typedef enum
{
LM_SINGLE_SM = 0, /* default */
} fw_ndsb_type;
typedef enum
{
LM_COS_MODE_COS3 = 0,
LM_COS_MODE_COS6 = 1
} lm_cos_modes ;
typedef enum
{
LM_COS_MODE_OVERRIDE = 0,
typedef enum
{
} lm_autogreeen_t ;
/*** This i2c section should be in common .h file with EMC... ***/
#define I2C_BINARY_SIZE 256
#define I2C_A2_DYNAMIC_OFFSET 0
#define I2C_A2_DYNAMIC_SIZE 128
#define I2C_A2_STATIC_OFFSET 128
#define I2C_A2_STATIC_SIZE 128
typedef enum
{
I2C_SECTION_A0 = 0,
I2C_SECTION_A2 = 1,
I2C_SECTION_MAX = 2
typedef struct _i2c_binary_info_t
{
/*** This i2c section should be in common .h file with EMC... ***/
typedef struct _lm_params_t
{
/* This value is used by the upper module to inform the protocol
* ranges from 1500-9600 bytes. This value does not include ETH_PACKET_LEN, LLC-SNAP, VLAN tag, CRC32
*/
#define LM_MTU_INVALID_VALUE (0xFFFFFFFF)
#define MAX_CLI_PACKET_SIZE(pdev, chain_idx) ((u16_t)(pdev)->params.l2_cli_con_params[(chain_idx)].mtu + (pdev)->params.rcv_buffer_offset + ETHERNET_PACKET_HEADER_SIZE+ ETHERNET_VLAN_TAG_SIZE + ETHERNET_LLC_SNAP_SIZE + CACHE_LINE_SIZE)
#define CLI_MTU_WITH_ETH_HDR_SIZE(pdev, chain_idx) ((u16_t)(pdev)->params.l2_cli_con_params[(chain_idx)].mtu + ETHERNET_PACKET_HEADER_SIZE)
#define MAX_L2_CLI_BUFFER_SIZE(pdev, chain_idx) ((MAX_CLI_PACKET_SIZE(pdev, chain_idx) + CACHE_LINE_SIZE_MASK) & \
#define LM_MTU_NDIS_DEFAULT (1500)
#define LM_MTU_ISCSI_DEFAULT (1500)
#define LM_MTU_FCOE_DEFAULT (2500)
#define LM_MTU_FWD_DEFAULT (LM_MTU_NDIS_DEFAULT)
#define LM_MTU_FLOW_CTRL_TX_THR (5000)
#define LM_MTU_MAX_DEFAULT (1500)
#define LM_MTU_MAX (9600)
/* Current node address. The MAC address is initially set to the
* hardware address. This entry can be modified to allow the driver
* to override the default MAC address. The new MAC address takes
* effect after a driver reset. */
1 for all rss chains, and 1 more for each non-rss chain */
/* All the L2 receive buffers start at a cache line size aligned
* address. This value determines the location of the L2 frame header
* from the beginning of the receive buffer. */
/* network type for defintion of max cwnd */
#define LM_NETOWRK_TYPE_LAN 0
#define LM_NETOWRK_TYPE_WAN 1
#define LM_CID_ALLOC_REGULAR 1
* cids pending allocation */
#define LM_CID_ALLOC_NUM_MODES 2
#define LM_INT_COAL_NONE 0
#define LM_INT_COAL_NUM_MODES 2
/* VF interrupt moderation (Low, Medium, High) parameters */
#define LM_VF_INT_LOW_IDX 0
#define LM_VF_INT_MEDIUM_IDX 1
#define LM_VF_INT_HIGH_IDX 2
/* all protocols dynamic coalescing params */
#define NUM_BUFS_FOR_GRQS(pdev) \
#else
#define NUM_BUFS_FOR_GRQS(pdev) \
#endif
// #define NUM_BUFS_FOR_GRQS(pdev)
// (pdev)->params.l4_grq_page_cnt*512*(LM_TOE_RSS_CHAIN_CNT(pdev))
/* DCA Related params */
u32_t l4_ignore_grq_push_enabled; /* Configuration passed to fw whether to ignore push on grq or not */
* driver to write to misc.swap_diag0 with the corresponding flag.
* The intention is to trigger the bus analyzer. */
// TODO - adjust to our needs
#define TEST_MODE_DISABLED 0x00
#define TEST_MODE_VERIFY_RX_CRC 0x10
#define TEST_MODE_RX_BD_TAGGING 0x20
#define TEST_MODE_TX_BD_TAGGING 0x40
#define TEST_MODE_LOG_REG_ACCESS 0x80
#define TEST_MODE_SAVE_DUMMY_DMA_DATA 0x0100
#define TEST_MODE_INIT_GEN_BUF_DATA 0x0200
#define TEST_MODE_DRIVER_PULSE_ALWAYS_ALIVE 0x0400
#define TEST_MODE_IGNORE_SHMEM_SIGNATURE 0x0800
#define TEST_MODE_NO_MCP 0x1000
#define SELECTIVE_AUTONEG_OFF 0
#define SELECTIVE_AUTONEG_SINGLE_SPEED 1
#define SELECTIVE_AUTONEG_ENABLE_SLOWER_SPEEDS 2
/* Ways for the MAC to determine a link change. */
#define PHY_INT_MODE_AUTO 0
#define PHY_INT_MODE_MI_INTERRUPT 1
#define PHY_INT_MODE_LINK_READY 2
#define PHY_INT_MODE_AUTO_POLLING 3
/* Ways for the driver to get the link change event. */
#define LINK_CHNG_MODE_AUTO 0
#define LINK_CHNG_MODE_USE_STATUS_REG 1
#define LINK_CHNG_MODE_USE_STATUS_BLOCK 2
/* Ways for the driver to determine which phy to prefer in case of dual media. */
#define PHY_PRIORITY_MODE_HW_DEF 0
#define PHY_PRIORITY_MODE_10GBASET 1
#define PHY_PRIORITY_MODE_SERDES 2
#define PHY_PRIORITY_MODE_HW_PIN 3
u32_t interrupt_mode; /* initialized by um to state whether we are using MSI-X or not, determined after we receive resources from OS */
#define LM_INT_MODE_INTA 0
/* Relevant only for E2, and defines how the igu will be worked with (via GRC / BAR). Default will be set to BAR,
* the defines for this are INTR_BLK_ACCESS_GRC, INTR_BLK_ACCESS_IGUMEM */
#define LM_SWCFG_1G 0
#define LM_SWCFG_10G 1
#define LM_SWCFG_AD 2
#define LM_SWCFG_OT_AD 3
#define LM_SWCFG_HW_DEF 4
#define IS_MF_AFEX_MODE(_pdev) (IS_MULTI_VNIC(_pdev) && ((_pdev)->params.mf_mode == MULTI_FUNCTION_AFEX))
#define IS_MF_SI_MODE(_pdev) (IS_MULTI_VNIC(_pdev) && ((_pdev)->params.mf_mode == MULTI_FUNCTION_SI))
#define IS_MF_SD_MODE(_pdev) (IS_MULTI_VNIC(_pdev) && ((_pdev)->params.mf_mode == MULTI_FUNCTION_SD))
#define IS_SD_REGULAR_MODE(_pdev) (IS_MF_SD_MODE(_pdev) && ((_pdev)->params.sd_mode == SD_REGULAR_MODE))
u32_t ilt_client_page_size; // ILT clients page size. We will give all client same page size. All ports as well.
/* vnic parameters */
/* Relative Function Number */
#define PORT_ID_PARAM_FUNC_ABS(_chip_num, _port_mode, _pfunc_abs) (lm_get_port_id_from_func_abs(_chip_num, _port_mode, _pfunc_abs)) //0 or 1
#define LM_PFS_PER_PORT(pdev) \
#define LM_FIRST_ABS_FUNC_IN_PORT(pdev) \
for ( (func) = LM_FIRST_ABS_FUNC_IN_PORT(pdev) ; (func) < MAX_FUNC_NUM; (func) += (MAX_FUNC_NUM/LM_PFS_PER_PORT(pdev)) )
#define FUNC_MAILBOX_ID_PARAM(_port,_vnic,_chip_num, _port_mode) ((_port) + (_vnic) * ((CHIP_IS_E1x_PARAM(_chip_num) || (_port_mode == LM_CHIP_PORT_MODE_4))? 2 : 1))
#define FUNC_MAILBOX_ID(pdev) (FUNC_MAILBOX_ID_PARAM(PORT_ID(pdev) ,VNIC_ID(pdev),CHIP_NUM(pdev), CHIP_PORT_MODE(pdev)))
/* Absolute Function Number */
for ((func) = PORT_ID(pdev); (func) < (CHIP_IS_E1x(pdev) ? E1H_FUNC_MAX : E2_FUNC_MAX); (func)+= (CHIP_IS_E1x(pdev) ? 2 : 1))
u8_t path_has_ovlan; // The multi function mode in the path (can be different than the mutli-function-mode of the function (4-port MF / SF mode E3 only)
u8_t pfunc_mb_id; // this is for shmem mail box id and currently doesn't support flows which are not mcp send/recv command
#define VNICS_PER_PATH(pdev) (PFDEV(pdev)->params.vnics_per_port * ((LM_CHIP_PORT_MODE_4 == CHIP_PORT_MODE(pdev))? 2 : 1 ))
/** 32-bit aligned **/
// min max bw
/* 32 bit aligned. */
/* Status-Block-Related. Status blocks */
#ifdef _VBD_
#else
#endif
/*
#define LM_REST_OF_SB_ID(pdev, sb_id) \
for ((sb_id) = LM_SB_CNT(pdev); (sb_id) < MAX_RSS_CHAINS / pdev->params.vnics_per_port; (sb_id)++)
*/
u8_t fw_qzone_id[PXP_REG_HST_ZONE_PERMISSION_TABLE_SIZE]; /* Which qzone-id in the qzone-table is used for updating producers + dhc counters
* relevant from E2. For qzone_id from base area offset in permission table is guaranted */
u8_t aux_fw_qzone_id; /* Which qzone-id in the qzone-table is used for updating producers + dhc counters
* relevant from E2*/
/* 32 bit aligned. */
#define LM_MC_NDIS_TABLE_SIZE (64)
#define LM_MC_FCOE_TABLE_SIZE (2)
#define LM_KEEP_CURRENT_CAM_VALUE (0xFFFF)
#define LM_INVALID_CAM_BASE_IDX (0xFF)
#define LM_RSS_CAP_IPV4 1
#define LM_RSS_CAP_IPV6 2
/* TODO FIX MAX RSS Chains with new HC SB management*/
/** 32-bit aligned * */
/* for registry */
#define CHAIN_TO_RSS_ID(_pdev, _chain) (lm_mp_get_reg_chain_from_chain(_pdev, _chain)) /* Mapping between rss-id to cid */
{ \
}
#define LM_SW_LEADING_SB_ID 0
#define LM_SW_LEADING_RSS_CID(pdev) 0
#define LM_INVALID_ETH_CID (0xFF)
#define LM_CHAIN_IDX_CLI(pdev, cid) ((lm_chain_type_not_cos != lm_mp_get_chain_type(pdev, cid)) ? LM_CLI_IDX_NDIS : \
(((cid >= (pdev)->params.max_pf_fw_client_cnt) && (cid < (pdev)->params.fw_client_cnt)) ? LM_CLI_IDX_NDIS : \
LM_CLI_IDX_MAX))))))))))
#define LM_CHAIN_IDX_TRAFFIC_TYPE(pdev, cid) ((lm_chain_type_not_cos != lm_mp_get_chain_type(pdev, cid)) ? LLFC_TRAFFIC_TYPE_NW : \
(((cid >= (pdev)->params.max_pf_fw_client_cnt) && (cid < (pdev)->params.fw_client_cnt)) ? LLFC_TRAFFIC_TYPE_NW : \
MAX_TRAFFIC_TYPE))))))))))
/* A bit about E2 Qzone-IDs: qzone is a new area in internal memory where the FW stores producers + dynamic-host-coalesing (dhc) values.
* It is a separate area than areas the have arrays for clients / status-blocks. Technically, the driver can decide to have separate entries
* for producers + dhc entries (it has to do with permissions in PXP for VFs..., for now there is no reason to do this. And we'll use the same
* id, but note that QZONE_ID is intended for fp ring producers. DHC_QZONE_ID is intended for status-block, and thus the parameter they receive.
*/
#define LM_FW_SB_ID(pdev, sb_id) ((sb_id == DEF_STATUS_BLOCK_INDEX)? DEF_STATUS_BLOCK_INDEX: pdev->params.base_fw_ndsb + sb_id)
#define LM_CLIENT_BIT_VECTOR(pdev, lm_cli_idx) (1 << (LM_FW_CLI_ID(pdev, LM_CLI_CID(pdev, lm_cli_idx))))
/* L4 RSS */
u8_t l4_rss_chain_cnt; /* number of L4 rss chains. lm wise, if rss_chain_cnt==1 then rss is disabled */
#define LM_TOE_FW_RSS_ID(pdev, rss_id) ((pdev)->params.l4_base_fw_rss_id + (IS_MULTI_VNIC(pdev) ? (CHIP_IS_E1x(pdev) ? rss_id : 0) : rss_id)) /* that is first L4 SB */
for ((rss_idx) = (pdev)->params.l4_rss_base_chain_idx; (rss_idx) < (pdev)->params.l4_rss_base_chain_idx + (pdev)->params.l4_rss_chain_cnt; (rss_idx)++)
for ((tss_idx) = (pdev)->params.l4_rss_base_chain_idx; (tss_idx) < (pdev)->params.l4_rss_base_chain_idx + (pdev)->params.l4_tss_chain_cnt; (tss_idx)++)
/* for multi function mode, when 'rss_base_chain_idx' != 0 */
// In new VBD dsign chain doesn't equal client and
// we must add client offset
//((pdev)->params.base_fw_client_id + (val))
// eth configuration.
// TODO: encapsulate in a connection object
// congestion managment parameters
// safc
// fairness
// rate shaping
// Demo will be removed later
// iscsi
// cls_params
struct elink_params link;
// fw flow control
#define L4_RSS_DISABLED 0 /* shmulikr: l4_enable_rss is more then a flag. The various values represent the possible flavors */
/* disable PCIe non-FATAL error reporting */
#define LM_PROTO_SUPPORT_ETHERNET 0x1
#define LM_PROTO_SUPPORT_ISCSI 0x2
#define LM_PROTO_SUPPORT_FCOE 0x4
/* In release this flag will prevent us from crashing in customer site */
#if DBG
#define DEFAULT_DEBUG_CAP_FLAGS_VAL 0xffffffff
#else
#define DEFAULT_DEBUG_CAP_FLAGS_VAL 0x0
#endif
#define DEBUG_CAP_FLAGS_STATS_FW 0x1
//#define DEBUG_CAP_FLAGS_XXX 0x2
#define L4_LI_NOTIFY 0x0001
#define L4_LI_MAX_GEN_BUFS_IN_ISLE 0x0002
#define L4_LI_MAX_GEN_BUFS_IN_ARCHIPELAGO 0x0004
u32_t l4_max_gen_buf_cnt; /* maximum number of generic buffers the system can allocate, duplicated from UM*/
// PF_FLR
//LLFC should be moved to vars
u32_t l4_max_dominance_value; /* set to 0 to disable dominant connection, set to 20 (default) to enable */
/* Virtualization related */
/* Error Recovery supported only on E2 and above. Can be controlled via registry */
#define IS_ERROR_RECOVERY_ENABLED(_pdev) ((_pdev)->params.enable_error_recovery && !CHIP_IS_E1x(_pdev))
/* Enables switching between non-enlighted vms under npar configuration.
* vm's that don't have their mac in the tx cam can't be 'switched' between pfs
* this mode actually means that all traffic will be passed on loopback channel if
* there is a pf in promiscuous/accept unmatched (which is set when there are vms)
* this feature hurts performance and therefore can be disabled */
#define LM_FLOW_CONTROL_REPORTING_MODE_DISABLED 0
#define LM_FLOW_CONTROL_REPORTING_MODE_ENABLED 1
#define XSTORM_RECORD_SLOW_PATH 0x01
#define CSTORM_RECORD_SLOW_PATH 0x02
#define TSTORM_RECORD_SLOW_PATH 0x04
#define USTORM_RECORD_SLOW_PATH 0x08
} lm_params_t;
/*******************************************************************************
* Device NVM info -- The native strapping does not support the new parts, the
* software needs to reconfigure for them.
******************************************************************************/
//TODO we need check
typedef struct _flash_spec_t
{
} flash_spec_t;
//TODO resolve big endian issues
typedef struct _lm_cam_entry_t
{
#define MAX_MAC_OFFSET_IN_NIG 16
typedef struct _lm_nig_mirror_entry_t
{
//atomic access is not needed because this struct is modified under TOE_LOCK.
typedef struct _lm_nig_mirror_t
{
/*******************************************************************************
* Device info.
******************************************************************************/
/* multi function specific */
typedef struct _lm_hardware_mf_info_t
{
#define NIV_FUNCTION_ENABLED(_pdev) (GET_FLAGS((_pdev)->hw_info.mf_info.func_mf_cfg, FUNC_MF_CFG_FUNC_DISABLED|FUNC_MF_CFG_FUNC_DELETED)==0)
#define INVALID_VIF_ID 0xFFFF
#define MF_INFO_VALID_MAC 0x0001
#define SD_REGULAR_MODE 0
#define SD_UFP_MODE 1
#define SD_BD_MODE 2
/* IGU related params for status-blocks */
typedef struct _lm_vf_igu_info_t
{
typedef struct _lm_igu_block_t
{
#define LM_IGU_STATUS_AVAILABLE 0x01
#define LM_IGU_STATUS_VALID 0x02
#define LM_IGU_STATUS_BUSY 0x04
#define LM_IGU_STATUS_PF 0x08
typedef struct _lm_igu_map_t
{
} lm_igu_map_t;
typedef struct _lm_igu_info_t {
typedef struct _lm_intr_blk_info_t
{
#define INTR_BLK_HC 0
#define INTR_BLK_IGU 1
#define INTR_BLK_MODE_BC 0
#define INTR_BLK_MODE_NORM 1
#define INTR_BLK_ACCESS_GRC 1
#define INTR_BLK_ACCESS_IGUMEM 0
#define INTR_BLK_CMD_CTRL_INVALID 0
#define INTR_BLK_REQUIRE_CMD_CTRL(_pdev) ((_pdev)->hw_info.intr_blk_info.cmd_ctrl_rd_wmask != INTR_BLK_CMD_CTRL_INVALID)
/* IGU specific data */
#ifdef VF_INVOLVED
#else
#define GET_NUM_VFS_PER_PF(_pdev) (0)
#define GET_NUM_VFS_PER_PATH(_pdev) (0)
#endif
typedef struct _lm_sriov_info_t {
// #define MAX_VF_BAR 3 Fix it when emulation supports 3 bars
#define MAX_VF_BAR 2
typedef enum
{
LM_CHIP_PORT_MODE_NONE = 0x0,
LM_CHIP_PORT_MODE_2 = 0x1,
LM_CHIP_PORT_MODE_4 = 0x2
typedef struct _lm_hardware_info_t
{
/* PCI info. */
/* Device info. */
#define CHIP_NUM_5710 0x164e0000
#define CHIP_NUM_5711 0x164f0000
#define CHIP_NUM_5711E 0x16500000
#define CHIP_NUM_5712 0x16620000
#define CHIP_NUM_5712E 0x16630000
#define CHIP_NUM_5713 0x16510000
#define CHIP_NUM_5713E 0x16520000
#define CHIP_NUM_57800 0x168a0000
#define CHIP_NUM_57840_OBSOLETE 0x168d0000
#define CHIP_NUM_57810 0x168e0000
#define CHIP_NUM_57800_MF 0x16a50000
#define CHIP_NUM_57840_MF_OBSOLETE 0x16ae0000
#define CHIP_NUM_57810_MF 0x16ab0000
#define CHIP_NUM_57811 0x163d0000
#define CHIP_NUM_57811_MF 0x163e0000
#define CHIP_NUM_57811_VF 0x163f0000
#define CHIP_NUM_57840_4_10 0x16a10000
#define CHIP_NUM_57840_2_20 0x16a20000
#define CHIP_NUM_57840_MF 0x16a40000
#define CHIP_NUM_57840_VF 0x16ad0000
#define CHIP_IS_E1H_PARAM(_chip_num) (((_chip_num) == CHIP_NUM_5711) || ((_chip_num) == CHIP_NUM_5711E))
#define CHIP_IS_E1x_PARAM(_chip_num) (CHIP_IS_E1_PARAM(((_chip_num))) || CHIP_IS_E1H_PARAM(((_chip_num))))
#define CHIP_IS_E2_PARAM(_chip_num) (((_chip_num) == CHIP_NUM_5712) || ((_chip_num) == CHIP_NUM_5713) || \
#define CHIP_IS_E3_PARAM(_chip_num) ((_chip_num == CHIP_NUM_57800) || (_chip_num == CHIP_NUM_57810) || \
(_chip_num == CHIP_NUM_57840_4_10) || (_chip_num == CHIP_NUM_57840_2_20) || (_chip_num == CHIP_NUM_57800_MF) || \
(_chip_num == CHIP_NUM_57811_VF))
#define CHIP_REV_SHIFT 12
#define CHIP_REV_IS_EMUL(_p) (CHIP_REV_IS_SLOW(_p) && !(CHIP_REV(_p)& CHIP_REV_SIM_IS_FPGA)) //if it's simulated, and not FPGA, it's EMUL.
#define CHIP_REV_SIM(_p) ((0xF - (CHIP_REV(_p)>>CHIP_REV_SHIFT))>>1)<<CHIP_REV_SHIFT //For EMUL: Ax=0xE, Bx=0xC, Cx=0xA. For FPGA: Ax=0xF, Bx=0xD, Cx=0xB.
#define CHIP_IS_E3B0(_p) (CHIP_IS_E3(_p)&&( (CHIP_REV(_p) == CHIP_REV_Bx)||(CHIP_REV_SIM(_p) == CHIP_REV_Bx)))
#define CHIP_IS_E3A0(_p) (CHIP_IS_E3(_p)&&( (CHIP_REV(_p) == CHIP_REV_Ax)||(CHIP_REV_SIM(_p) == CHIP_REV_Ax)))
#define CHIP_ID_5706_A0 0x57060000
#define CHIP_ID_5706_A1 0x57060010
#define CHIP_ID_5706_FPGA 0x5706f000
#define CHIP_ID_5706_IKOS 0x5706e000
#define CHIP_ID_5708_A0 0x57080000
#define CHIP_ID_5708_B0 0x57081000
#define CHIP_ID_5708_FPGA 0x5708f000
#define CHIP_ID_5708_IKOS 0x5708e000
#define CHIP_ID_5710_EMUL 0X164ed000
#define CHIP_ID_5710_A0 0x164e0000
#define CHIP_ID_5710_A1 0x164e0010
/* A serdes chip will have the first bit of the bond id set. */
#define CHIP_BOND_ID_SERDES_BIT 0x01
/* This bit defines if OTP process was done on chip */
#define CHIP_OPT_MISC_DO_BIT 0x02
For 57711 0-A0, 1-A1 2-A2
For 57710 0-A1 1-A2 */
#define SILENT_REV_E1_A0 0xFF
#define SILENT_REV_E1_A1 0x00
#define SILENT_REV_E1_A2 0x01
#define SILENT_REV_E1H_A0 0x00
#define SILENT_REV_E1H_A1 0x01
#define SILENT_REV_E1H_A2 0x02
#define SILENT_REV_E3_B0 0x00
#define SILENT_REV_E3_B1 0x01
/* In E2, the chip can be configured in 2-port mode (i.e. 1 port per path) or 4-port mode (i.e. 2 port per path)
* the driver needs this information since it needs to configure several blocks accordingly */
/* HW config from nvram. */
/* board sn*/
/* Flash info. */
/* Needed for pxp config should be done by the MCP*/
// external phy fw version
u8_t sz_ext_phy_fw_ver[16];// NULL terminated string populated only after a call to get ext phy fw version
// link config
// initial dual phy priority config
// pcie info
#define PCIE_WIDTH_1 1
#define PCIE_WIDTH_2 2
#define PCIE_WIDTH_4 4
#define PCIE_WIDTH_8 8
#define PCIE_WIDTH_16 16
#define PCIE_WIDTH_32 32
#define PCIE_LANE_SPEED_2_5G 1
#define PCIE_LANE_SPEED_5G 2
#define PCIE_LANE_SPEED_8G 3
// In E2 chip rev A0 the PCI LANE speed are different (ERR 8)
#define PCIE_LANE_SPEED_2_5G_E2_A0 0
#define PCIE_LANE_SPEED_5G_E2_A0 1
// We need to save PF0's MPS before going to D3 and restore it when
// returning to D0 to compensate for a Windows bug. See CQ57271.
// mba features
// port_feature_config bits
// mba vlan enable bits
// TRUE if dcc is active
// bc rev
// ther driver should not load with bc less then the following
/* HW Licensing of Max #connections for each protocol, takes into account bar-size, licensing is 'per-port' and not 'per functions' */
u32_t max_port_conns; /* the maximum number of connections support for this port, used to configure PORT registers */
u32_t max_common_conns; /* the maximum number of connections support for ALL ports, used to configure COMMON registers, only used by PORT-MASTER */
#define PCI_CFG_NOT_TESTED_FOR_TRUST 0x00
#define PCI_CFG_NOT_TRUSTED 0x01
#define PCI_CFG_TRUSTED 0x02
//this struct encapsulates both the default status block as well as the RSS status blocks.
typedef struct _gen_sp_status_block_t
{
/*physical address of the status block.*/
struct hc_sp_status_block_data sb_data;
volatile struct host_sp_status_block * hc_sp_status_blk;
//this struct encapsulates both the default status block as well as the RSS status blocks.
typedef struct _gen_status_block_t
{
union {
struct hc_status_block_data_e1x e1x_sb_data;
struct hc_status_block_data_e2 e2_sb_data;
union {
/*pointer to default status block */
volatile struct host_hc_status_block_e1x * e1x_sb;
/*pointer to RSS status block */
volatile struct host_hc_status_block_e2 * e2_sb;
/*physical address of the status block.*/
//attn group wiring
typedef struct _route_cfg_sig_output
{
#define NUM_ATTN_REGS_E1X 4
#define NUM_ATTN_REGS_E2 5
#define MAX_ATTN_REGS 5
#define HC_TIMEOUT_RESOLUTION_IN_US 4
typedef struct _lm_int_coalesing_info {
struct dynamic_hc_config eth_dynamic_hc_cfg;
u32_t hc_usec_c_sb[HC_CSTORM_SB_NUM_INDICES]; /* static host coalescing period for cstorm sb indexes */
u32_t hc_usec_u_sb[HC_USTORM_SB_NUM_INDICES]; /* static host coalescing period for ustorm sb indexes */
/*******************************************************************************
* Device state variables.
******************************************************************************/
#define LM_COMMON_DRV_STATS_ATOMIC_INC_TOE(_pdev, field_name) LM_COMMON_DRV_STATS_ATOMIC_INC(_pdev, toe, field_name)
#define LM_COMMON_DRV_STATS_ATOMIC_DEC_TOE(_pdev, field_name) LM_COMMON_DRV_STATS_ATOMIC_DEC(_pdev, toe, field_name)
#define LM_COMMON_DRV_STATS_INC_ETH(_pdev, field_name) LM_COMMON_DRV_STATS_INC(_pdev, eth, field_name)
#define LM_COMMON_DRV_STATS_DEC_ETH(_pdev, field_name) LM_COMMON_DRV_STATS_DEC(_pdev, eth, field_name)
/* currently driver ETH stats that use ATOMIC_INC are not required for NDIS or BACS, therefore they are disabled in release version */
#if DBG
#define LM_COMMON_DRV_STATS_ATOMIC_INC_ETH(_pdev, field_name) LM_COMMON_DRV_STATS_ATOMIC_INC(_pdev, eth, field_name)
#define LM_COMMON_DRV_STATS_ATOMIC_DEC_ETH(_pdev, field_name) LM_COMMON_DRV_STATS_ATOMIC_DEC(_pdev, eth, field_name)
#else
#endif /* DBG */
/* this is a wrapper structure for a vf to pf message, it contains the message itself,
* we use a void pointer to the actual message to enable compiling the vbd with out the vf/pf interface
*/
typedef struct _lm_vf_pf_message_t
{
void * message_virt_addr;
void * bulletin_virt_addr;
void * cookie;
#ifdef VF_INVOLVED
union
{
struct pf_vf_msg_hdr sw_channel_hdr;
struct pfvf_tlv hw_channel_hdr;
} bad_response;
#endif
}
////////////////////// Start DCBX define /////////////////////////////////////////////////////
// regular + extension
// 2 = 1 for default + 1 for ISCSI
#define LM_DCBX_IE_CLASSIF_TABLE_ALOC_SIZE_LOCAL (LM_DCBX_IE_CLASSIF_ENTRIES_TO_ALOC_SIZE(LM_DCBX_IE_CLASSIF_NUM_ENTRIES_LOCAL))
#define LM_DCBX_IE_CLASSIF_TABLE_ALOC_SIZE_REMOTE (LM_DCBX_IE_CLASSIF_ENTRIES_TO_ALOC_SIZE(LM_DCBX_IE_CLASSIF_NUM_ENTRIES_REMOTE))
// For debbuging purpose only This size has no arbitrary.
#define LM_DCBX_MAX_TRAFFIC_TYPES (8)
#define LM_DCBX_ILLEGAL_PRI (MAX_PFC_PRIORITIES)
PORT_MAX * sizeof(lldp_params_t) + \
typedef struct _lm_dcbx_stat
{
typedef enum
{
typedef enum
{
typedef enum {
typedef enum {
typedef struct _lm_dcbx_indicate_event_t
{
// This design supports only one client bounded
#define DCB_STATE_CONFIGURED_BY_OS_QOS (1 << 0)
// Configuration parameters
// CEE doesn't support CONDITION_TCP_PORT.
// If an ISCSI entry with CONDITION_TCP_PORT will be accepted (and enforced), but kept locally in the driver
// and not passed to MCP. This entry will be used when determining iSCSI priority:
// If the operational configuration from MCP contains an entry with 'TCP or UDP port' = 3260 use that entry,
// Else if OS configuration contained an entry with 'TCP port' = 3260 use that entry,
// Else use the default configuration.
// Only for debug use
typedef struct _lm_dcbx_info_t
{
// The dcbx ramrod state
volatile u32_t dcbx_ramrod_state;
// Flow control configuration
void *pfc_fw_cfg_virt;
#define DCBX_ERROR_NO_ERROR (0)
#define DCBX_ERROR_MCP_CMD_FAILED (1 << 0)
// This parameter can only be changed in is_dcbx_neg_received and is a one-shut parameter
// saved the original admin MIB
// Should not be used in MF this is only a pach until MCP will know how to return to default
// Indicate event to upper layer.
volatile u32_t is_indicate_event_en;
/*
1. This array will serve in order to find the correct COS in Fast path in O (1).(Instead of O(num_of_opr_cos))
2. All entries must always contain a valid COS value that will be between "num_of_opr_cos -1".
3. This array will be filled in slow path.
4. Any Array change or access will not require any lock.
*/
// For debugging
/******************************start Debbuging code not to submit**************************************/
/******************************end Debbuging code not to submit****************************************/
/**
* @description
* Set in a shared port memory place if DCBX completion was
* received. Function is needed for PMF migration in order to
* synchronize the new PMF that DCBX results has ended.
* @param pdev
* @param is_completion_recv
*/
void
////////////////////// End DCBX define /////////////////////////////////////////////////////
typedef enum
{
NOT_PMF = 0,
PMF_ORIGINAL = 1,
PMF_MIGRATION = 2,
typedef enum
{
MAC_TYPE_NONE = 0,
MAC_TYPE_EMAC = 1,
MAC_TYPE_BMAC = 2,
MAC_TYPE_UMAC = 3,
MAC_TYPE_XMAC = 4,
MAC_TYPE_MAX = 5
} mac_type_t;
// this is based on bdrv_if.h "l2_ioc_link_settings_t"
typedef struct _lm_reported_link_params_t
{
typedef struct _lm_variables_t
{
#if defined(__SunOS)
#endif
// Host Coalescing acknowledge numbers - this is the local copy to compare against the status index of each of the status blocks.
u16_t attn_state; //states for all 16 attn lines (per func) 0=ready for assertion 1=ready for deassertion
route_cfg_sig_output attn_groups_output[MAX_DYNAMIC_ATTN_GRPS]; //dynamic attn groups wiring definitions
#define PORT_STATE_CLOSE 0
#define PORT_STATE_OPEN 1
#define PORT_STATE_CLOSING 2
// lm statistics
//TODO MCP interface ready
/* Serdes autonegotiation fallback. For a serdes medium,
* if we cannot get link via autonegotiation, we'll force
* the speed to get link. */
//TODO after specs of serdes
/*Target phy address used with mread and mwrite*/
/* This flag is set if the cable is attached when there
* is no link. The upper module could check this flag to
* determine if there is a need to wait for link. */
/* Write sequence for driver pulse. */
// the page tables
void **searcher_t1_virt_addr_table;
void **searcher_t2_virt_addr_table;
void **timers_linear_virt_addr_table;
void** qm_queues_virt_addr_table;
void **context_cdu_virt_addr_table;
void * elt_virt_addr_table[NUM_OF_ELT_PAGES];
// Zeroed buffer to use in WB zero memory
u32_t clk_factor ; // clock factor to multiple timeouts in non ASIC (EMUL/FPGA) cases (value is 1 for ASIC)
// 0x0000ff00 - Bus
// 0x000000ff - Device
#ifndef INST_ID_TO_BUS_NUM
#define MAX_PCI_BUS_NUM (256)
#endif // INST_ID_TO_BUS_NUM
* The only impact on ASIC is an extra "if" command to check chip rev */
#ifndef USER_LINUX
#endif // USER_LINUX
#if defined(EMULATION_DOORBELL_FULL_WORKAROUND)
#define DOORBELL_CHECK_FREQUENCY 500
#define ALLOWED_DOORBELLS_HIGH_WM 1000
#define ALLOWED_DOORBELLS_LOW_WM 700
#endif // EMULATION_DOORBELL_FULL_WORKAROUND
// is this device in charge on link support.
#define IS_PMF(_pdev) (( PMF_ORIGINAL == (_pdev)->vars.is_pmf) || ( PMF_MIGRATION == (_pdev)->vars.is_pmf))
// The load-response we received from MCP when loading... need for elink calls and convenient
// for debugging.
// cls_vars
struct elink_vars link;
/* sriov-related */
//u8_t num_vfs_enabled; /* number of vfs that were enabled, need this for disabling them */
typedef struct _eth_tx_prod_t
{
/*******************************************************************************
* global chip info
******************************************************************************/
typedef struct _lm_chip_global_t
{
#define LM_CHIP_GLOBAL_FLAG_NIG_RESET_CALLED 0x2 // the flag will be set when lm_reset_path() will do nig reset
// the flag will be reset after grc timeout occured and the cause is NIG access OR after another "no nig" reset
u8_t func_en[E1H_FUNC_MAX]; /* Used for WOL: each function needs to mark itself: whether it should be enabled when reseting nig with wol enabled */
/*******************************************************************************
* bd chain
******************************************************************************/
/*******************************************************************************
* Transmit info.
******************************************************************************/
typedef struct _lm_tx_chain_t
{
u16_t volatile *hw_con_idx_ptr;
/* debug stats */
typedef struct _lm_tx_info_t
{
} lm_tx_info_t;
/*******************************************************************************
* Receive info.
******************************************************************************/
typedef struct _lm_rx_chain_common_t
{
/*******************************************************/
/*******************************************************************************
* TPA start info.
******************************************************************************/
#define LM_TPA_MAX_AGG_SIZE (8)
#define LM_TPA_MIN_DESC (LM_TPA_MAX_AGGS * LM_TPA_MAX_AGG_SIZE * 2) // TODO_RSC fine tuning Minimum TPA must be 64 for mask_array.
#define LM_TPA_BD_ELEN_SIZE (sizeof(struct eth_rx_sge))
//Ramrod defines
#define LM_TPA_SGE_PAUSE_THR_LOW (150)
#define LM_TPA_SGE_PAUSE_THR_HIGH (250)
typedef struct _lm_tpa_cahin_dbg_params
{
typedef enum
{
lm_tpa_state_disable = 0, // VBD changes to the state only under RX lock.
// In this state VBD won't accept RSC packet descriptors.
lm_tpa_state_wait_packets = 1, // VBD is waiting to receive number of "tpa_info:: tpa_desc_cnt_per_chain
// " multiply "RSS queues" RSC l2packet. After first enable.
lm_tpa_state_invalid = 3,
typedef struct _lm_tpa_sge_chain_t
{
#define LM_TPA_CHAIN_BD(_pdev, _idx) ((_pdev)->rx_info.rxq_chain[_idx].tpa_chain.sge_chain.bd_chain)
#define LM_TPA_CHAIN_BD_NUM_ELEM(_pdev, _idx) ((_pdev)->rx_info.rxq_chain[_idx].tpa_chain.sge_chain.size)
#define LM_TPA_ACTIVE_ENTRY_BOUNDARIES_VERIFY(_pdev,_idx,_entry) DbgBreakIf((LM_TPA_ACTIVE_DESCQ_ARRAY_ELEM(_pdev,_idx) <= (_entry)))
u64_t* mask_array; // Will have exactly a bit for each entry in the tpa_chain::sge_chain:: active_descq_array.
// Each bit represent if the RSC bd is free or used.1 is used. 0 is free.
/* Number of u64 elements in SGE mask array */
#define LM_TPA_BD_ENTRY_TO_MASK_ENTRY(_pdev,_idx,_x) (LM_TPA_BD_ENTRY_TO_ACTIVE_ENTRY(_pdev,_idx,_x) >> BIT_VEC64_ELEM_SHIFT)
#define LM_TPA_MASK_SET_ACTIVE_BIT(_pdev,_idx,_active_entry) LM_TPA_ACTIVE_ENTRY_BOUNDARIES_VERIFY(_pdev,_idx,_active_entry); \
#define LM_TPA_MASK_CLEAR_ACTIVE_BIT(_pdev,_idx,_active_entry) DbgBreakIf(0 == LM_TPA_MASK_TEST_ACTIVE_BIT(_pdev,_idx,_active_entry)); \
#define LM_TPA_MASK_TEST_ACTIVE_BIT(_pdev,_idx,_active_entry) (BIT_VEC64_TEST_BIT((&LM_SGE_TPA_CHAIN(_pdev,_idx))->mask_array,_active_entry))
// This is derived from the implementation that we will check in resolution of 64 for optimization.
// sge_chain::size should be larger from tpa_desc_cnt_per_chain
typedef struct _lm_tpa_start_coales_bd_t
{
typedef struct _lm_tpa_chain_t
{
lm_tpa_start_coales_bd_t start_coales_bd[LM_TPA_MAX_AGGS]; //Each entry represents an open coalescing,
// and save the first packet descriptor.
// all the state are suppose to be synchronized we keep them per chain and not in TPA info for reason of lock.
// The lock in lw_recv_packets is taken per chain
// The RSC state. The state is initialized to tpa_state_disable.
struct tpa_update_ramrod_data* ramrod_data_virt;
// Debug information
typedef struct _lm_tpa_info_t
{
struct tpa_update_ramrod_data* ramrod_data_virt;
volatile void * update_cookie;
volatile u32_t ramrod_recv_cnt; // Number of ramrods received.Decrement by using Interlockeddecrement.
#define TPA_STATE_NONE 0
#define TPA_STATE_RAMROD_SENT 1
#define TPA_IPVX_DISABLED (0)
#define TPA_IPV4_ENABLED (1<<0)
/*******************************************************************************
* RSC end info.
******************************************************************************/
typedef enum
{
LM_RXQ_CHAIN_IDX_BD = 0,
LM_RXQ_CHAIN_IDX_SGE = 1,
LM_RXQ_CHAIN_IDX_MAX = 2,
typedef struct _lm_rx_chain_t
{
/*******************************************************************************
* send queue info.
******************************************************************************/
typedef struct _lm_sq_chain_t
{
/* This is a contiguous memory block of params.l2_sq_bd_page_cnt pages
* used for rx completion. The BD chain is arranged as a circular
* chain where the last BD entry of a page points to the next page,
* and the last BD entry of the last page points to the first. */
struct slow_path_element *sq_chain_virt;
struct slow_path_element *prod_bd;
struct slow_path_element *last_bd;
/**
* Event Queue Structure. Used for the main event-queue, and
* also event queues used by iscsi + fcoe
*/
typedef struct _lm_eq_chain_t
{
u16_t volatile *hw_con_idx_ptr;
/* the rcq chain now holds the real HSI eth_rx_cqe */
typedef struct _lm_rcq_chain_t
{
u16_t volatile *hw_con_idx_ptr;
typedef struct _lm_rx_info_t
{
#define LM_RXQ_CHAIN(_pdev, _idx, _rxq_chain_idx) (_pdev)->rx_info.rxq_chain[_idx].chain_arr[_rxq_chain_idx]
#define LM_RXQ_SGE_PTR_IF_VALID(_pdev, _idx) LM_RXQ_IS_CHAIN_SGE_VALID(_pdev, _idx) ? &LM_RXQ_CHAIN_SGE(_pdev, _idx ) : NULL
} lm_rx_info_t;
#define MAX_RAMRODS_OUTSTANDING 2
typedef struct _lm_request_sp
{
#define REQ_SET_INFORMATION 0x1
#define REQ_QUERY_INFORMATION 0x2
u8_t ramrod_priority; //ramrod priority (this priority is for the 'common sq' and not for the 'per CID one outstanding' mechnism)
struct sq_pending_command sp_list_command;
typedef union _client_init_data_t{
struct client_init_ramrod_data init_data;
struct tx_queue_init_ramrod_data tx_queue;
typedef struct _lm_client_info_update
{
struct client_update_ramrod_data *data_virt;
#define LM_CLI_UPDATE_NOT_USED 0
#define LM_CLI_UPDATE_USED 1
#define LM_CLI_UPDATE_RECV 2
typedef struct _lm_client_info_t
{
/* Classification objects used in ecore-sp-verbs */
struct ecore_vlan_mac_obj mac_obj;
struct ecore_vlan_mac_obj mac_vlan_obj;
struct ecore_vlan_mac_obj vlan_obj; /* 9/21/11 MichalS :used only for default, but placed here as a preparation for
* future enhancement to support per client if needed */
void * volatile set_mac_cookie;
volatile u32_t sp_mac_state;
/* RX_MODE related */
void * volatile set_rx_mode_cookie;
volatile unsigned long sp_rxmode_state;
} lm_client_info_t ;
/*************** SlowPath Queue Information: should be modified under SQ_LOCK ************/
typedef enum {
SQ_STATE_NORMAL = 0,
* completed by vbd work-item (Error Recovery) */
SQ_STATE_BLOCKED = 2
typedef struct _lm_sq_info_t
{
/* This list contains the elements that have been posted to the SQ
* but not completed by FW yet. Maximum list size is MAX_NUM_SPE anyway */
} lm_sq_info_t;
typedef enum {
FUNCTION_STOP_POSTED = 2,
typedef struct _lm_eq_info_t
{
volatile u32_t function_state;
} lm_eq_info_t;
/* for now */
//TODO : need to change according to hsi enum
#if 0
#define LM_PROTO_NIC 0
#define LM_PROTO_TOE 1
#endif //0
/*******************************************************************************
* cid resources
******************************************************************************/
typedef struct _lm_cid_resc_t
{
#if defined(__SunOS)
#endif
volatile void *mapped_cid_bar_addr;/* Holds the mapped BAR address.*/
#define LM_CON_STATE_CLOSE 0
#define LM_CON_STATE_OPEN_SENT 1
#define LM_CON_STATE_OPEN 2
#define LM_CON_STATE_HALT_SENT 3
#define LM_CON_STATE_HALT 4
#define LM_CON_STATE_TERMINATE 5
struct lm_context_cookie{
};
#define LM_MAX_VALID_CFC_DELETIONS 3
#define LM_CONTEXT_VALID 0
#define LM_CONTEXT_INVALID_WAIT 1
#define LM_CONTEXT_INVALID_DELETE 2
/* The size of the context is currently 1K... this can change in the future*/
#define LM_CONTEXT_SIZE 1024
/* structures to support searcher hash table entries */
typedef struct _lm_searcher_hash_entry {
typedef struct _lm_searcher_hash_info {
#define SEARCHER_KEY_LEN 40
/* length in bytes of IPV6 "4 tuple" */
#define MAX_SEARCHER_IN_STR 36
/* per-function context data */
typedef struct _lm_context_info {
struct lm_context_cookie * array;
/* spinlock_t lock; lock was moved to the UM */
/* field added for searcher mirror hash management.
* it is part of the context info because this hash management
* is done as part of cid allocation/de-allocating */
//#endif /* 0 */
/*******************************************************************************
* Include the l4 header file.
******************************************************************************/
#include "lm_l4st.h"
#include "lm_l4if.h"
#include "lm_l5st.h"
#include "lm_l5if.h"
/* lm device offload info that is common to all offloaded protocols */
typedef struct _lm_offload_info_t
{
struct _lm_device_t *pdev;
/* Per stack offload state info. Each index correspond to a stack. */
#define STATE_BLOCK_IDX0 0
#define STATE_BLOCK_TOE STATE_BLOCK_IDX0
#define STATE_BLOCK_IDX1 1
#define STATE_BLOCK_IDX2 2
#define STATE_BLOCK_ISCSI STATE_BLOCK_IDX2
#define STATE_BLOCK_IDX3 3
#define STATE_BLOCK_RDMA STATE_BLOCK_IDX3
#define STATE_BLOCK_IDX4 4
#define STATE_BLOCK_FCOE STATE_BLOCK_IDX4
#define STATE_BLOCK_CNT 5
struct iro {
} ;
/* ecore info. Variables that are accessed from the common init code need using the defines below */
typedef struct _ecore_info_t
{
void * gunzip_buf; /* used for unzipping data */
#define FW_BUF_SIZE 0x8000
/* Init blocks offsets inside init_ops */
const u16_t *init_ops_offsets;
/* Data blob - has 32 bit granularity */
/* Zipped PRAM blobs - raw data */
const u8_t *tsem_int_table_data;
const u8_t *tsem_pram_data;
const u8_t *usem_int_table_data;
const u8_t *usem_pram_data;
const u8_t *xsem_int_table_data;
const u8_t *xsem_pram_data;
const u8_t *csem_int_table_data;
const u8_t *csem_pram_data;
} ecore_info_t;
typedef struct _flr_stats_t {
} flr_stats_t;
typedef struct _lm_slowpath_data_t {
/* Function Start Data */
struct function_start_data * func_start_data;
/* Classification */
union {
struct mac_configuration_cmd e1x;
struct eth_classify_rules_ramrod_data e2;
} * mac_rdata[LM_CLI_IDX_MAX];
/* TODO: MAC-VLAN PAIR!!! */
union {
struct tstorm_eth_mac_filter_config e1x;
struct eth_filter_rules_ramrod_data e2;
} * rx_mode_rdata[LM_CLI_IDX_MAX];
union {
struct mac_configuration_cmd e1;
struct eth_multicast_rules_ramrod_data e2;
} * mcast_rdata[LM_CLI_IDX_MAX];
union {
//struct eth_rss_update_ramrod_data_e1x e1x;
struct eth_rss_update_ramrod_data e2;
} * rss_rdata;
typedef enum _niv_ramrod_state_t
{
typedef enum _ufp_ramrod_state_t
{
typedef struct _lm_slowpath_info_t {
/* CAM credit pools */
struct ecore_credit_pool_obj vlans_pool;
struct ecore_credit_pool_obj macs_pool;
/* Rx-Mode Object */
struct ecore_rx_mode_obj rx_mode_obj;
/* Multi-Cast */
volatile void * set_mcast_cookie[LM_CLI_IDX_MAX];
/* RSS - Only support for NDIS client ! */
struct ecore_rss_config_obj rss_conf_obj;
volatile void * set_rss_cookie;
volatile u32_t sp_rss_state;
// possible values of the echo field
#define FUNC_UPDATE_RAMROD_NO_SOURCE 0
#define FUNC_UPDATE_RAMROD_SOURCE_NIV 1
#define FUNC_UPDATE_RAMROD_SOURCE_L2MP 2
#define FUNC_UPDATE_RAMROD_SOURCE_ENCAP 3
#define FUNC_UPDATE_RAMROD_SOURCE_UFP 4
volatile u32_t l2mp_func_update_ramrod_state;
#define L2MP_FUNC_UPDATE_RAMROD_NOT_POSTED 0
#define L2MP_FUNC_UPDATE_RAMROD_POSTED 1
#define L2MP_FUNC_UPDATE_RAMROD_COMPLETED 2
volatile u8_t last_vif_list_bitmap;
#define MAX_ER_DEBUG_ENTRIES 10
typedef struct _lm_er_debug_info_t
{
typedef enum _encap_ofld_state_t
{
typedef struct _lm_encap_info_t
{
volatile void * update_cookie;
typedef struct _lm_debug_info_t
{
/* Debug information for error recovery. */
/* Data for last MAX_ER_DEBUG_ENTRIES recoveries */
/* Some temporary statistics for removed sanity checks */
u32_t pending_tx_packets_on_fwd; /* There were pending tx packets on forward channel at time of abort
* CQ57879 : evbda!um_abort_tx_packets while running Super Stress with Error Recovery */
/* OS bugs worked-around in eVBD */
/*
* CQ 70040
* Support for NSCI get OS driver version
*/
typedef struct _lm_cli_drv_ver_to_shmem_t
{
struct os_drv_ver cli_drv_ver;
/*******************************************************************************
* Main device block.
******************************************************************************/
typedef struct _lm_device_t
{
//lm_mc_table_t mc_table;
/* Statistics. */
struct _lm_device_t* pf_dev;
#ifdef VF_INVOLVED
//PF master params
//VF PF Channel params
void * pf_vf_acquiring_resp;
#endif
/*
* 08/01/2014
* CQ 70040
* Support for NSCI get OS driver version
*/
/* Turned on if a panic occured in the device... (viewed by functions that wait and get a timeout... - do not assert... )
* not turned on yet, prep for the future...
*/
} lm_device_t;
// driver pulse interval calculation
#define DRV_PULSE_PERIOD_MS_FACTOR(_p) CHIP_REV_IS_ASIC(_p) ? DRV_PULSE_PERIOD_MS : (DRV_PULSE_PERIOD_MS*10)
// dropless mode definitions
#define FW_PREFETCH_CNT 16
#define DROPLESS_FC_HEADROOM 150
/*******************************************************************************
* Functions exported between file modules.
******************************************************************************/
/* Prints the entire information of all status blocks
* Parameters:
* pdev - LM device which holds the status blocks within
*/
//__________________________________________________________________________________
/* returns a non-default status block according to rss ID
* Parameters:
* pdev - LM device which holds the status blocks within
* rss_id - RSS ID for which we return the specific status block
*/
/* returns the default status block. It is unique per function.
* Parameters:
* pdev - LM device which holds the status blocks within
*/
/* returns the attention status block. It is unique per function.
* Parameters:
* pdev - LM device which holds the status blocks within
*/
/**
* @Description
* Prepares for MCP reset: takes care of CLP
* configurations.
*
* @param pdev
* @param magic_val Old value of 'magic' bit.
*/
/* Initalize the whole status blocks per port - overall: 1 defalt sb, 16 non-default sbs
*
* Parameters:
* pdev - the LM device which holds the sbs
* port - the port number
*/
void lm_setup_ndsb_index(struct _lm_device_t *pdev, u8_t sb_id, u8_t idx, u8_t sm_idx, u8_t timeout, u8_t dhc_enable);
/**
* This function sets all the status-block ack values back to
* zero. Must be called BEFORE initializing the igu + before
* initializing status-blocks.
*
* @param pdev
*/
/* set interrupt coalesing parameters.
- these settings are derived from user configured interrupt coalesing mode and tx/rx interrupts rate (lm params).
- these settings are used for status blocks initialization */
/**
* @description
* Get the HC_INDEX_ETH_TX_CQ_CONS_COSX index from chain.
* @param pdev
* @param chain
*
* @return STATIC u8_t
*/
/**
* This function sets all the status-block ack values back to
* zero. Must be called BEFORE initializing the igu + before
* initializing status-blocks.
*
* @param pdev
*/
/* Driver calls this function in order to ACK the default/non-default status block index(consumer) toward the chip.
* This is needed by the hw in order to decide whether an interrupt should be generated by the IGU.
* This is achieved via write into the INT ACK register.
*
* Parameters:
* pdev - this is the LM device
*/
#define USTORM_INTR_FLAG 1
#define CSTORM_INTR_FLAG 2
#define SERV_RX_INTR_FLAG 4
#define SERV_TX_INTR_FLAG 8
#ifndef USER_LINUX
{
if (CHIP_IS_E1x(pdev))
{
return HC_SB_MAX_INDICES_E1X;
}
else
{
return HC_SB_MAX_INDICES_E2;
}
}
{
#ifdef VF_INVOLVED
if (IS_CHANNEL_VFDEV(pdev)) {
}
#endif
if (CHIP_IS_E1x(pdev))
{
return mm_le16_to_cpu(pdev->vars.status_blocks_arr[sb_id].host_hc_status_block.e1x_sb->sb.running_index[sm_idx]);
}
else
{
return mm_le16_to_cpu(pdev->vars.status_blocks_arr[sb_id].host_hc_status_block.e2_sb->sb.running_index[sm_idx]);
}
}
{
#ifdef VF_INVOLVED
if (IS_CHANNEL_VFDEV(pdev)) {
}
#endif
if (CHIP_IS_E1x(pdev))
{
return mm_le16_to_cpu(pdev->vars.status_blocks_arr[sb_id].host_hc_status_block.e1x_sb->sb.index_values[idx]);
}
else
{
return mm_le16_to_cpu(pdev->vars.status_blocks_arr[sb_id].host_hc_status_block.e2_sb->sb.index_values[idx]);
}
}
{
u16_t volatile * running_indexes_ptr;
if (CHIP_IS_E1x(pdev))
{
running_indexes_ptr = &pdev->vars.status_blocks_arr[sb_idx].host_hc_status_block.e1x_sb->sb.running_index[0];
}
else
{
running_indexes_ptr = &pdev->vars.status_blocks_arr[sb_idx].host_hc_status_block.e2_sb->sb.running_index[0];
}
return running_indexes_ptr;
}
{
u16_t volatile * indexes_ptr;
#ifdef VF_INVOLVED
if (IS_CHANNEL_VFDEV(pdev)) {
}
#endif
if (CHIP_IS_E1x(pdev))
{
indexes_ptr = &pdev->vars.status_blocks_arr[sb_idx].host_hc_status_block.e1x_sb->sb.index_values[0];
}
else
{
}
return indexes_ptr;
}
{
{
{
}
}
/* FIXME: this doesn't have to be right - drv rss id can differ from sb-id */
return drv_sb_id;
}
{
{
case LM_SINGLE_SM:
/* One Segment Per u/c */
break;
case LM_DOUBLE_SM_SINGLE_IGU:
/* One Segment Per u/c */
break;
default:
{
{
}
else
{
}
}
break;
}
return flags;
}
/* Check whether a non-default status block has changed, that is,
* the hw has written a new prod_idx for on or more of its storm parts.
*
* Parameters:
* pdev - this is the LM device
* sb_idx - this is the index where the status block lies in the array under the lm_device
*
* Return Value:
* result - TRUE in case the specific status block is considered as changed.
* FALSE otherwise.
*
* Nots:
* For performance optimization, this function is static inline.
*/
{
if (!pdev)
{
return FALSE;
}
{
{
}
}
{
{
}
}
return result;
}
#endif // !USER_LINUX
/* Check if the default statu blocks has changed, that is,
* the hw has written a new prod_idx for on or more of its storm parts.
*
* Parameters:
* pdev - this is the LM device
*
* Return Value:
* result - TRUE in case the status block is considered as changed.
* FALSE otherwise.
*/
/* Check if the status block has outstanding completed Rx requests
*
* Parameters:
* pdev - this is the LM device
* sb_idx - this is the index where the status block lies in the array under the lm_device
*
* Return Value:
* result - TRUE in case the status block has new update regarding Rx completion
* FALSE otherwise.
*/
/* Check if the status block has outstanding completed Tx requests
*
* Parameters:
* pdev - this is the LM device
* sb_idx - this is the index where the status block lies in the array under the lm_device
*
* Return Value:
* result - TRUE in case the status block has new update regarding Tx completion
* FALSE otherwise.
*/
/*
* Handle an IGU status-block update.
* Parameters:
* pdev - the LM device
* igu_sb_id - the igu sb id that got the interrupt / MSI-X message
* rx_rss_id / tx_rss_id - matching driver chains
* flags: service_rx / service_tx to know which activity occured
*/
u8_t lm_handle_igu_sb_id(lm_device_t *pdev, u8_t igu_sb_id, OUT u8_t *rx_rss_id, OUT u8_t *tx_rss_id);
);
lm_status_t lm_establish_eth_con(struct _lm_device_t *pdev, u8_t const cid, u8_t sb_id, u8_t attributes_bitmap);
const u8_t send_halt_ramrod);
/*
* save client connection parameters for a given L2 client
*/
/*
* allocate and setup txq, rxq, rcq and set tstrom ram values for L2 client connection of a given client index
*/
/*
* reset txq, rxq, rcq counters for L2 client connection
*/
);
/*
* clear the status block consumer index in the internal ram for a given status block index
*/
);
/* Does relevant processing in case of attn signals assertion.
* 1)Write '1' into attn_ack to chip(IGU) (do this in parallel for _all_ bits including the fixed 8 hard-wired via the
* set_ack_bit_register
* 2)MASK AEU lines via the mask_attn_func_x register (also in parallel) via GRC - for AEU lower lines 0-7 only!
* 3)Only for the 8 upper fixed hard-wired AEU lines: do their relevant processing, if any.
Finally, drv needs to "clean the attn in the hw block"(e.g. INT_STS_CLR) for them.
*
* Parameters:
* pdev - this is the LM device
* assertion_proc_flgs - attn lines which got asserted
*/
/* Does relevant processing in case of attn signals deassertion.
* 1) Grab split access lock register of MCP (instead of SW arbiter)
* 2) Read 128bit after inverter via the 4*32regs via GRC.
* 3) For each dynamic group (8 lower bits only!), read the masks which were set aside to find for each group which attn bit is a member and
* needs to be handled. pass all over atten bits belonged to this group and treat them accordingly.
* After an attn signal was handled, drv needs to "clean the attn in the hw block"(e.g. INT_STS_CLR) for that attn bit.
* 4) Release split access lock register of MCP
* 5) Write '0' into attn_ack to chip(IGU) (do this in parallel for _all_ bits, including the fixed 8 hard-wired, via the set_ack_bit_register)
* 6) UNMASK AEU lines via the mask_attn_func_x register (also in parallel) via GRC - for AEU lower lines 0-7 only!
*
* Parameters:
* pdev - this is the LM device
* deassertion_proc_flgs - attn lines which got deasserted
*/
/* Returns the attn_bits and attn_ack fields from the default status block
*
* Parameters:
* pdev - this is the LM device
* attn_bits - OUT param which receives the attn_bits from the atten part of the def sb
* attn_ack - OUT param which receives the attn_ack from the atten part of the def sb
*/
/**Genrate a general attention on all functions but this one,
* which causes them to update their link status and CMNG state
* from SHMEM.
*
* @param pdev the LM device
*/
/**
* @description
* Calculates BW according to current linespeed and MF
* configuration of the function in Mbps.
* @param pdev
* @param link_speed - Port rate in Mbps.
* @param vnic
*
* @return u16
* Return the max BW of the function in Mbps.
*/
/**Update CMNG and link info from SHMEM and configure the
* firmware to the right CMNG values if this device is the PMF.
*
* @note This function must be called under PHY_LOCK
*
* @param pdev the LM device
*/
/* Returns the number of toggled bits in a 32 bit integer
* n - integer to count its '1' bits
*/
/**
* General function that waits for a certain state to change,
* not protocol specific. It takes into account vbd-commander
* and reset-is-in-progress
*
* @param pdev
* @param curr_state -> what to poll on
* @param new_state -> what we're waiting for
*
* @return lm_status_t TIMEOUT if state didn't change, SUCCESS
* otherwise
*/
lm_status_t lm_wait_state_change(struct _lm_device_t *pdev, volatile u32_t * curr_state, u32_t new_state);
/* copy the new values of the status block prod_index for each strom into the local copy we hold in the lm_device
*
* Parameters:
* pdev - this is the LM device
* sb_idx - this is the index where the status block lies in the array under the lm_device
*/
void lm_update_fp_hc_indices(lm_device_t *pdev, u8_t igu_sb_id, u32_t *activity_flg, u8_t *drv_rss_id);
/* mdio access functions*/
void
void
void
void
void
void
lm_device_t *pdev);
//TODO check if we need that when MCP ready
// mcp interface
lm_device_t *pdev);
void
void
struct _lm_device_t *pdev,
//acquire split MCP access lock register
//Release split MCP access lock register
/*******************************************************************************
* Description:
*
* Return:
******************************************************************************/
#ifdef __BIG_ENDIAN
#define CHANGE_ENDIANITY TRUE
#else
#define CHANGE_ENDIANITY FALSE
#endif
// do not call this macro directly from the code!
#define REG_WR_DMAE_LEN_IMP(_pdev,_reg_offset, _addr_src, _b_src_is_zeroed, _len, le32_swap) lm_dmae_reg_wr(_pdev, \
(void*)_addr_src, \
// do not call this macro directly from the code!
_reg_offset, \
_len,\
// Macro for writing a buffer to destination address using DMAE when data given is in VIRTUAL ADDRESS,
#define VIRT_WR_DMAE_LEN(_pdev, _src_addr, _dst_addr, _len, le32_swap) REG_WR_DMAE_LEN_IMP(_pdev, _dst_addr, _src_addr, FALSE, _len, le32_swap)
// Macro for writing a buffer to destination address using DMAE when data given is in PHYSICAL ADDRESS,
_src_addr, \
// Macro for copying physical buffer using DMAE,
#define PHYS_COPY_DMAE_LEN(_pdev, _src_addr, _dst_addr, _len) lm_dmae_copy_phys_buffer_unsafe( _pdev,\
// write a buffer to destination address using DMAE
#define REG_WR_DMAE_LEN(_pdev,_reg_offset, _addr_src, _len) REG_WR_DMAE_LEN_IMP(_pdev, _reg_offset, _addr_src, FALSE, _len, FALSE)
// read from a buffer to destination address using DMAE
#define REG_RD_DMAE_LEN(_pdev,_reg_offset, _addr_dst, _len) REG_RD_DMAE_LEN_IMP(_pdev,_reg_offset, _addr_dst, _len)
// write a zeroed buffer to destination address using DMAE
#define REG_WR_DMAE_LEN_ZERO(_pdev,_reg_offset, _len) REG_WR_DMAE_LEN_IMP(_pdev,_reg_offset, pdev->vars.zero_buffer, TRUE, _len, FALSE)
// Write to regiters, value of length 64 bit
// Read from regiters, value of length 64 bit
/* Indirect register access. */
#ifndef __LINUX
/* BAR write32 via register address */
#else
/* BAR write32 via register address */
#endif
#ifdef _VBD_CMD_
#define VBD_CMD_VERIFY_BAR_ACCESS(_pdev, _bar, _offset) vbd_cmd_on_bar_access(_pdev, _bar, _offset);
#else
#endif
/* BAR read8 via register offset and specific bar */
do { \
mm_read_barrier(); \
} while (0)
/* BAR read16 via register offset and specific bar */
do { \
mm_read_barrier(); \
} while (0)
/* BAR read32 via register offset and specific bar */
do { \
mm_read_barrier(); \
} while (0)
/* BAR read64 via register offset and specific bar */
do { \
mm_read_barrier(); \
} while (0)
/* BAR write8 via register offset and specific bar */
do { \
mm_write_barrier(); \
} while (0)
/* BAR write16 via register offset and specific bar */
do { \
mm_write_barrier(); \
} while (0)
/* BAR write32 via register offset and specific bar */
do { \
mm_write_barrier(); \
} while (0)
/* BAR write64 via register offset and specific bar */
do { \
mm_write_barrier(); \
} while (0)
/* BAR copy buffer to specific bar address */
do { \
u32_t i; \
for (i=0; i<size; i++) { \
*((u32_t volatile *) ((u8_t *) (_pdev)->vars.mapped_bar_addr[(_bar)]+(_offset)+i*4))=*(buf_ptr+i); \
} \
} while (0)
#else
#endif
#ifndef USER_LINUX
#if DBG && LOG_REG_ACCESS
{ \
}
{ \
}
#else
#endif /* DBG */
#endif /* USER_LINUX */
#if defined(__SunOS)
#ifdef __SunOS_MDB
{
return val;
}
do { \
} while (0)
#else /* __SunOS && !__SunOS_MDB */
(_reg_offset)))
(_reg_offset)), \
(_val)) \
(_reg_offset)))
(_reg_offset)), \
(_val))
#endif /* __SunOS_MDB */
//we repeat this function's signature here because including everest_sim.h leads to a circular dependency.
{
return val;
}
/* Register access via register name. Macro returns a value */
{
return val;
}
// Offset passed to LOG_REG_WR is now without the bar address!
do { \
} while (0)
do { \
} while (0)
#elif !defined(USER_LINUX)
{
return val;
}
/* Register access via register name. Macro returns a value */
{
return val;
}
// Offset passed to LOG_REG_WR is now without the bar address!
do { \
} while (0)
do { \
} while (0)
#endif /* USER_LINUX */
/* TBA: optionally add LOG_REG_WR as in Teton to write 8/16/32*/
// special macros for reading from shared memory
/* TBD - E1H: all shmen read/write operations currenly use FUNC_ID for offset calculatio. This may not be right! MCP TBD*/
#define LM_SHMEM2_ADDR(_pdev, field) (_pdev->hw_info.shmem_base2 + OFFSETOF(struct shmem2_region, field))
DbgMessage(pdev, INFORMi, "LM_INTMEM_WRITE16() inside! storm:%s address:0x%x offset=%x val=%x\n",#_type,_type, _offset, _val); \
//________________________________________________________________________________
u32_t reg_wait_verify_val(struct _lm_device_t * pdev, u32_t reg_offset, u32_t excpected_val, u32_t total_wait_time_ms );
#if !defined(_VBD_CMD_)
#else
/* For VBD_CMD: we don't verify values written... */
#endif
#define DPM_TRIGER_TYPE 0x40
#if defined(EMULATION_DOORBELL_FULL_WORKAROUND)
} while(0)
{
if (!pf_dev) {
}
/* wait while doorbells are blocked */
wait_cnt++; /* counter required to avoid Watcom warning */
}
if (db_fill > ALLOWED_DOORBELLS_HIGH_WM) {
"EMULATION_DOORBELL_FULL_WORKAROUND: db_fill=%d, doorbell in busy wait!\n",
db_fill);
/* block additional doorbells */
/* busy wait for doorbell capacity */
do {
if (db_fill == 0xffffffff) {
break;
}
} while (db_fill > ALLOWED_DOORBELLS_LOW_WM);
/* incr statistics */
/* unblock additional doorbells */
}
}
}
}
#else
// need to change LM_PAGE_SIZE to OS page size + when we will have 2 bars BAR_DOORBELL_OFFSET is not needed.
} while(0)
#endif /* defined(EMULATION_DOORBELL_FULL_WORKAROUND) */
// used on a CID received from the HW - ignore bits 17, 18 and 23 (though 19-22 can be ignored as well)
{
{
/* mapping iscsi / fcoe cids to the default status block */
}
else
{
}
return sb_id;
}
static void __inline lm_set_virt_mode(struct _lm_device_t *pdev, u8_t device_type, u8_t virtualization_type)
{
{
DbgBreakMsg("lm_set_virt_mode pdev is null");
return;
}
if ((pdev->params.device_type == DEVICE_TYPE_PF) && (pdev->params.virtualization_type == VT_NONE)) {
switch (device_type) {
case DEVICE_TYPE_PF:
switch (virtualization_type) {
case VT_NONE:
break;
case VT_BASIC_VF:
case VT_CHANNEL_VF:
case VT_ASSIGNED_TO_VM_PF:
break;
default:
DbgBreak();
break;
}
break;
case DEVICE_TYPE_VF:
switch (virtualization_type) {
case VT_BASIC_VF:
case VT_CHANNEL_VF:
break;
case VT_NONE:
DbgBreak();
break;
default:
DbgBreak();
break;
}
break;
default:
DbgBreak();
}
} else {
}
DbgMessage(pdev, WARN, "Virt.mode is set as (%d,%d)\n", pdev->params.device_type, pdev->params.virtualization_type);
}
{
{
DbgBreakMsg("lm_set_virt_channel_type pdev is null");
return;
}
switch (channel_type) {
case VT_HW_CHANNEL_TYPE:
case VT_SW_CHANNEL_TYPE:
break;
default:
DbgBreak();
}
}
{
{
DbgBreakMsg("lm_reset_virt_mode pdev is null");
return;
}
} else {
}
}
u8_t lm_get_port_id_from_func_abs( const u32_t chip_num, const lm_chip_port_mode_t lm_chip_port_mode, const u8_t abs_func );
u8_t lm_get_abs_func_vector( const u32_t chip_num, const lm_chip_port_mode_t chip_port_mode, const u8_t b_multi_vnics_mode, const u8_t path_id );
#ifdef VF_INVOLVED
lm_status_t lm_pf_download_standard_request(struct _lm_device_t *pdev, lm_vf_info_t *vf_info, void* virt_buffer, u32_t length);
lm_status_t lm_pf_upload_standard_response(struct _lm_device_t *pdev, lm_vf_info_t *vf_info, void* virt_buffer, u32_t length);
lm_status_t lm_pf_upload_standard_request(struct _lm_device_t *pdev, lm_vf_info_t *vf_info, lm_address_t * phys_buffer, u32_t length);
lm_status_t lm_pf_download_standard_response(struct _lm_device_t *pdev, lm_vf_info_t *vf_info, lm_address_t * phys_buffer, u32_t length);
#if 0
#endif
void lm_pf_release_separate_vf_chain_resources(struct _lm_device_t *pdev, u16_t vf_id, u8_t chain_num);
u8_t lm_pf_allocate_vf_igu_sbs(struct _lm_device_t *pdev, struct _lm_vf_info_t *vf_info, u8_t num_of_igu_sbs);
u8_t lm_pf_acquire_vf_igu_block(struct _lm_device_t *pdev, u8_t igu_sb_idx, u8_t abs_vf_id, u8_t vector_number);
lm_status_t lm_pf_update_vf_default_vlan(IN struct _lm_device_t *pdev, IN struct _lm_vf_info_t * vf_info,
#endif
#endif /* _LM5710_H */