Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*****************************************************************************
3 * *
4 * File: gmac.h *
5 * $Revision: 1.6 $ *
6 * $Date: 2005/06/21 18:29:47 $ *
7 * Description: *
8 * Generic MAC functionality. *
9 * part of the Chelsio 10Gb Ethernet Driver. *
10 * *
11 * *
12 * http://www.chelsio.com *
13 * *
14 * Copyright (c) 2003 - 2005 Chelsio Communications, Inc. *
15 * All rights reserved. *
16 * *
17 * Maintainers: maintainers@chelsio.com *
18 * *
19 * Authors: Dimitrios Michailidis <dm@chelsio.com> *
20 * Tina Yang <tainay@chelsio.com> *
21 * Felix Marti <felix@chelsio.com> *
22 * Scott Bardone <sbardone@chelsio.com> *
23 * Kurt Ottaway <kottaway@chelsio.com> *
24 * Frank DiMambro <frank@chelsio.com> *
25 * *
26 * History: *
27 * *
28 ****************************************************************************/
29
30#ifndef _CXGB_GMAC_H_
31#define _CXGB_GMAC_H_
32
33#include "common.h"
34
35enum {
36 MAC_STATS_UPDATE_FAST,
37 MAC_STATS_UPDATE_FULL
38};
39
40enum {
41 MAC_DIRECTION_RX = 1,
42 MAC_DIRECTION_TX = 2
43};
44
45struct cmac_statistics {
46 /* Transmit */
47 u64 TxOctetsOK;
48 u64 TxOctetsBad;
49 u64 TxUnicastFramesOK;
50 u64 TxMulticastFramesOK;
51 u64 TxBroadcastFramesOK;
52 u64 TxPauseFrames;
53 u64 TxFramesWithDeferredXmissions;
54 u64 TxLateCollisions;
55 u64 TxTotalCollisions;
56 u64 TxFramesAbortedDueToXSCollisions;
57 u64 TxUnderrun;
58 u64 TxLengthErrors;
59 u64 TxInternalMACXmitError;
60 u64 TxFramesWithExcessiveDeferral;
61 u64 TxFCSErrors;
62 u64 TxJumboFramesOK;
63 u64 TxJumboOctetsOK;
64
65 /* Receive */
66 u64 RxOctetsOK;
67 u64 RxOctetsBad;
68 u64 RxUnicastFramesOK;
69 u64 RxMulticastFramesOK;
70 u64 RxBroadcastFramesOK;
71 u64 RxPauseFrames;
72 u64 RxFCSErrors;
73 u64 RxAlignErrors;
74 u64 RxSymbolErrors;
75 u64 RxDataErrors;
76 u64 RxSequenceErrors;
77 u64 RxRuntErrors;
78 u64 RxJabberErrors;
79 u64 RxInternalMACRcvError;
80 u64 RxInRangeLengthErrors;
81 u64 RxOutOfRangeLengthField;
82 u64 RxFrameTooLongErrors;
83 u64 RxJumboFramesOK;
84 u64 RxJumboOctetsOK;
85};
86
87struct cmac_ops {
88 void (*destroy)(struct cmac *);
89 int (*reset)(struct cmac *);
90 int (*interrupt_enable)(struct cmac *);
91 int (*interrupt_disable)(struct cmac *);
92 int (*interrupt_clear)(struct cmac *);
93 int (*interrupt_handler)(struct cmac *);
94
95 int (*enable)(struct cmac *, int);
96 int (*disable)(struct cmac *, int);
97
98 int (*loopback_enable)(struct cmac *);
99 int (*loopback_disable)(struct cmac *);
100
101 int (*set_mtu)(struct cmac *, int mtu);
102 int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm);
103
104 int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc);
105 int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex,
106 int *fc);
107
108 const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
109
110 int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
111 int (*macaddress_set)(struct cmac *, const u8 mac_addr[6]);
112};
113
114typedef struct _cmac_instance cmac_instance;
115
116struct cmac {
117 struct cmac_statistics stats;
118 adapter_t *adapter;
119 const struct cmac_ops *ops;
120 cmac_instance *instance;
121};
122
123struct gmac {
124 unsigned int stats_update_period;
125 struct cmac *(*create)(adapter_t *adapter, int index);
126 int (*reset)(adapter_t *);
127};
128
129extern const struct gmac t1_pm3393_ops;
130extern const struct gmac t1_vsc7326_ops;
131
132#endif /* _CXGB_GMAC_H_ */
1/*****************************************************************************
2 * *
3 * File: gmac.h *
4 * $Revision: 1.6 $ *
5 * $Date: 2005/06/21 18:29:47 $ *
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, see <http://www.gnu.org/licenses/>. *
16 * *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED *
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF *
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
20 * *
21 * http://www.chelsio.com *
22 * *
23 * Copyright (c) 2003 - 2005 Chelsio Communications, Inc. *
24 * All rights reserved. *
25 * *
26 * Maintainers: maintainers@chelsio.com *
27 * *
28 * Authors: Dimitrios Michailidis <dm@chelsio.com> *
29 * Tina Yang <tainay@chelsio.com> *
30 * Felix Marti <felix@chelsio.com> *
31 * Scott Bardone <sbardone@chelsio.com> *
32 * Kurt Ottaway <kottaway@chelsio.com> *
33 * Frank DiMambro <frank@chelsio.com> *
34 * *
35 * History: *
36 * *
37 ****************************************************************************/
38
39#ifndef _CXGB_GMAC_H_
40#define _CXGB_GMAC_H_
41
42#include "common.h"
43
44enum {
45 MAC_STATS_UPDATE_FAST,
46 MAC_STATS_UPDATE_FULL
47};
48
49enum {
50 MAC_DIRECTION_RX = 1,
51 MAC_DIRECTION_TX = 2
52};
53
54struct cmac_statistics {
55 /* Transmit */
56 u64 TxOctetsOK;
57 u64 TxOctetsBad;
58 u64 TxUnicastFramesOK;
59 u64 TxMulticastFramesOK;
60 u64 TxBroadcastFramesOK;
61 u64 TxPauseFrames;
62 u64 TxFramesWithDeferredXmissions;
63 u64 TxLateCollisions;
64 u64 TxTotalCollisions;
65 u64 TxFramesAbortedDueToXSCollisions;
66 u64 TxUnderrun;
67 u64 TxLengthErrors;
68 u64 TxInternalMACXmitError;
69 u64 TxFramesWithExcessiveDeferral;
70 u64 TxFCSErrors;
71 u64 TxJumboFramesOK;
72 u64 TxJumboOctetsOK;
73
74 /* Receive */
75 u64 RxOctetsOK;
76 u64 RxOctetsBad;
77 u64 RxUnicastFramesOK;
78 u64 RxMulticastFramesOK;
79 u64 RxBroadcastFramesOK;
80 u64 RxPauseFrames;
81 u64 RxFCSErrors;
82 u64 RxAlignErrors;
83 u64 RxSymbolErrors;
84 u64 RxDataErrors;
85 u64 RxSequenceErrors;
86 u64 RxRuntErrors;
87 u64 RxJabberErrors;
88 u64 RxInternalMACRcvError;
89 u64 RxInRangeLengthErrors;
90 u64 RxOutOfRangeLengthField;
91 u64 RxFrameTooLongErrors;
92 u64 RxJumboFramesOK;
93 u64 RxJumboOctetsOK;
94};
95
96struct cmac_ops {
97 void (*destroy)(struct cmac *);
98 int (*reset)(struct cmac *);
99 int (*interrupt_enable)(struct cmac *);
100 int (*interrupt_disable)(struct cmac *);
101 int (*interrupt_clear)(struct cmac *);
102 int (*interrupt_handler)(struct cmac *);
103
104 int (*enable)(struct cmac *, int);
105 int (*disable)(struct cmac *, int);
106
107 int (*loopback_enable)(struct cmac *);
108 int (*loopback_disable)(struct cmac *);
109
110 int (*set_mtu)(struct cmac *, int mtu);
111 int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm);
112
113 int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc);
114 int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex,
115 int *fc);
116
117 const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
118
119 int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
120 int (*macaddress_set)(struct cmac *, u8 mac_addr[6]);
121};
122
123typedef struct _cmac_instance cmac_instance;
124
125struct cmac {
126 struct cmac_statistics stats;
127 adapter_t *adapter;
128 const struct cmac_ops *ops;
129 cmac_instance *instance;
130};
131
132struct gmac {
133 unsigned int stats_update_period;
134 struct cmac *(*create)(adapter_t *adapter, int index);
135 int (*reset)(adapter_t *);
136};
137
138extern const struct gmac t1_pm3393_ops;
139extern const struct gmac t1_vsc7326_ops;
140
141#endif /* _CXGB_GMAC_H_ */