xgehal-mgmtaux.c revision 8347601bcb0a439f6e50fc36b4039a73d08700e1
/*
* 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 (c) 2002-2006 Neterion, Inc.
*/
#include "xgehal-mgmt.h"
#include "xgehal-driver.h"
#include "xgehal-device.h"
#ifdef XGE_OS_HAS_SNPRINTF
if (bufsize <= 0) return XGE_HAL_ERR_OUT_OF_SPACE; \
XGE_HAL_AUX_SEPA, value); \
#else
if (bufsize <= 0) return XGE_HAL_ERR_OUT_OF_SPACE; \
return XGE_HAL_ERR_OUT_OF_SPACE;
#endif
/**
* xge_hal_aux_bar0_read - Read and format Xframe BAR0 register.
* @devh: HAL device handle.
* @offset: Register offset in the BAR0 space.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read Xframe register from BAR0 space. The result is formatted as an ascii string.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
* valid.
* XGE_HAL_ERR_INVALID_BAR_ID - BAR id is not valid.
*
* See also: xge_hal_mgmt_reg_read().
*/
int *retsize)
{
if (status != XGE_HAL_OK) {
return status;
}
if (bufsize < XGE_OS_SPRINTF_STRLEN) {
return XGE_HAL_ERR_OUT_OF_SPACE;
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_bar1_read - Read and format Xframe BAR1 register.
* @devh: HAL device handle.
* @offset: Register offset in the BAR1 space.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read Xframe register from BAR1 space. The result is formatted as ascii string.
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
* valid.
* XGE_HAL_ERR_INVALID_BAR_ID - BAR id is not valid.
*
* See also: xge_hal_mgmt_reg_read().
*/
int *retsize)
{
if (status != XGE_HAL_OK) {
return status;
}
if (bufsize < XGE_OS_SPRINTF_STRLEN) {
return XGE_HAL_ERR_OUT_OF_SPACE;
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_bar0_write - Write BAR0 register.
* @devh: HAL device handle.
* @offset: Register offset in the BAR0 space.
* @value: Regsister value (to write).
*
* Write BAR0 register.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
* valid.
* XGE_HAL_ERR_INVALID_BAR_ID - BAR id is not valid.
*
* See also: xge_hal_mgmt_reg_write().
*/
{
if (status != XGE_HAL_OK) {
return status;
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_about_read - Retrieve and format about info.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Retrieve about info (using xge_hal_mgmt_about()) and sprintf it
* into the provided @retbuf.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
* XGE_HAL_FAIL - Failed to retrieve the information.
*
* See also: xge_hal_mgmt_about(), xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_about_info_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("transponder_temperature",
return XGE_HAL_OK;
}
/**
* xge_hal_aux_stats_tmac_read - Read TMAC hardware statistics.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read TMAC hardware statistics. This is a subset of stats counters
* from xge_hal_stats_hw_info_t{}.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
* xge_hal_aux_stats_pci_read(),
* xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_hw_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("tmac_drop_frms", (unsigned long long)
__HAL_AUX_ENTRY("tmac_pause_ctrl_frms", (unsigned long long)
__HAL_AUX_ENTRY("tmac_ttl_less_fb_octets", (unsigned long long)
__HAL_AUX_ENTRY("tmac_vld_ip_octets", (unsigned long long)
__HAL_AUX_ENTRY("tmac_tcp", (unsigned long long)
return XGE_HAL_OK;
}
/**
* xge_hal_aux_stats_rmac_read - Read RMAC hardware statistics.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read RMAC hardware statistics. This is a subset of stats counters
* from xge_hal_stats_hw_info_t{}.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
* xge_hal_aux_stats_pci_read(), xge_hal_aux_stats_tmac_read(),
* xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_hw_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("rmac_fcs_err_frms", (unsigned long long)
__HAL_AUX_ENTRY("mac_drop_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_out_rng_len_err_frms",
__HAL_AUX_ENTRY("rmac_in_rng_len_err_frms",
__HAL_AUX_ENTRY("rmac_long_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_pause_ctrl_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_unsup_ctrl_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_accepted_ucst_frms",
__HAL_AUX_ENTRY("rmac_accepted_nucst_frms",
__HAL_AUX_ENTRY("rmac_ttl_less_fb_octets", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_frms", (unsigned long long)
__HAL_AUX_ENTRY("reserved_2", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_64_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_65_127_frms", (unsigned long long)
__HAL_AUX_ENTRY("reserved_5", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_128_255_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_256_511_frms", (unsigned long long)
__HAL_AUX_ENTRY("reserved_6", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_512_1023_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ttl_1024_1518_frms", (unsigned long long)
__HAL_AUX_ENTRY("rmac_ip_octets", (unsigned long long)
__HAL_AUX_ENTRY("rmac_tcp", (unsigned long long)
__HAL_AUX_ENTRY("rmac_xgmii_err_sym", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q0", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q1", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q2", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q3", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q4", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q5", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q6", (unsigned long long)
__HAL_AUX_ENTRY("rmac_frms_q7", (unsigned long long)
__HAL_AUX_ENTRY("rmac_xgmii_data_err_cnt", (unsigned long long)
__HAL_AUX_ENTRY("rmac_xgmii_ctrl_err_cnt", (unsigned long long)
return XGE_HAL_OK;
}
/**
* xge_hal_aux_stats_herc_enchanced - Get Hercules hardware statistics.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read Hercules device hardware statistics.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
* xge_hal_aux_stats_tmac_read(), xge_hal_aux_stats_rmac_read(),
* xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_hw_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
"%u");
"%u");
"%u");
"%u");
"%llu");
"%u");
"%u");
"%u");
"%u");
__HAL_AUX_ENTRY("rmac_accepted_ucst_frms_oflow",
__HAL_AUX_ENTRY("rmac_accepted_nucst_frms_oflow",
__HAL_AUX_ENTRY("rmac_discarded_frms_oflow",
"%u");
"%u");
"%u");
"%u");
"%u");
__HAL_AUX_ENTRY("rmac_ttl_1519_4095_frms",
__HAL_AUX_ENTRY("rmac_ttl_4096_8191_frms",
__HAL_AUX_ENTRY("rmac_ttl_8192_max_frms",
__HAL_AUX_ENTRY("rmac_ttl_gt_max_frms",
__HAL_AUX_ENTRY("rmac_osized_alt_frms",
__HAL_AUX_ENTRY("rmac_jabber_alt_frms",
__HAL_AUX_ENTRY("rmac_gt_max_alt_frms",
__HAL_AUX_ENTRY("rmac_vlan_frms",
"%u");
"%u");
return XGE_HAL_OK;
}
/**
* xge_hal_aux_stats_rmac_read - Read PCI hardware statistics.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read PCI statistics counters, including number of PCI read and
* write transactions, PCI retries, discards, etc.
* This is a subset of stats counters from xge_hal_stats_hw_info_t{}.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
* xge_hal_aux_stats_tmac_read(), xge_hal_aux_stats_rmac_read(),
* xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_hw_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_stats_hal_read - Read HAL (layer) statistics.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read HAL statistics.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
* XGE_HAL_INF_STATS_IS_NOT_READY - Statistics information is not
* currently available.
*
* See also: xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_device_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("rx_traffic_intr_cnt",
}
__HAL_AUX_ENTRY("not_traffic_intr_cnt",
__HAL_AUX_ENTRY("rxufca_lo_adjust_cnt",
__HAL_AUX_ENTRY("rxufca_hi_adjust_cnt",
}
__HAL_AUX_ENTRY("bimodal_lo_adjust_cnt",
__HAL_AUX_ENTRY("bimodal_hi_adjust_cnt",
}
#if defined(XGE_HAL_CONFIG_LRO)
__HAL_AUX_ENTRY("tot_frms_lroised",
__HAL_AUX_ENTRY("tot_lro_sessions",
__HAL_AUX_ENTRY("lro_frm_len_exceed_cnt",
__HAL_AUX_ENTRY("lro_sg_exceed_cnt",
__HAL_AUX_ENTRY("lro_out_of_seq_pkt_cnt",
__HAL_AUX_ENTRY("lro_dup_pkt_cnt",
#endif
/* for each opened rx channel */
char key[XGE_OS_SPRINTF_STRLEN];
sizeof(xge_hal_mgmt_channel_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
}
}
/* for each opened tx channel */
char key[XGE_OS_SPRINTF_STRLEN];
sizeof(xge_hal_mgmt_channel_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_stats_sw_dev_read - Read software device statistics.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read software-maintained device statistics.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
* XGE_HAL_INF_STATS_IS_NOT_READY - Statistics information is not
* currently available.
*
* See also: xge_hal_aux_device_dump().
*/
{
int t_code;
char buf[XGE_OS_SPRINTF_STRLEN];
sizeof(xge_hal_mgmt_sw_stats_t));
if (status != XGE_HAL_OK) {
return status;
}
if (t_code_cnt) {
}
if (t_code_cnt) {
}
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_pci_config_read - Retrieve and format PCI Configuration
* info.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Retrieve about info (using xge_hal_mgmt_pci_config()) and sprintf it
* into the provided @retbuf.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_mgmt_pci_config(), xge_hal_aux_device_dump().
*/
{
sizeof(xge_hal_mgmt_pci_config_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("cache_line_size",
__HAL_AUX_ENTRY("not_Implemented1",
"0x%08X");
"0x%08X");
"0x%04X");
__HAL_AUX_ENTRY("capabilities_pointer",
"0x%08X");
"0x%08X");
char key[XGE_OS_SPRINTF_STRLEN];
int i;
for (i = 0;
i++) {
"0x%08X");
}
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_channel_read - Read channels information.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read HAL statistics.
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
* See also: xge_hal_aux_device_dump().
*/
{
return XGE_HAL_ERR_INVALID_DEVICE;
}
/* for each opened rx channel */
char key[XGE_OS_SPRINTF_STRLEN];
continue;
}
/* for each opened tx channel */
char key[XGE_OS_SPRINTF_STRLEN];
continue;
}
return XGE_HAL_OK;
}
/**
* xge_hal_aux_device_dump - Dump driver "about" info and device state.
* @devh: HAL device handle.
*
* Dump driver & device "about" info and device state,
* including all BAR0 registers, hardware and software statistics, PCI
* configuration space.
* See also: xge_hal_aux_about_read(), xge_hal_mgmt_reg_read(),
* xge_hal_aux_pci_config_read(), xge_hal_aux_stats_sw_dev_read(),
* xge_hal_aux_stats_tmac_read(), xge_hal_aux_stats_rmac_read(),
* xge_hal_aux_channel_read(), xge_hal_aux_stats_hal_read().
* Returns:
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
*/
{
int retsize;
int offset;
xge_os_println("********* xge DEVICE DUMP BEGIN **********");
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
if (status != XGE_HAL_OK) {
goto error;
}
if (!retval) continue;
}
xge_os_println("\n");
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
if (status != XGE_HAL_OK) {
goto error;
}
}
if (status != XGE_HAL_OK) {
goto error;
}
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
&retsize);
if (status != XGE_HAL_OK) {
goto error;
}
xge_os_println("********* XFRAME DEVICE DUMP END **********");
return status;
}
/**
* xge_hal_aux_driver_config_read - Read Driver configuration.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read driver configuration,
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_aux_device_config_read().
*/
{
sizeof(xge_hal_driver_config_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("queue size initial",
return XGE_HAL_OK;
}
/**
* xge_hal_aux_device_config_read - Read device configuration.
* @devh: HAL device handle.
* @bufsize: Buffer size.
* @retbuf: Buffer pointer.
* @retsize: Size of the result. Cannot be greater than @bufsize.
*
* Read device configuration,
*
* Returns: XGE_HAL_OK - success.
* XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
* XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
*
* See also: xge_hal_aux_driver_config_read().
*/
{
int i;
char key[XGE_OS_SPRINTF_STRLEN];
sizeof(xge_hal_device_config_t));
if (status != XGE_HAL_OK) {
return status;
}
__HAL_AUX_ENTRY("max_splits_trans",
__HAL_AUX_ENTRY("stats_refresh_time_sec",
__HAL_AUX_ENTRY("ring_memblock_size",
__HAL_AUX_ENTRY("sched_timer_one_shot",
for(i = 0; i < XGE_HAL_MAX_RING_NUM; i++)
{
if (!ring->configured)
continue;
}
{
__HAL_AUX_ENTRY("tmac_util_period",
__HAL_AUX_ENTRY("rmac_util_period",
__HAL_AUX_ENTRY("rmac_bcast_en",
__HAL_AUX_ENTRY("rmac_pause_gen_en",
__HAL_AUX_ENTRY("rmac_pause_rcv_en",
__HAL_AUX_ENTRY("rmac_pause_time",
__HAL_AUX_ENTRY("mc_pause_threshold_q0q3",
__HAL_AUX_ENTRY("mc_pause_threshold_q4q7",
}
__HAL_AUX_ENTRY("fifo_reserve_threshold",
__HAL_AUX_ENTRY("fifo_memblock_size",
#ifdef XGE_HAL_ALIGN_XMIT
__HAL_AUX_ENTRY("fifo_alignment_size",
#endif
for (i = 0; i < XGE_HAL_MAX_FIFO_NUM; i++) {
int j;
if (!fifo->configured)
continue;
for (j = 0; j < XGE_HAL_MAX_FIFO_TTI_NUM; j++) {
continue;
i * XGE_HAL_MAX_FIFO_TTI_NUM + j);
}
}
/* and bimodal TTIs */
for (i=0; i<XGE_HAL_MAX_RING_NUM; i++) {
continue;
}
__HAL_AUX_ENTRY("dump_on_eccerr",
__HAL_AUX_ENTRY("dump_on_parityerr",
return XGE_HAL_OK;
}