Deleted Added
sdiff udiff text old ( 13638 ) new ( 13937 )
full compact
1/*
2 * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
3 *
4 * This software may be used, modified, copied, distributed, and sold, in
5 * both source and binary form provided that the above copyright, these
6 * terms and the following disclaimer are retained. The name of the author
7 * and/or the contributor may not be used to endorse or promote products
8 * derived from this software without specific prior written permission.

--- 200 unchanged lines hidden (view full) ---

209 u_char proto_dlcr5; /* DLCR5 prototype. */
210 u_char proto_dlcr6; /* DLCR6 prototype. */
211 u_char proto_dlcr7; /* DLCR7 prototype. */
212
213 /* Vendor specific hooks. */
214 void ( * init )( struct fe_softc * ); /* Just before fe_init(). */
215 void ( * stop )( struct fe_softc * ); /* Just after fe_stop(). */
216
217 /* Transmission buffer management. */
218 u_short txb_free; /* free bytes in TX buffer */
219 u_char txb_count; /* number of packets in TX buffer */
220 u_char txb_sched; /* number of scheduled packets */
221 u_char txb_padding; /* number of delayed padding bytes */
222
223 /* Multicast address filter management. */
224 u_char filter_change; /* MARs must be changed ASAP. */
225 struct fe_filter filter;/* new filter value. */
226
227} fe_softc[NFE];
228
229/* Frequently accessed members in arpcom and kdc. */
230#define sc_if arpcom.ac_if
231#define sc_unit arpcom.ac_if.if_unit
232#define sc_enaddr arpcom.ac_enaddr
233#define sc_dcstate kdc.kdc_state
234#define sc_description kdc.kdc_description
235
236#define IFNET2SOFTC(P) (P)->if_softc
237
238/* Standard driver entry points. These can be static. */
239static int fe_probe ( struct isa_device * );
240static int fe_attach ( struct isa_device * );
241static void fe_init ( int );
242static int fe_ioctl ( struct ifnet *, int, caddr_t );
243static void fe_start ( struct ifnet * );
244static void fe_reset ( int );

--- 10 unchanged lines hidden (view full) ---

255static void fe_rint ( struct fe_softc *, u_char );
256static void fe_xmit ( struct fe_softc * );
257static void fe_write_mbufs ( struct fe_softc *, struct mbuf * );
258static struct fe_filter
259 fe_mcaf ( struct fe_softc * );
260static int fe_hash ( u_char * );
261static void fe_setmode ( struct fe_softc * );
262static void fe_loadmar ( struct fe_softc * );
263#if FE_DEBUG >= 1
264static void fe_dump ( int, struct fe_softc *, char * );
265#endif
266
267/* Ethernet constants. To be defined in if_ehter.h? FIXME. */
268#define ETHER_MIN_LEN 60 /* with header, without CRC. */
269#define ETHER_MAX_LEN 1514 /* with header, without CRC. */
270#define ETHER_ADDR_LEN 6 /* number of bytes in an address. */

--- 773 unchanged lines hidden (view full) ---

1044static int
1045fe_attach ( struct isa_device *isa_dev )
1046{
1047 struct fe_softc *sc = &fe_softc[isa_dev->id_unit];
1048
1049 /*
1050 * Initialize ifnet structure
1051 */
1052 sc->sc_if.if_softc = sc;
1053 sc->sc_if.if_unit = sc->sc_unit;
1054 sc->sc_if.if_name = "fe";
1055 sc->sc_if.if_output = ether_output;
1056 sc->sc_if.if_start = fe_start;
1057 sc->sc_if.if_ioctl = fe_ioctl;
1058 sc->sc_if.if_watchdog = fe_watchdog;
1059
1060 /*

--- 45 unchanged lines hidden (view full) ---

1106 sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB;
1107 sc->txb_size = 2048;
1108 break;
1109 }
1110
1111 /* Attach and stop the interface. */
1112 if_attach( &sc->sc_if );
1113 fe_stop( sc->sc_unit ); /* This changes the state to IDLE. */
1114 ether_ifattach(&sc->sc_if);
1115
1116 /* Print additional info when attached. */
1117 printf( "fe%d: address %6D, type %s\n", sc->sc_unit,
1118 sc->sc_enaddr, ":" , sc->typestr );
1119#if FE_DEBUG >= 3
1120 {
1121 int buf, txb, bbw, sbw, ram;
1122

--- 23 unchanged lines hidden (view full) ---

1146 }
1147 printf( "fe%d: SRAM %dKB %dbit %dns, TXB %dKBx2, %dbit I/O\n",
1148 sc->sc_unit, buf, bbw, ram, txb, sbw );
1149 }
1150#endif
1151
1152#if NBPFILTER > 0
1153 /* If BPF is in the kernel, call the attach for it. */
1154 bpfattach(&sc->sc_if, DLT_EN10MB, sizeof(struct ether_header));
1155#endif
1156 return 1;
1157}
1158
1159/*
1160 * Reset interface.
1161 */
1162static void

--- 920 unchanged lines hidden (view full) ---

2083 struct ifreq * ifr = ( struct ifreq * )data;
2084
2085 bcopy((caddr_t)sc->sc_enaddr,
2086 (caddr_t)&ifr->ifr_data, ETHER_ADDR_LEN);
2087 break;
2088 }
2089#endif
2090
2091#ifdef notdef
2092#ifdef SIOCSIFPHYSADDR
2093 case SIOCSIFPHYSADDR:
2094 {
2095 /*
2096 * Set the physical (Ehternet) address of the interface.
2097 * When and by whom is this command used? FIXME.
2098 */
2099 struct ifreq * ifr = ( struct ifreq * )data;
2100
2101 bcopy((caddr_t)&ifr->ifr_data,
2102 (caddr_t)sc->sc_enaddr, ETHER_ADDR_LEN);
2103 fe_setlinkaddr( sc );
2104 break;
2105 }
2106#endif
2107#endif /* notdef */
2108
2109#ifdef SIOCSIFFLAGS
2110 case SIOCSIFFLAGS:
2111 {
2112 /*
2113 * Switch interface state between "running" and
2114 * "stopped", reflecting the UP flag.
2115 */

--- 147 unchanged lines hidden (view full) ---

2263
2264#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1)
2265
2266#if NBPFILTER > 0
2267 /*
2268 * Check if there's a BPF listener on this interface.
2269 * If it is, hand off the raw packet to bpf.
2270 */
2271 if ( sc->sc_if.if_bpf ) {
2272 bpf_mtap( &sc->sc_if, m );
2273 }
2274#endif
2275
2276 /*
2277 * Make sure this packet is (or may be) directed to us.
2278 * That is, the packet is either unicasted to our address,
2279 * or broad/multi-casted. If any other packets are
2280 * received, it is an indication of an error -- probably

--- 384 unchanged lines hidden (view full) ---

2665 /* We have just updated the filter. */
2666 sc->filter_change = 0;
2667
2668#if FE_DEBUG >= 3
2669 log( LOG_INFO, "fe%d: address filter changed\n", sc->sc_unit );
2670#endif
2671}
2672
2673#if FE_DEBUG >= 1
2674static void
2675fe_dump ( int level, struct fe_softc * sc, char * message )
2676{
2677 log( level, "fe%d: %s,"
2678 " DLCR = %02x %02x %02x %02x %02x %02x %02x %02x,"
2679 " BMPR = xx xx %02x %02x %02x %02x %02x %02x,"
2680 " asic = %02x %02x %02x %02x %02x %02x %02x %02x"

--- 19 unchanged lines hidden ---