summaryrefslogtreecommitdiffstats
path: root/drivers/net/dgrs_ether.h
blob: 51596ce6cf84f63e20f7af0bd61c152103c2495d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
 *	A filtering function.  There are two filters/port.  Filter "0"
 *	is the input filter, and filter "1" is the output filter.
 */
typedef int (FILTER_FUNC)(uchar *pktp, int pktlen, ulong *scratch, int port);
#define	NFILTERS	2

/*
 *	The per port structure
 */
typedef struct
{
	int		chan;		/* Channel number (0-3) */
	ulong		portaddr;	/* address of 596 port register */
	volatile ulong	*ca;		/* address of 596 chan attention */
	ulong		intmask;	/* Interrupt mask for this port */
	ulong		intack;		/* Ack bit for this port */

	uchar		ethaddr[6];	/* Ethernet address of this port */
	int		is_promisc;	/* Port is promiscuous */

	int		debug;		/* Debugging turned on */

	I596_ISCP	*iscpp;		/* Uncached ISCP pointer */
	I596_SCP	*scpp;		/* Uncached SCP pointer */
	I596_SCB	*scbp;		/* Uncached SCB pointer */

	I596_ISCP	iscp;
	I596_SCB	scb;

	/* Command Queue */
	I596_CB		*cb0;
	I596_CB		*cbN;
	I596_CB		*cb_head;
	I596_CB		*cb_tail;

	/* Receive Queue */
	I596_RFD	*rfd0;
	I596_RFD	*rfdN;
	I596_RFD	*rfd_head;
	I596_RFD	*rfd_tail;

	/* Receive Buffers */
	I596_RBD	*rbd0;
	I596_RBD	*rbdN;
	I596_RBD	*rbd_head;
	I596_RBD	*rbd_tail;
	int		buf_size;	/* Size of an RBD buffer */
	int		buf_cnt;	/* Total RBD's allocated */

	/* Rx Statistics */
	ulong		cnt_rx_cnt;	/* Total packets rcvd, good and bad */ 
	ulong		cnt_rx_good;	/* Total good packets rcvd */
	ulong		cnt_rx_bad;	/* Total of all bad packets rcvd */
					/* Subtotals can be gotten from SCB */
	ulong		cnt_rx_nores;	/* No resources */
	ulong		cnt_rx_bytes;	/* Total bytes rcvd */

	/* Tx Statistics */
	ulong		cnt_tx_queued;
	ulong		cnt_tx_done;
	ulong		cnt_tx_freed;
	ulong		cnt_tx_nores;	/* No resources */

	ulong		cnt_tx_bad;
	ulong		cnt_tx_err_late;
	ulong		cnt_tx_err_nocrs;
	ulong		cnt_tx_err_nocts;
	ulong		cnt_tx_err_under;
	ulong		cnt_tx_err_maxcol;
	ulong		cnt_tx_collisions;

	/* Special stuff for host */
#	define		rfd_freed	cnt_rx_cnt
	ulong		rbd_freed;
	int		host_timer;

	/* Added after first beta */
	ulong		cnt_tx_races;	/* Counts race conditions */
	int		spanstate;
	ulong		cnt_st_tx;	/* send span tree pkts */
	ulong		cnt_st_fail_tx;	/* Failures to send span tree pkts */
	ulong		cnt_st_fail_rbd;/* Failures to send span tree pkts */
	ulong		cnt_st_rx;	/* rcv span tree pkts */
	ulong		cnt_st_rx_bad;	/* bogus st packets rcvd */
	ulong		cnt_rx_fwd;	/* Rcvd packets that were forwarded */

	ulong		cnt_rx_mcast;	/* Multicast pkts received */
	ulong		cnt_tx_mcast;	/* Multicast pkts transmitted */
	ulong		cnt_tx_bytes;	/* Bytes transmitted */

	/*
	 *	Packet filtering
	 *	Filter 0: input filter
	 *	Filter 1: output filter
	 */
	
	ulong		*filter_space[NFILTERS];
	FILTER_FUNC	*filter_func[NFILTERS];
	ulong		filter_cnt[NFILTERS];
	ulong		filter_len[NFILTERS];

	ulong		pad[ (512-300) / 4];
} PORT;

/*
 *	Port[0]			is host interface
 *	Port[1..SE_NPORTS]	are external 10 Base T ports.  Fewer may be in
 *				use, depending on whether this is an SE-4 or
 *				an SE-6.
 *	Port[SE_NPORTS]		Pseudo-port for Spanning tree and SNMP
 */
extern PORT	Port[1+SE_NPORTS+1];

extern int	Nports;		/* Number of genuine ethernet controllers */
extern int	Nchan;		/* ... plus one for host interface */

extern int	FirstChan;	/* 0 or 1, depedning on whether host is used */
extern int	NumChan;	/* 4 or 5 */

/*
 *	A few globals
 */
extern int	IsPromisc;
extern int	MultiNicMode;

/*
 *	Functions
 */
extern void	eth_xmit_spew_on(PORT *p, int cnt);
extern void	eth_xmit_spew_off(PORT *p);

extern I596_RBD	*alloc_rbds(PORT *p, int num);

extern I596_CB * eth_cb_alloc(PORT *p);
OpenPOWER on IntegriCloud