1171095Ssam/*- 2171095Ssam * Copyright (c) 2002-2007 Neterion, Inc. 3171095Ssam * All rights reserved. 4171095Ssam * 5171095Ssam * Redistribution and use in source and binary forms, with or without 6171095Ssam * modification, are permitted provided that the following conditions 7171095Ssam * are met: 8171095Ssam * 1. Redistributions of source code must retain the above copyright 9171095Ssam * notice, this list of conditions and the following disclaimer. 10171095Ssam * 2. Redistributions in binary form must reproduce the above copyright 11171095Ssam * notice, this list of conditions and the following disclaimer in the 12171095Ssam * documentation and/or other materials provided with the distribution. 13171095Ssam * 14171095Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15171095Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16171095Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17171095Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18171095Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19171095Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20171095Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21171095Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22171095Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23171095Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24171095Ssam * SUCH DAMAGE. 25171095Ssam * 26171095Ssam * $FreeBSD$ 27171095Ssam */ 28173139Srwatson 29171095Ssam#ifndef XGE_CMN_H 30171095Ssam#include "xge_cmn.h" 31171095Ssam#endif 32171095Ssam 33171095Ssam#define XGE_QUERY_STATS 1 34171095Ssam#define XGE_QUERY_PCICONF 2 35173139Srwatson#define XGE_QUERY_DEVSTATS 3 36171095Ssam#define XGE_QUERY_DEVCONF 4 37171095Ssam#define XGE_READ_VERSION 5 38173139Srwatson#define XGE_QUERY_SWSTATS 6 39173139Srwatson#define XGE_QUERY_DRIVERSTATS 7 40173139Srwatson#define XGE_SET_BUFFER_MODE_1 8 41173139Srwatson#define XGE_SET_BUFFER_MODE_2 9 42171095Ssam#define XGE_SET_BUFFER_MODE_5 10 43171095Ssam#define XGE_QUERY_BUFFER_MODE 11 44171095Ssam 45171095Ssam 46171095Ssam/* Function declerations */ 47173139Srwatsonint xge_get_pciconf(void); 48173139Srwatsonint xge_get_devconf(void); 49173139Srwatsonint xge_get_hwstats(void); 50173139Srwatsonint xge_get_registers(void); 51173139Srwatsonint xge_get_devstats(void); 52173139Srwatsonint xge_get_swstats(void); 53173139Srwatsonint xge_get_drvstats(void); 54173139Srwatsonint xge_get_register(char *); 55173139Srwatsonint xge_set_register(char *,char *); 56173139Srwatsonint xge_get_drv_version(void); 57173139Srwatsonint xge_get_buffer_mode(void); 58173139Srwatsonint xge_change_buffer_mode(char *); 59173139Srwatsonvoid xge_print_hwstats(void *,unsigned short); 60173139Srwatsonvoid xge_print_pciconf(void *); 61173139Srwatsonvoid xge_print_devconf(void *); 62173139Srwatsonvoid xge_print_registers(void *); 63173139Srwatsonvoid xge_print_register(u64,u64); 64173139Srwatsonvoid xge_print_devstats(void *); 65173139Srwatsonvoid xge_print_swstats(void *); 66173139Srwatsonvoid xge_print_drvstats(void *); 67173139Srwatsonvoid xge_print_drv_version(char *); 68171095Ssam 69171095Ssamextern xge_pci_bar0_t regInfo[]; 70171095Ssamextern xge_pci_config_t pciconfInfo[]; 71171095Ssamextern xge_stats_hw_info_t statsInfo[]; 72171095Ssamextern xge_device_config_t devconfInfo[]; 73171095Ssamextern xge_stats_intr_info_t intrInfo[]; 74171095Ssamextern xge_stats_tcode_info_t tcodeInfo[]; 75173139Srwatsonextern xge_stats_driver_info_t driverInfo[]; 76173139Srwatson 77171095Ssamstruct ifreq ifreqp; 78173139Srwatsonint sockfd, indexer, buffer_size = 0; 79171095Ssam 80