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