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 #ifndef CHELSIO_GMAC_H 27*d39a76e7Sxw #define CHELSIO_GMAC_H 28*d39a76e7Sxw 29*d39a76e7Sxw #include "common.h" 30*d39a76e7Sxw 31*d39a76e7Sxw enum { MAC_STATS_UPDATE_FAST, MAC_STATS_UPDATE_FULL }; 32*d39a76e7Sxw enum { MAC_DIRECTION_RX = 1, MAC_DIRECTION_TX = 2 }; 33*d39a76e7Sxw 34*d39a76e7Sxw struct cmac_statistics { 35*d39a76e7Sxw /* Transmit */ 36*d39a76e7Sxw u64 TxOctetsOK; 37*d39a76e7Sxw u64 TxOctetsBad; 38*d39a76e7Sxw u64 TxUnicastFramesOK; 39*d39a76e7Sxw u64 TxMulticastFramesOK; 40*d39a76e7Sxw u64 TxBroadcastFramesOK; 41*d39a76e7Sxw u64 TxPauseFrames; 42*d39a76e7Sxw u64 TxFramesWithDeferredXmissions; 43*d39a76e7Sxw u64 TxLateCollisions; 44*d39a76e7Sxw u64 TxTotalCollisions; 45*d39a76e7Sxw u64 TxFramesAbortedDueToXSCollisions; 46*d39a76e7Sxw u64 TxUnderrun; 47*d39a76e7Sxw u64 TxLengthErrors; 48*d39a76e7Sxw u64 TxInternalMACXmitError; 49*d39a76e7Sxw u64 TxFramesWithExcessiveDeferral; 50*d39a76e7Sxw u64 TxFCSErrors; 51*d39a76e7Sxw u64 TxJumboFramesOK; 52*d39a76e7Sxw u64 TxJumboOctetsOK; 53*d39a76e7Sxw 54*d39a76e7Sxw /* Receive */ 55*d39a76e7Sxw u64 RxOctetsOK; 56*d39a76e7Sxw u64 RxOctetsBad; 57*d39a76e7Sxw u64 RxUnicastFramesOK; 58*d39a76e7Sxw u64 RxMulticastFramesOK; 59*d39a76e7Sxw u64 RxBroadcastFramesOK; 60*d39a76e7Sxw u64 RxPauseFrames; 61*d39a76e7Sxw u64 RxFCSErrors; 62*d39a76e7Sxw u64 RxAlignErrors; 63*d39a76e7Sxw u64 RxSymbolErrors; 64*d39a76e7Sxw u64 RxDataErrors; 65*d39a76e7Sxw u64 RxSequenceErrors; 66*d39a76e7Sxw u64 RxRuntErrors; 67*d39a76e7Sxw u64 RxJabberErrors; 68*d39a76e7Sxw u64 RxInternalMACRcvError; 69*d39a76e7Sxw u64 RxInRangeLengthErrors; 70*d39a76e7Sxw u64 RxOutOfRangeLengthField; 71*d39a76e7Sxw u64 RxFrameTooLongErrors; 72*d39a76e7Sxw u64 RxJumboFramesOK; 73*d39a76e7Sxw u64 RxJumboOctetsOK; 74*d39a76e7Sxw }; 75*d39a76e7Sxw 76*d39a76e7Sxw struct cmac_ops { 77*d39a76e7Sxw void (*destroy)(struct cmac *); 78*d39a76e7Sxw int (*reset)(struct cmac *); 79*d39a76e7Sxw int (*interrupt_enable)(struct cmac *); 80*d39a76e7Sxw int (*interrupt_disable)(struct cmac *); 81*d39a76e7Sxw int (*interrupt_clear)(struct cmac *); 82*d39a76e7Sxw int (*interrupt_handler)(struct cmac *); 83*d39a76e7Sxw 84*d39a76e7Sxw int (*enable)(struct cmac *, int); 85*d39a76e7Sxw int (*disable)(struct cmac *, int); 86*d39a76e7Sxw 87*d39a76e7Sxw int (*loopback_enable)(struct cmac *); 88*d39a76e7Sxw int (*loopback_disable)(struct cmac *); 89*d39a76e7Sxw 90*d39a76e7Sxw int (*set_mtu)(struct cmac *, int mtu); 91*d39a76e7Sxw int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm); 92*d39a76e7Sxw 93*d39a76e7Sxw int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc); 94*d39a76e7Sxw int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex, 95*d39a76e7Sxw int *fc); 96*d39a76e7Sxw 97*d39a76e7Sxw const struct cmac_statistics *(*statistics_update)(struct cmac *, int); 98*d39a76e7Sxw 99*d39a76e7Sxw int (*macaddress_get)(struct cmac *, u8 mac_addr[6]); 100*d39a76e7Sxw int (*macaddress_set)(struct cmac *, u8 mac_addr[6]); 101*d39a76e7Sxw }; 102*d39a76e7Sxw 103*d39a76e7Sxw typedef struct _cmac_instance cmac_instance; 104*d39a76e7Sxw 105*d39a76e7Sxw struct cmac { 106*d39a76e7Sxw struct cmac_statistics stats; 107*d39a76e7Sxw adapter_t *adapter; 108*d39a76e7Sxw struct cmac_ops *ops; 109*d39a76e7Sxw cmac_instance *instance; 110*d39a76e7Sxw }; 111*d39a76e7Sxw 112*d39a76e7Sxw struct gmac { 113*d39a76e7Sxw unsigned int stats_update_period; 114*d39a76e7Sxw struct cmac *(*create)(adapter_t *adapter, int index); 115*d39a76e7Sxw int (*reset)(adapter_t *); 116*d39a76e7Sxw }; 117*d39a76e7Sxw 118*d39a76e7Sxw extern struct gmac t1_pm3393_ops; 119*d39a76e7Sxw extern struct gmac t1_chelsio_mac_ops; 120*d39a76e7Sxw extern struct gmac t1_vsc7321_ops; 121*d39a76e7Sxw extern struct gmac t1_vsc7326_ops; 122*d39a76e7Sxw extern struct gmac t1_ixf1010_ops; 123*d39a76e7Sxw extern struct gmac t1_dummy_mac_ops; 124*d39a76e7Sxw #endif 125