mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
A diagnostic tool to go along with the vxge(4) 10GbE driver.
This tool can be used to print statistics, registers, and other device specific information once the driver is loaded into the kernel. Submitted by: Sriram Rapuru from Exar MFC after: 2 weeks
This commit is contained in:
parent
2be767e069
commit
3c31540d7c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221175
@ -66,4 +66,5 @@ vimage An interim utility for managing the virtualized network
|
||||
stack infrastructure.
|
||||
vop_table Generates a HTML document that shows all the VOP's in
|
||||
the kernel.
|
||||
vxge A diagnostic tool for the vxge(4) driver
|
||||
whereintheworld Summarizes "make world" output.
|
||||
|
7
tools/tools/vxge/Makefile
Normal file
7
tools/tools/vxge/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= vxge-manage
|
||||
SRCS= vxge_info.c vxge_log.c
|
||||
NO_MAN=
|
||||
|
||||
.include <bsd.prog.mk>
|
260
tools/tools/vxge/vxge_cmn.h
Normal file
260
tools/tools/vxge/vxge_cmn.h
Normal file
@ -0,0 +1,260 @@
|
||||
/*-
|
||||
* Copyright(c) 2002-2011 Exar Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification are permitted provided the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Exar Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _VXGE_CMN_H_
|
||||
#define _VXGE_CMN_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define VXGE_OS_HOST_BIG_ENDIAN
|
||||
#else
|
||||
#define VXGE_OS_HOST_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined(VXGE_OS_HOST_BIG_ENDIAN)
|
||||
|
||||
#define GET_OFFSET_STATS(index) statsInfo[(index)].be_offset
|
||||
#define GET_OFFSET_PCICONF(index) pciconfInfo[(index)].be_offset
|
||||
|
||||
#else
|
||||
|
||||
#define GET_OFFSET_STATS(index) statsInfo[(index)].le_offset
|
||||
#define GET_OFFSET_PCICONF(index) pciconfInfo[(index)].le_offset
|
||||
|
||||
#endif
|
||||
|
||||
#define vxge_mem_free(x) \
|
||||
if (NULL != x) { free(x); x = NULL; }
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef unsigned long long u64;
|
||||
typedef u_long ulong_t;
|
||||
|
||||
typedef enum _vxge_query_device_info_e {
|
||||
|
||||
VXGE_GET_PCI_CONF = 100,
|
||||
VXGE_GET_MRPCIM_STATS = 101,
|
||||
VXGE_GET_DEVICE_STATS = 102,
|
||||
VXGE_GET_DEVICE_HWINFO = 103,
|
||||
VXGE_GET_DRIVER_STATS = 104,
|
||||
VXGE_GET_INTR_STATS = 105,
|
||||
VXGE_GET_VERSION = 106,
|
||||
VXGE_GET_TCODE = 107,
|
||||
VXGE_GET_VPATH_COUNT = 108,
|
||||
VXGE_GET_BANDWIDTH = 109,
|
||||
VXGE_SET_BANDWIDTH = 110,
|
||||
VXGE_GET_PORT_MODE = 111,
|
||||
VXGE_SET_PORT_MODE = 112
|
||||
|
||||
} vxge_query_device_info_e;
|
||||
|
||||
/* Register type enumaration */
|
||||
typedef enum vxge_hal_mgmt_reg_type_e {
|
||||
|
||||
vxge_hal_mgmt_reg_type_legacy = 0,
|
||||
vxge_hal_mgmt_reg_type_toc = 1,
|
||||
vxge_hal_mgmt_reg_type_common = 2,
|
||||
vxge_hal_mgmt_reg_type_memrepair = 3,
|
||||
vxge_hal_mgmt_reg_type_pcicfgmgmt = 4,
|
||||
vxge_hal_mgmt_reg_type_mrpcim = 5,
|
||||
vxge_hal_mgmt_reg_type_srpcim = 6,
|
||||
vxge_hal_mgmt_reg_type_vpmgmt = 7,
|
||||
vxge_hal_mgmt_reg_type_vpath = 8
|
||||
|
||||
} vxge_hal_mgmt_reg_type_e;
|
||||
|
||||
typedef enum vxge_hal_xmac_nwif_dp_mode {
|
||||
|
||||
VXGE_HAL_DP_NP_MODE_DEFAULT,
|
||||
VXGE_HAL_DP_NP_MODE_LINK_AGGR,
|
||||
VXGE_HAL_DP_NP_MODE_ACTIVE_PASSIVE,
|
||||
VXGE_HAL_DP_NP_MODE_SINGLE_PORT,
|
||||
VXGE_HAL_DP_NP_MODE_DUAL_PORT,
|
||||
VXGE_HAL_DP_NP_MODE_DISABLE_PORT_MGMT
|
||||
|
||||
} vxge_hal_xmac_nwif_dp_mode;
|
||||
|
||||
typedef enum vxge_hal_xmac_nwif_behavior_on_failure {
|
||||
|
||||
VXGE_HAL_XMAC_NWIF_OnFailure_NoMove,
|
||||
VXGE_HAL_XMAC_NWIF_OnFailure_OtherPort,
|
||||
VXGE_HAL_XMAC_NWIF_OnFailure_OtherPortBackOnRestore
|
||||
|
||||
} vxge_hal_xmac_nwif_behavior_on_failure;
|
||||
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_LEGACY 7
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_TOC 11
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_COMMON 65
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_PCICFGMGMT 3
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_MRPCIM 1370
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_SRPCIM 48
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_VPMGMT 29
|
||||
#define VXGE_HAL_MGMT_REG_COUNT_VPATH 139
|
||||
#define VXGE_HAL_MGMT_STATS_COUNT_DRIVER 17
|
||||
#define VXGE_HAL_MGMT_STATS_COUNT 160
|
||||
#define VXGE_HAL_MGMT_STATS_COUNT_SW 54
|
||||
#define VXGE_HAL_MGMT_STATS_COUNT_EXTENDED 56
|
||||
#define VXGE_MAX_BANDWIDTH 10000
|
||||
|
||||
#define VXGE_HAL_MAX_VIRTUAL_PATHS 17
|
||||
#define ETH_LENGTH_OF_ADDRESS 6
|
||||
|
||||
typedef char macaddr[ETH_LENGTH_OF_ADDRESS];
|
||||
|
||||
#define VXGE_PRINT(fd, fmt...) { \
|
||||
fprintf(fd, fmt); \
|
||||
fprintf(fd, "\n"); \
|
||||
printf(fmt); \
|
||||
printf("\n"); \
|
||||
}
|
||||
|
||||
/* Read & Write Register */
|
||||
typedef struct _vxge_register_info_t {
|
||||
|
||||
u64 value;
|
||||
u64 offset;
|
||||
char option[2];
|
||||
|
||||
} vxge_register_info_t;
|
||||
|
||||
/* Register Dump */
|
||||
typedef struct _vxge_pci_bar0_t {
|
||||
char name[64];
|
||||
u64 offset;
|
||||
u32 size;
|
||||
|
||||
} vxge_pci_bar0_t;
|
||||
|
||||
typedef struct _vxge_stats_driver_info_t {
|
||||
|
||||
char name[32];
|
||||
u64 value;
|
||||
|
||||
} vxge_stats_driver_info_t;
|
||||
|
||||
typedef struct _vxge_hal_device_pmd_info_t {
|
||||
|
||||
u32 type;
|
||||
u32 unused;
|
||||
char vendor[24];
|
||||
char part_num[24];
|
||||
char ser_num[24];
|
||||
|
||||
} vxge_hal_device_pmd_info_t;
|
||||
|
||||
typedef struct _vxge_hal_device_version_t {
|
||||
|
||||
u32 major;
|
||||
u32 minor;
|
||||
u32 build;
|
||||
char version[32];
|
||||
|
||||
} vxge_hal_device_version_t;
|
||||
|
||||
typedef struct _vxge_hal_device_date_t {
|
||||
|
||||
u32 day;
|
||||
u32 month;
|
||||
u32 year;
|
||||
char date[16];
|
||||
|
||||
} vxge_hal_device_date_t;
|
||||
|
||||
typedef struct _vxge_hal_device_hw_info_t {
|
||||
|
||||
u32 host_type;
|
||||
u64 function_mode;
|
||||
u32 func_id;
|
||||
u64 vpath_mask;
|
||||
|
||||
vxge_hal_device_version_t fw_version;
|
||||
vxge_hal_device_date_t fw_date;
|
||||
vxge_hal_device_version_t flash_version;
|
||||
vxge_hal_device_date_t flash_date;
|
||||
|
||||
char serial_number[24];
|
||||
char part_number[24];
|
||||
char product_description[72];
|
||||
u32 unused;
|
||||
u32 ports;
|
||||
|
||||
vxge_hal_device_pmd_info_t pmd_port0;
|
||||
vxge_hal_device_pmd_info_t pmd_port1;
|
||||
|
||||
macaddr mac_addrs[VXGE_HAL_MAX_VIRTUAL_PATHS];
|
||||
macaddr mac_addr_masks[VXGE_HAL_MAX_VIRTUAL_PATHS];
|
||||
|
||||
} vxge_hal_device_hw_info_t;
|
||||
|
||||
typedef struct _vxge_device_hw_info_t {
|
||||
|
||||
vxge_hal_device_hw_info_t hw_info;
|
||||
u32 port_mode;
|
||||
u32 port_failure;
|
||||
|
||||
} vxge_device_hw_info_t;
|
||||
|
||||
typedef struct _vxge_bw_info_t {
|
||||
|
||||
char query;
|
||||
u64 func_id;
|
||||
int priority;
|
||||
int bandwidth;
|
||||
|
||||
} vxge_bw_info_t;
|
||||
|
||||
typedef struct _vxge_port_info_t {
|
||||
|
||||
char query;
|
||||
int port_mode;
|
||||
int port_failure;
|
||||
|
||||
} vxge_port_info_t;
|
||||
|
||||
u32 vxge_get_num_vpath(void);
|
||||
void vxge_null_terminate(char *, size_t);
|
||||
|
||||
#endif /* _VXGE_CMN_H_ */
|
857
tools/tools/vxge/vxge_info.c
Normal file
857
tools/tools/vxge/vxge_info.c
Normal file
@ -0,0 +1,857 @@
|
||||
/*-
|
||||
* Copyright(c) 2002-2011 Exar Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification are permitted provided the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Exar Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "vxge_info.h"
|
||||
|
||||
static int sockfd;
|
||||
static struct ifreq ifr;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
if (argc >= 4) {
|
||||
if (!((strcasecmp(argv[2], "regs") == 0) ||
|
||||
(strcasecmp(argv[2], "stats") == 0) ||
|
||||
(strcasecmp(argv[2], "bw_pri_set") == 0) ||
|
||||
(strcasecmp(argv[2], "port_mode_set") == 0) ||
|
||||
(strcasecmp(argv[2], "bw_pri_get") == 0)))
|
||||
goto out;
|
||||
else {
|
||||
if (strcasecmp(argv[2], "regs") == 0) {
|
||||
if (!((strcasecmp(argv[3], "common") == 0) ||
|
||||
(strcasecmp(argv[3], "legacy") == 0) ||
|
||||
(strcasecmp(argv[3], "pcicfgmgmt") == 0) ||
|
||||
(strcasecmp(argv[3], "toc") == 0) ||
|
||||
(strcasecmp(argv[3], "vpath") == 0) ||
|
||||
(strcasecmp(argv[3], "vpmgmt") == 0) ||
|
||||
(strcasecmp(argv[3], "mrpcim") == 0) ||
|
||||
(strcasecmp(argv[3], "srpcim") == 0) ||
|
||||
(strcasecmp(argv[3], "all") == 0))) {
|
||||
goto regs;
|
||||
}
|
||||
} else if (strcasecmp(argv[2], "stats") == 0) {
|
||||
|
||||
if (!((strcasecmp(argv[3], "common") == 0) ||
|
||||
(strcasecmp(argv[3], "mrpcim") == 0) ||
|
||||
(strcasecmp(argv[3], "all") == 0) ||
|
||||
(strcasecmp(argv[3], "driver") == 0))) {
|
||||
goto stats;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (argc != 3)
|
||||
goto out;
|
||||
else {
|
||||
if (!((strcasecmp(argv[2], "hwinfo") == 0) ||
|
||||
(strcasecmp(argv[2], "pciconfig") == 0) ||
|
||||
(strcasecmp(argv[2], "port_mode_get") == 0) ||
|
||||
(strcasecmp(argv[2], "bw_pri_get") == 0))) {
|
||||
if (strcasecmp(argv[2], "regs") == 0)
|
||||
goto regs;
|
||||
|
||||
if (strcasecmp(argv[2], "stats") == 0)
|
||||
goto stats;
|
||||
|
||||
if (strcasecmp(argv[2], "bw_pri_set") == 0)
|
||||
goto bw_pri_set;
|
||||
|
||||
if (strcasecmp(argv[2], "port_mode_set") == 0)
|
||||
goto port_mode_set;
|
||||
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd < 0) {
|
||||
printf("Creating socket failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
ifr.ifr_addr.sa_family = AF_INET;
|
||||
strlcpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name));
|
||||
|
||||
if (strcasecmp(argv[2], "pciconfig") == 0)
|
||||
vxge_get_pci_config();
|
||||
|
||||
else if (strcasecmp(argv[2], "hwinfo") == 0)
|
||||
vxge_get_hw_info();
|
||||
|
||||
else if (strcasecmp(argv[2], "vpathinfo") == 0)
|
||||
vxge_get_num_vpath();
|
||||
|
||||
else if (strcasecmp(argv[2], "port_mode_get") == 0)
|
||||
vxge_get_port_mode();
|
||||
|
||||
else if (strcasecmp(argv[2], "regs") == 0) {
|
||||
|
||||
if (strcasecmp(argv[3], "common") == 0)
|
||||
vxge_get_registers_common();
|
||||
|
||||
else if (strcasecmp(argv[3], "toc") == 0)
|
||||
vxge_get_registers_toc();
|
||||
|
||||
else if (strcasecmp(argv[3], "pcicfgmgmt") == 0)
|
||||
vxge_get_registers_pcicfgmgmt();
|
||||
|
||||
else if (strcasecmp(argv[3], "vpath") == 0)
|
||||
vxge_get_registers_vpath();
|
||||
|
||||
else if (strcasecmp(argv[3], "vpmgmt") == 0)
|
||||
vxge_get_registers_vpmgmt();
|
||||
|
||||
else if (strcasecmp(argv[3], "srpcim") == 0)
|
||||
vxge_get_registers_srpcim();
|
||||
|
||||
else if (strcasecmp(argv[3], "legacy") == 0)
|
||||
vxge_get_registers_legacy();
|
||||
|
||||
if (strcasecmp(argv[3], "mrpcim") == 0)
|
||||
vxge_get_registers_mrpcim();
|
||||
|
||||
else if (strcasecmp(argv[3], "all") == 0)
|
||||
vxge_get_registers_all();
|
||||
|
||||
} else if (strcasecmp(argv[2], "stats") == 0) {
|
||||
|
||||
if (strcasecmp(argv[3], "mrpcim") == 0)
|
||||
vxge_get_stats_mrpcim();
|
||||
|
||||
else if (strcasecmp(argv[3], "common") == 0)
|
||||
vxge_get_stats_common();
|
||||
|
||||
else if (strcasecmp(argv[3], "all") == 0)
|
||||
vxge_get_stats_all();
|
||||
|
||||
else if (strcasecmp(argv[3], "driver") == 0) {
|
||||
if (argc == 4) {
|
||||
vxge_get_stats_driver(-1);
|
||||
} else if (argc == 6) {
|
||||
if ((strcasecmp(argv[4], "vpath") == 0) &&
|
||||
(atoi(argv[5]) >= 0) &&
|
||||
(atoi(argv[5]) < 17)) {
|
||||
vxge_get_stats_driver(atoi(argv[5]));
|
||||
} else {
|
||||
goto stats;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
goto stats;
|
||||
}
|
||||
} else if (strcasecmp(argv[2], "port_mode_set") == 0) {
|
||||
if ((atoi(argv[3]) >= 2) && (atoi(argv[3]) <= 4))
|
||||
vxge_set_port_mode(atoi(argv[3]));
|
||||
else
|
||||
goto port_mode_set;
|
||||
} else if (argc == 5) {
|
||||
if (strcasecmp(argv[2], "bw_pri_set") == 0) {
|
||||
if (((atoi(argv[3]) >= 0) && (atoi(argv[3]) < 8) &&
|
||||
(atoi(argv[4]) <= 10000)))
|
||||
vxge_set_bw_priority(atoi(argv[3]),
|
||||
atoi(argv[4]), -1, VXGE_SET_BANDWIDTH);
|
||||
else
|
||||
goto bw_pri_set;
|
||||
}
|
||||
} else if (argc == 6) {
|
||||
if (strcasecmp(argv[2], "bw_pri_set") == 0) {
|
||||
if (((atoi(argv[3]) >= 0) && (atoi(argv[3]) < 8) &&
|
||||
(atoi(argv[4]) <= 10000)) && (atoi(argv[5]) <= 3))
|
||||
vxge_set_bw_priority(atoi(argv[3]),
|
||||
atoi(argv[4]), atoi(argv[5]),
|
||||
VXGE_SET_BANDWIDTH);
|
||||
else
|
||||
goto bw_pri_set;
|
||||
}
|
||||
} else if (argc == 4) {
|
||||
if (strcasecmp(argv[2], "bw_pri_get") == 0) {
|
||||
if ((atoi(argv[3]) >= 0) && (atoi(argv[3]) < 8))
|
||||
vxge_get_bw_priority(atoi(argv[3]), VXGE_GET_BANDWIDTH);
|
||||
else
|
||||
goto bw_pri_get;
|
||||
}
|
||||
} else if (argc == 3) {
|
||||
if (strcasecmp(argv[2], "bw_pri_get") == 0)
|
||||
vxge_get_bw_priority(-1, VXGE_GET_BANDWIDTH);
|
||||
else
|
||||
goto bw_pri_get;
|
||||
}
|
||||
|
||||
goto _exit0;
|
||||
|
||||
out:
|
||||
printf("Usage: ");
|
||||
printf("vxge-manage <INTERFACE> ");
|
||||
printf("[regs] [stats] [hwinfo] [bw_pri_get] [bw_pri_set] [port_mode_get] [port_mode_set] [pciconfig]\n");
|
||||
printf("\tINTERFACE : Interface (vxge0, vxge1, vxge2, ..)\n");
|
||||
printf("\tregs : Prints register values\n");
|
||||
printf("\tstats : Prints statistics\n");
|
||||
printf("\tpciconfig : Prints pci configuration space\n");
|
||||
printf("\thwinfo : Displays hardware information\n");
|
||||
printf("\tbw_pri_get : Displays bandwidth and priority information\n");
|
||||
printf("\tbw_pri_set : Set bandwidth and priority of a function\n");
|
||||
printf("\tport_mode_get : Displays dual port adapter's port mode\n");
|
||||
printf("\tport_mode_set : Set dual port adapter's port mode\n\n");
|
||||
goto _exit0;
|
||||
|
||||
regs:
|
||||
printf("Regs\n");
|
||||
printf("[common] [legacy] [pcicfgmgmt] [toc] [vpath] [vpmgmt] [mrpcim] [srpcim] [All]\n");
|
||||
printf("\tcommon : print common registers\n");
|
||||
printf("\tlegacy : print legacy registers\n");
|
||||
printf("\tpcicfgmgmt : print pcicfgmgmt registers\n");
|
||||
printf("\ttoc : print toc registers\n");
|
||||
printf("\tvpath : print vpath registers\n");
|
||||
printf("\tvpmgmt : print vpmgmt registers\n");
|
||||
printf("\tmrpcim : print mrpcim registers\n");
|
||||
printf("\tsrpcim : print srpcim registers\n\n");
|
||||
goto _exit0;
|
||||
|
||||
stats:
|
||||
printf("Stats\n");
|
||||
printf("[common] [mrpcim] [driver [vpath (< 17) ]] [All]\n");
|
||||
printf("\tcommon : print common statistics\n");
|
||||
printf("\tmrpcim : print mrpcim statistics\n");
|
||||
printf("\tdriver : print driver statistics\n");
|
||||
printf("\tAll : print all statistics\n\n");
|
||||
goto _exit0;
|
||||
|
||||
bw_pri_set:
|
||||
printf("Bandwidth & Priority\n");
|
||||
printf("[vf-id (0-7)] [bandwidth (100-10000)] [priority (0-3)]\n\n");
|
||||
goto _exit0;
|
||||
|
||||
bw_pri_get:
|
||||
printf("Bandwidth & Priority\n");
|
||||
printf("[vf-id (0-7)]\n\n");
|
||||
goto _exit0;
|
||||
|
||||
port_mode_set:
|
||||
printf("Port mode Setting\n");
|
||||
printf("[port mode value (2-4)]\n\n");
|
||||
goto _exit0;
|
||||
|
||||
_exit0:
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_all
|
||||
*/
|
||||
void
|
||||
vxge_get_registers_all(void)
|
||||
{
|
||||
vxge_get_registers_legacy();
|
||||
vxge_get_registers_toc();
|
||||
vxge_get_registers_common();
|
||||
vxge_get_registers_pcicfgmgmt();
|
||||
vxge_get_registers_srpcim();
|
||||
vxge_get_registers_mrpcim();
|
||||
vxge_get_registers_vpmgmt();
|
||||
vxge_get_registers_vpath();
|
||||
}
|
||||
|
||||
int
|
||||
vxge_get_registers_common(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize =
|
||||
reginfo_registers[VXGE_HAL_MGMT_REG_COUNT_COMMON - 1].offset + 8;
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = vxge_hal_mgmt_reg_type_common;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_legacy
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_legacy(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = reginfo_legacy[VXGE_HAL_MGMT_REG_COUNT_LEGACY - 1].offset + 8;
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = vxge_hal_mgmt_reg_type_legacy;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_legacy(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_toc
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_toc(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = reginfo_toc[VXGE_HAL_MGMT_REG_COUNT_TOC - 1].offset + 8;
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = vxge_hal_mgmt_reg_type_toc;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_toc(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_pcicfgmgmt
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_pcicfgmgmt(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = reginfo_pcicfgmgmt[VXGE_HAL_MGMT_REG_COUNT_PCICFGMGMT - 1].offset + 8;
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = vxge_hal_mgmt_reg_type_pcicfgmgmt;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_pcicfgmgmt(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_vpath
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_vpath(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
u32 i, no_of_vpath;
|
||||
char *buffer = NULL;
|
||||
|
||||
no_of_vpath = vxge_get_num_vpath();
|
||||
bufsize = reginfo_vpath[VXGE_HAL_MGMT_REG_COUNT_VPATH - 1].offset + 8;
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
for (i = 0; i < no_of_vpath; i++) {
|
||||
|
||||
bzero(buffer, bufsize);
|
||||
*buffer = vxge_hal_mgmt_reg_type_vpath;
|
||||
*((u32 *) (buffer + sizeof(u32))) = i;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_vpath(buffer, i);
|
||||
}
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_vpmgmt
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_vpmgmt(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
u32 i, no_of_vpath;
|
||||
char *buffer = NULL;
|
||||
|
||||
no_of_vpath = vxge_get_num_vpath();
|
||||
bufsize = reginfo_vpmgmt[VXGE_HAL_MGMT_REG_COUNT_VPMGMT - 1].offset + 8;
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
for (i = 0; i < no_of_vpath; i++) {
|
||||
|
||||
bzero(buffer, bufsize);
|
||||
*buffer = vxge_hal_mgmt_reg_type_vpmgmt;
|
||||
*((u32 *) (buffer + sizeof(u32))) = i;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_vpmgmt(buffer);
|
||||
}
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
u32
|
||||
vxge_get_num_vpath(void)
|
||||
{
|
||||
int err = 0;
|
||||
u32 buffer, no_of_vpath = 0;
|
||||
|
||||
buffer = VXGE_GET_VPATH_COUNT;
|
||||
|
||||
ifr.ifr_data = (caddr_t) &buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if (err == 0)
|
||||
no_of_vpath = buffer;
|
||||
else
|
||||
printf("Getting number of vpath failed\n");
|
||||
|
||||
return (no_of_vpath);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_mrpcim
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_mrpcim(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = reginfo_mrpcim[VXGE_HAL_MGMT_REG_COUNT_MRPCIM - 1].offset + 8;
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = vxge_hal_mgmt_reg_type_mrpcim;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_mrpcim(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_registers_srpcim
|
||||
* Gets srpcim register values
|
||||
* Returns EXIT_SUCCESS or EXIT_FAILURE
|
||||
*/
|
||||
int
|
||||
vxge_get_registers_srpcim(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = reginfo_srpcim[VXGE_HAL_MGMT_REG_COUNT_SRPCIM - 1].offset + 8;
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for register dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = vxge_hal_mgmt_reg_type_srpcim;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_1, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting register values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_registers_srpcim(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_stats_driver
|
||||
*/
|
||||
int
|
||||
vxge_get_stats_driver(int vpath_num)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = VXGE_HAL_MGMT_STATS_COUNT_DRIVER * sizeof(u64) *
|
||||
VXGE_HAL_MAX_VIRTUAL_PATHS;
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for driver statistics failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = VXGE_GET_DRIVER_STATS;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting Driver Statistics failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_stats_drv(buffer, vpath_num);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_stats_common
|
||||
*/
|
||||
int
|
||||
vxge_get_stats_common(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = 1024 * 64 * sizeof(char);
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for statistics dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = VXGE_GET_DEVICE_STATS;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting statistics values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_stats(buffer, VXGE_GET_DEVICE_STATS);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_stats_mrpcim
|
||||
*/
|
||||
int
|
||||
vxge_get_stats_mrpcim(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = 1024 * 64 * sizeof(char);
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for statistics dump failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = VXGE_GET_MRPCIM_STATS;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting statistics values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_stats(buffer, VXGE_GET_MRPCIM_STATS);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
vxge_get_pci_config(void)
|
||||
{
|
||||
int bufsize, err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
bufsize = 64 * 1024 * sizeof(char);
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(bufsize);
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for pci config failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = VXGE_GET_PCI_CONF;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting pci config values failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_pci_config(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_hw_info
|
||||
*/
|
||||
int
|
||||
vxge_get_hw_info(void)
|
||||
{
|
||||
int err = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
buffer = (char *) vxge_mem_alloc(sizeof(vxge_device_hw_info_t));
|
||||
if (!buffer) {
|
||||
printf("Allocating memory for hw info failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
*buffer = VXGE_GET_DEVICE_HWINFO;
|
||||
|
||||
ifr.ifr_data = (caddr_t) buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL)) {
|
||||
printf("Getting hw info failed\n");
|
||||
goto _exit0;
|
||||
}
|
||||
|
||||
vxge_print_hw_info(buffer);
|
||||
|
||||
_exit0:
|
||||
vxge_mem_free(buffer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_get_stats_all
|
||||
*/
|
||||
void
|
||||
vxge_get_stats_all(void)
|
||||
{
|
||||
vxge_get_stats_mrpcim();
|
||||
vxge_get_stats_common();
|
||||
vxge_get_stats_driver(0);
|
||||
}
|
||||
|
||||
int
|
||||
vxge_get_bw_priority(int func_id, vxge_query_device_info_e vxge_query_info)
|
||||
{
|
||||
int err = 0;
|
||||
vxge_bw_info_t buffer;
|
||||
|
||||
bzero(&buffer, sizeof(vxge_bw_info_t));
|
||||
|
||||
buffer.query = (char) vxge_query_info;
|
||||
if (func_id != -1)
|
||||
buffer.func_id = func_id;
|
||||
|
||||
ifr.ifr_data = (caddr_t) &buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL))
|
||||
printf("Getting bw info failed\n");
|
||||
else
|
||||
vxge_print_bw_priority(&buffer);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
vxge_set_bw_priority(int func_id, int bandwidth, int priority,
|
||||
vxge_query_device_info_e vxge_query_info)
|
||||
{
|
||||
int err = 0;
|
||||
vxge_bw_info_t buffer;
|
||||
|
||||
bzero(&buffer, sizeof(vxge_bw_info_t));
|
||||
|
||||
buffer.query = (char) vxge_query_info;
|
||||
buffer.func_id = func_id;
|
||||
buffer.bandwidth = bandwidth;
|
||||
buffer.priority = priority;
|
||||
|
||||
ifr.ifr_data = (caddr_t) &buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL))
|
||||
printf("Setting bandwidth failed\n");
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
vxge_set_port_mode(int port_val)
|
||||
{
|
||||
int err = 0;
|
||||
vxge_port_info_t buffer;
|
||||
|
||||
buffer.query = VXGE_SET_PORT_MODE;
|
||||
buffer.port_mode = port_val;
|
||||
buffer.port_failure = 0;
|
||||
|
||||
ifr.ifr_data = (caddr_t) &buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL))
|
||||
printf("Setting port_mode failed\n");
|
||||
else
|
||||
printf("Port mode set. Reboot the system for changes to take effect.\n");
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
vxge_get_port_mode()
|
||||
{
|
||||
int err = 0;
|
||||
vxge_port_info_t buffer;
|
||||
|
||||
bzero(&buffer, sizeof(vxge_port_info_t));
|
||||
|
||||
buffer.query = VXGE_GET_PORT_MODE;
|
||||
|
||||
ifr.ifr_data = (caddr_t) &buffer;
|
||||
err = ioctl(sockfd, SIOCGPRIVATE_0, &ifr);
|
||||
if ((err < 0) || (err == EINVAL))
|
||||
printf("Getting port mode info failed\n");
|
||||
else
|
||||
vxge_print_port_mode(&buffer);
|
||||
|
||||
return (err);
|
||||
}
|
||||
/*
|
||||
* Removes trailing spaces padded
|
||||
* and NULL terminates strings
|
||||
*/
|
||||
void
|
||||
vxge_null_terminate(char *str, size_t len)
|
||||
{
|
||||
len--;
|
||||
while (*str && (*str != ' ') && (len != 0))
|
||||
++str;
|
||||
|
||||
--len;
|
||||
if (*str)
|
||||
*str = '\0';
|
||||
}
|
||||
|
||||
void *
|
||||
vxge_mem_alloc(u_long size)
|
||||
{
|
||||
void *vaddr = NULL;
|
||||
vaddr = malloc(size);
|
||||
if (NULL != vaddr)
|
||||
bzero(vaddr, size);
|
||||
|
||||
return (vaddr);
|
||||
}
|
90
tools/tools/vxge/vxge_info.h
Normal file
90
tools/tools/vxge/vxge_info.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*-
|
||||
* Copyright(c) 2002-2011 Exar Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification are permitted provided the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Exar Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _VXGE_INFO_H_
|
||||
#define _VXGE_INFO_H_
|
||||
|
||||
#include "vxge_cmn.h"
|
||||
|
||||
/* Function declerations */
|
||||
|
||||
void vxge_get_registers_all(void);
|
||||
int vxge_get_registers_toc(void);
|
||||
int vxge_get_registers_vpath(void);
|
||||
int vxge_get_registers_vpmgmt(void);
|
||||
int vxge_get_registers_legacy(void);
|
||||
int vxge_get_registers_srpcim(void);
|
||||
int vxge_get_registers_mrpcim(void);
|
||||
int vxge_get_registers_common(void);
|
||||
int vxge_get_registers_pcicfgmgmt(void);
|
||||
|
||||
int vxge_get_stats_common(void);
|
||||
int vxge_get_stats_mrpcim(void);
|
||||
int vxge_get_stats_driver(int);
|
||||
void vxge_get_stats_all(void);
|
||||
|
||||
int vxge_get_hw_info(void);
|
||||
int vxge_get_pci_config(void);
|
||||
int vxge_get_port_mode(void);
|
||||
int vxge_set_port_mode(int);
|
||||
|
||||
int vxge_get_bw_priority(int, vxge_query_device_info_e);
|
||||
int vxge_set_bw_priority(int, int, int, vxge_query_device_info_e);
|
||||
|
||||
void vxge_print_registers(void *);
|
||||
void vxge_print_registers_toc(void *);
|
||||
void vxge_print_registers_vpath(void *, int);
|
||||
void vxge_print_registers_vpmgmt(void *);
|
||||
void vxge_print_registers_legacy(void *);
|
||||
void vxge_print_registers_srpcim(void *);
|
||||
void vxge_print_registers_mrpcim(void *);
|
||||
void vxge_print_registers_pcicfgmgmt(void *);
|
||||
|
||||
void vxge_print_hw_info(void *);
|
||||
void vxge_print_pci_config(void *);
|
||||
void vxge_print_stats(void *, int);
|
||||
void vxge_print_stats_drv(void *, int);
|
||||
void vxge_print_bw_priority(void *);
|
||||
void vxge_print_port_mode(void *);
|
||||
|
||||
void* vxge_mem_alloc(u_long);
|
||||
|
||||
extern vxge_pci_bar0_t reginfo_toc[];
|
||||
extern vxge_pci_bar0_t reginfo_vpath[];
|
||||
extern vxge_pci_bar0_t reginfo_legacy[];
|
||||
extern vxge_pci_bar0_t reginfo_vpmgmt[];
|
||||
extern vxge_pci_bar0_t reginfo_mrpcim[];
|
||||
extern vxge_pci_bar0_t reginfo_srpcim[];
|
||||
extern vxge_pci_bar0_t reginfo_registers[];
|
||||
extern vxge_pci_bar0_t reginfo_pcicfgmgmt[];
|
||||
|
||||
#endif /* _VXGE_INFO_H_ */
|
594
tools/tools/vxge/vxge_log.c
Normal file
594
tools/tools/vxge/vxge_log.c
Normal file
@ -0,0 +1,594 @@
|
||||
/*-
|
||||
* Copyright(c) 2002-2011 Exar Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification are permitted provided the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Exar Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "vxge_log.h"
|
||||
|
||||
static FILE *fdAll;
|
||||
|
||||
/*
|
||||
* vxge_print_registers
|
||||
* Prints/logs Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "w+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : COMMON");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_COMMON; i++) {
|
||||
if (reginfo_registers[i].size == 1)
|
||||
strlcpy(szName, reginfo_registers[i].name,
|
||||
sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_registers[i].size; j++) {
|
||||
noffset = reginfo_registers[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_registers[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_registers[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_legacy
|
||||
* Prints/logs legacy Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_legacy(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : LEGACY");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_LEGACY; i++) {
|
||||
if (reginfo_legacy[i].size == 1)
|
||||
strlcpy(szName, reginfo_legacy[i].name, sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_legacy[i].size; j++) {
|
||||
noffset = reginfo_legacy[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_legacy[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_legacy[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_toc
|
||||
* Prints/logs toc Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_toc(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : TOC");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_TOC; i++) {
|
||||
if (reginfo_toc[i].size == 1)
|
||||
strlcpy(szName, reginfo_toc[i].name, sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_toc[i].size; j++) {
|
||||
noffset = reginfo_toc[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_toc[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_toc[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_pcicfgmgmt
|
||||
* Prints/logs pcicfgmgmt Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_pcicfgmgmt(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : PCICFGMGMT");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_PCICFGMGMT; i++) {
|
||||
if (reginfo_pcicfgmgmt[i].size == 1)
|
||||
strlcpy(szName, reginfo_pcicfgmgmt[i].name,
|
||||
sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_pcicfgmgmt[i].size; j++) {
|
||||
|
||||
noffset = reginfo_pcicfgmgmt[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_pcicfgmgmt[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_pcicfgmgmt[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_vpath
|
||||
* Prints/logs vpath Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_vpath(void *registers, int vpath_num)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : VPATH");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_VPATH; i++) {
|
||||
if (reginfo_vpath[i].size == 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_vpath[i].name, vpath_num);
|
||||
|
||||
for (j = 0; j < reginfo_vpath[i].size; j++) {
|
||||
noffset = reginfo_vpath[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_vpath[i].size > 1)
|
||||
snprintf(szName, sizeof(szName), reginfo_vpath[i].name, j, vpath_num);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_vpmgmt
|
||||
* Prints/logs vpmgmt Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_vpmgmt(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : VPMGMT");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_VPMGMT; i++) {
|
||||
|
||||
if (reginfo_vpmgmt[i].size == 1)
|
||||
strlcpy(szName, reginfo_vpmgmt[i].name, sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_vpmgmt[i].size; j++) {
|
||||
|
||||
noffset = reginfo_vpmgmt[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_vpmgmt[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_vpmgmt[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_mrpcim
|
||||
* Prints/logs mrpcim Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_mrpcim(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : MRPCIM");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_MRPCIM; i++) {
|
||||
|
||||
if (reginfo_mrpcim[i].size == 1)
|
||||
strlcpy(szName, reginfo_mrpcim[i].name, sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_mrpcim[i].size; j++) {
|
||||
|
||||
noffset = reginfo_mrpcim[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_mrpcim[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_mrpcim[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_registers_srpcim
|
||||
* Prints/logs srpcim Register values
|
||||
* @registers Register values
|
||||
*/
|
||||
void
|
||||
vxge_print_registers_srpcim(void *registers)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
u64 noffset, nRegValue = 0;
|
||||
char szName[64];
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Registers : SRPCIM");
|
||||
VXGE_PRINT_HEADER_REGS(fdAll);
|
||||
|
||||
for (i = 0; i < VXGE_HAL_MGMT_REG_COUNT_SRPCIM; i++) {
|
||||
|
||||
if (reginfo_srpcim[i].size == 1)
|
||||
strlcpy(szName, reginfo_srpcim[i].name, sizeof(szName));
|
||||
|
||||
for (j = 0; j < reginfo_srpcim[i].size; j++) {
|
||||
|
||||
noffset = reginfo_srpcim[i].offset + (0x8 * j);
|
||||
|
||||
if (reginfo_srpcim[i].size > 1)
|
||||
snprintf(szName, sizeof(szName),
|
||||
reginfo_srpcim[i].name, j);
|
||||
|
||||
nRegValue = *((u64 *) ((unsigned char *) registers +
|
||||
noffset));
|
||||
|
||||
VXGE_PRINT_REGS(fdAll, (const char *) szName, noffset,
|
||||
nRegValue);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_stats_drv
|
||||
* Prints/logs Driver Statistics
|
||||
* @driver_stats Driver Statistics
|
||||
*/
|
||||
void
|
||||
vxge_print_stats_drv(void *driver_stats, int vpath_num)
|
||||
{
|
||||
int i, j;
|
||||
u32 no_of_vpath;
|
||||
|
||||
no_of_vpath = vxge_get_num_vpath();
|
||||
fdAll = fopen("vxge_drv_stats.log", "w+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
for (i = 0; i < no_of_vpath; i++) {
|
||||
|
||||
if (vpath_num != -1) {
|
||||
if (vpath_num != i) {
|
||||
driver_stats = driver_stats +
|
||||
(VXGE_HAL_MGMT_STATS_COUNT_DRIVER * sizeof(u64));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
VXGE_PRINT(fdAll, " VPath # %d ", i);
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
|
||||
for (j = 0; j < VXGE_HAL_MGMT_STATS_COUNT_DRIVER; j++) {
|
||||
|
||||
driverInfo[j].value =
|
||||
*((u64 *) ((unsigned char *) driver_stats +
|
||||
(j * (sizeof(u64)))));
|
||||
|
||||
VXGE_PRINT_STATS(fdAll, (const char *)
|
||||
driverInfo[j].name, driverInfo[j].value);
|
||||
}
|
||||
driver_stats = driver_stats + (j * sizeof(u64));
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
/*
|
||||
* vxge_print_stats
|
||||
* Prints/logs Statistics
|
||||
* @driver_stats Driver Statistics
|
||||
*/
|
||||
void
|
||||
vxge_print_stats(void *stats, vxge_query_device_info_e stat_type)
|
||||
{
|
||||
fdAll = fopen("vxge_stats.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
switch (stat_type) {
|
||||
case VXGE_GET_MRPCIM_STATS:
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Statistics : MRPCIM");
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
break;
|
||||
|
||||
case VXGE_GET_DEVICE_STATS:
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
VXGE_PRINT_REG_NAME(fdAll, "Statistics: COMMON");
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
break;
|
||||
}
|
||||
|
||||
VXGE_PRINT(fdAll, "%s", stats);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
void
|
||||
vxge_print_pci_config(void *info)
|
||||
{
|
||||
fdAll = fopen("vxge_regs.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
VXGE_PRINT_REG_NAME(fdAll, "PCI CONFIG SPACE");
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
VXGE_PRINT(fdAll, "%s", info);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
void
|
||||
vxge_print_hw_info(void *info)
|
||||
{
|
||||
u32 i;
|
||||
vxge_device_hw_info_t *dev_hw_info;
|
||||
vxge_hal_device_hw_info_t *hw_info;
|
||||
vxge_hal_device_pmd_info_t *pmd_port;
|
||||
|
||||
fdAll = fopen("vxge_regs.log", "w+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
dev_hw_info = (vxge_device_hw_info_t *) info;
|
||||
hw_info = &(dev_hw_info->hw_info);
|
||||
pmd_port = &(hw_info->pmd_port0);
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
VXGE_PRINT_REG_NAME(fdAll, "HARDWARE INFO");
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
|
||||
VXGE_PRINT(fdAll, "Description \t\t: %s",
|
||||
hw_info->product_description);
|
||||
|
||||
VXGE_PRINT(fdAll, "Serial Number \t\t: %s", hw_info->serial_number);
|
||||
VXGE_PRINT(fdAll, "Part Number \t\t: %s", hw_info->part_number);
|
||||
|
||||
VXGE_PRINT(fdAll, "Firmware Version \t: %s",
|
||||
hw_info->fw_version.version);
|
||||
|
||||
VXGE_PRINT(fdAll, "Firmware Date \t\t: %s", hw_info->fw_date.date);
|
||||
|
||||
VXGE_PRINT(fdAll, "Function Mode \t\t: %s",
|
||||
vxge_func_mode[hw_info->function_mode]);
|
||||
|
||||
for (i = 0; i < hw_info->ports; i++) {
|
||||
|
||||
vxge_null_terminate(pmd_port->vendor,
|
||||
sizeof(pmd_port->vendor));
|
||||
|
||||
if (strlen(pmd_port->vendor) == 0) {
|
||||
VXGE_PRINT(fdAll,
|
||||
"PMD Port %d \t\t: vendor=??, sn=??, pn=??", i);
|
||||
|
||||
pmd_port = &(hw_info->pmd_port1);
|
||||
continue;
|
||||
}
|
||||
|
||||
vxge_null_terminate(pmd_port->ser_num,
|
||||
sizeof(pmd_port->ser_num));
|
||||
|
||||
vxge_null_terminate(pmd_port->part_num,
|
||||
sizeof(pmd_port->part_num));
|
||||
|
||||
VXGE_PRINT(fdAll,
|
||||
"PMD Port %d \t\t: vendor=%s, sn=%s, pn=%s", i,
|
||||
pmd_port->vendor, pmd_port->ser_num,
|
||||
pmd_port->part_num);
|
||||
|
||||
pmd_port = &(hw_info->pmd_port1);
|
||||
}
|
||||
|
||||
if (hw_info->ports > 1) {
|
||||
|
||||
VXGE_PRINT(fdAll, "Port mode \t\t: %s",
|
||||
vxge_port_mode[dev_hw_info->port_mode]);
|
||||
|
||||
if (dev_hw_info->port_mode != VXGE_HAL_DP_NP_MODE_SINGLE_PORT) {
|
||||
VXGE_PRINT(fdAll, "Port failure \t\t: %s",
|
||||
vxge_port_failure[dev_hw_info->port_failure]);
|
||||
}
|
||||
}
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
void
|
||||
vxge_print_bw_priority(void *info)
|
||||
{
|
||||
u32 i;
|
||||
u64 func_id;
|
||||
vxge_bw_info_t *buffer;
|
||||
|
||||
fdAll = fopen("vxge_stats.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
buffer = (vxge_bw_info_t *) info;
|
||||
func_id = buffer->func_id;
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
|
||||
VXGE_PRINT(fdAll,
|
||||
"Function : %02lld Bandwidth : %05d\tPriority : %d",
|
||||
func_id, (buffer->bandwidth ?
|
||||
buffer->bandwidth : VXGE_MAX_BANDWIDTH),
|
||||
buffer->priority);
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
||||
|
||||
void
|
||||
vxge_print_port_mode(void *info)
|
||||
{
|
||||
vxge_port_info_t *buffer;
|
||||
|
||||
fdAll = fopen("vxge_stats.log", "a+");
|
||||
if (!fdAll)
|
||||
return;
|
||||
|
||||
buffer = (vxge_port_info_t *) info;
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
|
||||
VXGE_PRINT(fdAll,
|
||||
"Port Mode: %s\tPort Failure: %s",
|
||||
vxge_port_mode[buffer->port_mode],
|
||||
vxge_port_failure[buffer->port_failure]);
|
||||
|
||||
VXGE_PRINT_LINE(fdAll);
|
||||
fclose(fdAll);
|
||||
}
|
1872
tools/tools/vxge/vxge_log.h
Normal file
1872
tools/tools/vxge/vxge_log.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user