hpi_pfc.c revision 63b1987d5d7387bda49397c0f3f063b49651a5bc
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CDDL HEADER START
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The contents of this file are subject to the terms of the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Common Development and Distribution License (the "License").
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You may not use this file except in compliance with the License.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * See the License for the specific language governing permissions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * and limitations under the License.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * When distributing Covered Code, include this CDDL HEADER in each
199767f8919635c4928607450d9e0abb932109ceToomas Soome * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If applicable, add the following below this CDDL HEADER, with the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * fields enclosed by brackets "[]" replaced with your own identifying
199767f8919635c4928607450d9e0abb932109ceToomas Soome * information: Portions Copyright [yyyy] [name of copyright owner]
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CDDL HEADER END
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Use is subject to license terms.
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_check_completion(hpi_handle_t handle, tcam_op_t op_type)
199767f8919635c4928607450d9e0abb932109ceToomas Soome " TCAM RWC_STAT operation"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " failed to complete \n"));
199767f8919635c4928607450d9e0abb932109ceToomas Soome " TCAM Match operationfailed to find match \n"));
199767f8919635c4928607450d9e0abb932109ceToomas Soome " Invalid TCAM completion Request \n"));
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (HPI_PFC_ERROR | HPI_TCAM_ERROR | OPCODE_INVALID);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_entry_read(hpi_handle_t handle, uint32_t location,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Hydra doesn't allow to read TCAM entries. Use compare instead.
199767f8919635c4928607450d9e0abb932109ceToomas Soome tctl_rv.value = hpi_pfc_tcam_check_completion(handle, TCAM_RWC_MATCH);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_asc_ram_entry_read(hpi_handle_t handle,
199767f8919635c4928607450d9e0abb932109ceToomas Soome tcam_stat = hpi_pfc_tcam_check_completion(handle, TCAM_RWC_STAT);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_asc_ram_entry_write(hpi_handle_t handle, uint32_t location,
199767f8919635c4928607450d9e0abb932109ceToomas Soome " tcam ascr write: location %x data %llx ctl value %llx \n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome tcam_stat = hpi_pfc_tcam_check_completion(handle, TCAM_RWC_STAT);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_config(hpi_handle_t handle, pfc_config_t config)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_config(hpi_handle_t handle, pfc_config_t *configp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_READ64(handle, offset, &configp->value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcam_enable(hpi_handle_t handle, boolean_t tcam)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read the register first.
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_l2_hash(hpi_handle_t handle, boolean_t l2_hash)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read the register first.
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_cksum(hpi_handle_t handle, boolean_t cksum)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read the register first.
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_default_dma(hpi_handle_t handle, uint32_t dma_channel_no)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_mac_addr_enable(hpi_handle_t handle, uint32_t slot)
199767f8919635c4928607450d9e0abb932109ceToomas Soome config.bits.mac_addr_en_l = config.bits.mac_addr_en_l | bit;
199767f8919635c4928607450d9e0abb932109ceToomas Soome config.bits.mac_addr_en = config.bits.mac_addr_en | bit;
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_mac_addr_disable(hpi_handle_t handle, uint32_t slot)
199767f8919635c4928607450d9e0abb932109ceToomas Soome config.bits.mac_addr_en_l = config.bits.mac_addr_en_l & ~bit;
199767f8919635c4928607450d9e0abb932109ceToomas Soome config.bits.mac_addr_en = config.bits.mac_addr_en & ~bit;
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_force_csum(hpi_handle_t handle, boolean_t force)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_cfg_vlan_table_clear(hpi_handle_t handle)
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < HXGE_VLAN_TABLE_ENTRIES; i++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, table_entry.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_cfg_vlan_table_entry_clear(hpi_handle_t handle, vlan_id_t vlan_id)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Assumes that the hardware will generate the new parity
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_READ64(handle, offset, (uint64_t *)&vlan_tbl_entry.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soome vlan_tbl_entry.bits.member = vlan_tbl_entry.bits.member & ~bit;
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, vlan_tbl_entry.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_cfg_vlan_table_entry_set(hpi_handle_t handle, vlan_id_t vlan_id)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Assumes that the hardware will generate the new parity
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_READ64(handle, offset, (uint64_t *)&vlan_tbl_entry.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soome vlan_tbl_entry.bits.member = vlan_tbl_entry.bits.member | bit;
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, vlan_tbl_entry.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_cfg_vlan_control_set(hpi_handle_t handle, boolean_t parity,
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, PFC_VLAN_CTRL, vlan_control.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_vlan_parity_log(hpi_handle_t handle, pfc_vlan_par_err_log_t *logp)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_mac_address(hpi_handle_t handle, uint32_t slot, uint64_t address)
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (hpi_pfc_mac_addr_enable(handle, slot));
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_clear_mac_address(hpi_handle_t handle, uint32_t slot)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_clear_multicast_hash_table(hpi_handle_t handle, uint32_t slot)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_multicast_hash_table(hpi_handle_t handle, uint32_t slot,
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_l2_class_slot(hpi_handle_t handle, uint16_t etype, boolean_t valid,
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, l2_config.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_l3_class_config(hpi_handle_t handle, tcam_class_t slot,
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, l3_config.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_l3_class_config(hpi_handle_t handle, tcam_class_t slot,
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_READ64(handle, offset, &l3_config.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcam_control(hpi_handle_t handle, pfc_tcam_ctrl_t *tcontrolp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, tcontrolp->value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_entry_invalidate(hpi_handle_t handle, uint32_t location)
199767f8919635c4928607450d9e0abb932109ceToomas Soome (void) memset(&tcam_ptr, 0, sizeof (hxge_tcam_entry_t));
199767f8919635c4928607450d9e0abb932109ceToomas Soome (void) hpi_pfc_tcam_entry_write(handle, location, &tcam_ptr);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_invalidate_all(hpi_handle_t handle)
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < PFC_N_TCAM_ENTRIES; i++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome (void) hpi_pfc_set_tcam_control(handle, &tcontrol);
199767f8919635c4928607450d9e0abb932109ceToomas Soome (void) hpi_pfc_tcam_entry_invalidate(handle, i);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_tcam_entry_write(hpi_handle_t handle, uint32_t location,
199767f8919635c4928607450d9e0abb932109ceToomas Soome " tcam write: location %x\n key: %llx %llx\n mask: %llx %llx\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome " tcam write: ctl value %llx \n", tctl.value));
199767f8919635c4928607450d9e0abb932109ceToomas Soome tcam_stat = hpi_pfc_tcam_check_completion(handle, TCAM_RWC_STAT);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_tcam_parity_log(hpi_handle_t handle, pfc_tcam_par_err_log_t *logp)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_tcam_auto_init(hpi_handle_t handle, pfc_auto_init_t *autoinitp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_READ64(handle, offset, &autoinitp->value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_control_discard(hpi_handle_t handle, boolean_t discard)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_control_fin(hpi_handle_t handle, boolean_t fin)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_control_syn(hpi_handle_t handle, boolean_t syn)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_control_rst(hpi_handle_t handle, boolean_t rst)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_control_psh(hpi_handle_t handle, boolean_t push)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_tcp_control_ack(hpi_handle_t handle, boolean_t ack)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_hash_seed_value(hpi_handle_t handle, uint32_t seed)
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, src_hash_seed.value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_interrupt_status(hpi_handle_t handle, pfc_int_status_t *statusp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_READ64(handle, offset, &statusp->value);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_clear_interrupt_status(hpi_handle_t handle)
199767f8919635c4928607450d9e0abb932109ceToomas Soome REG_PIO_WRITE64(handle, offset, HXGE_PFC_INT_STATUS_CLEAR);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_interrupt_mask(hpi_handle_t handle, boolean_t drop,
199767f8919635c4928607450d9e0abb932109ceToomas Soome boolean_t tcam_parity_error, boolean_t vlan_parity_error)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_drop_log(hpi_handle_t handle, pfc_drop_log_t *logp)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_set_drop_log_mask(hpi_handle_t handle, boolean_t vlan_drop,
199767f8919635c4928607450d9e0abb932109ceToomas Soome boolean_t tcam_drop, boolean_t class_code_drop, boolean_t l2_addr_drop,
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_bad_csum_counter(hpi_handle_t handle, uint64_t *countp)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_drop_counter(hpi_handle_t handle, uint64_t *countp)
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_get_number_mac_addrs(hpi_handle_t handle, uint32_t *n_of_addrs)
199767f8919635c4928607450d9e0abb932109ceToomas Soome HXGE_REG_RD32(handle, HCR_REG + HCR_N_MAC_ADDRS, n_of_addrs);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_mac_addr_get_i(hpi_handle_t handle, uint8_t *data, int slot)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read the MAC address out of the SPROM at the blade's
199767f8919635c4928607450d9e0abb932109ceToomas Soome * specific location.
199767f8919635c4928607450d9e0abb932109ceToomas Soome HXGE_REG_RD32(handle, HCR_REG + HCR_ADDR_LO + slot * step, &addr_lo);
199767f8919635c4928607450d9e0abb932109ceToomas Soome HXGE_REG_RD32(handle, HCR_REG + HCR_ADDR_HI + slot * step, &addr_hi);
199767f8919635c4928607450d9e0abb932109ceToomas Soomehpi_pfc_num_macs_get(hpi_handle_t handle, uint8_t *data)
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < 16; i++) {