/*
* 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 © 2003-2011 Emulex. All rights reserved. */
/*
* Source file containing the implementation of the driver statistics
* and related helper functions
*/
#include <oce_impl.h>
#include <oce_stat.h>
#include <oce_buf.h>
0,
10,
100,
1000,
10000
};
/*
* function called by kstat to update the stats counters
*
* ksp - pointer to the kstats structure
*
* return DDI_SUCCESS => success, failure otherwise
*/
static int
{
int ret;
if (rw == KSTAT_WRITE) {
return (EACCES);
}
return (EIO);
}
if (ret != DDI_SUCCESS) {
"Failed to get stats:%d", ret);
return (EIO);
}
/* update the stats */
return (DDI_SUCCESS);
} /* oce_update_stats */
/*
* function to setup the kstat_t structure for the device and install it
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
int
{
sizeof (kstat_named_t);
/* allocate the kstat */
"net", KSTAT_TYPE_NAMED,
num_stats, 0);
"kstat creation failed: 0x%p",
(void *)dev->oce_kstats);
return (DDI_FAILURE);
}
/* allocate the device copy of the stats */
sizeof (struct mbx_get_nic_stats),
"Could not allocate stats_dbuf: %p",
(void *)dev->stats_dbuf);
return (DDI_FAILURE);
}
/* initialize the counters */
"rx unicast frames", KSTAT_DATA_ULONG);
"rx multicast frames", KSTAT_DATA_ULONG);
"rx broadcast frames", KSTAT_DATA_ULONG);
"rx crc errors", KSTAT_DATA_ULONG);
"rx alignment symbol errors", KSTAT_DATA_ULONG);
"rx in range errors", KSTAT_DATA_ULONG);
"rx out range errors", KSTAT_DATA_ULONG);
"rx frame too long", KSTAT_DATA_ULONG);
"rx address match errors", KSTAT_DATA_ULONG);
"rx pause frames", KSTAT_DATA_ULONG);
"rx control frames", KSTAT_DATA_ULONG);
"rx ip checksum errors", KSTAT_DATA_ULONG);
"rx tcp checksum errors", KSTAT_DATA_ULONG);
"rx udp checksum errors", KSTAT_DATA_ULONG);
"rx fifo overflow", KSTAT_DATA_ULONG);
"rx input fifo overflow", KSTAT_DATA_ULONG);
"tx unicast frames", KSTAT_DATA_ULONG);
"tx multicast frames", KSTAT_DATA_ULONG);
"tx broadcast frames", KSTAT_DATA_ULONG);
"tx pause frames", KSTAT_DATA_ULONG);
"tx control frames", KSTAT_DATA_ULONG);
"rx_drops_no_pbuf", KSTAT_DATA_ULONG);
"rx_drops_no_txpb", KSTAT_DATA_ULONG);
"rx_drops_no_erx_descr", KSTAT_DATA_ULONG);
"rx_drops_no_tpre_descr", KSTAT_DATA_ULONG);
"rx_drops_too_many_frags", KSTAT_DATA_ULONG);
"rx_drops_invalid_ring", KSTAT_DATA_ULONG);
"rx_drops_mtu", KSTAT_DATA_ULONG);
"rx_dropped_too_small", KSTAT_DATA_ULONG);
"rx_dropped_too_short", KSTAT_DATA_ULONG);
"rx_dropped_header_too_small", KSTAT_DATA_ULONG);
"rx_dropped_tcp_length", KSTAT_DATA_ULONG);
"rx_dropped_runt", KSTAT_DATA_ULONG);
"rx_drop_no_frag", KSTAT_DATA_ULONG);
return (DDI_SUCCESS);
} /* oce_stat_init */
/*
* function to undo initialization done in oce_stat_init
*
* dev - software handle to the device
*
* return none
*/
void
{
} /* oce_stat_fini */
/*
* GLDv3 entry for statistic query
*/
int
{
return (EIO);
}
switch (stat) {
case MAC_STAT_IFSPEED: {
if (dev->link_speed < 0) {
}
}
break;
case MAC_STAT_RBYTES:
break;
case MAC_STAT_IPACKETS:
break;
case MAC_STAT_OBYTES:
break;
case MAC_STAT_OPACKETS:
break;
case MAC_STAT_BRDCSTRCV:
break;
case MAC_STAT_MULTIRCV:
break;
case MAC_STAT_MULTIXMT:
break;
case MAC_STAT_BRDCSTXMT:
break;
case MAC_STAT_NORCVBUF:
break;
case MAC_STAT_IERRORS:
break;
case MAC_STAT_NOXMTBUF:
break;
case MAC_STAT_OERRORS:
break;
case ETHER_STAT_LINK_DUPLEX:
*val = LINK_DUPLEX_FULL;
else
break;
case ETHER_STAT_ALIGN_ERRORS:
break;
case ETHER_STAT_FCS_ERRORS:
break;
case ETHER_STAT_MACRCV_ERRORS:
break;
case ETHER_STAT_MACXMT_ERRORS:
break;
break;
case ETHER_STAT_CAP_PAUSE:
case ETHER_STAT_LINK_PAUSE:
*val = LINK_FLOWCTRL_BI;
*val = LINK_FLOWCTRL_TX;
*val = LINK_FLOWCTRL_RX;
else if (dev->flow_control == 0)
break;
default:
return (ENOTSUP);
}
return (0);
} /* oce_m_stat */