1*8462Sroot /* if_en.c 4.69 82/10/10 */ 24686Swnj 34686Swnj #include "en.h" 45105Swnj 54686Swnj /* 65105Swnj * Xerox prototype (3 Mb) Ethernet interface driver. 74686Swnj */ 84686Swnj 94686Swnj #include "../h/param.h" 104686Swnj #include "../h/systm.h" 114686Swnj #include "../h/mbuf.h" 124686Swnj #include "../h/pte.h" 134686Swnj #include "../h/buf.h" 145083Swnj #include "../h/protosw.h" 155083Swnj #include "../h/socket.h" 165083Swnj #include "../h/vmmac.h" 17*8462Sroot #include <errno.h> 18*8462Sroot 19*8462Sroot #include "../net/if.h" 20*8462Sroot #include "../net/netisr.h" 21*8462Sroot #include "../net/route.h" 228418Swnj #include "../netinet/in.h" 238418Swnj #include "../netinet/in_systm.h" 248418Swnj #include "../netinet/ip.h" 258418Swnj #include "../netinet/ip_var.h" 268418Swnj #include "../netpup/pup.h" 274686Swnj 28*8462Sroot #include "../vax/cpu.h" 29*8462Sroot #include "../vax/mtpr.h" 30*8462Sroot #include "../vaxif/if_en.h" 31*8462Sroot #include "../vaxif/if_enreg.h" 32*8462Sroot #include "../vaxif/if_uba.h" 33*8462Sroot #include "../vaxuba/ubareg.h" 34*8462Sroot #include "../vaxuba/ubavar.h" 35*8462Sroot 365213Swnj #define ENMTU (1024+512) 376925Swnj #define ENMRU (1024+512+16) /* 16 is enough to receive trailer */ 385083Swnj 394686Swnj int enprobe(), enattach(), enrint(), enxint(), encollide(); 404686Swnj struct uba_device *eninfo[NEN]; 414686Swnj u_short enstd[] = { 0 }; 424686Swnj struct uba_driver endriver = 435171Swnj { enprobe, 0, enattach, 0, enstd, "en", eninfo }; 444686Swnj #define ENUNIT(x) minor(x) 454686Swnj 465105Swnj int eninit(),enoutput(),enreset(); 475105Swnj 485105Swnj /* 495105Swnj * Ethernet software status per interface. 505105Swnj * 515105Swnj * Each interface is referenced by a network interface structure, 525105Swnj * es_if, which the routing code uses to locate the interface. 535105Swnj * This structure contains the output queue for the interface, its address, ... 545105Swnj * We also have, for each interface, a UBA interface structure, which 555105Swnj * contains information about the UNIBUS resources held by the interface: 565105Swnj * map registers, buffered data paths, etc. Information is cached in this 575105Swnj * structure for use by the if_uba.c routines in running the interface 585105Swnj * efficiently. 595105Swnj */ 605083Swnj struct en_softc { 615105Swnj struct ifnet es_if; /* network-visible interface */ 625105Swnj struct ifuba es_ifuba; /* UNIBUS resources */ 635105Swnj short es_delay; /* current output delay */ 645105Swnj short es_mask; /* mask for current output delay */ 656471Sroot short es_lastx; /* host last transmitted to */ 665105Swnj short es_oactive; /* is output active? */ 675105Swnj short es_olen; /* length of last output */ 685083Swnj } en_softc[NEN]; 694686Swnj 705105Swnj /* 715105Swnj * Do output DMA to determine interface presence and 725105Swnj * interrupt vector. DMA is too short to disturb other hosts. 735105Swnj */ 744686Swnj enprobe(reg) 754686Swnj caddr_t reg; 764686Swnj { 775171Swnj register int br, cvec; /* r11, r10 value-result */ 784686Swnj register struct endevice *addr = (struct endevice *)reg; 794686Swnj 804686Swnj #ifdef lint 814686Swnj br = 0; cvec = br; br = cvec; 824922Swnj enrint(0); enxint(0); encollide(0); 834686Swnj #endif 844686Swnj addr->en_istat = 0; 854686Swnj addr->en_owc = -1; 864686Swnj addr->en_oba = 0; 874771Swnj addr->en_ostat = EN_IEN|EN_GO; 884686Swnj DELAY(100000); 894686Swnj addr->en_ostat = 0; 906575Ssam #ifdef ECHACK 916575Ssam br = 0x16; 926575Ssam #endif 934686Swnj return (1); 944686Swnj } 954686Swnj 965105Swnj /* 975105Swnj * Interface exists: make available by filling in network interface 985105Swnj * record. System will initialize the interface when it is ready 995105Swnj * to accept packets. 1005105Swnj */ 1014686Swnj enattach(ui) 1024686Swnj struct uba_device *ui; 1034686Swnj { 1045105Swnj register struct en_softc *es = &en_softc[ui->ui_unit]; 1056335Ssam register struct sockaddr_in *sin; 1064688Swnj 1075105Swnj es->es_if.if_unit = ui->ui_unit; 1085171Swnj es->es_if.if_name = "en"; 1095105Swnj es->es_if.if_mtu = ENMTU; 1107163Ssam es->es_if.if_net = ui->ui_flags; 1115105Swnj es->es_if.if_host[0] = 1126335Ssam (~(((struct endevice *)eninfo[ui->ui_unit]->ui_addr)->en_addr)) & 0xff; 1136335Ssam sin = (struct sockaddr_in *)&es->es_if.if_addr; 1146335Ssam sin->sin_family = AF_INET; 1156335Ssam sin->sin_addr = if_makeaddr(es->es_if.if_net, es->es_if.if_host[0]); 1166335Ssam sin = (struct sockaddr_in *)&es->es_if.if_broadaddr; 1176335Ssam sin->sin_family = AF_INET; 1186335Ssam sin->sin_addr = if_makeaddr(es->es_if.if_net, 0); 1196335Ssam es->es_if.if_flags = IFF_BROADCAST; 1205171Swnj es->es_if.if_init = eninit; 1215105Swnj es->es_if.if_output = enoutput; 1225105Swnj es->es_if.if_ubareset = enreset; 1236554Ssam es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16 | UBA_CANTWAIT; 1245160Swnj if_attach(&es->es_if); 1254686Swnj } 1264686Swnj 1275105Swnj /* 1285105Swnj * Reset of interface after UNIBUS reset. 1295105Swnj * If interface is on specified uba, reset its state. 1305105Swnj */ 1315105Swnj enreset(unit, uban) 1325105Swnj int unit, uban; 1335105Swnj { 1345105Swnj register struct uba_device *ui; 1355105Swnj 1365171Swnj if (unit >= NEN || (ui = eninfo[unit]) == 0 || ui->ui_alive == 0 || 1375171Swnj ui->ui_ubanum != uban) 1385105Swnj return; 1395171Swnj printf(" en%d", unit); 1405105Swnj eninit(unit); 1415105Swnj } 1425105Swnj 1435105Swnj /* 1445105Swnj * Initialization of interface; clear recorded pending 1455105Swnj * operations, and reinitialize UNIBUS usage. 1465105Swnj */ 1474688Swnj eninit(unit) 1484686Swnj int unit; 1495083Swnj { 1505171Swnj register struct en_softc *es = &en_softc[unit]; 1515171Swnj register struct uba_device *ui = eninfo[unit]; 1524686Swnj register struct endevice *addr; 1535105Swnj int s; 1544686Swnj 1555105Swnj if (if_ubainit(&es->es_ifuba, ui->ui_ubanum, 1566925Swnj sizeof (struct en_header), (int)btoc(ENMRU)) == 0) { 1575171Swnj printf("en%d: can't initialize\n", unit); 1586335Ssam es->es_if.if_flags &= ~IFF_UP; 1595083Swnj return; 1604686Swnj } 1614686Swnj addr = (struct endevice *)ui->ui_addr; 1625083Swnj addr->en_istat = addr->en_ostat = 0; 1634686Swnj 1645105Swnj /* 1655171Swnj * Hang a receive and start any 1665171Swnj * pending writes by faking a transmit complete. 1675105Swnj */ 1685105Swnj s = splimp(); 1695171Swnj addr->en_iba = es->es_ifuba.ifu_r.ifrw_info; 1706925Swnj addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1; 1715171Swnj addr->en_istat = EN_IEN|EN_GO; 1725171Swnj es->es_oactive = 1; 1736335Ssam es->es_if.if_flags |= IFF_UP; 1745105Swnj enxint(unit); 1755105Swnj splx(s); 1767151Swnj if_rtinit(&es->es_if, RTF_UP); 1774686Swnj } 1784686Swnj 1796471Sroot int enalldelay = 0; 1806951Swnj int enlastdel = 50; 1816471Sroot int enlastmask = (~0) << 5; 1825083Swnj 1835105Swnj /* 1845105Swnj * Start or restart output on interface. 1855105Swnj * If interface is already active, then this is a retransmit 1865105Swnj * after a collision, and just restuff registers and delay. 1875105Swnj * If interface is not already active, get another datagram 1885105Swnj * to send off of the interface queue, and map it to the interface 1895105Swnj * before starting the output. 1905105Swnj */ 1914688Swnj enstart(dev) 1924686Swnj dev_t dev; 1934686Swnj { 1945171Swnj int unit = ENUNIT(dev); 1955171Swnj struct uba_device *ui = eninfo[unit]; 1965171Swnj register struct en_softc *es = &en_softc[unit]; 1975083Swnj register struct endevice *addr; 1985083Swnj struct mbuf *m; 1995083Swnj int dest; 2004686Swnj 2015083Swnj if (es->es_oactive) 2025083Swnj goto restart; 2035105Swnj 2045105Swnj /* 2055105Swnj * Not already active: dequeue another request 2065105Swnj * and map it to the UNIBUS. If no more requests, 2075105Swnj * just return. 2085105Swnj */ 2095105Swnj IF_DEQUEUE(&es->es_if.if_snd, m); 2105083Swnj if (m == 0) { 2115083Swnj es->es_oactive = 0; 2124686Swnj return; 2134686Swnj } 2145213Swnj dest = mtod(m, struct en_header *)->en_dhost; 2155105Swnj es->es_olen = if_wubaput(&es->es_ifuba, m); 2165105Swnj 2175105Swnj /* 2185105Swnj * Ethernet cannot take back-to-back packets (no 2196471Sroot * buffering in interface. To help avoid overrunning 2206471Sroot * receivers, enforce a small delay (about 1ms) in interface: 2216471Sroot * * between all packets when enalldelay 2226471Sroot * * whenever last packet was broadcast 2236471Sroot * * whenever this packet is to same host as last packet 2245105Swnj */ 2256471Sroot if (enalldelay || es->es_lastx == 0 || es->es_lastx == dest) { 2265083Swnj es->es_delay = enlastdel; 2276471Sroot es->es_mask = enlastmask; 2286471Sroot } 2296471Sroot es->es_lastx = dest; 2305105Swnj 2315083Swnj restart: 2325105Swnj /* 2335105Swnj * Have request mapped to UNIBUS for transmission. 2345105Swnj * Purge any stale data from this BDP, and start the otput. 2355105Swnj */ 2366335Ssam if (es->es_ifuba.ifu_flags & UBA_NEEDBDP) 2376335Ssam UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_w.ifrw_bdp); 2384686Swnj addr = (struct endevice *)ui->ui_addr; 2395160Swnj addr->en_oba = (int)es->es_ifuba.ifu_w.ifrw_info; 2405083Swnj addr->en_odelay = es->es_delay; 2415083Swnj addr->en_owc = -((es->es_olen + 1) >> 1); 2424771Swnj addr->en_ostat = EN_IEN|EN_GO; 2435083Swnj es->es_oactive = 1; 2444686Swnj } 2454686Swnj 2465105Swnj /* 2475105Swnj * Ethernet interface transmitter interrupt. 2485105Swnj * Start another output if more data to send. 2495105Swnj */ 2504686Swnj enxint(unit) 2514686Swnj int unit; 2524686Swnj { 2535171Swnj register struct uba_device *ui = eninfo[unit]; 2545171Swnj register struct en_softc *es = &en_softc[unit]; 2556242Sroot register struct endevice *addr = (struct endevice *)ui->ui_addr; 2564686Swnj 2575083Swnj if (es->es_oactive == 0) 2585083Swnj return; 2596242Sroot if (es->es_mask && (addr->en_ostat&EN_OERROR)) { 2606242Sroot es->es_if.if_oerrors++; 2616242Sroot endocoll(unit); 2626242Sroot return; 2636242Sroot } 2645171Swnj es->es_if.if_opackets++; 2655083Swnj es->es_oactive = 0; 2665083Swnj es->es_delay = 0; 2675083Swnj es->es_mask = ~0; 2685696Sroot if (es->es_ifuba.ifu_xtofree) { 2695696Sroot m_freem(es->es_ifuba.ifu_xtofree); 2705696Sroot es->es_ifuba.ifu_xtofree = 0; 2715696Sroot } 2725105Swnj if (es->es_if.if_snd.ifq_head == 0) { 2736471Sroot es->es_lastx = 256; /* putatively illegal */ 2744686Swnj return; 2754686Swnj } 2765083Swnj enstart(unit); 2774686Swnj } 2784686Swnj 2795105Swnj /* 2805105Swnj * Collision on ethernet interface. Do exponential 2815105Swnj * backoff, and retransmit. If have backed off all 2826335Ssam * the way print warning diagnostic, and drop packet. 2835105Swnj */ 2844686Swnj encollide(unit) 2854686Swnj int unit; 2864686Swnj { 2876242Sroot struct en_softc *es = &en_softc[unit]; 2884686Swnj 2895105Swnj es->es_if.if_collisions++; 2905083Swnj if (es->es_oactive == 0) 2914686Swnj return; 2926242Sroot endocoll(unit); 2936242Sroot } 2946242Sroot 2956242Sroot endocoll(unit) 2966242Sroot int unit; 2976242Sroot { 2986242Sroot register struct en_softc *es = &en_softc[unit]; 2996242Sroot 3005171Swnj /* 3015171Swnj * Es_mask is a 16 bit number with n low zero bits, with 3025171Swnj * n the number of backoffs. When es_mask is 0 we have 3035171Swnj * backed off 16 times, and give up. 3045171Swnj */ 3055083Swnj if (es->es_mask == 0) { 3065213Swnj printf("en%d: send error\n", unit); 3075083Swnj enxint(unit); 3085171Swnj return; 3094686Swnj } 3105171Swnj /* 3115171Swnj * Another backoff. Restart with delay based on n low bits 3125171Swnj * of the interval timer. 3135171Swnj */ 3145171Swnj es->es_mask <<= 1; 3155171Swnj es->es_delay = mfpr(ICR) &~ es->es_mask; 3165171Swnj enstart(unit); 3174686Swnj } 3184686Swnj 3196027Ssam struct sockaddr_pup pupsrc = { AF_PUP }; 3206027Ssam struct sockaddr_pup pupdst = { AF_PUP }; 3216027Ssam struct sockproto pupproto = { PF_PUP }; 3225105Swnj /* 3235105Swnj * Ethernet interface receiver interrupt. 3245105Swnj * If input error just drop packet. 3255105Swnj * Otherwise purge input buffered data path and examine 3265105Swnj * packet to determine type. If can't determine length 3275105Swnj * from type, then have to drop packet. Othewise decapsulate 3285105Swnj * packet based on type and pass to type specific higher-level 3295105Swnj * input routine. 3305105Swnj */ 3314686Swnj enrint(unit) 3324686Swnj int unit; 3334686Swnj { 3345171Swnj register struct en_softc *es = &en_softc[unit]; 3355171Swnj struct endevice *addr = (struct endevice *)eninfo[unit]->ui_addr; 3365171Swnj register struct en_header *en; 3375083Swnj struct mbuf *m; 3386471Sroot int len, plen; short resid; 3395171Swnj register struct ifqueue *inq; 3405083Swnj int off; 3414686Swnj 3425171Swnj es->es_if.if_ipackets++; 3435105Swnj 3445105Swnj /* 3455171Swnj * Purge BDP; drop if input error indicated. 3465105Swnj */ 3476335Ssam if (es->es_ifuba.ifu_flags & UBA_NEEDBDP) 3486335Ssam UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_r.ifrw_bdp); 3494771Swnj if (addr->en_istat&EN_IERROR) { 3505105Swnj es->es_if.if_ierrors++; 3515083Swnj goto setup; 3524686Swnj } 3535105Swnj 3545105Swnj /* 3556471Sroot * Calculate input data length. 3565105Swnj * Get pointer to ethernet header (in input buffer). 3575105Swnj * Deal with trailer protocol: if type is PUP trailer 3585105Swnj * get true type from first 16-bit word past data. 3595105Swnj * Remember that type was trailer by setting off. 3605105Swnj */ 3616471Sroot resid = addr->en_iwc; 3626471Sroot if (resid) 3636471Sroot resid |= 0176000; 3646925Swnj len = (((sizeof (struct en_header) + ENMRU) >> 1) + resid) << 1; 3656471Sroot len -= sizeof (struct en_header); 3666925Swnj if (len > ENMRU) 3676471Sroot goto setup; /* sanity */ 3685105Swnj en = (struct en_header *)(es->es_ifuba.ifu_r.ifrw_addr); 3695083Swnj #define endataaddr(en, off, type) ((type)(((caddr_t)((en)+1)+(off)))) 3705083Swnj if (en->en_type >= ENPUP_TRAIL && 3715083Swnj en->en_type < ENPUP_TRAIL+ENPUP_NTRAILER) { 3725083Swnj off = (en->en_type - ENPUP_TRAIL) * 512; 3736925Swnj if (off > ENMTU) 3745171Swnj goto setup; /* sanity */ 3755083Swnj en->en_type = *endataaddr(en, off, u_short *); 3766471Sroot resid = *(endataaddr(en, off+2, u_short *)); 3776471Sroot if (off + resid > len) 3786471Sroot goto setup; /* sanity */ 3796471Sroot len = off + resid; 3805083Swnj } else 3815083Swnj off = 0; 3825083Swnj if (len == 0) 3835083Swnj goto setup; 3845105Swnj /* 3855105Swnj * Pull packet off interface. Off is nonzero if packet 3865105Swnj * has trailing header; if_rubaget will then force this header 3875105Swnj * information to be at the front, but we still have to drop 3886471Sroot * the type and length which are at the front of any trailer data. 3895105Swnj */ 3905105Swnj m = if_rubaget(&es->es_ifuba, len, off); 3915213Swnj if (m == 0) 3925213Swnj goto setup; 3935105Swnj if (off) { 3946471Sroot m->m_off += 2 * sizeof (u_short); 3956471Sroot m->m_len -= 2 * sizeof (u_short); 3965105Swnj } 3976027Ssam switch (en->en_type) { 3986027Ssam 3996027Ssam #ifdef INET 4006027Ssam case ENPUP_IPTYPE: 4016260Swnj schednetisr(NETISR_IP); 4026027Ssam inq = &ipintrq; 4036027Ssam break; 4046027Ssam #endif 4056335Ssam #ifdef PUP 4066027Ssam case ENPUP_PUPTYPE: { 4076027Ssam struct pup_header *pup = mtod(m, struct pup_header *); 4086027Ssam 4096027Ssam pupproto.sp_protocol = pup->pup_type; 4106027Ssam pupdst.spup_addr = pup->pup_dport; 4116027Ssam pupsrc.spup_addr = pup->pup_sport; 4126526Ssam raw_input(m, &pupproto, (struct sockaddr *)&pupsrc, 4136526Ssam (struct sockaddr *)&pupdst); 4146027Ssam goto setup; 4156027Ssam } 4166335Ssam #endif 4176476Swnj default: 4186476Swnj m_freem(m); 4196476Swnj goto setup; 4206335Ssam } 4216335Ssam 4226207Swnj if (IF_QFULL(inq)) { 4236207Swnj IF_DROP(inq); 4246335Ssam m_freem(m); 4256207Swnj } else 4266207Swnj IF_ENQUEUE(inq, m); 4275105Swnj 4284688Swnj setup: 4295105Swnj /* 4305105Swnj * Reset for next packet. 4315105Swnj */ 4325105Swnj addr->en_iba = es->es_ifuba.ifu_r.ifrw_info; 4336925Swnj addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1; 4344771Swnj addr->en_istat = EN_IEN|EN_GO; 4354688Swnj } 4364686Swnj 4375083Swnj /* 4385083Swnj * Ethernet output routine. 4395083Swnj * Encapsulate a packet of type family for the local net. 4405105Swnj * Use trailer local net encapsulation if enough data in first 4415105Swnj * packet leaves a multiple of 512 bytes of data in remainder. 4425083Swnj */ 4436335Ssam enoutput(ifp, m0, dst) 4445083Swnj struct ifnet *ifp; 4455083Swnj struct mbuf *m0; 4466335Ssam struct sockaddr *dst; 4474686Swnj { 4486503Ssam int type, dest, s, error; 4495105Swnj register struct mbuf *m = m0; 4505083Swnj register struct en_header *en; 4516335Ssam register int off; 4524686Swnj 4536335Ssam switch (dst->sa_family) { 4545083Swnj 4555083Swnj #ifdef INET 4566335Ssam case AF_INET: 4576484Swnj dest = ((struct sockaddr_in *)dst)->sin_addr.s_addr; 4586503Ssam if (dest & 0x00ffff00) { 4596503Ssam error = EPERM; /* ??? */ 4606486Swnj goto bad; 4616503Ssam } 4626484Swnj dest = (dest >> 24) & 0xff; 4636335Ssam off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len; 4646335Ssam if (off > 0 && (off & 0x1ff) == 0 && 4656471Sroot m->m_off >= MMINOFF + 2 * sizeof (u_short)) { 4665083Swnj type = ENPUP_TRAIL + (off>>9); 4676471Sroot m->m_off -= 2 * sizeof (u_short); 4686471Sroot m->m_len += 2 * sizeof (u_short); 4695105Swnj *mtod(m, u_short *) = ENPUP_IPTYPE; 4706471Sroot *(mtod(m, u_short *) + 1) = m->m_len; 4715105Swnj goto gottrailertype; 4725083Swnj } 4735105Swnj type = ENPUP_IPTYPE; 4745105Swnj off = 0; 4755105Swnj goto gottype; 4765083Swnj #endif 4776027Ssam #ifdef PUP 4786335Ssam case AF_PUP: 4796335Ssam dest = ((struct sockaddr_pup *)dst)->spup_addr.pp_host; 4806027Ssam type = ENPUP_PUPTYPE; 4816027Ssam off = 0; 4826027Ssam goto gottype; 4836027Ssam #endif 4846027Ssam 4855083Swnj default: 4866335Ssam printf("en%d: can't handle af%d\n", ifp->if_unit, 4876335Ssam dst->sa_family); 4886503Ssam error = EAFNOSUPPORT; 4896503Ssam goto bad; 4904686Swnj } 4915105Swnj 4925171Swnj gottrailertype: 4935105Swnj /* 4945105Swnj * Packet to be sent as trailer: move first packet 4955105Swnj * (control information) to end of chain. 4965105Swnj */ 4975105Swnj while (m->m_next) 4985105Swnj m = m->m_next; 4995105Swnj m->m_next = m0; 5005105Swnj m = m0->m_next; 5015105Swnj m0->m_next = 0; 5025171Swnj m0 = m; 5035105Swnj 5045171Swnj gottype: 5055105Swnj /* 5065105Swnj * Add local net header. If no space in first mbuf, 5075105Swnj * allocate another. 5085105Swnj */ 5095213Swnj if (m->m_off > MMAXOFF || 5105213Swnj MMINOFF + sizeof (struct en_header) > m->m_off) { 5115584Sroot m = m_get(M_DONTWAIT); 5125083Swnj if (m == 0) { 5136503Ssam error = ENOBUFS; 5146503Ssam goto bad; 5155083Swnj } 5165083Swnj m->m_next = m0; 5175083Swnj m->m_off = MMINOFF; 5185083Swnj m->m_len = sizeof (struct en_header); 5195083Swnj } else { 5205083Swnj m->m_off -= sizeof (struct en_header); 5215083Swnj m->m_len += sizeof (struct en_header); 5225083Swnj } 5235083Swnj en = mtod(m, struct en_header *); 5245083Swnj en->en_shost = ifp->if_host[0]; 5255083Swnj en->en_dhost = dest; 5265083Swnj en->en_type = type; 5275105Swnj 5285105Swnj /* 5295105Swnj * Queue message on interface, and start output if interface 5305105Swnj * not yet active. 5315105Swnj */ 5325083Swnj s = splimp(); 5336207Swnj if (IF_QFULL(&ifp->if_snd)) { 5346207Swnj IF_DROP(&ifp->if_snd); 5356503Ssam error = ENOBUFS; 5366503Ssam goto qfull; 5376207Swnj } 5385083Swnj IF_ENQUEUE(&ifp->if_snd, m); 5395083Swnj if (en_softc[ifp->if_unit].es_oactive == 0) 5405083Swnj enstart(ifp->if_unit); 5415275Swnj splx(s); 5426503Ssam return (0); 5436503Ssam qfull: 5446503Ssam m0 = m; 5456503Ssam splx(s); 5466484Swnj bad: 5476503Ssam m_freem(m0); 5486503Ssam return (error); 5494686Swnj } 550