| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 1 | /***************************************************************************** | 
|  | 2 | *                                                                           * | 
|  | 3 | * File: gmac.h                                                              * | 
| Scott Bardone | 559fb51 | 2005-06-23 01:40:19 -0400 | [diff] [blame] | 4 | * $Revision: 1.6 $                                                          * | 
|  | 5 | * $Date: 2005/06/21 18:29:47 $                                              * | 
| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 6 | * Description:                                                              * | 
|  | 7 | *  Generic MAC functionality.                                               * | 
|  | 8 | *  part of the Chelsio 10Gb Ethernet Driver.                                * | 
|  | 9 | *                                                                           * | 
|  | 10 | * This program is free software; you can redistribute it and/or modify      * | 
|  | 11 | * it under the terms of the GNU General Public License, version 2, as       * | 
|  | 12 | * published by the Free Software Foundation.                                * | 
|  | 13 | *                                                                           * | 
|  | 14 | * You should have received a copy of the GNU General Public License along   * | 
|  | 15 | * with this program; if not, write to the Free Software Foundation, Inc.,   * | 
|  | 16 | * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 * | 
|  | 17 | *                                                                           * | 
|  | 18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED    * | 
|  | 19 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF      * | 
|  | 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.                     * | 
|  | 21 | *                                                                           * | 
|  | 22 | * http://www.chelsio.com                                                    * | 
|  | 23 | *                                                                           * | 
|  | 24 | * Copyright (c) 2003 - 2005 Chelsio Communications, Inc.                    * | 
|  | 25 | * All rights reserved.                                                      * | 
|  | 26 | *                                                                           * | 
|  | 27 | * Maintainers: maintainers@chelsio.com                                      * | 
|  | 28 | *                                                                           * | 
|  | 29 | * Authors: Dimitrios Michailidis   <dm@chelsio.com>                         * | 
|  | 30 | *          Tina Yang               <tainay@chelsio.com>                     * | 
|  | 31 | *          Felix Marti             <felix@chelsio.com>                      * | 
|  | 32 | *          Scott Bardone           <sbardone@chelsio.com>                   * | 
|  | 33 | *          Kurt Ottaway            <kottaway@chelsio.com>                   * | 
|  | 34 | *          Frank DiMambro          <frank@chelsio.com>                      * | 
|  | 35 | *                                                                           * | 
|  | 36 | * History:                                                                  * | 
|  | 37 | *                                                                           * | 
|  | 38 | ****************************************************************************/ | 
|  | 39 |  | 
| Scott Bardone | 559fb51 | 2005-06-23 01:40:19 -0400 | [diff] [blame] | 40 | #ifndef _CXGB_GMAC_H_ | 
|  | 41 | #define _CXGB_GMAC_H_ | 
| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 42 |  | 
|  | 43 | #include "common.h" | 
|  | 44 |  | 
| Francois Romieu | 356bd14 | 2006-12-11 23:47:00 +0100 | [diff] [blame] | 45 | enum { | 
|  | 46 | MAC_STATS_UPDATE_FAST, | 
|  | 47 | MAC_STATS_UPDATE_FULL | 
|  | 48 | }; | 
|  | 49 |  | 
|  | 50 | enum { | 
|  | 51 | MAC_DIRECTION_RX = 1, | 
|  | 52 | MAC_DIRECTION_TX = 2 | 
|  | 53 | }; | 
| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 54 |  | 
|  | 55 | struct cmac_statistics { | 
|  | 56 | /* Transmit */ | 
|  | 57 | u64 TxOctetsOK; | 
|  | 58 | u64 TxOctetsBad; | 
|  | 59 | u64 TxUnicastFramesOK; | 
|  | 60 | u64 TxMulticastFramesOK; | 
|  | 61 | u64 TxBroadcastFramesOK; | 
|  | 62 | u64 TxPauseFrames; | 
|  | 63 | u64 TxFramesWithDeferredXmissions; | 
|  | 64 | u64 TxLateCollisions; | 
|  | 65 | u64 TxTotalCollisions; | 
|  | 66 | u64 TxFramesAbortedDueToXSCollisions; | 
|  | 67 | u64 TxUnderrun; | 
|  | 68 | u64 TxLengthErrors; | 
|  | 69 | u64 TxInternalMACXmitError; | 
|  | 70 | u64 TxFramesWithExcessiveDeferral; | 
|  | 71 | u64 TxFCSErrors; | 
| Stephen Hemminger | f1d3d38 | 2006-12-01 16:36:16 -0800 | [diff] [blame] | 72 | u64 TxJumboFramesOK; | 
|  | 73 | u64 TxJumboOctetsOK; | 
| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 74 |  | 
|  | 75 | /* Receive */ | 
|  | 76 | u64 RxOctetsOK; | 
|  | 77 | u64 RxOctetsBad; | 
|  | 78 | u64 RxUnicastFramesOK; | 
|  | 79 | u64 RxMulticastFramesOK; | 
|  | 80 | u64 RxBroadcastFramesOK; | 
|  | 81 | u64 RxPauseFrames; | 
|  | 82 | u64 RxFCSErrors; | 
|  | 83 | u64 RxAlignErrors; | 
|  | 84 | u64 RxSymbolErrors; | 
|  | 85 | u64 RxDataErrors; | 
|  | 86 | u64 RxSequenceErrors; | 
|  | 87 | u64 RxRuntErrors; | 
|  | 88 | u64 RxJabberErrors; | 
|  | 89 | u64 RxInternalMACRcvError; | 
|  | 90 | u64 RxInRangeLengthErrors; | 
|  | 91 | u64 RxOutOfRangeLengthField; | 
|  | 92 | u64 RxFrameTooLongErrors; | 
| Stephen Hemminger | f1d3d38 | 2006-12-01 16:36:16 -0800 | [diff] [blame] | 93 | u64 RxJumboFramesOK; | 
|  | 94 | u64 RxJumboOctetsOK; | 
| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 95 | }; | 
|  | 96 |  | 
|  | 97 | struct cmac_ops { | 
|  | 98 | void (*destroy)(struct cmac *); | 
|  | 99 | int (*reset)(struct cmac *); | 
|  | 100 | int (*interrupt_enable)(struct cmac *); | 
|  | 101 | int (*interrupt_disable)(struct cmac *); | 
|  | 102 | int (*interrupt_clear)(struct cmac *); | 
|  | 103 | int (*interrupt_handler)(struct cmac *); | 
|  | 104 |  | 
|  | 105 | int (*enable)(struct cmac *, int); | 
|  | 106 | int (*disable)(struct cmac *, int); | 
|  | 107 |  | 
|  | 108 | int (*loopback_enable)(struct cmac *); | 
|  | 109 | int (*loopback_disable)(struct cmac *); | 
|  | 110 |  | 
|  | 111 | int (*set_mtu)(struct cmac *, int mtu); | 
|  | 112 | int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm); | 
|  | 113 |  | 
|  | 114 | int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc); | 
|  | 115 | int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex, | 
|  | 116 | int *fc); | 
|  | 117 |  | 
|  | 118 | const struct cmac_statistics *(*statistics_update)(struct cmac *, int); | 
|  | 119 |  | 
|  | 120 | int (*macaddress_get)(struct cmac *, u8 mac_addr[6]); | 
|  | 121 | int (*macaddress_set)(struct cmac *, u8 mac_addr[6]); | 
|  | 122 | }; | 
|  | 123 |  | 
|  | 124 | typedef struct _cmac_instance cmac_instance; | 
|  | 125 |  | 
|  | 126 | struct cmac { | 
|  | 127 | struct cmac_statistics stats; | 
|  | 128 | adapter_t *adapter; | 
| Stephen Hemminger | 459e536 | 2007-02-20 15:58:02 -0800 | [diff] [blame] | 129 | const struct cmac_ops *ops; | 
| Christoph Lameter | 8199d3a | 2005-03-30 13:34:31 -0800 | [diff] [blame] | 130 | cmac_instance *instance; | 
|  | 131 | }; | 
|  | 132 |  | 
|  | 133 | struct gmac { | 
|  | 134 | unsigned int stats_update_period; | 
|  | 135 | struct cmac *(*create)(adapter_t *adapter, int index); | 
|  | 136 | int (*reset)(adapter_t *); | 
|  | 137 | }; | 
|  | 138 |  | 
| Stephen Hemminger | 459e536 | 2007-02-20 15:58:02 -0800 | [diff] [blame] | 139 | extern const struct gmac t1_pm3393_ops; | 
|  | 140 | extern const struct gmac t1_vsc7326_ops; | 
| Scott Bardone | 559fb51 | 2005-06-23 01:40:19 -0400 | [diff] [blame] | 141 |  | 
|  | 142 | #endif /* _CXGB_GMAC_H_ */ |