18c2ecf20Sopenharmony_ci/*****************************************************************************
28c2ecf20Sopenharmony_ci *                                                                           *
38c2ecf20Sopenharmony_ci * File: gmac.h                                                              *
48c2ecf20Sopenharmony_ci * $Revision: 1.6 $                                                          *
58c2ecf20Sopenharmony_ci * $Date: 2005/06/21 18:29:47 $                                              *
68c2ecf20Sopenharmony_ci * Description:                                                              *
78c2ecf20Sopenharmony_ci *  Generic MAC functionality.                                               *
88c2ecf20Sopenharmony_ci *  part of the Chelsio 10Gb Ethernet Driver.                                *
98c2ecf20Sopenharmony_ci *                                                                           *
108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify      *
118c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, version 2, as       *
128c2ecf20Sopenharmony_ci * published by the Free Software Foundation.                                *
138c2ecf20Sopenharmony_ci *                                                                           *
148c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along   *
158c2ecf20Sopenharmony_ci * with this program; if not, see <http://www.gnu.org/licenses/>.            *
168c2ecf20Sopenharmony_ci *                                                                           *
178c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED    *
188c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF      *
198c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.                     *
208c2ecf20Sopenharmony_ci *                                                                           *
218c2ecf20Sopenharmony_ci * http://www.chelsio.com                                                    *
228c2ecf20Sopenharmony_ci *                                                                           *
238c2ecf20Sopenharmony_ci * Copyright (c) 2003 - 2005 Chelsio Communications, Inc.                    *
248c2ecf20Sopenharmony_ci * All rights reserved.                                                      *
258c2ecf20Sopenharmony_ci *                                                                           *
268c2ecf20Sopenharmony_ci * Maintainers: maintainers@chelsio.com                                      *
278c2ecf20Sopenharmony_ci *                                                                           *
288c2ecf20Sopenharmony_ci * Authors: Dimitrios Michailidis   <dm@chelsio.com>                         *
298c2ecf20Sopenharmony_ci *          Tina Yang               <tainay@chelsio.com>                     *
308c2ecf20Sopenharmony_ci *          Felix Marti             <felix@chelsio.com>                      *
318c2ecf20Sopenharmony_ci *          Scott Bardone           <sbardone@chelsio.com>                   *
328c2ecf20Sopenharmony_ci *          Kurt Ottaway            <kottaway@chelsio.com>                   *
338c2ecf20Sopenharmony_ci *          Frank DiMambro          <frank@chelsio.com>                      *
348c2ecf20Sopenharmony_ci *                                                                           *
358c2ecf20Sopenharmony_ci * History:                                                                  *
368c2ecf20Sopenharmony_ci *                                                                           *
378c2ecf20Sopenharmony_ci ****************************************************************************/
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#ifndef _CXGB_GMAC_H_
408c2ecf20Sopenharmony_ci#define _CXGB_GMAC_H_
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#include "common.h"
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cienum {
458c2ecf20Sopenharmony_ci	MAC_STATS_UPDATE_FAST,
468c2ecf20Sopenharmony_ci	MAC_STATS_UPDATE_FULL
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cienum {
508c2ecf20Sopenharmony_ci	MAC_DIRECTION_RX = 1,
518c2ecf20Sopenharmony_ci	MAC_DIRECTION_TX = 2
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistruct cmac_statistics {
558c2ecf20Sopenharmony_ci	/* Transmit */
568c2ecf20Sopenharmony_ci	u64 TxOctetsOK;
578c2ecf20Sopenharmony_ci	u64 TxOctetsBad;
588c2ecf20Sopenharmony_ci	u64 TxUnicastFramesOK;
598c2ecf20Sopenharmony_ci	u64 TxMulticastFramesOK;
608c2ecf20Sopenharmony_ci	u64 TxBroadcastFramesOK;
618c2ecf20Sopenharmony_ci	u64 TxPauseFrames;
628c2ecf20Sopenharmony_ci	u64 TxFramesWithDeferredXmissions;
638c2ecf20Sopenharmony_ci	u64 TxLateCollisions;
648c2ecf20Sopenharmony_ci	u64 TxTotalCollisions;
658c2ecf20Sopenharmony_ci	u64 TxFramesAbortedDueToXSCollisions;
668c2ecf20Sopenharmony_ci	u64 TxUnderrun;
678c2ecf20Sopenharmony_ci	u64 TxLengthErrors;
688c2ecf20Sopenharmony_ci	u64 TxInternalMACXmitError;
698c2ecf20Sopenharmony_ci	u64 TxFramesWithExcessiveDeferral;
708c2ecf20Sopenharmony_ci	u64 TxFCSErrors;
718c2ecf20Sopenharmony_ci	u64 TxJumboFramesOK;
728c2ecf20Sopenharmony_ci	u64 TxJumboOctetsOK;
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	/* Receive */
758c2ecf20Sopenharmony_ci	u64 RxOctetsOK;
768c2ecf20Sopenharmony_ci	u64 RxOctetsBad;
778c2ecf20Sopenharmony_ci	u64 RxUnicastFramesOK;
788c2ecf20Sopenharmony_ci	u64 RxMulticastFramesOK;
798c2ecf20Sopenharmony_ci	u64 RxBroadcastFramesOK;
808c2ecf20Sopenharmony_ci	u64 RxPauseFrames;
818c2ecf20Sopenharmony_ci	u64 RxFCSErrors;
828c2ecf20Sopenharmony_ci	u64 RxAlignErrors;
838c2ecf20Sopenharmony_ci	u64 RxSymbolErrors;
848c2ecf20Sopenharmony_ci	u64 RxDataErrors;
858c2ecf20Sopenharmony_ci	u64 RxSequenceErrors;
868c2ecf20Sopenharmony_ci	u64 RxRuntErrors;
878c2ecf20Sopenharmony_ci	u64 RxJabberErrors;
888c2ecf20Sopenharmony_ci	u64 RxInternalMACRcvError;
898c2ecf20Sopenharmony_ci	u64 RxInRangeLengthErrors;
908c2ecf20Sopenharmony_ci	u64 RxOutOfRangeLengthField;
918c2ecf20Sopenharmony_ci	u64 RxFrameTooLongErrors;
928c2ecf20Sopenharmony_ci	u64 RxJumboFramesOK;
938c2ecf20Sopenharmony_ci	u64 RxJumboOctetsOK;
948c2ecf20Sopenharmony_ci};
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistruct cmac_ops {
978c2ecf20Sopenharmony_ci	void (*destroy)(struct cmac *);
988c2ecf20Sopenharmony_ci	int (*reset)(struct cmac *);
998c2ecf20Sopenharmony_ci	int (*interrupt_enable)(struct cmac *);
1008c2ecf20Sopenharmony_ci	int (*interrupt_disable)(struct cmac *);
1018c2ecf20Sopenharmony_ci	int (*interrupt_clear)(struct cmac *);
1028c2ecf20Sopenharmony_ci	int (*interrupt_handler)(struct cmac *);
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci	int (*enable)(struct cmac *, int);
1058c2ecf20Sopenharmony_ci	int (*disable)(struct cmac *, int);
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	int (*loopback_enable)(struct cmac *);
1088c2ecf20Sopenharmony_ci	int (*loopback_disable)(struct cmac *);
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci	int (*set_mtu)(struct cmac *, int mtu);
1118c2ecf20Sopenharmony_ci	int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm);
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc);
1148c2ecf20Sopenharmony_ci	int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex,
1158c2ecf20Sopenharmony_ci				   int *fc);
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
1208c2ecf20Sopenharmony_ci	int (*macaddress_set)(struct cmac *, u8 mac_addr[6]);
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_citypedef struct _cmac_instance cmac_instance;
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_cistruct cmac {
1268c2ecf20Sopenharmony_ci	struct cmac_statistics stats;
1278c2ecf20Sopenharmony_ci	adapter_t *adapter;
1288c2ecf20Sopenharmony_ci	const struct cmac_ops *ops;
1298c2ecf20Sopenharmony_ci	cmac_instance *instance;
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cistruct gmac {
1338c2ecf20Sopenharmony_ci	unsigned int stats_update_period;
1348c2ecf20Sopenharmony_ci	struct cmac *(*create)(adapter_t *adapter, int index);
1358c2ecf20Sopenharmony_ci	int (*reset)(adapter_t *);
1368c2ecf20Sopenharmony_ci};
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ciextern const struct gmac t1_pm3393_ops;
1398c2ecf20Sopenharmony_ciextern const struct gmac t1_vsc7326_ops;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#endif /* _CXGB_GMAC_H_ */
142