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