/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <npi_fflp.h>
#include <nxge_common.h>
/* macros to compute calss configuration register offset */
((partid < NXGE_MAX_RDC_GRPS))
((port < MAX_PORTS_PER_NXGE))
((table < NXGE_MAX_RDC_GRPS))
};
const char *fflp_fzc_name[] = {
"FFLP_ENET_VLAN_TBL_REG", "FFLP_L2_CLS_ENET1_REG",
"FFLP_L2_CLS_ENET2_REG", "FFLP_TCAM_KEY_IP_USR4_REG",
"FFLP_TCAM_KEY_IP_USR5_REG", "FFLP_TCAM_KEY_IP_USR6_REG",
"FFLP_TCAM_KEY_IP_USR7_REG", "FFLP_TCAM_KEY_IP4_TCP_REG",
"FFLP_TCAM_KEY_IP4_UDP_REG", "FFLP_TCAM_KEY_IP4_AH_ESP_REG",
"FFLP_TCAM_KEY_IP4_SCTP_REG", "FFLP_TCAM_KEY_IP6_TCP_REG",
"FFLP_TCAM_KEY_IP6_UDP_REG", "FFLP_TCAM_KEY_IP6_AH_ESP_REG",
"FFLP_TCAM_KEY_IP6_SCTP_REG", "FFLP_TCAM_KEY_0_REG",
"FFLP_TCAM_KEY_1_REG", "FFLP_TCAM_KEY_2_REG", "FFLP_TCAM_KEY_3_REG",
"FFLP_TCAM_MASK_0_REG", "FFLP_TCAM_MASK_1_REG", "FFLP_TCAM_MASK_2_REG",
"FFLP_TCAM_MASK_3_REG", "FFLP_TCAM_CTL_REG", "FFLP_VLAN_PAR_ERR_REG",
"FFLP_TCAM_ERR_REG", "HASH_LKUP_ERR_LOG1_REG",
"HASH_LKUP_ERR_LOG2_REG", "FFLP_FCRAM_ERR_TST0_REG",
"FFLP_FCRAM_ERR_TST1_REG", "FFLP_FCRAM_ERR_TST2_REG",
"FFLP_ERR_MSK_REG", "FFLP_CFG_1_REG", "FFLP_DBG_TRAIN_VCT_REG",
"FFLP_TCP_CFLAG_MSK_REG", "FFLP_FCRAM_REF_TMR_REG",
"FFLP_FLOW_KEY_IP_USR4_REG", "FFLP_FLOW_KEY_IP_USR5_REG",
"FFLP_FLOW_KEY_IP_USR6_REG", "FFLP_FLOW_KEY_IP_USR7_REG",
"FFLP_FLOW_KEY_IP4_TCP_REG", "FFLP_FLOW_KEY_IP4_UDP_REG",
"FFLP_FLOW_KEY_IP4_AH_ESP_REG", "FFLP_FLOW_KEY_IP4_SCTP_REG",
"FFLP_FLOW_KEY_IP6_TCP_REG", "FFLP_FLOW_KEY_IP6_UDP_REG",
"FFLP_FLOW_KEY_IP6_AH_ESP_REG",
"FFLP_FLOW_KEY_IP6_SCTP_REG", "FFLP_H1POLY_REG", "FFLP_H2POLY_REG",
"FFLP_FLW_PRT_SEL_REG"
};
};
const char *fflp_reg_name[] = {
"FFLP_HASH_TBL_ADDR_REG", "FFLP_HASH_TBL_DATA_REG",
"FFLP_HASH_TBL_DATA_LOG_REG"
};
{
int num_regs, i;
"\nFFLP_FZC Register Dump \n"));
for (i = 0; i < num_regs; i++) {
" %8llx %s\t %8llx \n",
}
"\nFFLP Register Dump\n"));
for (i = 0; i < num_regs; i++) {
" %8llx %s\t %8llx \n",
}
"\n FFLP Register Dump done\n"));
return (NPI_SUCCESS);
}
void
{
"\nVlan Table Dump \n"));
"VID\t Offset\t Value\n"));
}
}
static uint64_t
/*
* npi_fflp_tcam_check_completion()
* Returns TCAM completion status.
*
* Input:
* op_type : Read, Write, Compare
* handle : OS specific handle
*
* Output:
* For Read and write operations:
* 0 Successful
*
* For Compare operations (debug only )
* TCAM_REG_CTL read value on success
* value contains match location
* NPI_TCAM_COMP_NO_MATCH no match
*
*/
static uint64_t
{
switch (op_type) {
case TCAM_RWC_STAT:
while ((try_counter) &&
try_counter--;
}
if (!try_counter) {
" TCAM RWC_STAT operation"
" failed to complete \n"));
return (NPI_FFLP_TCAM_HW_ERROR);
}
break;
case TCAM_RWC_MATCH:
while ((try_counter) &&
try_counter--;
}
if (!try_counter) {
" TCAM Match operation"
"failed to find match \n"));
}
break;
default:
" Invalid TCAM completion Request \n"));
return (NPI_FFLP_ERROR |
}
}
/*
* npi_fflp_tcam_entry_invalidate()
*
* invalidates entry at tcam location
*
* Input
* handle : OS specific handle
* location : TCAM location
*
* Return
* NPI_SUCCESS
* NPI_FFLP_TCAM_HW_ERROR
*
*/
{
/*
* Need to write zero to class field.
* Class field is bits [195:191].
* This corresponds to TCAM key 0 register
*
*/
return (NPI_FFLP_TCAM_HW_ERROR);
return (NPI_SUCCESS);
}
/*
* npi_fflp_tcam_entry_match()
*
* lookup a tcam entry in the TCAM
*
* Input
* handle : OS specific handle
* tcam_ptr : TCAM entry ptr
*
* Return
*
* NPI_FAILURE | NPI_XX_ERROR: Operational Error (HW etc ...)
* NPI_TCAM_NO_MATCH: no match
* 0 - TCAM_SIZE: matching entry location (if match)
*/
int
{
if (tcam_stat & NPI_FAILURE) {
}
}
}
/*
* npi_fflp_tcam_entry_read ()
*
* Reads a tcam entry from the TCAM location, location
*
* Input:
* handle : OS specific handle
* location : TCAM location
* tcam_ptr : TCAM entry pointer
*
* Return:
* NPI_SUCCESS
* NPI_FFLP_TCAM_RD_ERROR
*
*/
struct tcam_entry *tcam_ptr)
{
if (tcam_stat & NPI_FAILURE) {
"TCAM read failed loc %d \n", location));
return (NPI_FFLP_TCAM_RD_ERROR);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_tcam_entry_write()
*
* writes a tcam entry to the TCAM location, location
*
* Input:
* handle : OS specific handle
* location : TCAM location
* tcam_ptr : TCAM entry pointer
*
* Return:
* NPI_SUCCESS
* NPI_FFLP_TCAM_WR_ERROR
*
*/
{
" tcam write: location %x\n"
" key: %llx %llx %llx %llx \n"
" mask: %llx %llx %llx %llx \n",
if (tcam_stat & NPI_FAILURE) {
"TCAM Write failed loc %d \n", location));
return (NPI_FFLP_TCAM_WR_ERROR);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_tcam_asc_ram_entry_write()
*
* writes a tcam associatedRAM at the TCAM location, location
*
* Input:
* handle : OS specific handle
* location : tcam associatedRAM location
* ram_data : Value to write
*
* Return:
* NPI_SUCCESS
* NPI_FFLP_ASC_RAM_WR_ERROR
*
*/
{
" tcam ascr write: location %x data %llx ctl value %llx \n",
if (tcam_stat & NPI_FAILURE) {
"TCAM RAM write failed loc %d \n", location));
return (NPI_FFLP_ASC_RAM_WR_ERROR);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_tcam_asc_ram_entry_read()
*
* reads a tcam associatedRAM content at the TCAM location, location
*
* Input:
* handle : OS specific handle
* location : tcam associatedRAM location
* ram_data : ptr to return contents
*
* Return:
* NPI_SUCCESS
* NPI_FFLP_ASC_RAM_RD_ERROR
*
*/
{
if (tcam_stat & NPI_FAILURE) {
"TCAM RAM read failed loc %d \n", location));
return (NPI_FFLP_ASC_RAM_RD_ERROR);
}
return (NPI_SUCCESS);
}
/* FFLP FCRAM Related functions */
/* The following are FCRAM datapath functions */
/*
* npi_fflp_fcram_entry_write ()
* Populates an FCRAM entry
* Inputs:
* handle: opaque handle interpreted by the underlying OS
* partid: Partition ID
* location: Index to the FCRAM.
* Corresponds to last 20 bits of H1 value
* fcram_ptr: Pointer to the FCRAM contents to be used for writing
* format: Entry Format. Determines the size of the write.
* FCRAM_ENTRY_OPTIM: 8 bytes (a 64 bit write)
* FCRAM_ENTRY_EX_IP4: 32 bytes (4 X 64 bit write)
* FCRAM_ENTRY_EX_IP6: 56 bytes (7 X 64 bit write)
*
* Outputs:
*/
{
int num_subareas = 0;
int subarea;
int autoinc;
switch (format) {
case FCRAM_ENTRY_OPTIM:
if (location % 8) {
/* need to be 8 byte alligned */
" FCRAM_ENTRY_OOPTIM Write:"
" unaligned location %llx \n",
location));
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
num_subareas = 1;
autoinc = 0;
break;
case FCRAM_ENTRY_EX_IP4:
if (location % 32) {
/* need to be 32 byte alligned */
" FCRAM_ENTRY_EX_IP4 Write:"
" unaligned location %llx \n",
location));
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
num_subareas = 4;
autoinc = 1;
break;
case FCRAM_ENTRY_EX_IP6:
if (location % 64) {
/* need to be 64 byte alligned */
" FCRAM_ENTRY_EX_IP6 Write:"
" unaligned location %llx \n",
location));
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
num_subareas = 7;
autoinc = 1;
break;
default:
" fcram_entry_write:"
" unknown format param location %llx\n",
location));
}
/* write to addr reg */
/* write data to the data register */
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_read_read ()
* Reads an FCRAM entry
* Inputs:
* handle: opaque handle interpreted by the underlying OS
* partid: Partition ID
* location: Index to the FCRAM.
* Corresponds to last 20 bits of H1 value
*
* fcram_ptr: Pointer to the FCRAM contents to be updated
* format: Entry Format. Determines the size of the read.
* FCRAM_ENTRY_OPTIM: 8 bytes (a 64 bit read)
* FCRAM_ENTRY_EX_IP4: 32 bytes (4 X 64 bit read )
* FCRAM_ENTRY_EX_IP6: 56 bytes (7 X 64 bit read )
* Return:
*
*/
{
int num_subareas = 0;
switch (format) {
case FCRAM_ENTRY_OPTIM:
if (location % 8) {
" FCRAM_ENTRY_OOPTIM Read:"
" unaligned location %llx \n",
location));
/* need to be 8 byte alligned */
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
num_subareas = 1;
autoinc = 0;
break;
case FCRAM_ENTRY_EX_IP4:
if (location % 32) {
/* need to be 32 byte alligned */
" FCRAM_ENTRY_EX_IP4 READ:"
" unaligned location %llx \n",
location));
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
num_subareas = 4;
autoinc = 1;
break;
case FCRAM_ENTRY_EX_IP6:
if (location % 64) {
/* need to be 64 byte alligned */
" FCRAM_ENTRY_EX_IP6 READ:"
" unaligned location %llx \n",
location));
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
num_subareas = 7;
autoinc = 1;
break;
default:
" fcram_entry_read:"
" unknown format param location %llx\n",
location));
return (NPI_FFLP_SW_PARAM_ERROR);
}
/* write to addr reg */
/* read data from the data register */
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_entry_invalidate ()
* Invalidate FCRAM entry at the given location
* Inputs:
* handle: opaque handle interpreted by the underlying OS
* partid: Partition ID
*
* Return:
*/
{
if (location % 8) {
" FCRAM_ENTRY_Invalidate:"
" unaligned location %llx \n",
location));
/* need to be 8 byte aligned */
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
/* write to addr reg */
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_write_subarea ()
* Writes to FCRAM entry subarea i.e the 8 bytes within the 64 bytes
* pointed by the last 20 bits of H1. Effectively, this accesses
* specific 8 bytes within the hash table bucket.
*
* H1--> |-----------------|
* | subarea 0 |
* |_________________|
* | Subarea 1 |
* |_________________|
* | ....... |
* |_________________|
* | Subarea 7 |
* |_________________|
*
* Inputs:
* handle: opaque handle interpreted by the underlying OS
* partid: Partition ID
* location: location of the subarea. It is derived from:
* Bucket = [19:15][14:0] (20 bits of H1)
* location = (Bucket << 3 ) + subarea * 8
* = [22:18][17:3] || subarea * 8
* data: Data
*
* Return:
*/
{
if (location % 8) {
" fcram_subarea_write:"
" unaligned location %llx \n",
location));
/* need to be 8 byte alligned */
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
/* write to addr reg */
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_subarea_read ()
* Reads an FCRAM entry subarea i.e the 8 bytes within the 64 bytes
* pointed by the last 20 bits of H1. Effectively, this accesses
* specific 8 bytes within the hash table bucket.
*
* H1--> |-----------------|
* | subarea 0 |
* |_________________|
* | Subarea 1 |
* |_________________|
* | ....... |
* |_________________|
* | Subarea 7 |
* |_________________|
*
* Inputs:
* handle: opaque handle interpreted by the underlying OS
* partid: Partition ID
* location: location of the subarea. It is derived from:
* Bucket = [19:15][14:0] (20 bits of H1)
* location = (Bucket << 3 ) + subarea * 8
* = [22:18][17:3] || subarea * 8
* data: ptr do write subarea contents to.
*
* Return:
*/
{
if (location % 8) {
" fcram_subarea_read:"
" unaligned location %llx \n",
location));
/* need to be 8 byte alligned */
return (NPI_FFLP_FCRAM_LOC_INVALID);
}
/* write to addr reg */
return (NPI_SUCCESS);
}
/*
* The following are zero function fflp configuration functions.
*/
/*
* npi_fflp_fcram_config_partition()
* Partitions and configures the FCRAM
*/
{
/*
* assumes that the base mask and relocation are computed somewhere
* and kept in the state data structure. Alternativiely, one can pass
* a partition size and a starting address and this routine can compute
* the mask and reloc vlaues.
*/
if (!FCRAM_PARTITION_VALID(partid)) {
" npi_fflp_cfg_fcram_partition:"
" Invalid Partition %d \n",
partid));
return (NPI_FFLP_FCRAM_PART_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_partition_enable
* Enable previously configured FCRAM partition
*
* Input
* handle: opaque handle interpreted by the underlying OS
* partid: partition ID, Corresponds to the RDC table
*
* Return
* 0 Successful
* Non zero error code Enable failed, and reason.
*
*/
{
if (!FCRAM_PARTITION_VALID(partid)) {
" fcram_partition enable:"
" Invalid Partition %d \n",
partid));
return (NPI_FFLP_FCRAM_PART_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_partition_disable
* Disable previously configured FCRAM partition
*
* Input
* handle: opaque handle interpreted by the underlying OS
* partid: partition ID, Corresponds to the RDC table
*
* Return:
*/
{
if (!FCRAM_PARTITION_VALID(partid)) {
" fcram_partition disable:"
" Invalid Partition %d \n",
partid));
return (NPI_FFLP_FCRAM_PART_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cam_errorcheck_disable
* Disables FCRAM and TCAM error checking
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cam_errorcheck_enable
* Enables FCRAM and TCAM error checking
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cam_llcsnap_enable
* Enables input parser llcsnap recognition
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cam_llcsnap_disable
* Disables input parser llcsnap recognition
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_config_fcram_refresh
* Set FCRAM min and max refresh time.
*
* Input
* handle opaque handle interpreted by the underlying OS
* min_time Minimum Refresh time count
* max_time maximum Refresh Time count
* sys_time System Clock rate
*
* The counters are 16 bit counters. The maximum refresh time is
* Clock cycle is the FCRAM clock cycle?????
* If the cycle is FCRAM clock cycle, then sys_time parameter
* is not needed as there wont be configuration variation due to
* system clock cycle.
*
* Return:
*/
{
/* need to figure out how to dervive the numbers */
/* for now, just set with #def values */
return (NPI_SUCCESS);
}
/*
* npi_fflp_hash_lookup_err_report
* Reports hash table (fcram) lookup errors
*
* Input
* handle opaque handle interpreted by the underlying OS
* err_stat Pointer to return Error bits
*
*
* Return:
*/
{
/* nonzero means there are some errors */
} else {
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_get_pio_err_log
* Reports hash table PIO read errors for the given partition.
* by default, it clears the error bit which was set by the HW.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* partid: partition ID
* err_stat Pointer to return Error bits
*
* Return
*/
{
if (!FCRAM_PARTITION_VALID(partid)) {
" fcram_get_pio_err_log:"
" Invalid Partition %d \n",
partid));
return (NPI_FFLP_FCRAM_PART_INVALID);
}
/* nonzero means there are some errors */
} else {
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_clr_pio_err_log
* Clears FCRAM PIO error status for the partition.
* If there are TCAM errors as indicated by err bit set by HW,
* then the SW will clear it by clearing the bit.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* partid: partition ID
*
*
* Return
*/
{
if (!FCRAM_PARTITION_VALID(partid)) {
" fcram_clr_pio_err_log:"
" Invalid Partition %d \n",
partid));
return (NPI_FFLP_FCRAM_PART_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_tcam_get_err_log
* Reports TCAM PIO read and lookup errors.
* If there are TCAM errors as indicated by err bit set by HW,
* then the SW will clear it by clearing the bit.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* err_stat: structure to report various TCAM errors.
* will be updated if there are TCAM errors.
*
*
* Return
* NPI_SUCCESS Success
*
*
*/
{
/* non-zero means err */
err_stat->parity_err = 0;
} else {
}
/* now clear the error */
} else {
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_tcam_clr_err_log
* Clears TCAM PIO read and lookup error status.
* If there are TCAM errors as indicated by err bit set by HW,
* then the SW will clear it by clearing the bit.
*
* Input
* handle: opaque handle interpreted by the underlying OS
*
*
* Return
* NPI_SUCCESS Success
*
*
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_err_synd_test
* Tests the FCRAM error detection logic.
* The error detection logic for the syndrome is tested.
* tst0->synd (8bits) are set to select the syndrome bits
* to be XOR'ed
*
* Input
* handle: opaque handle interpreted by the underlying OS
* syndrome_bits: Syndrome bits to select bits to be xor'ed
*
*
* Return
* NPI_SUCCESS Success
*
*
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_fcram_err_data_test
* Tests the FCRAM error detection logic.
* The error detection logic for the datapath is tested.
* bits [63:0] are set to select the data bits to be xor'ed
*
* Input
* handle: opaque handle interpreted by the underlying OS
* data: data bits to select bits to be xor'ed
*
*
* Return
* NPI_SUCCESS Success
*
*
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_enet_vlan_table_assoc
* associates port vlan id to rdc table.
*
* Input
* handle opaque handle interpreted by the underlying OS
* mac_portn port number
* vlan_id VLAN ID
* rdc_table RDC Table #
* priority priority
*
* Output
*
*
*/
{
if (!FFLP_VLAN_VALID(vlan_id)) {
" fflp_cfg_enet_vlan_table:"
" Invalid vlan ID %d \n",
vlan_id));
return (NPI_FFLP_VLAN_INVALID);
}
if (!FFLP_PORT_VALID(mac_portn)) {
" fflp_cfg_enet_vlan_table:"
" Invalid port num %d \n",
mac_portn));
return (NPI_FFLP_PORT_INVALID);
}
if (!FFLP_RDC_TABLE_VALID(rdc_table)) {
" fflp_cfg_enet_vlan_table:"
" Invalid RDC Table %d \n",
rdc_table));
return (NPI_FFLP_RDC_TABLE_INVALID);
}
switch (mac_portn) {
case 0:
if (priority)
else
/* set the parity bits */
break;
case 1:
if (priority)
else
/* set the parity bits */
break;
case 2:
if (priority)
else
/* set the parity bits */
break;
case 3:
if (priority)
else
/* set the parity bits */
break;
default:
return (NPI_FFLP_SW_PARAM_ERROR);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_enet_vlan_table_set_pri
* sets the vlan based classification priority in respect to L2DA
* classification.
*
* Input
* handle opaque handle interpreted by the underlying OS
* mac_portn port number
* vlan_id VLAN ID
* priority priority
* 1: vlan classification has higher priority
* 0: l2da classification has higher priority
*
* Output
*
*/
{
if (!FFLP_VLAN_VALID(vlan_id)) {
" enet_vlan_table set pri:"
" Invalid vlan ID %d \n",
vlan_id));
return (NPI_FFLP_VLAN_INVALID);
}
if (!FFLP_PORT_VALID(mac_portn)) {
" enet_vlan_table set pri:"
" Invalid port num %d \n",
mac_portn));
return (NPI_FFLP_PORT_INVALID);
}
switch (mac_portn) {
case 0:
if (priority)
else
break;
case 1:
if (priority)
else
break;
case 2:
if (priority)
else
break;
case 3:
if (priority)
else
break;
default:
return (NPI_FFLP_SW_PARAM_ERROR);
}
if (mac_portn > 1)
else
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_vlan_table_clear
* Clears the vlan RDC table
*
* Input
* handle opaque handle interpreted by the underlying OS
* vlan_id VLAN ID
*
* Output
*
*
*/
{
" enet_vlan_table clear:"
" Invalid vlan ID %d \n",
vlan_id));
return (NPI_FFLP_VLAN_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_vlan_tbl_get_err_log
* Reports VLAN Table errors.
* If there are VLAN Table errors as indicated by err bit set by HW,
* then the SW will clear it by clearing the bit.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* err_stat: structure to report various VLAN table errors.
* will be updated if there are errors.
*
*
* Return
* NPI_SUCCESS Success
*
*
*/
{
/* non-zero means err */
/* now clear the error */
} else {
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_vlan_tbl_clr_err_log
* Clears VLAN Table PIO error status.
* If there are VLAN Table errors as indicated by err bit set by HW,
* then the SW will clear it by clearing the bit.
*
* Input
* handle: opaque handle interpreted by the underlying OS
*
*
* Return
* NPI_SUCCESS Success
*
*
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_enet_usr_cls_set()
* Configures a user configurable ethernet class
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: Ethernet Class class
* (TCAM_CLASS_ETYPE or TCAM_CLASS_ETYPE_2)
* enet_type: 16 bit Ethernet Type value, corresponding ethernet bytes
* [13:14] in the frame.
*
* by default, the class will be disabled until explicitly enabled.
*
* Return
*/
{
/* check if etype is valid */
if (!TCAM_L2_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_enet_usr_cls_set:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
/*
* etype check code
*
* if (check_fail)
* return (NPI_FAILURE | NPI_SW_ERROR);
*/
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_enet_usr_cls_enable()
* Enable previously configured TCAM user configurable Ethernet classes.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: Ethernet Class class
* (TCAM_CLASS_ETYPE or TCAM_CLASS_ETYPE_2)
*
* Return
*/
{
if (!TCAM_L2_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_enet_usr_cls_enable:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_enet_usr_cls_disable()
* Disables previously configured TCAM user configurable Ethernet classes.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: Ethernet Class class
* (TCAM_CLASS_ETYPE or TCAM_CLASS_ETYPE_2)
*
* Return
*/
{
if (!TCAM_L2_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_enet_usr_cls_disable:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_usr_cls_set()
* Configures the TCAM user configurable IP classes.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: IP Class class
* (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7)
* tos: IP TOS bits
* tos_mask: IP TOS bits mask. bits with mask bits set will be used
* proto: IP Proto
* ver: IP Version
* by default, will the class is disabled until explicitly enabled
*
* Return
*/
{
if (!TCAM_L3_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_ip_usr_cls_set:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_usr_cls_set_iptun()
* Configures the TCAM user configurable IP classes. This function sets the
* new fields that were added for IP tunneling support
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: IP Class class
* (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7)
* l4b0_val value of the first L4 byte to be compared
* l4b0_msk mask to apply to compare byte 0 of L4
* l4b23_val values of L4 bytes 2 and 3 to compare
* l4b23_sel set to 1 to compare L4 bytes 2 and 3.
* by default, the class is disabled until explicitly enabled
*
* Return
*/
{
if (!TCAM_L3_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_ip_usr_cls_set:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
val = 1;
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_usr_cls_get_iptun()
* Retrieves the IP tunneling related settings for the given TCAM user
* configurable IP classe.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: IP Class class
* (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7)
* l4b0_val value of the first L4 byte to be compared
* l4b0_msk mask to apply to compare byte 0 of L4
* l4b23_val values of L4 bytes 2 and 3 to compare
* l4b23_sel set to 1 to compare L4 bytes 2 and 3.
* by default, the class is disabled until explicitly enabled
*
* Return
*/
{
if (!TCAM_L3_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_ip_usr_cls_set:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_usr_cls_enable()
* Enable previously configured TCAM user configurable IP classes.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: IP Class class
* (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7)
*
* Return
*/
{
if (!TCAM_L3_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_ip_usr_cls_enable:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_usr_cls_disable()
* Disables previously configured TCAM user configurable IP classes.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* class: IP Class class
* (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7)
*
* Return
*/
{
if (!TCAM_L3_USR_CLASS_VALID(class)) {
" npi_fflp_cfg_ip_usr_cls_disable:"
" Invalid class %d \n",
class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_cls_tcam_key ()
*
* Configures the TCAM key generation for the IP classes
*
* Input
* handle: opaque handle interpreted by the underlying OS
* l3_class: IP class to configure key generation
* cfg: Configuration bits:
* discard: Discard all frames of this class
* use_ip_saddr: use ip src address (for ipv6)
* use_ip_daddr: use ip dest address (for ipv6)
* lookup_enable: Enable Lookup
*
*
* Return
*/
{
if (!(TCAM_L3_CLASS_VALID(l3_class))) {
" npi_fflp_cfg_ip_cls_tcam_key:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
if ((cfg->use_ip_daddr) &&
" npi_fflp_cfg_ip_cls_tcam_key:"
" Invalid configuration %x for class %d \n",
return (NPI_FFLP_SW_PARAM_ERROR);
}
tcam_cls_cfg.value = 0;
}
if (cfg->use_ip_saddr) {
}
if (cfg->use_ip_daddr) {
}
if (cfg->lookup_enable) {
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_cls_flow_key ()
*
* Configures the flow key generation for the IP classes
* Flow key is used to generate the H1 hash function value
* The fields used for the generation are configured using this
* NPI function.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* l3_class: IP class to configure flow key generation
* cfg: Configuration bits:
* use_proto: Use IP proto field
* use_dport: use l4 destination port
* use_sport: use l4 source port
* ip_opts_exist: IP Options Present
* use_daddr: use ip dest address
* use_saddr: use ip source address
* use_vlan: use VLAN ID
* use_l2da: use L2 Dest MAC Address
* use_portnum: use L2 virtual port number
*
*
* Return
*/
{
if (!(TCAM_L3_CLASS_VALID(l3_class))) {
" npi_fflp_cfg_ip_cls_flow_key:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
}
if (cfg->ip_opts_exist)
}
if (cfg->ip_opts_exist)
}
}
}
}
}
if (cfg->use_portnum) {
}
return (NPI_SUCCESS);
}
{
if (!(TCAM_L3_CLASS_VALID(l3_class))) {
" npi_fflp_cfg_ip_cls_flow_key:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
cfg->ip_opts_exist = 0;
cfg->use_portnum = 0;
}
}
}
}
}
}
}
}
}
}
" npi_fflp_cfg_ip_cls_flow_get %llx \n",
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_ip_cls_flow_key_rfnl ()
*
* Configures the flow key generation for the IP classes
* Flow key is used to generate the H1 hash function value
* The fields used for the generation are configured using this
* NPI function.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* l3_class: IP class to configure flow key generation
* cfg: Configuration bits:
* l4_xor_sel: bit field to select the L4 payload
* bytes for X-OR to get hash key.
* use_l4_md: Set to 1 for enabling L4-mode.
* use_sym: Set to 1 to use symmetric mode.
* use_proto: Use IP proto field
* use_dport: use l4 destination port
* use_sport: use l4 source port
* ip_opts_exist: IP Options Present
* use_daddr: use ip dest address
* use_saddr: use ip source address
* use_vlan: use VLAN ID
* use_l2da: use L2 Dest MAC Address
* use_portnum: use L2 virtual port number
*
*
* Return
*/
{
if (!(TCAM_L3_CLASS_VALID_RFNL(l3_class))) {
" npi_fflp_cfg_ip_cls_flow_key_rfnl:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
if (l3_class == TCAM_CLASS_IPV6_FRAG) {
} else {
}
flow_cfg_reg.value = 0;
}
if (cfg->ip_opts_exist)
}
if (cfg->ip_opts_exist)
}
}
}
}
}
if (cfg->use_portnum) {
}
return (NPI_SUCCESS);
}
{
if (!(TCAM_L3_CLASS_VALID_RFNL(l3_class))) {
" npi_fflp_cfg_sym_ip_cls_flow_key:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
if (l3_class == TCAM_CLASS_IPV6_FRAG) {
} else {
}
}
return (NPI_SUCCESS);
}
{
if (!(TCAM_L3_CLASS_VALID_RFNL(l3_class))) {
" npi_fflp_cfg_ip_cls_flow_key_get_rfnl:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
if (l3_class == TCAM_CLASS_IPV6_FRAG) {
} else {
}
cfg->l4_xor_sel = 0;
cfg->ip_opts_exist = 0;
cfg->use_portnum = 0;
}
}
}
}
}
}
}
}
}
}
" npi_fflp_cfg_ip_cls_flow_get %llx \n",
return (NPI_SUCCESS);
}
{
if (!(TCAM_L3_CLASS_VALID(l3_class))) {
" npi_fflp_cfg_ip_cls_tcam_key_get:"
" Invalid class %d \n",
l3_class));
return (NPI_FFLP_TCAM_CLASS_INVALID);
}
cfg->use_ip_saddr = 0;
cfg->lookup_enable = 0;
cfg->use_ip_daddr = 0;
}
}
" npi_fflp_cfg_ip_cls_tcam_key_get %llx \n",
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_fcram_access ()
*
* Sets the ratio between the FCRAM pio and lookup access
* Input:
* handle: opaque handle interpreted by the underlying OS
* access_ratio: 0 Lookup has the highest priority
* 15 PIO has maximum possible priority
*
* Return
*/
{
if (access_ratio > 0xf) {
" npi_fflp_cfg_fcram_access:"
" Invalid access ratio %d \n",
access_ratio));
return (NPI_FFLP_ERROR | NPI_FFLP_SW_PARAM_ERROR);
}
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_tcam_access ()
*
* Sets the ratio between the TCAM pio and lookup access
* Input:
* handle: opaque handle interpreted by the underlying OS
* access_ratio: 0 Lookup has the highest priority
* 15 PIO has maximum possible priority
* Return
*/
{
if (access_ratio > 0xf) {
" npi_fflp_cfg_tcram_access:"
" Invalid access ratio %d \n",
access_ratio));
return (NPI_FFLP_ERROR | NPI_FFLP_SW_PARAM_ERROR);
}
/* since the cam latency is fixed, we might set it here */
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_hash_h1poly()
* Initializes the H1 hash generation logic.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* init_value: The initial value (seed)
*
* Return
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_hash_h2poly()
* Initializes the H2 hash generation logic.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* init_value: The initial value (seed)
*
* Return
* NPI_SUCCESS
*
*/
{
return (NPI_SUCCESS);
}
/*
* npi_fflp_cfg_reset
* Initializes the FCRAM reset sequence.
*
* Input
* handle: opaque handle interpreted by the underlying OS
* strength: FCRAM Drive strength
* strong, weak or normal
* HW recommended value:
* qs: FCRAM QS mode selection
* qs mode or free running
* HW recommended value is:
*
* Return:
*/
{
/* These bits have to be configured before FCRAM reset is issued */
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
{
return (NPI_SUCCESS);
}
/*
* Enables the TCAM search function.
*
*/
{
return (NPI_SUCCESS);
}
/*
* Disables the TCAM search function.
* While the TCAM is in disabled state, all TCAM matches would return NO_MATCH
*
*/
{
return (NPI_SUCCESS);
}
/*
* npi_rxdma_event_mask_config():
* This function is called to operate on the event mask
* register which is used for generating interrupts
* and status register.
*/
{
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
break;
case OP_CLEAR:
break;
default:
" npi_fflp_event_mask_config",
" eventmask <0x%x>", op_mode));
return (NPI_FFLP_ERROR | NPI_FFLP_SW_PARAM_ERROR);
}
return (status);
}
/*
* Read vlan error bits
*/
void
{
}
/*
* clear vlan error bits
*/
void
{
}
/*
* Read TCAM error bits
*/
void
{
}
/*
* clear TCAM error bits
*/
void
{
}
/*
* Read FCRAM error bits
*/
void
{
}
/*
* clear FCRAM error bits
*/
void
{
}
/*
* Read FCRAM lookup error log1 bits
*/
void
{
}
/*
* Read FCRAM lookup error log2 bits
*/
void
{
}