1: /*
2: * SCCSID: @(#)if_de.h 1.1 (2.11BSD GTE) 12/31/93
3: */
4:
5: /* Header files and definitons to support multiple DEUNAs */
6:
7: #include "socket.h"
8: #include "../net/if.h"
9: #include "../net/netisr.h"
10: #include "../net/route.h"
11:
12: #ifdef INET
13: #include "../netinet/in.h"
14: #include "../netinet/in_systm.h"
15: #include "../netinet/in_var.h"
16: #include "../netinet/ip.h"
17: #include "../netinet/if_ether.h"
18: #endif /* INET */
19:
20: #ifdef NS
21: #include "../netns/ns.h"
22: #include "../netns/ns_if.h"
23: #endif /* NS */
24:
25: #include "../pdpif/if_dereg.h"
26: #include "../pdpuba/ubavar.h"
27: #include "../pdpif/if_uba.h"
28:
29: /*
30: * These numbers are based on the amount of space that is allocated
31: * int netinit() to miobase, for 4 + 6, miosize must be 16384 instead
32: * of the 8192 allocated originally. m_ioget() gets a click address
33: * within the allocated region. NOTE: the UMR handling has been fixed
34: * in 2.11BSD to allocate only the number of UMRs required by the size
35: * of the m_ioget I/O region - a UMR per buffer is NO LONGER THE CASE!
36: * Note that the size of a buffer is:
37: * 1500 (ETHERMTU) + sizeof(ether_header) + some rounding from btoc() =
38: * 1536 bytes or 24 clicks.
39: */
40:
41: #define NXMT 4 /* number of transmit buffers */
42: #define NRCV 6 /* number of receive buffers (must be > 1) */
43:
44: #ifdef DE_DO_MULTI
45: /*
46: * Multicast address list structure
47: */
48: struct de_m_add {
49: u_char dm_char[6];
50: };
51: #define MULTISIZE sizeof(struct de_m_add)
52: #define NMULTI 10 /* # of multicast addrs on the DEUNA */
53: #endif /* DE_DO_MULTI */
54:
55: /*
56: * The deuba structures generalizes the ifuba structure
57: * to an arbitrary number of receive and transmit buffers.
58: */
59: struct deuba {
60: u_short ifu_hlen; /* local net header length */
61: struct ifrw difu_r[NRCV]; /* receive information */
62: struct ifrw difu_w[NXMT]; /* transmit information */
63: short difu_flags;
64: };
65: /*
66: * Ethernet software status per interface.
67: *
68: * Each interface is referenced by a network interface structure,
69: * ds_if, which the routing code uses to locate the interface.
70: * This structure contains the output queue for the interface, its address, ...
71: * We also have, for each interface, a UBA interface structure, which
72: * contains information about the UNIBUS resources held by the interface:
73: * map registers, buffered data paths, etc. Information is cached in this
74: * structure for use by the if_uba.c routines in running the interface
75: * efficiently.
76: */
77: struct de_softc {
78: struct arpcom ds_ac; /* Ethernet common part */
79: #define ds_if ds_ac.ac_if /* network-visible interface */
80: #define ds_addr ds_ac.ac_enaddr /* hardware Ethernet address */
81: char ds_flags; /* Has the board be initialized? */
82: #define DSF_LOCK 1
83: #define DSF_RUNNING 2
84: #define DSF_SETADDR 4
85: char ds_devid; /* device id DEUNA=0, DELUA=1 */
86: ubadr_t ds_ubaddr; /* map info for incore structs */
87: struct deuba ds_deuba; /* unibus resource structure */
88: /* the following structures are always mapped in */
89: struct de_pcbb ds_pcbb; /* port control block */
90: struct de_ring ds_xrent[NXMT]; /* transmit ring entrys */
91: struct de_ring ds_rrent[NRCV]; /* receive ring entrys */
92: struct de_udbbuf ds_udbbuf; /* UNIBUS data buffer */
93: #ifdef DE_DO_MULTI
94: struct de_m_add ds_multicast[NMULTI]; /* multicast addr list */
95: #endif /* DE_DO_MULTI */
96:
97: #ifdef DE_DO_BCTRS
98: struct de_counters ds_counters;/* counter block */
99: #endif /* DE_DO_BCTRS */
100:
101: /* end mapped area */
102: #define INCORE_BASE(p) ((char *)&(p)->ds_pcbb)
103: #define RVAL_OFF(n) ((char *)&de_softc[0].n - INCORE_BASE(&de_softc[0]))
104: #define LVAL_OFF(n) ((char *)de_softc[0].n - INCORE_BASE(&de_softc[0]))
105: #define PCBB_OFFSET RVAL_OFF(ds_pcbb)
106: #define XRENT_OFFSET LVAL_OFF(ds_xrent)
107: #define RRENT_OFFSET LVAL_OFF(ds_rrent)
108: #define UDBBUF_OFFSET RVAL_OFF(ds_udbbuf)
109:
110: #ifdef DE_DO_MULTI
111: #define MULTI_OFFSET RVAL_OFF(ds_multicast[0])
112: #endif /* DE_DO_MULTI */
113:
114: #ifdef DE_DO_BCTRS
115: #define COUNTER_OFFSET RVAL_OFF(ds_counters)
116: #endif /* DE_DO_BCTRS */
117:
118: #define INCORE_SIZE RVAL_OFF(ds_xindex)
119: u_char ds_xindex; /* UNA index into transmit chain */
120: u_char ds_rindex; /* UNA index into receive chain */
121: u_char ds_xfree; /* index for next transmit buffer */
122: u_char ds_nxmit; /* # of transmits in progress */
123:
124: #ifdef DE_DO_MULTI
125: u_char ds_muse[NMULTI]; /* multicast address use */
126: #endif /* DE_DO_MULTI */
127:
128: #ifdef DE_DO_BCTRS
129: long ds_ztime; /* time counters were last zeroed */
130: u_short ds_unrecog; /* unrecognized frame destination */
131: #endif /* DE_DO_BCTRS */
132: };
133:
134: /*
135: * These are the Ultrix ioctl's that are specific to this driver
136: */
137:
138: #ifdef DE_DO_PHYSADDR
139: #define SIOCSPHYSADDR _IOWR(i,23, struct ifreq) /* Set phys. ad.*/
140: #define SIOCRPHYSADDR _IOWR(i,28, struct ifdevea) /* Read phy. ad.*/
141: #endif /* DE_DO_PHYSADDR */
142:
143: #ifdef DE_DO_MULTI
144: #define SIOCADDMULTI _IOWR(i,24, struct ifreq) /* Add m.c. ad. */
145: #define SIOCDELMULTI _IOWR(i,25, struct ifreq) /* Dele. m.c.ad.*/
146: #endif /* DE_DO_MULTI */
147:
148: #ifdef DE_DO_BCTRS
149: #define SIOCRDCTRS _IOWR(i,26, struct ctrreq) /* Read if cntr.*/
150: #define SIOCRDZCTRS _IOWR(i,27, struct ctrreq) /* Read/0 if c. */
151: #endif /* DE_DO_BCTRS */
152:
153: #ifdef DE_INT_LOOPBACK
154: #define SIOCDISABLBACK _IOW(i,34, struct ifreq) /* Cl.in.ex.lpb.*/
155: #define SIOCENABLBACK _IOW(i,33, struct ifreq) /* Set in.ex.lb.*/
156: #endif /* DE_INT_LOOPBACK */
Defined struct's
de_softc
defined in line
77; used 24 times
- in /usr/src/sys/pdpif/if_de.c line
74(2),
173(2),
260(2),
389(2),
443(2),
563(2),
619(2),
760(2),
1066(2),
1309(2),
1354(2),
1389(2)
deuba
defined in line
59; used 8 times
Defined macros
DSF_RUNNING
defined in line
83; used 14 times
- in /usr/src/sys/pdpif/if_de.c line
274,
364,
415,
430,
1101,
1119,
1161,
1181,
1258-1262(2),
1268,
1318,
1340,
1393
NRCV
defined in line
42; used 7 times
NXMT
defined in line
41; used 10 times
ds_if
defined in line
79; used 19 times
- in /usr/src/sys/pdpif/if_de.c line
174,
264,
286,
361,
398,
496,
502,
513-521(4),
541,
570-573(2),
579,
675,
709,
716,
736
Usage of this include