blob: 7539b596bff8e2bf4d1045e2ad41b05fd50c5323 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * A filtering function. There are two filters/port. Filter "0"
3 * is the input filter, and filter "1" is the output filter.
4 */
5typedef int (FILTER_FUNC)(uchar *pktp, int pktlen, ulong *scratch, int port);
6#define NFILTERS 2
7
8/*
9 * The per port structure
10 */
11typedef struct
12{
13 int chan; /* Channel number (0-3) */
14 ulong portaddr; /* address of 596 port register */
15 volatile ulong *ca; /* address of 596 chan attention */
16 ulong intmask; /* Interrupt mask for this port */
17 ulong intack; /* Ack bit for this port */
18
19 uchar ethaddr[6]; /* Ethernet address of this port */
20 int is_promisc; /* Port is promiscuous */
21
22 int debug; /* Debugging turned on */
23
24 I596_ISCP *iscpp; /* Uncached ISCP pointer */
25 I596_SCP *scpp; /* Uncached SCP pointer */
26 I596_SCB *scbp; /* Uncached SCB pointer */
27
28 I596_ISCP iscp;
29 I596_SCB scb;
30
31 /* Command Queue */
32 I596_CB *cb0;
33 I596_CB *cbN;
34 I596_CB *cb_head;
35 I596_CB *cb_tail;
36
37 /* Receive Queue */
38 I596_RFD *rfd0;
39 I596_RFD *rfdN;
40 I596_RFD *rfd_head;
41 I596_RFD *rfd_tail;
42
43 /* Receive Buffers */
44 I596_RBD *rbd0;
45 I596_RBD *rbdN;
46 I596_RBD *rbd_head;
47 I596_RBD *rbd_tail;
48 int buf_size; /* Size of an RBD buffer */
49 int buf_cnt; /* Total RBD's allocated */
50
51 /* Rx Statistics */
Jeff Garzik6aa20a22006-09-13 13:24:59 -040052 ulong cnt_rx_cnt; /* Total packets rcvd, good and bad */
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 ulong cnt_rx_good; /* Total good packets rcvd */
54 ulong cnt_rx_bad; /* Total of all bad packets rcvd */
55 /* Subtotals can be gotten from SCB */
56 ulong cnt_rx_nores; /* No resources */
57 ulong cnt_rx_bytes; /* Total bytes rcvd */
58
59 /* Tx Statistics */
60 ulong cnt_tx_queued;
61 ulong cnt_tx_done;
62 ulong cnt_tx_freed;
63 ulong cnt_tx_nores; /* No resources */
64
65 ulong cnt_tx_bad;
66 ulong cnt_tx_err_late;
67 ulong cnt_tx_err_nocrs;
68 ulong cnt_tx_err_nocts;
69 ulong cnt_tx_err_under;
70 ulong cnt_tx_err_maxcol;
71 ulong cnt_tx_collisions;
72
73 /* Special stuff for host */
74# define rfd_freed cnt_rx_cnt
75 ulong rbd_freed;
76 int host_timer;
77
78 /* Added after first beta */
79 ulong cnt_tx_races; /* Counts race conditions */
80 int spanstate;
81 ulong cnt_st_tx; /* send span tree pkts */
82 ulong cnt_st_fail_tx; /* Failures to send span tree pkts */
83 ulong cnt_st_fail_rbd;/* Failures to send span tree pkts */
84 ulong cnt_st_rx; /* rcv span tree pkts */
85 ulong cnt_st_rx_bad; /* bogus st packets rcvd */
86 ulong cnt_rx_fwd; /* Rcvd packets that were forwarded */
87
88 ulong cnt_rx_mcast; /* Multicast pkts received */
89 ulong cnt_tx_mcast; /* Multicast pkts transmitted */
90 ulong cnt_tx_bytes; /* Bytes transmitted */
91
92 /*
93 * Packet filtering
94 * Filter 0: input filter
95 * Filter 1: output filter
96 */
Jeff Garzik6aa20a22006-09-13 13:24:59 -040097
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 ulong *filter_space[NFILTERS];
99 FILTER_FUNC *filter_func[NFILTERS];
100 ulong filter_cnt[NFILTERS];
101 ulong filter_len[NFILTERS];
102
103 ulong pad[ (512-300) / 4];
104} PORT;
105
106/*
107 * Port[0] is host interface
108 * Port[1..SE_NPORTS] are external 10 Base T ports. Fewer may be in
109 * use, depending on whether this is an SE-4 or
110 * an SE-6.
111 * Port[SE_NPORTS] Pseudo-port for Spanning tree and SNMP
112 */
113extern PORT Port[1+SE_NPORTS+1];
114
115extern int Nports; /* Number of genuine ethernet controllers */
116extern int Nchan; /* ... plus one for host interface */
117
118extern int FirstChan; /* 0 or 1, depedning on whether host is used */
119extern int NumChan; /* 4 or 5 */
120
121/*
122 * A few globals
123 */
124extern int IsPromisc;
125extern int MultiNicMode;
126
127/*
128 * Functions
129 */
130extern void eth_xmit_spew_on(PORT *p, int cnt);
131extern void eth_xmit_spew_off(PORT *p);
132
133extern I596_RBD *alloc_rbds(PORT *p, int num);
134
135extern I596_CB * eth_cb_alloc(PORT *p);