12311Sseb /* 22311Sseb * CDDL HEADER START 32311Sseb * 42311Sseb * The contents of this file are subject to the terms of the 52311Sseb * Common Development and Distribution License (the "License"). 62311Sseb * You may not use this file except in compliance with the License. 72311Sseb * 82311Sseb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92311Sseb * or http://www.opensolaris.org/os/licensing. 102311Sseb * See the License for the specific language governing permissions 112311Sseb * and limitations under the License. 122311Sseb * 132311Sseb * When distributing Covered Code, include this CDDL HEADER in each 142311Sseb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152311Sseb * If applicable, add the following below this CDDL HEADER, with the 162311Sseb * fields enclosed by brackets "[]" replaced with your own identifying 172311Sseb * information: Portions Copyright [yyyy] [name of copyright owner] 182311Sseb * 192311Sseb * CDDL HEADER END 202311Sseb */ 212311Sseb /* 22*9449Sxiuyan.wang@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 232311Sseb * Use is subject to license terms. 242311Sseb */ 252311Sseb 262311Sseb #ifndef _SYS_MAC_ETHER_H 272311Sseb #define _SYS_MAC_ETHER_H 282311Sseb 292311Sseb /* 302311Sseb * Ethernet MAC Plugin 312311Sseb */ 322311Sseb 332311Sseb #ifdef __cplusplus 342311Sseb extern "C" { 352311Sseb #endif 362311Sseb 372311Sseb #ifdef _KERNEL 382311Sseb 392311Sseb #define MAC_PLUGIN_IDENT_ETHER "mac_ether" 402311Sseb 414089Sgd78059 /* 424089Sgd78059 * Do not reorder, and add only to the end of this list. 434089Sgd78059 */ 442311Sseb enum ether_stat { 452311Sseb /* RFC 1643 stats */ 462311Sseb ETHER_STAT_ALIGN_ERRORS = MACTYPE_STAT_MIN, 472311Sseb ETHER_STAT_FCS_ERRORS, 482311Sseb ETHER_STAT_FIRST_COLLISIONS, 492311Sseb ETHER_STAT_MULTI_COLLISIONS, 502311Sseb ETHER_STAT_SQE_ERRORS, 512311Sseb ETHER_STAT_DEFER_XMTS, 522311Sseb ETHER_STAT_TX_LATE_COLLISIONS, 532311Sseb ETHER_STAT_EX_COLLISIONS, 542311Sseb ETHER_STAT_MACXMT_ERRORS, 552311Sseb ETHER_STAT_CARRIER_ERRORS, 562311Sseb ETHER_STAT_TOOLONG_ERRORS, 572311Sseb ETHER_STAT_MACRCV_ERRORS, 582311Sseb 592311Sseb /* MII/GMII stats */ 602311Sseb ETHER_STAT_XCVR_ADDR, 612311Sseb ETHER_STAT_XCVR_ID, 622311Sseb ETHER_STAT_XCVR_INUSE, 632311Sseb ETHER_STAT_CAP_1000FDX, 642311Sseb ETHER_STAT_CAP_1000HDX, 652311Sseb ETHER_STAT_CAP_100FDX, 662311Sseb ETHER_STAT_CAP_100HDX, 672311Sseb ETHER_STAT_CAP_10FDX, 682311Sseb ETHER_STAT_CAP_10HDX, 692311Sseb ETHER_STAT_CAP_ASMPAUSE, 702311Sseb ETHER_STAT_CAP_PAUSE, 712311Sseb ETHER_STAT_CAP_AUTONEG, 722311Sseb ETHER_STAT_ADV_CAP_1000FDX, 732311Sseb ETHER_STAT_ADV_CAP_1000HDX, 742311Sseb ETHER_STAT_ADV_CAP_100FDX, 752311Sseb ETHER_STAT_ADV_CAP_100HDX, 762311Sseb ETHER_STAT_ADV_CAP_10FDX, 772311Sseb ETHER_STAT_ADV_CAP_10HDX, 782311Sseb ETHER_STAT_ADV_CAP_ASMPAUSE, 792311Sseb ETHER_STAT_ADV_CAP_PAUSE, 802311Sseb ETHER_STAT_ADV_CAP_AUTONEG, 812311Sseb ETHER_STAT_LP_CAP_1000FDX, 822311Sseb ETHER_STAT_LP_CAP_1000HDX, 832311Sseb ETHER_STAT_LP_CAP_100FDX, 842311Sseb ETHER_STAT_LP_CAP_100HDX, 852311Sseb ETHER_STAT_LP_CAP_10FDX, 862311Sseb ETHER_STAT_LP_CAP_10HDX, 872311Sseb ETHER_STAT_LP_CAP_ASMPAUSE, 882311Sseb ETHER_STAT_LP_CAP_PAUSE, 892311Sseb ETHER_STAT_LP_CAP_AUTONEG, 902311Sseb ETHER_STAT_LINK_ASMPAUSE, 912311Sseb ETHER_STAT_LINK_PAUSE, 922311Sseb ETHER_STAT_LINK_AUTONEG, 934089Sgd78059 ETHER_STAT_LINK_DUPLEX, 944089Sgd78059 954089Sgd78059 ETHER_STAT_TOOSHORT_ERRORS, 964089Sgd78059 ETHER_STAT_CAP_REMFAULT, 974089Sgd78059 ETHER_STAT_ADV_REMFAULT, 984403Sgd78059 ETHER_STAT_LP_REMFAULT, 994403Sgd78059 1004403Sgd78059 ETHER_STAT_JABBER_ERRORS, 1014403Sgd78059 ETHER_STAT_CAP_100T4, 1024403Sgd78059 ETHER_STAT_ADV_CAP_100T4, 1034403Sgd78059 ETHER_STAT_LP_CAP_100T4, 104*9449Sxiuyan.wang@Sun.COM 105*9449Sxiuyan.wang@Sun.COM ETHER_STAT_CAP_10GFDX, 106*9449Sxiuyan.wang@Sun.COM ETHER_STAT_ADV_CAP_10GFDX, 107*9449Sxiuyan.wang@Sun.COM ETHER_STAT_LP_CAP_10GFDX, 1082311Sseb }; 1092311Sseb 110*9449Sxiuyan.wang@Sun.COM #define ETHER_NSTAT (ETHER_STAT_LP_CAP_10GFDX - ETHER_STAT_ALIGN_ERRORS + 1) 1112311Sseb 1122311Sseb #define ETHER_STAT_ISACOUNTER(_ether_stat) \ 1132311Sseb ((_ether_stat) == ETHER_STAT_ALIGN_ERRORS || \ 1142311Sseb (_ether_stat) == ETHER_STAT_FCS_ERRORS || \ 1152311Sseb (_ether_stat) == ETHER_STAT_FIRST_COLLISIONS || \ 1162311Sseb (_ether_stat) == ETHER_STAT_MULTI_COLLISIONS || \ 1172311Sseb (_ether_stat) == ETHER_STAT_SQE_ERRORS || \ 1182311Sseb (_ether_stat) == ETHER_STAT_DEFER_XMTS || \ 1192311Sseb (_ether_stat) == ETHER_STAT_TX_LATE_COLLISIONS || \ 1202311Sseb (_ether_stat) == ETHER_STAT_EX_COLLISIONS || \ 1212311Sseb (_ether_stat) == ETHER_STAT_MACXMT_ERRORS || \ 1222311Sseb (_ether_stat) == ETHER_STAT_CARRIER_ERRORS || \ 1232311Sseb (_ether_stat) == ETHER_STAT_TOOLONG_ERRORS || \ 1244089Sgd78059 (_ether_stat) == ETHER_STAT_TOOSHORT_ERRORS || \ 1254403Sgd78059 (_ether_stat) == ETHER_STAT_JABBER_ERRORS || \ 1262311Sseb (_ether_stat) == ETHER_STAT_MACRCV_ERRORS) 1272311Sseb 1282311Sseb /* 1292311Sseb * Some drivers have a need to determine if a particular stat is a MII/GMII 1302311Sseb * physical layer 802.3 stat. 1312311Sseb */ 1322311Sseb #define ETHER_STAT_ISMII(_ether_stat) \ 1332311Sseb ((_ether_stat) == ETHER_STAT_XCVR_ADDR || \ 1342311Sseb (_ether_stat) == ETHER_STAT_XCVR_ID || \ 1352311Sseb (_ether_stat) == ETHER_STAT_XCVR_INUSE || \ 1362311Sseb (_ether_stat) == ETHER_STAT_CAP_1000FDX || \ 1372311Sseb (_ether_stat) == ETHER_STAT_CAP_1000HDX || \ 1382311Sseb (_ether_stat) == ETHER_STAT_CAP_100FDX || \ 1392311Sseb (_ether_stat) == ETHER_STAT_CAP_100HDX || \ 1402311Sseb (_ether_stat) == ETHER_STAT_CAP_10FDX || \ 1412311Sseb (_ether_stat) == ETHER_STAT_CAP_10HDX || \ 1422311Sseb (_ether_stat) == ETHER_STAT_CAP_ASMPAUSE || \ 1432311Sseb (_ether_stat) == ETHER_STAT_CAP_PAUSE || \ 1442311Sseb (_ether_stat) == ETHER_STAT_CAP_AUTONEG || \ 1454089Sgd78059 (_ether_stat) == ETHER_STAT_CAP_REMFAULT || \ 1464403Sgd78059 (_ether_stat) == ETHER_STAT_CAP_100T4 || \ 1472311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_1000FDX || \ 1482311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_1000HDX || \ 1492311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_100FDX || \ 1502311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_100HDX || \ 1512311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_10FDX || \ 1522311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_10HDX || \ 1532311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_ASMPAUSE || \ 1542311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_PAUSE || \ 1552311Sseb (_ether_stat) == ETHER_STAT_ADV_CAP_AUTONEG || \ 1564089Sgd78059 (_ether_stat) == ETHER_STAT_ADV_REMFAULT || \ 1574403Sgd78059 (_ether_stat) == ETHER_STAT_ADV_CAP_100T4 || \ 1582311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_1000FDX || \ 1592311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_1000HDX || \ 1602311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_100FDX || \ 1612311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_100HDX || \ 1622311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_10FDX || \ 1632311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_10HDX || \ 1642311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_ASMPAUSE || \ 1652311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_PAUSE || \ 1662311Sseb (_ether_stat) == ETHER_STAT_LP_CAP_AUTONEG || \ 1674089Sgd78059 (_ether_stat) == ETHER_STAT_LP_REMFAULT || \ 1684403Sgd78059 (_ether_stat) == ETHER_STAT_LP_CAP_100T4 || \ 1692311Sseb (_ether_stat) == ETHER_STAT_LINK_ASMPAUSE || \ 1702311Sseb (_ether_stat) == ETHER_STAT_LINK_PAUSE || \ 1712311Sseb (_ether_stat) == ETHER_STAT_LINK_AUTONEG || \ 1722311Sseb (_ether_stat) == ETHER_STAT_LINK_DUPLEX) 1732311Sseb 1742311Sseb #endif /* _KERNEL */ 1752311Sseb 1762311Sseb #ifdef __cplusplus 1772311Sseb } 1782311Sseb #endif 1792311Sseb 1802311Sseb #endif /* _SYS_MAC_ETHER_H */ 181