1*d39a76e7Sxw /* 2*d39a76e7Sxw * CDDL HEADER START 3*d39a76e7Sxw * 4*d39a76e7Sxw * The contents of this file are subject to the terms of the 5*d39a76e7Sxw * Common Development and Distribution License (the "License"). 6*d39a76e7Sxw * You may not use this file except in compliance with the License. 7*d39a76e7Sxw * 8*d39a76e7Sxw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*d39a76e7Sxw * or http://www.opensolaris.org/os/licensing. 10*d39a76e7Sxw * See the License for the specific language governing permissions 11*d39a76e7Sxw * and limitations under the License. 12*d39a76e7Sxw * 13*d39a76e7Sxw * When distributing Covered Code, include this CDDL HEADER in each 14*d39a76e7Sxw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*d39a76e7Sxw * If applicable, add the following below this CDDL HEADER, with the 16*d39a76e7Sxw * fields enclosed by brackets "[]" replaced with your own identifying 17*d39a76e7Sxw * information: Portions Copyright [yyyy] [name of copyright owner] 18*d39a76e7Sxw * 19*d39a76e7Sxw * CDDL HEADER END 20*d39a76e7Sxw */ 21*d39a76e7Sxw 22*d39a76e7Sxw /* 23*d39a76e7Sxw * Copyright (C) 2003-2005 Chelsio Communications. All rights reserved. 24*d39a76e7Sxw */ 25*d39a76e7Sxw 26*d39a76e7Sxw #pragma ident "%Z%%M% %I% %E% SMI" /* gmac.h */ 27*d39a76e7Sxw 28*d39a76e7Sxw #ifndef CHELSIO_GMAC_H 29*d39a76e7Sxw #define CHELSIO_GMAC_H 30*d39a76e7Sxw 31*d39a76e7Sxw #include "common.h" 32*d39a76e7Sxw 33*d39a76e7Sxw enum { MAC_STATS_UPDATE_FAST, MAC_STATS_UPDATE_FULL }; 34*d39a76e7Sxw enum { MAC_DIRECTION_RX = 1, MAC_DIRECTION_TX = 2 }; 35*d39a76e7Sxw 36*d39a76e7Sxw struct cmac_statistics { 37*d39a76e7Sxw /* Transmit */ 38*d39a76e7Sxw u64 TxOctetsOK; 39*d39a76e7Sxw u64 TxOctetsBad; 40*d39a76e7Sxw u64 TxUnicastFramesOK; 41*d39a76e7Sxw u64 TxMulticastFramesOK; 42*d39a76e7Sxw u64 TxBroadcastFramesOK; 43*d39a76e7Sxw u64 TxPauseFrames; 44*d39a76e7Sxw u64 TxFramesWithDeferredXmissions; 45*d39a76e7Sxw u64 TxLateCollisions; 46*d39a76e7Sxw u64 TxTotalCollisions; 47*d39a76e7Sxw u64 TxFramesAbortedDueToXSCollisions; 48*d39a76e7Sxw u64 TxUnderrun; 49*d39a76e7Sxw u64 TxLengthErrors; 50*d39a76e7Sxw u64 TxInternalMACXmitError; 51*d39a76e7Sxw u64 TxFramesWithExcessiveDeferral; 52*d39a76e7Sxw u64 TxFCSErrors; 53*d39a76e7Sxw u64 TxJumboFramesOK; 54*d39a76e7Sxw u64 TxJumboOctetsOK; 55*d39a76e7Sxw 56*d39a76e7Sxw /* Receive */ 57*d39a76e7Sxw u64 RxOctetsOK; 58*d39a76e7Sxw u64 RxOctetsBad; 59*d39a76e7Sxw u64 RxUnicastFramesOK; 60*d39a76e7Sxw u64 RxMulticastFramesOK; 61*d39a76e7Sxw u64 RxBroadcastFramesOK; 62*d39a76e7Sxw u64 RxPauseFrames; 63*d39a76e7Sxw u64 RxFCSErrors; 64*d39a76e7Sxw u64 RxAlignErrors; 65*d39a76e7Sxw u64 RxSymbolErrors; 66*d39a76e7Sxw u64 RxDataErrors; 67*d39a76e7Sxw u64 RxSequenceErrors; 68*d39a76e7Sxw u64 RxRuntErrors; 69*d39a76e7Sxw u64 RxJabberErrors; 70*d39a76e7Sxw u64 RxInternalMACRcvError; 71*d39a76e7Sxw u64 RxInRangeLengthErrors; 72*d39a76e7Sxw u64 RxOutOfRangeLengthField; 73*d39a76e7Sxw u64 RxFrameTooLongErrors; 74*d39a76e7Sxw u64 RxJumboFramesOK; 75*d39a76e7Sxw u64 RxJumboOctetsOK; 76*d39a76e7Sxw }; 77*d39a76e7Sxw 78*d39a76e7Sxw struct cmac_ops { 79*d39a76e7Sxw void (*destroy)(struct cmac *); 80*d39a76e7Sxw int (*reset)(struct cmac *); 81*d39a76e7Sxw int (*interrupt_enable)(struct cmac *); 82*d39a76e7Sxw int (*interrupt_disable)(struct cmac *); 83*d39a76e7Sxw int (*interrupt_clear)(struct cmac *); 84*d39a76e7Sxw int (*interrupt_handler)(struct cmac *); 85*d39a76e7Sxw 86*d39a76e7Sxw int (*enable)(struct cmac *, int); 87*d39a76e7Sxw int (*disable)(struct cmac *, int); 88*d39a76e7Sxw 89*d39a76e7Sxw int (*loopback_enable)(struct cmac *); 90*d39a76e7Sxw int (*loopback_disable)(struct cmac *); 91*d39a76e7Sxw 92*d39a76e7Sxw int (*set_mtu)(struct cmac *, int mtu); 93*d39a76e7Sxw int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm); 94*d39a76e7Sxw 95*d39a76e7Sxw int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc); 96*d39a76e7Sxw int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex, 97*d39a76e7Sxw int *fc); 98*d39a76e7Sxw 99*d39a76e7Sxw const struct cmac_statistics *(*statistics_update)(struct cmac *, int); 100*d39a76e7Sxw 101*d39a76e7Sxw int (*macaddress_get)(struct cmac *, u8 mac_addr[6]); 102*d39a76e7Sxw int (*macaddress_set)(struct cmac *, u8 mac_addr[6]); 103*d39a76e7Sxw }; 104*d39a76e7Sxw 105*d39a76e7Sxw typedef struct _cmac_instance cmac_instance; 106*d39a76e7Sxw 107*d39a76e7Sxw struct cmac { 108*d39a76e7Sxw struct cmac_statistics stats; 109*d39a76e7Sxw adapter_t *adapter; 110*d39a76e7Sxw struct cmac_ops *ops; 111*d39a76e7Sxw cmac_instance *instance; 112*d39a76e7Sxw }; 113*d39a76e7Sxw 114*d39a76e7Sxw struct gmac { 115*d39a76e7Sxw unsigned int stats_update_period; 116*d39a76e7Sxw struct cmac *(*create)(adapter_t *adapter, int index); 117*d39a76e7Sxw int (*reset)(adapter_t *); 118*d39a76e7Sxw }; 119*d39a76e7Sxw 120*d39a76e7Sxw extern struct gmac t1_pm3393_ops; 121*d39a76e7Sxw extern struct gmac t1_chelsio_mac_ops; 122*d39a76e7Sxw extern struct gmac t1_vsc7321_ops; 123*d39a76e7Sxw extern struct gmac t1_vsc7326_ops; 124*d39a76e7Sxw extern struct gmac t1_ixf1010_ops; 125*d39a76e7Sxw extern struct gmac t1_dummy_mac_ops; 126*d39a76e7Sxw #endif 127