144961713Sgirish /* 244961713Sgirish * CDDL HEADER START 344961713Sgirish * 444961713Sgirish * The contents of this file are subject to the terms of the 544961713Sgirish * Common Development and Distribution License (the "License"). 644961713Sgirish * You may not use this file except in compliance with the License. 744961713Sgirish * 844961713Sgirish * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 944961713Sgirish * or http://www.opensolaris.org/os/licensing. 1044961713Sgirish * See the License for the specific language governing permissions 1144961713Sgirish * and limitations under the License. 1244961713Sgirish * 1344961713Sgirish * When distributing Covered Code, include this CDDL HEADER in each 1444961713Sgirish * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1544961713Sgirish * If applicable, add the following below this CDDL HEADER, with the 1644961713Sgirish * fields enclosed by brackets "[]" replaced with your own identifying 1744961713Sgirish * information: Portions Copyright [yyyy] [name of copyright owner] 1844961713Sgirish * 1944961713Sgirish * CDDL HEADER END 2044961713Sgirish */ 2144961713Sgirish /* 22*4df55fdeSJanie Lu * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2344961713Sgirish * Use is subject to license terms. 2444961713Sgirish */ 2544961713Sgirish 2644961713Sgirish #ifndef _NPI_RXDMA_H 2744961713Sgirish #define _NPI_RXDMA_H 2844961713Sgirish 2944961713Sgirish #ifdef __cplusplus 3044961713Sgirish extern "C" { 3144961713Sgirish #endif 3244961713Sgirish 3344961713Sgirish #include <npi.h> 3444961713Sgirish 3544961713Sgirish #include "nxge_defs.h" 3644961713Sgirish #include "nxge_hw.h" 3744961713Sgirish #include <nxge_rxdma_hw.h> 3844961713Sgirish 3944961713Sgirish /* 4044961713Sgirish * Register offset (0x200 bytes for each channel) for receive ring registers. 4144961713Sgirish */ 4244961713Sgirish #define NXGE_RXDMA_OFFSET(x, v, channel) (x + \ 4344961713Sgirish (!v ? DMC_OFFSET(channel) : \ 4444961713Sgirish RDMC_PIOVADDR_OFFSET(channel))) 4544961713Sgirish 4644961713Sgirish 4744961713Sgirish #define REG_FZC_RDC_OFFSET(reg, rdc) (reg + RX_LOG_DMA_OFFSET(rdc)) 4844961713Sgirish 4944961713Sgirish #define REG_RDC_TABLE_OFFSET(table) \ 5044961713Sgirish (RDC_TBL_REG + table * (NXGE_MAX_RDCS * 8)) 5144961713Sgirish 5244961713Sgirish /* 5344961713Sgirish * RX NPI error codes 5444961713Sgirish */ 5544961713Sgirish #define RXDMA_ER_ST (RXDMA_BLK_ID << NPI_BLOCK_ID_SHIFT) 5644961713Sgirish #define RXDMA_ID_SHIFT(n) (n << NPI_PORT_CHAN_SHIFT) 5744961713Sgirish 5844961713Sgirish 5944961713Sgirish #define NPI_RXDMA_ERROR RXDMA_ER_ST 6044961713Sgirish 6144961713Sgirish #define NPI_RXDMA_SW_PARAM_ERROR (NPI_RXDMA_ERROR | 0x40) 6244961713Sgirish #define NPI_RXDMA_HW_ERROR (NPI_RXDMA_ERROR | 0x80) 6344961713Sgirish 6444961713Sgirish #define NPI_RXDMA_RDC_INVALID (NPI_RXDMA_ERROR | CHANNEL_INVALID) 6544961713Sgirish #define NPI_RXDMA_PAGE_INVALID (NPI_RXDMA_ERROR | LOGICAL_PAGE_INVALID) 6644961713Sgirish #define NPI_RXDMA_RESET_ERR (NPI_RXDMA_HW_ERROR | RESET_FAILED) 6744961713Sgirish #define NPI_RXDMA_DISABLE_ERR (NPI_RXDMA_HW_ERROR | 0x0000a) 6844961713Sgirish #define NPI_RXDMA_ENABLE_ERR (NPI_RXDMA_HW_ERROR | 0x0000b) 6944961713Sgirish #define NPI_RXDMA_FUNC_INVALID (NPI_RXDMA_SW_PARAM_ERROR | 0x0000a) 70678453a8Sspeer #define NPI_RXDMA_BUFSIZE_INVALID (NPI_RXDMA_SW_PARAM_ERROR | 0x0000b) 71678453a8Sspeer #define NPI_RXDMA_RBRSIZE_INVALID (NPI_RXDMA_SW_PARAM_ERROR | 0x0000c) 72678453a8Sspeer #define NPI_RXDMA_RCRSIZE_INVALID (NPI_RXDMA_SW_PARAM_ERROR | 0x0000d) 7344961713Sgirish #define NPI_RXDMA_PORT_INVALID (NPI_RXDMA_ERROR | PORT_INVALID) 7444961713Sgirish #define NPI_RXDMA_TABLE_INVALID (NPI_RXDMA_ERROR | RDC_TAB_INVALID) 7544961713Sgirish 7644961713Sgirish #define NPI_RXDMA_CHANNEL_INVALID(n) (RXDMA_ID_SHIFT(n) | \ 7744961713Sgirish NPI_RXDMA_ERROR | CHANNEL_INVALID) 7844961713Sgirish #define NPI_RXDMA_OPCODE_INVALID(n) (RXDMA_ID_SHIFT(n) | \ 7944961713Sgirish NPI_RXDMA_ERROR | OPCODE_INVALID) 8044961713Sgirish 8144961713Sgirish 8244961713Sgirish #define NPI_RXDMA_ERROR_ENCODE(err, rdc) \ 8344961713Sgirish (RXDMA_ID_SHIFT(rdc) | RXDMA_ER_ST | err) 8444961713Sgirish 8544961713Sgirish 8644961713Sgirish #define RXDMA_CHANNEL_VALID(rdc) \ 8744961713Sgirish ((rdc < NXGE_MAX_RDCS)) 8844961713Sgirish 8944961713Sgirish #define RXDMA_PORT_VALID(port) \ 9044961713Sgirish ((port < MAX_PORTS_PER_NXGE)) 9144961713Sgirish 9244961713Sgirish #define RXDMA_TABLE_VALID(table) \ 9344961713Sgirish ((table < NXGE_MAX_RDC_GROUPS)) 9444961713Sgirish 9544961713Sgirish 9644961713Sgirish #define RXDMA_PAGE_VALID(page) \ 9744961713Sgirish ((page == 0) || (page == 1)) 9844961713Sgirish 9944961713Sgirish #define RXDMA_BUFF_OFFSET_VALID(offset) \ 10044961713Sgirish ((offset == SW_OFFSET_NO_OFFSET) || \ 10144961713Sgirish (offset == SW_OFFSET_64) || \ 10244961713Sgirish (offset == SW_OFFSET_128)) 10344961713Sgirish 104*4df55fdeSJanie Lu #define RXDMA_RF_BUFF_OFFSET_VALID(offset) \ 105*4df55fdeSJanie Lu ((offset == SW_OFFSET_NO_OFFSET) || \ 106*4df55fdeSJanie Lu (offset == SW_OFFSET_64) || \ 107*4df55fdeSJanie Lu (offset == SW_OFFSET_128) || \ 108*4df55fdeSJanie Lu (offset == SW_OFFSET_192) || \ 109*4df55fdeSJanie Lu (offset == SW_OFFSET_256) || \ 110*4df55fdeSJanie Lu (offset == SW_OFFSET_320) || \ 111*4df55fdeSJanie Lu (offset == SW_OFFSET_384) || \ 112*4df55fdeSJanie Lu (offset == SW_OFFSET_448)) 113*4df55fdeSJanie Lu 11444961713Sgirish 11544961713Sgirish #define RXDMA_RCR_TO_VALID(tov) ((tov) && (tov < 64)) 11644961713Sgirish #define RXDMA_RCR_THRESH_VALID(thresh) ((thresh) && (thresh < 512)) 11744961713Sgirish 11844961713Sgirish /* 11944961713Sgirish * RXDMA NPI defined control types. 12044961713Sgirish */ 12144961713Sgirish typedef enum _rxdma_cs_cntl_e { 12244961713Sgirish RXDMA_CS_CLEAR_ALL = 0x1, 12344961713Sgirish RXDMA_MEX_SET = 0x2, 12444961713Sgirish RXDMA_RCRTO_CLEAR = 0x8, 12544961713Sgirish RXDMA_PT_DROP_PKT_CLEAR = 0x10, 12644961713Sgirish RXDMA_WRED_DROP_CLEAR = 0x20, 12744961713Sgirish RXDMA_RCR_SFULL_CLEAR = 0x40, 12844961713Sgirish RXDMA_RCR_FULL_CLEAR = 0x80, 12944961713Sgirish RXDMA_RBR_PRE_EMPTY_CLEAR = 0x100, 13044961713Sgirish RXDMA_RBR_EMPTY_CLEAR = 0x200 13144961713Sgirish } rxdma_cs_cntl_t; 13244961713Sgirish 13344961713Sgirish /* 13444961713Sgirish * RXDMA NPI defined event masks (mapped to the hardware defined masks). 13544961713Sgirish */ 13644961713Sgirish typedef enum _rxdma_ent_msk_cfg_e { 13744961713Sgirish CFG_RXDMA_ENT_MSK_CFIGLOGPGE_MASK = RX_DMA_ENT_MSK_CFIGLOGPGE_MASK, 13844961713Sgirish CFG_RXDMA_ENT_MSK_RBRLOGPGE_MASK = RX_DMA_ENT_MSK_RBRLOGPGE_MASK, 13944961713Sgirish CFG_RXDMA_ENT_MSK_RBRFULL_MASK = RX_DMA_ENT_MSK_RBRFULL_MASK, 14044961713Sgirish CFG_RXDMA_ENT_MSK_RBREMPTY_MASK = RX_DMA_ENT_MSK_RBREMPTY_MASK, 14144961713Sgirish CFG_RXDMA_ENT_MSK_RCRFULL_MASK = RX_DMA_ENT_MSK_RCRFULL_MASK, 14244961713Sgirish CFG_RXDMA_ENT_MSK_RCRINCON_MASK = RX_DMA_ENT_MSK_RCRINCON_MASK, 14344961713Sgirish CFG_RXDMA_ENT_MSK_CONFIG_ERR = RX_DMA_ENT_MSK_CONFIG_ERR_MASK, 14444961713Sgirish CFG_RXDMA_ENT_MSK_RCR_SH_FULL_MASK = RX_DMA_ENT_MSK_RCRSH_FULL_MASK, 14544961713Sgirish CFG_RXDMA_ENT_MSK_RBR_PRE_EMTY_MASK = RX_DMA_ENT_MSK_RBR_PRE_EMPTY_MASK, 14644961713Sgirish CFG_RXDMA_ENT_MSK_WRED_DROP_MASK = RX_DMA_ENT_MSK_WRED_DROP_MASK, 14744961713Sgirish CFG_RXDMA_ENT_MSK_PT_DROP_PKT_MASK = RX_DMA_ENT_MSK_PTDROP_PKT_MASK, 14844961713Sgirish CFG_RXDMA_ENT_MSK_RBR_PRE_PAR_MASK = RX_DMA_ENT_MSK_RBR_PRE_PAR_MASK, 14944961713Sgirish CFG_RXDMA_ENT_MSK_RCR_SHA_PAR_MASK = RX_DMA_ENT_MSK_RCR_SHA_PAR_MASK, 15044961713Sgirish CFG_RXDMA_ENT_MSK_RCRTO_MASK = RX_DMA_ENT_MSK_RCRTO_MASK, 15144961713Sgirish CFG_RXDMA_ENT_MSK_THRES_MASK = RX_DMA_ENT_MSK_THRES_MASK, 15244961713Sgirish CFG_RXDMA_ENT_MSK_DC_FIFO_ERR_MASK = RX_DMA_ENT_MSK_DC_FIFO_ERR_MASK, 15344961713Sgirish CFG_RXDMA_ENT_MSK_RCR_ACK_ERR_MASK = RX_DMA_ENT_MSK_RCR_ACK_ERR_MASK, 15444961713Sgirish CFG_RXDMA_ENT_MSK_RSP_DAT_ERR_MASK = RX_DMA_ENT_MSK_RSP_DAT_ERR_MASK, 15544961713Sgirish CFG_RXDMA_ENT_MSK_BYTE_EN_BUS_MASK = RX_DMA_ENT_MSK_BYTE_EN_BUS_MASK, 15644961713Sgirish CFG_RXDMA_ENT_MSK_RSP_CNT_ERR_MASK = RX_DMA_ENT_MSK_RSP_CNT_ERR_MASK, 15744961713Sgirish CFG_RXDMA_ENT_MSK_RBR_TMOUT_MASK = RX_DMA_ENT_MSK_RBR_TMOUT_MASK, 15844961713Sgirish 15944961713Sgirish CFG_RXDMA_MASK_ALL = (RX_DMA_ENT_MSK_CFIGLOGPGE_MASK | 16044961713Sgirish RX_DMA_ENT_MSK_RBRLOGPGE_MASK | 16144961713Sgirish RX_DMA_ENT_MSK_RBRFULL_MASK | 16244961713Sgirish RX_DMA_ENT_MSK_RBREMPTY_MASK | 16344961713Sgirish RX_DMA_ENT_MSK_RCRFULL_MASK | 16444961713Sgirish RX_DMA_ENT_MSK_RCRINCON_MASK | 16544961713Sgirish RX_DMA_ENT_MSK_CONFIG_ERR_MASK | 16644961713Sgirish RX_DMA_ENT_MSK_RCRSH_FULL_MASK | 16744961713Sgirish RX_DMA_ENT_MSK_RBR_PRE_EMPTY_MASK | 16844961713Sgirish RX_DMA_ENT_MSK_WRED_DROP_MASK | 16944961713Sgirish RX_DMA_ENT_MSK_PTDROP_PKT_MASK | 17044961713Sgirish RX_DMA_ENT_MSK_RBR_PRE_PAR_MASK | 17144961713Sgirish RX_DMA_ENT_MSK_RCR_SHA_PAR_MASK | 17244961713Sgirish RX_DMA_ENT_MSK_RCRTO_MASK | 17344961713Sgirish RX_DMA_ENT_MSK_THRES_MASK | 17444961713Sgirish RX_DMA_ENT_MSK_DC_FIFO_ERR_MASK | 17544961713Sgirish RX_DMA_ENT_MSK_RCR_ACK_ERR_MASK | 17644961713Sgirish RX_DMA_ENT_MSK_RSP_DAT_ERR_MASK | 17744961713Sgirish RX_DMA_ENT_MSK_BYTE_EN_BUS_MASK | 17844961713Sgirish RX_DMA_ENT_MSK_RSP_CNT_ERR_MASK | 17944961713Sgirish RX_DMA_ENT_MSK_RBR_TMOUT_MASK) 18044961713Sgirish } rxdma_ent_msk_cfg_t; 18144961713Sgirish 18244961713Sgirish 18344961713Sgirish 18444961713Sgirish typedef union _addr44 { 18544961713Sgirish uint64_t addr; 18644961713Sgirish struct { 18744961713Sgirish #if defined(_BIG_ENDIAN) 18844961713Sgirish uint32_t rsrvd:20; 18944961713Sgirish uint32_t hdw:12; 19044961713Sgirish uint32_t ldw; 19144961713Sgirish #else 19244961713Sgirish uint32_t ldw; 19344961713Sgirish uint32_t hdw:12; 19444961713Sgirish uint32_t rsrvd:20; 19544961713Sgirish #endif 19644961713Sgirish } bits; 19744961713Sgirish } addr44_t; 19844961713Sgirish 19944961713Sgirish 20044961713Sgirish /* 20144961713Sgirish * npi_rxdma_cfg_default_port_rdc() 20244961713Sgirish * Set the default rdc for the port 20344961713Sgirish * 20444961713Sgirish * Inputs: 20544961713Sgirish * handle: register handle interpreted by the underlying OS 20644961713Sgirish * portnm: Physical Port Number 20744961713Sgirish * rdc: RX DMA Channel number 20844961713Sgirish * 20944961713Sgirish * Return: 21044961713Sgirish * NPI_SUCCESS 21144961713Sgirish * NPI_RXDMA_RDC_INVALID 21244961713Sgirish * NPI_RXDMA_PORT_INVALID 21344961713Sgirish * 21444961713Sgirish */ 21544961713Sgirish 21644961713Sgirish npi_status_t npi_rxdma_cfg_default_port_rdc(npi_handle_t, 21744961713Sgirish uint8_t, uint8_t); 21844961713Sgirish 21944961713Sgirish /* 220678453a8Sspeer * npi_rxdma_rdc_table_config 22144961713Sgirish * Configure/populate the RDC table 22244961713Sgirish * 22344961713Sgirish * Inputs: 224678453a8Sspeer * handle: register handle interpreted by the underlying OS 225678453a8Sspeer * table: RDC Group Number 226678453a8Sspeer * map: Bitmap of RDCs to be written to <table>. 227678453a8Sspeer * count: A count of the number of bits in <map>. 22844961713Sgirish * 22944961713Sgirish * Return: 23044961713Sgirish * NPI_SUCCESS 23144961713Sgirish * NPI_RXDMA_TABLE_INVALID 23244961713Sgirish * 23344961713Sgirish */ 23444961713Sgirish 235678453a8Sspeer npi_status_t npi_rxdma_rdc_table_config(npi_handle_t, uint8_t, dc_map_t, 236678453a8Sspeer int); 23744961713Sgirish 23844961713Sgirish npi_status_t npi_rxdma_cfg_rdc_table_default_rdc(npi_handle_t, 23944961713Sgirish uint8_t, uint8_t); 24044961713Sgirish npi_status_t npi_rxdma_cfg_rdc_rcr_timeout_disable(npi_handle_t, 24144961713Sgirish uint8_t); 24244961713Sgirish 24344961713Sgirish 24444961713Sgirish /* 24544961713Sgirish * npi_rxdma_32bitmode_enable() 24644961713Sgirish * Enable 32 bit mode 24744961713Sgirish * 24844961713Sgirish * Inputs: 24944961713Sgirish * handle: register handle interpreted by the underlying OS 25044961713Sgirish * 25144961713Sgirish * Return: 25244961713Sgirish * NPI_SUCCESS 25344961713Sgirish * NPI_FAILURE 25444961713Sgirish * NPI_HW_ERR 25544961713Sgirish * 25644961713Sgirish */ 25744961713Sgirish 25844961713Sgirish npi_status_t npi_rxdma_cfg_32bitmode_enable(npi_handle_t); 25944961713Sgirish 26044961713Sgirish 26144961713Sgirish /* 26244961713Sgirish * npi_rxdma_32bitmode_disable() 26344961713Sgirish * disable 32 bit mode 26444961713Sgirish * 26544961713Sgirish * Inputs: 26644961713Sgirish * handle: register handle interpreted by the underlying OS 26744961713Sgirish * 26844961713Sgirish * Return: 26944961713Sgirish * NPI_SUCCESS 27044961713Sgirish * NPI_FAILURE 27144961713Sgirish * NPI_HW_ERR 27244961713Sgirish * 27344961713Sgirish */ 27444961713Sgirish 27544961713Sgirish 27644961713Sgirish npi_status_t npi_rxdma_cfg_32bitmode_disable(npi_handle_t); 27744961713Sgirish 27844961713Sgirish /* 27944961713Sgirish * npi_rxdma_cfg_ram_access_enable() 28044961713Sgirish * Enable PIO access to shadow and prefetch memory. 28144961713Sgirish * In the case of DMA errors, software may need to 28244961713Sgirish * initialize the shadow and prefetch memories to 28344961713Sgirish * sane value (may be clear it) before re-enabling 28444961713Sgirish * the DMA channel. 28544961713Sgirish * 28644961713Sgirish * Inputs: 28744961713Sgirish * handle: register handle interpreted by the underlying OS 28844961713Sgirish * 28944961713Sgirish * Return: 29044961713Sgirish * NPI_SUCCESS 29144961713Sgirish * NPI_FAILURE 29244961713Sgirish * NPI_HW_ERR 29344961713Sgirish * 29444961713Sgirish */ 29544961713Sgirish 29644961713Sgirish npi_status_t npi_rxdma_cfg_ram_access_enable(npi_handle_t); 29744961713Sgirish 29844961713Sgirish 29944961713Sgirish /* 30044961713Sgirish * npi_rxdma_cfg_ram_access_disable() 30144961713Sgirish * Disable PIO access to shadow and prefetch memory. 30244961713Sgirish * This is the normal operation mode. 30344961713Sgirish * 30444961713Sgirish * Inputs: 30544961713Sgirish * handle: register handle interpreted by the underlying OS 30644961713Sgirish * 30744961713Sgirish * Return: 30844961713Sgirish * NPI_SUCCESS 30944961713Sgirish * NPI_FAILURE 31044961713Sgirish * NPI_HW_ERR 31144961713Sgirish * 31244961713Sgirish */ 31344961713Sgirish 31444961713Sgirish npi_status_t npi_rxdma_cfg_ram_access_disable(npi_handle_t); 31544961713Sgirish 31644961713Sgirish 31744961713Sgirish /* 31844961713Sgirish * npi_rxdma_cfg_clock_div_set() 31944961713Sgirish * init the clock division, used for RX timers 32044961713Sgirish * This determines the granularity of RX DMA countdown timers 32144961713Sgirish * It depends on the system clock. For example if the system 32244961713Sgirish * clock is 300 MHz, a value of 30000 will yield a granularity 32344961713Sgirish * of 100usec. 32444961713Sgirish * 32544961713Sgirish * Inputs: 32644961713Sgirish * handle: register handle interpreted by the underlying OS 32744961713Sgirish * count: System clock divider 32844961713Sgirish * 32944961713Sgirish * Return: 33044961713Sgirish * NPI_SUCCESS 33144961713Sgirish * NPI_FAILURE 33244961713Sgirish * NPI_SW_ERR 33344961713Sgirish * NPI_HW_ERR 33444961713Sgirish * 33544961713Sgirish */ 33644961713Sgirish 33744961713Sgirish npi_status_t npi_rxdma_cfg_clock_div_set(npi_handle_t, uint16_t); 33844961713Sgirish 33944961713Sgirish /* 34044961713Sgirish * npi_rxdma_cfg_red_rand_init() 34144961713Sgirish * init the WRED Discard 34244961713Sgirish * By default, it is enabled 34344961713Sgirish * 34444961713Sgirish * Inputs: 34544961713Sgirish * handle: register handle interpreted by the underlying OS 34644961713Sgirish * init_value: WRED init value 34744961713Sgirish * 34844961713Sgirish * Return: 34944961713Sgirish * NPI_SUCCESS 35044961713Sgirish * NPI_FAILURE 35144961713Sgirish * NPI_SW_ERR 35244961713Sgirish * NPI_HW_ERR 35344961713Sgirish * 35444961713Sgirish */ 35544961713Sgirish 35644961713Sgirish npi_status_t npi_rxdma_cfg_red_rand_init(npi_handle_t, uint16_t); 35744961713Sgirish 35844961713Sgirish /* 35944961713Sgirish * npi_rxdma_cfg_wred_disable() 36044961713Sgirish * init the WRED Discard 36144961713Sgirish * By default, it is enabled 36244961713Sgirish * 36344961713Sgirish * Inputs: 36444961713Sgirish * handle: register handle interpreted by the underlying OS 36544961713Sgirish * 36644961713Sgirish * Return: 36744961713Sgirish * NPI_SUCCESS 36844961713Sgirish * NPI_FAILURE 36944961713Sgirish * NPI_SW_ERR 37044961713Sgirish * NPI_HW_ERR 37144961713Sgirish * 37244961713Sgirish */ 37344961713Sgirish 37444961713Sgirish 37544961713Sgirish npi_status_t npi_rxdma_cfg_wred_disable(npi_handle_t); 37644961713Sgirish 37744961713Sgirish /* 37844961713Sgirish * npi_rxdma_cfg_wred_param() 37944961713Sgirish * COnfigure per rxdma channel WRED parameters 38044961713Sgirish * By default, it is enabled 38144961713Sgirish * 38244961713Sgirish * Inputs: 38344961713Sgirish * handle: register handle interpreted by the underlying OS 38444961713Sgirish * rdc: RX DMA Channel number 38544961713Sgirish * wred_params: WRED configuration parameters 38644961713Sgirish * 38744961713Sgirish * Return: 38844961713Sgirish * NPI_SUCCESS 38944961713Sgirish * NPI_FAILURE 39044961713Sgirish * NPI_SW_ERR 39144961713Sgirish * NPI_HW_ERR 39244961713Sgirish * 39344961713Sgirish */ 39444961713Sgirish 39544961713Sgirish 39644961713Sgirish 39744961713Sgirish npi_status_t npi_rxdma_cfg_wred_param(npi_handle_t, uint8_t, 39844961713Sgirish rdc_red_para_t *); 39944961713Sgirish 40044961713Sgirish 40144961713Sgirish /* 40244961713Sgirish * npi_rxdma_port_ddr_weight 40344961713Sgirish * Set the DDR weight for a port. 40444961713Sgirish * 40544961713Sgirish * Inputs: 40644961713Sgirish * handle: register handle interpreted by the underlying OS 40744961713Sgirish * portnm: Physical Port Number 40844961713Sgirish * weight: Port relative weight (in approx. bytes) 40944961713Sgirish * Default values are: 41044961713Sgirish * 0x400 (port 0 and 1) corresponding to 10 standard 41144961713Sgirish * size (1500 bytes) Frames 41244961713Sgirish * 0x66 (port 2 and 3) corresponding to 10% 10Gig ports 41344961713Sgirish * 41444961713Sgirish * Return: 41544961713Sgirish * NPI_SUCCESS 41644961713Sgirish * NPI_FAILURE 41744961713Sgirish * NPI_HW_ERR 41844961713Sgirish * NPI_SW_ERR 41944961713Sgirish * 42044961713Sgirish */ 42144961713Sgirish 42244961713Sgirish npi_status_t npi_rxdma_cfg_port_ddr_weight(npi_handle_t, 42344961713Sgirish uint8_t, uint32_t); 42444961713Sgirish 42544961713Sgirish 42644961713Sgirish /* 42744961713Sgirish * npi_rxdma_port_usage_get() 42844961713Sgirish * Gets the port usage, in terms of 16 byte blocks 42944961713Sgirish * 43044961713Sgirish * NOTE: The register count is cleared upon reading. 43144961713Sgirish * 43244961713Sgirish * Inputs: 43344961713Sgirish * handle: register handle interpreted by the underlying OS 43444961713Sgirish * portnm: Physical Port Number 43544961713Sgirish * blocks: ptr to save current count. 43644961713Sgirish * 43744961713Sgirish * Return: 43844961713Sgirish * NPI_SUCCESS 43944961713Sgirish * NPI_FAILURE 44044961713Sgirish * NPI_HW_ERR 44144961713Sgirish * NPI_SW_ERR 44244961713Sgirish * 44344961713Sgirish */ 44444961713Sgirish 44544961713Sgirish npi_status_t npi_rxdma_port_usage_get(npi_handle_t, 44644961713Sgirish uint8_t, uint32_t *); 44744961713Sgirish 44844961713Sgirish 44944961713Sgirish /* 45044961713Sgirish * npi_rxdma_cfg_logical_page() 45144961713Sgirish * Configure per rxdma channel Logical page 45244961713Sgirish * 45344961713Sgirish * To disable the logical page, set valid = 0; 45444961713Sgirish * 45544961713Sgirish * Inputs: 45644961713Sgirish * handle: register handle interpreted by the underlying OS 45744961713Sgirish * rdc: RX DMA Channel number 45844961713Sgirish * page_params: Logical Page configuration parameters 45944961713Sgirish * 46044961713Sgirish * Return: 46144961713Sgirish * NPI_SUCCESS 46244961713Sgirish * NPI_FAILURE 46344961713Sgirish * NPI_SW_ERR 46444961713Sgirish * NPI_HW_ERR 46544961713Sgirish * 46644961713Sgirish */ 46744961713Sgirish 46844961713Sgirish 46944961713Sgirish 47044961713Sgirish npi_status_t npi_rxdma_cfg_logical_page(npi_handle_t, uint8_t, 47144961713Sgirish dma_log_page_t *); 47244961713Sgirish 47344961713Sgirish 47444961713Sgirish /* 47544961713Sgirish * npi_rxdma_cfg_logical_page_handle() 47644961713Sgirish * Configure per rxdma channel Logical page handle 47744961713Sgirish * 47844961713Sgirish * 47944961713Sgirish * Inputs: 48044961713Sgirish * handle: register handle interpreted by the underlying OS 48144961713Sgirish * rdc: RX DMA Channel number 48244961713Sgirish * pg_handle: Logical Page handle 48344961713Sgirish * 48444961713Sgirish * Return: 48544961713Sgirish * NPI_SUCCESS 48644961713Sgirish * NPI_FAILURE 48744961713Sgirish * NPI_SW_ERR 48844961713Sgirish * NPI_HW_ERR 48944961713Sgirish * 49044961713Sgirish */ 49144961713Sgirish 49244961713Sgirish 49344961713Sgirish npi_status_t npi_rxdma_cfg_logical_page_handle(npi_handle_t, uint8_t, 49444961713Sgirish uint64_t); 49544961713Sgirish 49644961713Sgirish 49744961713Sgirish 49844961713Sgirish 49944961713Sgirish npi_status_t npi_rxdma_cfg_logical_page_disable(npi_handle_t, 50044961713Sgirish uint8_t, uint8_t); 50144961713Sgirish 50244961713Sgirish typedef enum _bsize { 50344961713Sgirish SIZE_0B = 0x0, 50444961713Sgirish SIZE_64B, 50544961713Sgirish SIZE_128B, 50644961713Sgirish SIZE_192B, 50744961713Sgirish SIZE_256B, 50844961713Sgirish SIZE_512B, 50944961713Sgirish SIZE_1KB, 51044961713Sgirish SIZE_2KB, 51144961713Sgirish SIZE_4KB, 51244961713Sgirish SIZE_8KB, 51344961713Sgirish SIZE_16KB, 51444961713Sgirish SIZE_32KB 51544961713Sgirish } bsize_t; 51644961713Sgirish 51744961713Sgirish 51844961713Sgirish 51944961713Sgirish /* 52044961713Sgirish * npi_rxdma_cfg_rdc_ring() 52144961713Sgirish * Configure The RDC channel Rcv Buffer Ring 52244961713Sgirish * 52344961713Sgirish * Inputs: 52444961713Sgirish * rdc: RX DMA Channel number 52544961713Sgirish * rdc_params: RDC configuration parameters 52644961713Sgirish * 52744961713Sgirish * Return: 52844961713Sgirish * NPI_SUCCESS 52944961713Sgirish * NPI_FAILURE 53044961713Sgirish * NPI_SW_ERR 53144961713Sgirish * NPI_HW_ERR 53244961713Sgirish * 53344961713Sgirish */ 53444961713Sgirish 53544961713Sgirish typedef struct _rdc_desc_cfg_t { 53644961713Sgirish uint8_t mbox_enable; /* Enable full (18b) header */ 53744961713Sgirish uint8_t full_hdr; /* Enable full (18b) header */ 53844961713Sgirish uint8_t offset; /* 64 byte offsets */ 53944961713Sgirish uint8_t valid2; /* size 2 is valid */ 54044961713Sgirish bsize_t size2; /* Size 2 length */ 54144961713Sgirish uint8_t valid1; /* size 1 is valid */ 54244961713Sgirish bsize_t size1; /* Size 1 length */ 54344961713Sgirish uint8_t valid0; /* size 0 is valid */ 54444961713Sgirish bsize_t size0; /* Size 1 length */ 54544961713Sgirish bsize_t page_size; /* Page or buffer Size */ 54644961713Sgirish uint8_t rcr_timeout_enable; 54744961713Sgirish uint8_t rcr_timeout; 54844961713Sgirish uint16_t rcr_threshold; 54944961713Sgirish uint16_t rcr_len; /* RBR Descriptor size (entries) */ 55044961713Sgirish uint16_t rbr_len; /* RBR Descriptor size (entries) */ 55144961713Sgirish uint64_t mbox_addr; /* Mailbox Address */ 55244961713Sgirish uint64_t rcr_addr; /* RCR Address */ 55344961713Sgirish uint64_t rbr_addr; /* RBB Address */ 55444961713Sgirish } rdc_desc_cfg_t; 55544961713Sgirish 55644961713Sgirish 55744961713Sgirish 55844961713Sgirish npi_status_t npi_rxdma_cfg_rdc_ring(npi_handle_t, uint8_t, 559*4df55fdeSJanie Lu rdc_desc_cfg_t *, boolean_t); 56044961713Sgirish 56144961713Sgirish 56244961713Sgirish 56344961713Sgirish 56444961713Sgirish /* 56544961713Sgirish * npi_rxdma_rdc_rcr_flush 56644961713Sgirish * Forces RX completion ring update 56744961713Sgirish * 56844961713Sgirish * Inputs: 56944961713Sgirish * rdc: RX DMA Channel number 57044961713Sgirish * 57144961713Sgirish * Return: 57244961713Sgirish * 57344961713Sgirish */ 57444961713Sgirish 57544961713Sgirish #define npi_rxdma_rdc_rcr_flush(handle, rdc) \ 57644961713Sgirish RXDMA_REG_WRITE64(handle, RCR_FLSH_REG, rdc, \ 57744961713Sgirish (RCR_FLSH_SET << RCR_FLSH_SHIFT)) 57844961713Sgirish 57944961713Sgirish 58044961713Sgirish 58144961713Sgirish /* 58244961713Sgirish * npi_rxdma_rdc_rcr_read_update 58344961713Sgirish * Update the number of rcr packets and buffers processed 58444961713Sgirish * 58544961713Sgirish * Inputs: 58644961713Sgirish * channel: RX DMA Channel number 58744961713Sgirish * num_pkts: Number of pkts processed by SW. 58844961713Sgirish * A packet could constitute multiple 58944961713Sgirish * buffers, in case jumbo packets. 59044961713Sgirish * num_bufs: Number of buffer processed by SW. 59144961713Sgirish * 59244961713Sgirish * Return: 59344961713Sgirish * NPI_FAILURE - 59444961713Sgirish * NPI_RXDMA_OPCODE_INVALID - 59544961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 59644961713Sgirish * 59744961713Sgirish */ 59844961713Sgirish 59944961713Sgirish npi_status_t npi_rxdma_rdc_rcr_read_update(npi_handle_t, uint8_t, 60044961713Sgirish uint16_t, uint16_t); 60144961713Sgirish /* 60244961713Sgirish * npi_rxdma_rdc_rcr_pktread_update 60344961713Sgirish * Update the number of packets processed 60444961713Sgirish * 60544961713Sgirish * Inputs: 60644961713Sgirish * channel: RX DMA Channel number 60744961713Sgirish * num_pkts: Number ofpkts processed by SW. 60844961713Sgirish * A packet could constitute multiple 60944961713Sgirish * buffers, in case jumbo packets. 61044961713Sgirish * 61144961713Sgirish * Return: 61244961713Sgirish * NPI_FAILURE - 61344961713Sgirish * NPI_RXDMA_OPCODE_INVALID - 61444961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 61544961713Sgirish * 61644961713Sgirish */ 61744961713Sgirish 61844961713Sgirish npi_status_t npi_rxdma_rdc_rcr_pktread_update(npi_handle_t, 61944961713Sgirish uint8_t, uint16_t); 62044961713Sgirish 62144961713Sgirish 62244961713Sgirish 62344961713Sgirish /* 62444961713Sgirish * npi_rxdma_rdc_rcr_bufread_update 62544961713Sgirish * Update the number of buffers processed 62644961713Sgirish * 62744961713Sgirish * Inputs: 62844961713Sgirish * channel: RX DMA Channel number 62944961713Sgirish * num_bufs: Number of buffer processed by SW. Multiple buffers 63044961713Sgirish * could be part of a single packet. 63144961713Sgirish * 63244961713Sgirish * Return: 63344961713Sgirish * NPI_FAILURE - 63444961713Sgirish * NPI_RXDMA_OPCODE_INVALID - 63544961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 63644961713Sgirish * 63744961713Sgirish */ 63844961713Sgirish 63944961713Sgirish npi_status_t npi_rxdma_rdc_rcr_bufread_update(npi_handle_t, 64044961713Sgirish uint8_t, uint16_t); 64144961713Sgirish 64244961713Sgirish 64344961713Sgirish 64444961713Sgirish /* 64544961713Sgirish * npi_rxdma_rdc_rbr_kick 64644961713Sgirish * Kick RDC RBR 64744961713Sgirish * 64844961713Sgirish * Inputs: 64944961713Sgirish * rdc: RX DMA Channel number 65044961713Sgirish * num_buffers: Number of Buffers posted to the RBR 65144961713Sgirish * 65244961713Sgirish * Return: 65344961713Sgirish * 65444961713Sgirish */ 65544961713Sgirish 65644961713Sgirish #define npi_rxdma_rdc_rbr_kick(handle, rdc, num_buffers) \ 65744961713Sgirish RXDMA_REG_WRITE64(handle, RBR_KICK_REG, rdc, num_buffers) 65844961713Sgirish 65944961713Sgirish 66044961713Sgirish /* 66144961713Sgirish * npi_rxdma_rdc_rbr_head_get 66244961713Sgirish * Gets the current rbr head pointer. 66344961713Sgirish * 66444961713Sgirish * Inputs: 66544961713Sgirish * rdc: RX DMA Channel number 66644961713Sgirish * hdptr ptr to write the rbr head value 66744961713Sgirish * 66844961713Sgirish * Return: 66944961713Sgirish * 67044961713Sgirish */ 67144961713Sgirish 67244961713Sgirish npi_status_t npi_rxdma_rdc_rbr_head_get(npi_handle_t, 67344961713Sgirish uint8_t, addr44_t *); 67444961713Sgirish 67544961713Sgirish 67644961713Sgirish 67744961713Sgirish /* 67844961713Sgirish * npi_rxdma_rdc_rbr_stat_get 67944961713Sgirish * Returns the RBR stat. The stat consists of the 68044961713Sgirish * RX buffers in the ring. It also indicates if there 68144961713Sgirish * has been an overflow. 68244961713Sgirish * 68344961713Sgirish * Inputs: 68444961713Sgirish * rdc: RX DMA Channel number 68544961713Sgirish * rbr_stat_t: Structure to update stat 68644961713Sgirish * 68744961713Sgirish * Return: 68844961713Sgirish * 68944961713Sgirish */ 69044961713Sgirish 69144961713Sgirish npi_status_t npi_rxdma_rdc_rbr_stat_get(npi_handle_t, uint8_t, 69244961713Sgirish rbr_stat_t *); 69344961713Sgirish 69444961713Sgirish 69544961713Sgirish 69644961713Sgirish /* 69744961713Sgirish * npi_rxdma_cfg_rdc_reset 69844961713Sgirish * Resets the RDC channel 69944961713Sgirish * 70044961713Sgirish * Inputs: 70144961713Sgirish * rdc: RX DMA Channel number 70244961713Sgirish * 70344961713Sgirish * Return: 70444961713Sgirish * 70544961713Sgirish */ 70644961713Sgirish 70744961713Sgirish npi_status_t npi_rxdma_cfg_rdc_reset(npi_handle_t, uint8_t); 70844961713Sgirish 70944961713Sgirish 71044961713Sgirish /* 71144961713Sgirish * npi_rxdma_rdc_enable 71244961713Sgirish * Enables the RDC channel 71344961713Sgirish * 71444961713Sgirish * Inputs: 71544961713Sgirish * rdc: RX DMA Channel number 71644961713Sgirish * 71744961713Sgirish * Return: 71844961713Sgirish * 71944961713Sgirish */ 72044961713Sgirish 72144961713Sgirish npi_status_t npi_rxdma_cfg_rdc_enable(npi_handle_t, uint8_t); 72244961713Sgirish 72344961713Sgirish /* 72444961713Sgirish * npi_rxdma_rdc_disable 72544961713Sgirish * Disables the RDC channel 72644961713Sgirish * 72744961713Sgirish * Inputs: 72844961713Sgirish * rdc: RX DMA Channel number 72944961713Sgirish * 73044961713Sgirish * Return: 73144961713Sgirish * 73244961713Sgirish */ 73344961713Sgirish 73444961713Sgirish npi_status_t npi_rxdma_cfg_rdc_disable(npi_handle_t, uint8_t); 73544961713Sgirish 73644961713Sgirish 73744961713Sgirish /* 73844961713Sgirish * npi_rxdma_cfg_rdc_rcr_timeout() 73944961713Sgirish * Configure The RDC channel completion ring timeout. 74044961713Sgirish * If a frame has been received, an event would be 74144961713Sgirish * generated atleast at the expiration of the timeout. 74244961713Sgirish * 74344961713Sgirish * Enables timeout by default. 74444961713Sgirish * 74544961713Sgirish * Inputs: 74644961713Sgirish * rdc: RX DMA Channel number 74744961713Sgirish * rcr_timeout: Completion Ring timeout value 74844961713Sgirish * 74944961713Sgirish * Return: 75044961713Sgirish * NPI_SUCCESS 75144961713Sgirish * NPI_FAILURE 75244961713Sgirish * NPI_SW_ERR 75344961713Sgirish * NPI_HW_ERR 75444961713Sgirish * 75544961713Sgirish */ 75644961713Sgirish 75744961713Sgirish npi_status_t npi_rxdma_cfg_rdc_rcr_timeout(npi_handle_t, uint8_t, 75844961713Sgirish uint8_t); 75944961713Sgirish 76044961713Sgirish 76144961713Sgirish /* 76244961713Sgirish * npi_rxdma_cfg_rdc_rcr_threshold() 76344961713Sgirish * Configure The RDC channel completion ring threshold. 76444961713Sgirish * An event would be If the number of frame received, 76544961713Sgirish * surpasses the threshold value 76644961713Sgirish * 76744961713Sgirish * Inputs: 76844961713Sgirish * rdc: RX DMA Channel number 76944961713Sgirish * rcr_threshold: Completion Ring Threshold count 77044961713Sgirish * 77144961713Sgirish * Return: 77244961713Sgirish * NPI_SUCCESS 77344961713Sgirish * NPI_FAILURE 77444961713Sgirish * NPI_SW_ERR 77544961713Sgirish * NPI_HW_ERR 77644961713Sgirish * 77744961713Sgirish */ 77844961713Sgirish 77944961713Sgirish npi_status_t npi_rxdma_cfg_rdc_rcr_threshold(npi_handle_t, uint8_t, 78044961713Sgirish uint16_t); 78144961713Sgirish 78244961713Sgirish 78344961713Sgirish npi_status_t npi_rxdma_cfg_rdc_rcr_timeout_disable(npi_handle_t, uint8_t); 78444961713Sgirish 78544961713Sgirish typedef struct _rdc_error_stat_t { 78644961713Sgirish uint8_t fault:1; 78744961713Sgirish uint8_t multi_fault:1; 78844961713Sgirish uint8_t rbr_fault:1; 78944961713Sgirish uint8_t buff_fault:1; 79044961713Sgirish uint8_t rcr_fault:1; 79144961713Sgirish addr44_t fault_addr; 79244961713Sgirish } rdc_error_stat_t; 79344961713Sgirish 79444961713Sgirish #if OLD 79544961713Sgirish /* 79644961713Sgirish * npi_rxdma_rdc_error_stat_get 79744961713Sgirish * Gets the current Error stat for the RDC. 79844961713Sgirish * 79944961713Sgirish * Inputs: 80044961713Sgirish * rdc: RX DMA Channel number 80144961713Sgirish * error_stat Structure to write current RDC Error stat 80244961713Sgirish * 80344961713Sgirish * Return: 80444961713Sgirish * 80544961713Sgirish */ 80644961713Sgirish 80744961713Sgirish npi_status_t npi_rxdma_rdc_error_stat_get(npi_handle_t, 80844961713Sgirish uint8_t, rdc_error_stat_t *); 80944961713Sgirish 81044961713Sgirish #endif 81144961713Sgirish 81244961713Sgirish /* 81344961713Sgirish * npi_rxdma_rdc_rcr_tail_get 81444961713Sgirish * Gets the current RCR tail address for the RDC. 81544961713Sgirish * 81644961713Sgirish * Inputs: 81744961713Sgirish * rdc: RX DMA Channel number 81844961713Sgirish * tail_addr Structure to write current RDC RCR tail address 81944961713Sgirish * 82044961713Sgirish * Return: 82144961713Sgirish * 82244961713Sgirish */ 82344961713Sgirish 82444961713Sgirish npi_status_t npi_rxdma_rdc_rcr_tail_get(npi_handle_t, 82544961713Sgirish uint8_t, addr44_t *); 82644961713Sgirish 82744961713Sgirish 82844961713Sgirish npi_status_t npi_rxdma_rdc_rcr_qlen_get(npi_handle_t, 82944961713Sgirish uint8_t, uint16_t *); 83044961713Sgirish 83144961713Sgirish 83244961713Sgirish 83344961713Sgirish typedef struct _rdc_discard_stat_t { 83444961713Sgirish uint8_t nobuf_ovflow; 83544961713Sgirish uint8_t red_ovflow; 83644961713Sgirish uint32_t nobuf_discard; 83744961713Sgirish uint32_t red_discard; 83844961713Sgirish } rdc_discard_stat_t; 83944961713Sgirish 84044961713Sgirish 84144961713Sgirish /* 84244961713Sgirish * npi_rxdma_rdc_discard_stat_get 84344961713Sgirish * Gets the current discrad stats for the RDC. 84444961713Sgirish * 84544961713Sgirish * Inputs: 84644961713Sgirish * rdc: RX DMA Channel number 84744961713Sgirish * rcr_stat Structure to write current RDC discard stat 84844961713Sgirish * 84944961713Sgirish * Return: 85044961713Sgirish * 85144961713Sgirish */ 85244961713Sgirish 85344961713Sgirish npi_status_t npi_rxdma_rdc_discard_stat_get(npi_handle_t, 85444961713Sgirish uint8_t, rdc_discard_stat_t); 85544961713Sgirish 85644961713Sgirish 85744961713Sgirish /* 85844961713Sgirish * npi_rx_port_discard_stat_get 85944961713Sgirish * Gets the current input (IPP) discrad stats for the rx port. 86044961713Sgirish * 86144961713Sgirish * Inputs: 86244961713Sgirish * rdc: RX DMA Channel number 86344961713Sgirish * rx_disc_cnt_t Structure to write current RDC discard stat 86444961713Sgirish * 86544961713Sgirish * Return: 86644961713Sgirish * 86744961713Sgirish */ 86844961713Sgirish 86944961713Sgirish npi_status_t npi_rx_port_discard_stat_get(npi_handle_t, 87044961713Sgirish uint8_t, 87144961713Sgirish rx_disc_cnt_t *); 87244961713Sgirish 87344961713Sgirish 87444961713Sgirish /* 87544961713Sgirish * npi_rxdma_red_discard_stat_get 87644961713Sgirish * Gets the current discrad count due RED 87744961713Sgirish * The counter overflow bit is cleared, if it has been set. 87844961713Sgirish * 87944961713Sgirish * Inputs: 88044961713Sgirish * rdc: RX DMA Channel number 88144961713Sgirish * rx_disc_cnt_t Structure to write current RDC discard stat 88244961713Sgirish * 88344961713Sgirish * Return: 88444961713Sgirish * NPI_SUCCESS 88544961713Sgirish * NPI_RXDMA_RDC_INVALID 88644961713Sgirish * 88744961713Sgirish */ 88844961713Sgirish 88944961713Sgirish npi_status_t npi_rxdma_red_discard_stat_get(npi_handle_t, uint8_t, 89044961713Sgirish rx_disc_cnt_t *); 89144961713Sgirish 89244961713Sgirish 89344961713Sgirish 89444961713Sgirish /* 89544961713Sgirish * npi_rxdma_red_discard_oflow_clear 89644961713Sgirish * Clear RED discard counter overflow bit 89744961713Sgirish * 89844961713Sgirish * Inputs: 89944961713Sgirish * rdc: RX DMA Channel number 90044961713Sgirish * 90144961713Sgirish * Return: 90244961713Sgirish * NPI_SUCCESS 90344961713Sgirish * NPI_RXDMA_RDC_INVALID 90444961713Sgirish * 90544961713Sgirish */ 90644961713Sgirish 90744961713Sgirish npi_status_t npi_rxdma_red_discard_oflow_clear(npi_handle_t, 90844961713Sgirish uint8_t); 90944961713Sgirish 91044961713Sgirish 91144961713Sgirish 91244961713Sgirish 91344961713Sgirish /* 91444961713Sgirish * npi_rxdma_misc_discard_stat_get 91544961713Sgirish * Gets the current discrad count for the rdc due to 91644961713Sgirish * buffer pool empty 91744961713Sgirish * The counter overflow bit is cleared, if it has been set. 91844961713Sgirish * 91944961713Sgirish * Inputs: 92044961713Sgirish * rdc: RX DMA Channel number 92144961713Sgirish * rx_disc_cnt_t Structure to write current RDC discard stat 92244961713Sgirish * 92344961713Sgirish * Return: 92444961713Sgirish * NPI_SUCCESS 92544961713Sgirish * NPI_RXDMA_RDC_INVALID 92644961713Sgirish * 92744961713Sgirish */ 92844961713Sgirish 92944961713Sgirish npi_status_t npi_rxdma_misc_discard_stat_get(npi_handle_t, uint8_t, 93044961713Sgirish rx_disc_cnt_t *); 93144961713Sgirish 93244961713Sgirish 93344961713Sgirish 93444961713Sgirish /* 93544961713Sgirish * npi_rxdma_red_discard_oflow_clear 93644961713Sgirish * Clear RED discard counter overflow bit 93744961713Sgirish * clear the overflow bit for buffer pool empty discrad counter 93844961713Sgirish * for the rdc 93944961713Sgirish * 94044961713Sgirish * 94144961713Sgirish * Inputs: 94244961713Sgirish * rdc: RX DMA Channel number 94344961713Sgirish * 94444961713Sgirish * Return: 94544961713Sgirish * NPI_SUCCESS 94644961713Sgirish * NPI_RXDMA_RDC_INVALID 94744961713Sgirish * 94844961713Sgirish */ 94944961713Sgirish 95044961713Sgirish npi_status_t npi_rxdma_misc_discard_oflow_clear(npi_handle_t, 95144961713Sgirish uint8_t); 95244961713Sgirish 95344961713Sgirish 95444961713Sgirish 95544961713Sgirish /* 95644961713Sgirish * npi_rxdma_ring_perr_stat_get 95744961713Sgirish * Gets the current RDC Memory parity error 95844961713Sgirish * The counter overflow bit is cleared, if it has been set. 95944961713Sgirish * 96044961713Sgirish * Inputs: 96144961713Sgirish * pre_cnt: Structure to write current RDC Prefetch memory 96244961713Sgirish * Parity Error stat 96344961713Sgirish * sha_cnt: Structure to write current RDC Shadow memory 96444961713Sgirish * Parity Error stat 96544961713Sgirish * 96644961713Sgirish * Return: 96744961713Sgirish * NPI_SUCCESS 96844961713Sgirish * NPI_RXDMA_RDC_INVALID 96944961713Sgirish * 97044961713Sgirish */ 97144961713Sgirish 97244961713Sgirish npi_status_t npi_rxdma_ring_perr_stat_get(npi_handle_t, 97344961713Sgirish rdmc_par_err_log_t *, 97444961713Sgirish rdmc_par_err_log_t *); 97544961713Sgirish 97644961713Sgirish 97744961713Sgirish /* 97844961713Sgirish * npi_rxdma_ring_perr_stat_get 97944961713Sgirish * Clear RDC Memory Parity Error counter overflow bits 98044961713Sgirish * 98144961713Sgirish * Inputs: 98244961713Sgirish * Return: 98344961713Sgirish * NPI_SUCCESS 98444961713Sgirish * 98544961713Sgirish */ 98644961713Sgirish 98744961713Sgirish npi_status_t npi_rxdma_ring_perr_stat_clear(npi_handle_t); 98844961713Sgirish 98944961713Sgirish 99044961713Sgirish /* Access the RDMC Memory: used for debugging */ 99144961713Sgirish 99244961713Sgirish npi_status_t npi_rxdma_rdmc_memory_io(npi_handle_t, 99344961713Sgirish rdmc_mem_access_t *, uint8_t); 99444961713Sgirish 99544961713Sgirish 99644961713Sgirish 99744961713Sgirish /* 99844961713Sgirish * npi_rxdma_rxctl_fifo_error_intr_set 99944961713Sgirish * Configure The RX ctrl fifo error interrupt generation 100044961713Sgirish * 100144961713Sgirish * Inputs: 100244961713Sgirish * mask: rx_ctl_dat_fifo_mask_t specifying the errors 100344961713Sgirish * 100444961713Sgirish * Return: 100544961713Sgirish * NPI_SUCCESS 100644961713Sgirish * NPI_FAILURE 100744961713Sgirish * 100844961713Sgirish */ 100944961713Sgirish 101044961713Sgirish npi_status_t npi_rxdma_rxctl_fifo_error_intr_set(npi_handle_t, 101144961713Sgirish rx_ctl_dat_fifo_mask_t *); 101244961713Sgirish 101344961713Sgirish /* 101444961713Sgirish * npi_rxdma_rxctl_fifo_error_status_get 101544961713Sgirish * Read The RX ctrl fifo error Status 101644961713Sgirish * 101744961713Sgirish * Inputs: 101844961713Sgirish * stat: rx_ctl_dat_fifo_stat_t to read the errors to 101944961713Sgirish * valid fields in rx_ctl_dat_fifo_stat_t structure are: 102044961713Sgirish * zcp_eop_err, ipp_eop_err, id_mismatch. 102144961713Sgirish * Return: 102244961713Sgirish * NPI_SUCCESS 102344961713Sgirish * NPI_FAILURE 102444961713Sgirish * 102544961713Sgirish */ 102644961713Sgirish 102744961713Sgirish npi_status_t npi_rxdma_rxctl_fifo_error_status_get(npi_handle_t, 102844961713Sgirish rx_ctl_dat_fifo_stat_t *); 102944961713Sgirish 103044961713Sgirish 103144961713Sgirish /* 103244961713Sgirish * npi_rxdma_channel_mex_set(): 103344961713Sgirish * This function is called to arm the DMA channel with 103444961713Sgirish * mailbox updating capability. Software needs to rearm 103544961713Sgirish * for each update by writing to the control and status register. 103644961713Sgirish * 103744961713Sgirish * Parameters: 103844961713Sgirish * handle - NPI handle (virtualization flag must be defined). 103944961713Sgirish * channel - logical RXDMA channel from 0 to 23. 104044961713Sgirish * (If virtualization flag is not set, then 104144961713Sgirish * logical channel is the same as the hardware 104244961713Sgirish * channel number). 104344961713Sgirish * 104444961713Sgirish * Return: 104544961713Sgirish * NPI_SUCCESS - If enable channel with mailbox update 104644961713Sgirish * is complete successfully. 104744961713Sgirish * 104844961713Sgirish * Error: 104944961713Sgirish * NPI_FAILURE - 105044961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 105144961713Sgirish */ 105244961713Sgirish npi_status_t npi_rxdma_channel_mex_set(npi_handle_t, uint8_t); 105344961713Sgirish 105444961713Sgirish /* 105544961713Sgirish * npi_rxdma_channel_rcrto_clear(): 105644961713Sgirish * This function is called to reset RCRTO bit to 0. 105744961713Sgirish * 105844961713Sgirish * Parameters: 105944961713Sgirish * handle - NPI handle (virtualization flag must be defined). 106044961713Sgirish * channel - logical RXDMA channel from 0 to 23. 106144961713Sgirish * (If virtualization flag is not set, then 106244961713Sgirish * logical channel is the same as the hardware 106344961713Sgirish * channel number). 106444961713Sgirish * Return: 106544961713Sgirish * NPI_SUCCESS 106644961713Sgirish * 106744961713Sgirish * Error: 106844961713Sgirish * NPI_FAILURE - 106944961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 107044961713Sgirish */ 107144961713Sgirish npi_status_t npi_rxdma_channel_rcrto_clear(npi_handle_t, uint8_t); 107244961713Sgirish 107344961713Sgirish /* 107444961713Sgirish * npi_rxdma_channel_pt_drop_pkt_clear(): 107544961713Sgirish * This function is called to clear the port drop packet bit (debug). 107644961713Sgirish * 107744961713Sgirish * Parameters: 107844961713Sgirish * handle - NPI handle (virtualization flag must be defined). 107944961713Sgirish * channel - logical RXDMA channel from 0 to 23. 108044961713Sgirish * (If virtualization flag is not set, then 108144961713Sgirish * logical channel is the same as the hardware 108244961713Sgirish * channel number). 108344961713Sgirish * Return: 108444961713Sgirish * NPI_SUCCESS 108544961713Sgirish * 108644961713Sgirish * Error: 108744961713Sgirish * NPI_FAILURE - 108844961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 108944961713Sgirish */ 109044961713Sgirish npi_status_t npi_rxdma_channel_pt_drop_pkt_clear(npi_handle_t, uint8_t); 109144961713Sgirish 109244961713Sgirish /* 109344961713Sgirish * npi_rxdma_channel_wred_drop_clear(): 109444961713Sgirish * This function is called to wred drop bit (debug only). 109544961713Sgirish * 109644961713Sgirish * Parameters: 109744961713Sgirish * handle - NPI handle (virtualization flag must be defined). 109844961713Sgirish * channel - logical RXDMA channel from 0 to 23. 109944961713Sgirish * (If virtualization flag is not set, then 110044961713Sgirish * logical channel is the same as the hardware 110144961713Sgirish * channel number). 110244961713Sgirish * Return: 110344961713Sgirish * NPI_SUCCESS 110444961713Sgirish * 110544961713Sgirish * Error: 110644961713Sgirish * NPI_FAILURE - 110744961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 110844961713Sgirish */ 110944961713Sgirish npi_status_t npi_rxdma_channel_wred_drop_clear(npi_handle_t, uint8_t); 111044961713Sgirish 111144961713Sgirish /* 111244961713Sgirish * npi_rxdma_channel_rcr_shfull_clear(): 111344961713Sgirish * This function is called to clear RCR shadow full bit. 111444961713Sgirish * 111544961713Sgirish * Parameters: 111644961713Sgirish * handle - NPI handle (virtualization flag must be defined). 111744961713Sgirish * channel - logical RXDMA channel from 0 to 23. 111844961713Sgirish * (If virtualization flag is not set, then 111944961713Sgirish * logical channel is the same as the hardware 112044961713Sgirish * channel number). 112144961713Sgirish * Return: 112244961713Sgirish * NPI_SUCCESS 112344961713Sgirish * 112444961713Sgirish * Error: 112544961713Sgirish * NPI_FAILURE - 112644961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 112744961713Sgirish */ 112844961713Sgirish npi_status_t npi_rxdma_channel_rcr_shfull_clear(npi_handle_t, uint8_t); 112944961713Sgirish 113044961713Sgirish /* 113144961713Sgirish * npi_rxdma_channel_rcrfull_clear(): 113244961713Sgirish * This function is called to clear RCR full bit. 113344961713Sgirish * 113444961713Sgirish * Parameters: 113544961713Sgirish * handle - NPI handle (virtualization flag must be defined). 113644961713Sgirish * channel - logical RXDMA channel from 0 to 23. 113744961713Sgirish * (If virtualization flag is not set, then 113844961713Sgirish * logical channel is the same as the hardware 113944961713Sgirish * channel number). 114044961713Sgirish * Return: 114144961713Sgirish * NPI_SUCCESS 114244961713Sgirish * 114344961713Sgirish * Error: 114444961713Sgirish * NPI_FAILURE - 114544961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 114644961713Sgirish */ 114744961713Sgirish npi_status_t npi_rxdma_channel_rcrfull_clear(npi_handle_t, uint8_t); 114844961713Sgirish 114944961713Sgirish /* 115044961713Sgirish * npi_rxdma_rbr_pre_empty_clear(): 115144961713Sgirish * This function is called to control a receive DMA channel 115244961713Sgirish * for arming the channel with mailbox updates, resetting 115344961713Sgirish * various event status bits (control and status register). 115444961713Sgirish * 115544961713Sgirish * Parameters: 115644961713Sgirish * handle - NPI handle (virtualization flag must be defined). 115744961713Sgirish * control - NPI defined control type supported: 115844961713Sgirish * - RXDMA_MEX_SET 115944961713Sgirish * - RXDMA_RCRTO_CLEAR 116044961713Sgirish * - RXDMA_PT_DROP_PKT_CLEAR 116144961713Sgirish * - RXDMA_WRED_DROP_CLEAR 116244961713Sgirish * - RXDMA_RCR_SFULL_CLEAR 116344961713Sgirish * - RXDMA_RCR_FULL_CLEAR 116444961713Sgirish * - RXDMA_RBR_PRE_EMPTY_CLEAR 116544961713Sgirish * channel - logical RXDMA channel from 0 to 23. 116644961713Sgirish * (If virtualization flag is not set, then 116744961713Sgirish * logical channel is the same as the hardware. 116844961713Sgirish * Return: 116944961713Sgirish * NPI_SUCCESS 117044961713Sgirish * 117144961713Sgirish * Error: 117244961713Sgirish * NPI_FAILURE - 117344961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 117444961713Sgirish */ 117544961713Sgirish npi_status_t npi_rxdma_channel_rbr_pre_empty_clear(npi_handle_t, uint8_t); 117644961713Sgirish 117744961713Sgirish /* 117844961713Sgirish * npi_rxdma_channel_control(): 117944961713Sgirish * This function is called to control a receive DMA channel 118044961713Sgirish * for arming the channel with mailbox updates, resetting 118144961713Sgirish * various event status bits (control and status register). 118244961713Sgirish * 118344961713Sgirish * Parameters: 118444961713Sgirish * handle - NPI handle (virtualization flag must be defined). 118544961713Sgirish * control - NPI defined control type supported: 118644961713Sgirish * - RXDMA_MEX_SET 118744961713Sgirish * - RXDMA_RCRTO_CLEAR 118844961713Sgirish * - RXDMA_PT_DROP_PKT_CLEAR 118944961713Sgirish * - RXDMA_WRED_DROP_CLEAR 119044961713Sgirish * - RXDMA_RCR_SFULL_CLEAR 119144961713Sgirish * - RXDMA_RCR_FULL_CLEAR 119244961713Sgirish * - RXDMA_RBR_PRE_EMPTY_CLEAR 119344961713Sgirish * channel - logical RXDMA channel from 0 to 23. 119444961713Sgirish * (If virtualization flag is not set, then 119544961713Sgirish * logical channel is the same as the hardware. 119644961713Sgirish * Return: 119744961713Sgirish * NPI_SUCCESS 119844961713Sgirish * 119944961713Sgirish * Error: 120044961713Sgirish * NPI_FAILURE - 120144961713Sgirish * NPI_TXDMA_OPCODE_INVALID - 120244961713Sgirish * NPI_TXDMA_CHANNEL_INVALID - 120344961713Sgirish */ 120444961713Sgirish npi_status_t npi_rxdma_channel_control(npi_handle_t, 120544961713Sgirish rxdma_cs_cntl_t, uint8_t); 120644961713Sgirish 120744961713Sgirish /* 120844961713Sgirish * npi_rxdma_control_status(): 120944961713Sgirish * This function is called to operate on the control 121044961713Sgirish * and status register. 121144961713Sgirish * 121244961713Sgirish * Parameters: 121344961713Sgirish * handle - NPI handle 121444961713Sgirish * op_mode - OP_GET: get hardware control and status 121544961713Sgirish * OP_SET: set hardware control and status 121644961713Sgirish * OP_UPDATE: update hardware control and status. 121744961713Sgirish * OP_CLEAR: clear control and status register to 0s. 121844961713Sgirish * channel - hardware RXDMA channel from 0 to 23. 121944961713Sgirish * cs_p - pointer to hardware defined control and status 122044961713Sgirish * structure. 122144961713Sgirish * Return: 122244961713Sgirish * NPI_SUCCESS 122344961713Sgirish * 122444961713Sgirish * Error: 122544961713Sgirish * NPI_FAILURE - 122644961713Sgirish * NPI_RXDMA_OPCODE_INVALID - 122744961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 122844961713Sgirish */ 122944961713Sgirish npi_status_t npi_rxdma_control_status(npi_handle_t, io_op_t, 123044961713Sgirish uint8_t, p_rx_dma_ctl_stat_t); 123144961713Sgirish 123244961713Sgirish /* 123344961713Sgirish * npi_rxdma_event_mask(): 123444961713Sgirish * This function is called to operate on the event mask 123544961713Sgirish * register which is used for generating interrupts. 123644961713Sgirish * 123744961713Sgirish * Parameters: 123844961713Sgirish * handle - NPI handle 123944961713Sgirish * op_mode - OP_GET: get hardware event mask 124044961713Sgirish * OP_SET: set hardware interrupt event masks 124144961713Sgirish * OP_CLEAR: clear control and status register to 0s. 124244961713Sgirish * channel - hardware RXDMA channel from 0 to 23. 124344961713Sgirish * mask_p - pointer to hardware defined event mask 124444961713Sgirish * structure. 124544961713Sgirish * Return: 124644961713Sgirish * NPI_SUCCESS - If set is complete successfully. 124744961713Sgirish * 124844961713Sgirish * Error: 124944961713Sgirish * NPI_FAILURE - 125044961713Sgirish * NPI_RXDMA_OPCODE_INVALID - 125144961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 125244961713Sgirish */ 125344961713Sgirish npi_status_t npi_rxdma_event_mask(npi_handle_t, io_op_t, 125444961713Sgirish uint8_t, p_rx_dma_ent_msk_t); 125544961713Sgirish 125644961713Sgirish /* 125744961713Sgirish * npi_rxdma_event_mask_config(): 125844961713Sgirish * This function is called to operate on the event mask 125944961713Sgirish * register which is used for generating interrupts 126044961713Sgirish * and status register. 126144961713Sgirish * 126244961713Sgirish * Parameters: 126344961713Sgirish * handle - NPI handle 126444961713Sgirish * op_mode - OP_GET: get hardware event mask 126544961713Sgirish * OP_SET: set hardware interrupt event masks 126644961713Sgirish * OP_CLEAR: clear control and status register to 0s. 126744961713Sgirish * channel - hardware RXDMA channel from 0 to 23. 126844961713Sgirish * cfgp - pointer to NPI defined event mask 126944961713Sgirish * enum data type. 127044961713Sgirish * Return: 127144961713Sgirish * NPI_SUCCESS - If set is complete successfully. 127244961713Sgirish * 127344961713Sgirish * Error: 127444961713Sgirish * NPI_FAILURE - 127544961713Sgirish * NPI_RXDMA_OPCODE_INVALID - 127644961713Sgirish * NPI_RXDMA_CHANNEL_INVALID - 127744961713Sgirish */ 127844961713Sgirish npi_status_t npi_rxdma_event_mask_config(npi_handle_t, io_op_t, 127944961713Sgirish uint8_t, rxdma_ent_msk_cfg_t *); 128044961713Sgirish 128144961713Sgirish 128244961713Sgirish /* 128344961713Sgirish * npi_rxdma_dump_rdc_regs 128444961713Sgirish * Dumps the contents of rdc csrs and fzc registers 128544961713Sgirish * 128644961713Sgirish * Input: 128744961713Sgirish * rdc: RX DMA number 128844961713Sgirish * 128944961713Sgirish * return: 129044961713Sgirish * NPI_SUCCESS 129144961713Sgirish * NPI_FAILURE 129244961713Sgirish * NPI_RXDMA_RDC_INVALID 129344961713Sgirish * 129444961713Sgirish */ 129544961713Sgirish 129644961713Sgirish npi_status_t npi_rxdma_dump_rdc_regs(npi_handle_t, uint8_t); 129744961713Sgirish 129844961713Sgirish 129944961713Sgirish /* 130044961713Sgirish * npi_rxdma_dump_fzc_regs 130144961713Sgirish * Dumps the contents of rdc csrs and fzc registers 130244961713Sgirish * 130344961713Sgirish * Input: 130444961713Sgirish * rdc: RX DMA number 130544961713Sgirish * 130644961713Sgirish * return: 130744961713Sgirish * NPI_SUCCESS 130844961713Sgirish * NPI_FAILURE 130944961713Sgirish * NPI_RXDMA_RDC_INVALID 131044961713Sgirish * 131144961713Sgirish */ 131244961713Sgirish 131344961713Sgirish npi_status_t npi_rxdma_dump_fzc_regs(npi_handle_t); 131444961713Sgirish 131544961713Sgirish npi_status_t npi_rxdma_channel_rbr_empty_clear(npi_handle_t, 131644961713Sgirish uint8_t); 131744961713Sgirish npi_status_t npi_rxdma_rxctl_fifo_error_intr_get(npi_handle_t, 131844961713Sgirish rx_ctl_dat_fifo_stat_t *); 131944961713Sgirish 132044961713Sgirish npi_status_t npi_rxdma_rxctl_fifo_error_intr_set(npi_handle_t, 132144961713Sgirish rx_ctl_dat_fifo_mask_t *); 132244961713Sgirish 132344961713Sgirish npi_status_t npi_rxdma_dump_rdc_table(npi_handle_t, uint8_t); 132444961713Sgirish #ifdef __cplusplus 132544961713Sgirish } 132644961713Sgirish #endif 132744961713Sgirish 132844961713Sgirish #endif /* _NPI_RXDMA_H */ 1329