1*8418Swnj /* if_en.c 4.68 82/10/09 */ 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" 164686Swnj #include "../h/ubareg.h" 174686Swnj #include "../h/ubavar.h" 184686Swnj #include "../h/enreg.h" 195083Swnj #include "../h/cpu.h" 204686Swnj #include "../h/mtpr.h" 215083Swnj #include "../h/vmmac.h" 22*8418Swnj #include "../netinet/in.h" 23*8418Swnj #include "../netinet/in_systm.h" 245083Swnj #include "../net/if.h" 25*8418Swnj #include "../vaxif/if_en.h" 26*8418Swnj #include "../vaxif/if_uba.h" 27*8418Swnj #include "../netinet/ip.h" 28*8418Swnj #include "../netinet/ip_var.h" 29*8418Swnj #include "../netpup/pup.h" 306364Ssam #include "../net/route.h" 316503Ssam #include <errno.h> 324686Swnj 335213Swnj #define ENMTU (1024+512) 346925Swnj #define ENMRU (1024+512+16) /* 16 is enough to receive trailer */ 355083Swnj 364686Swnj int enprobe(), enattach(), enrint(), enxint(), encollide(); 374686Swnj struct uba_device *eninfo[NEN]; 384686Swnj u_short enstd[] = { 0 }; 394686Swnj struct uba_driver endriver = 405171Swnj { enprobe, 0, enattach, 0, enstd, "en", eninfo }; 414686Swnj #define ENUNIT(x) minor(x) 424686Swnj 435105Swnj int eninit(),enoutput(),enreset(); 445105Swnj 455105Swnj /* 465105Swnj * Ethernet software status per interface. 475105Swnj * 485105Swnj * Each interface is referenced by a network interface structure, 495105Swnj * es_if, which the routing code uses to locate the interface. 505105Swnj * This structure contains the output queue for the interface, its address, ... 515105Swnj * We also have, for each interface, a UBA interface structure, which 525105Swnj * contains information about the UNIBUS resources held by the interface: 535105Swnj * map registers, buffered data paths, etc. Information is cached in this 545105Swnj * structure for use by the if_uba.c routines in running the interface 555105Swnj * efficiently. 565105Swnj */ 575083Swnj struct en_softc { 585105Swnj struct ifnet es_if; /* network-visible interface */ 595105Swnj struct ifuba es_ifuba; /* UNIBUS resources */ 605105Swnj short es_delay; /* current output delay */ 615105Swnj short es_mask; /* mask for current output delay */ 626471Sroot short es_lastx; /* host last transmitted to */ 635105Swnj short es_oactive; /* is output active? */ 645105Swnj short es_olen; /* length of last output */ 655083Swnj } en_softc[NEN]; 664686Swnj 675105Swnj /* 685105Swnj * Do output DMA to determine interface presence and 695105Swnj * interrupt vector. DMA is too short to disturb other hosts. 705105Swnj */ 714686Swnj enprobe(reg) 724686Swnj caddr_t reg; 734686Swnj { 745171Swnj register int br, cvec; /* r11, r10 value-result */ 754686Swnj register struct endevice *addr = (struct endevice *)reg; 764686Swnj 774686Swnj #ifdef lint 784686Swnj br = 0; cvec = br; br = cvec; 794922Swnj enrint(0); enxint(0); encollide(0); 804686Swnj #endif 814686Swnj addr->en_istat = 0; 824686Swnj addr->en_owc = -1; 834686Swnj addr->en_oba = 0; 844771Swnj addr->en_ostat = EN_IEN|EN_GO; 854686Swnj DELAY(100000); 864686Swnj addr->en_ostat = 0; 876575Ssam #ifdef ECHACK 886575Ssam br = 0x16; 896575Ssam #endif 904686Swnj return (1); 914686Swnj } 924686Swnj 935105Swnj /* 945105Swnj * Interface exists: make available by filling in network interface 955105Swnj * record. System will initialize the interface when it is ready 965105Swnj * to accept packets. 975105Swnj */ 984686Swnj enattach(ui) 994686Swnj struct uba_device *ui; 1004686Swnj { 1015105Swnj register struct en_softc *es = &en_softc[ui->ui_unit]; 1026335Ssam register struct sockaddr_in *sin; 1034688Swnj 1045105Swnj es->es_if.if_unit = ui->ui_unit; 1055171Swnj es->es_if.if_name = "en"; 1065105Swnj es->es_if.if_mtu = ENMTU; 1077163Ssam es->es_if.if_net = ui->ui_flags; 1085105Swnj es->es_if.if_host[0] = 1096335Ssam (~(((struct endevice *)eninfo[ui->ui_unit]->ui_addr)->en_addr)) & 0xff; 1106335Ssam sin = (struct sockaddr_in *)&es->es_if.if_addr; 1116335Ssam sin->sin_family = AF_INET; 1126335Ssam sin->sin_addr = if_makeaddr(es->es_if.if_net, es->es_if.if_host[0]); 1136335Ssam sin = (struct sockaddr_in *)&es->es_if.if_broadaddr; 1146335Ssam sin->sin_family = AF_INET; 1156335Ssam sin->sin_addr = if_makeaddr(es->es_if.if_net, 0); 1166335Ssam es->es_if.if_flags = IFF_BROADCAST; 1175171Swnj es->es_if.if_init = eninit; 1185105Swnj es->es_if.if_output = enoutput; 1195105Swnj es->es_if.if_ubareset = enreset; 1206554Ssam es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16 | UBA_CANTWAIT; 1215160Swnj if_attach(&es->es_if); 1224686Swnj } 1234686Swnj 1245105Swnj /* 1255105Swnj * Reset of interface after UNIBUS reset. 1265105Swnj * If interface is on specified uba, reset its state. 1275105Swnj */ 1285105Swnj enreset(unit, uban) 1295105Swnj int unit, uban; 1305105Swnj { 1315105Swnj register struct uba_device *ui; 1325105Swnj 1335171Swnj if (unit >= NEN || (ui = eninfo[unit]) == 0 || ui->ui_alive == 0 || 1345171Swnj ui->ui_ubanum != uban) 1355105Swnj return; 1365171Swnj printf(" en%d", unit); 1375105Swnj eninit(unit); 1385105Swnj } 1395105Swnj 1405105Swnj /* 1415105Swnj * Initialization of interface; clear recorded pending 1425105Swnj * operations, and reinitialize UNIBUS usage. 1435105Swnj */ 1444688Swnj eninit(unit) 1454686Swnj int unit; 1465083Swnj { 1475171Swnj register struct en_softc *es = &en_softc[unit]; 1485171Swnj register struct uba_device *ui = eninfo[unit]; 1494686Swnj register struct endevice *addr; 1505105Swnj int s; 1514686Swnj 1525105Swnj if (if_ubainit(&es->es_ifuba, ui->ui_ubanum, 1536925Swnj sizeof (struct en_header), (int)btoc(ENMRU)) == 0) { 1545171Swnj printf("en%d: can't initialize\n", unit); 1556335Ssam es->es_if.if_flags &= ~IFF_UP; 1565083Swnj return; 1574686Swnj } 1584686Swnj addr = (struct endevice *)ui->ui_addr; 1595083Swnj addr->en_istat = addr->en_ostat = 0; 1604686Swnj 1615105Swnj /* 1625171Swnj * Hang a receive and start any 1635171Swnj * pending writes by faking a transmit complete. 1645105Swnj */ 1655105Swnj s = splimp(); 1665171Swnj addr->en_iba = es->es_ifuba.ifu_r.ifrw_info; 1676925Swnj addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1; 1685171Swnj addr->en_istat = EN_IEN|EN_GO; 1695171Swnj es->es_oactive = 1; 1706335Ssam es->es_if.if_flags |= IFF_UP; 1715105Swnj enxint(unit); 1725105Swnj splx(s); 1737151Swnj if_rtinit(&es->es_if, RTF_UP); 1744686Swnj } 1754686Swnj 1766471Sroot int enalldelay = 0; 1776951Swnj int enlastdel = 50; 1786471Sroot int enlastmask = (~0) << 5; 1795083Swnj 1805105Swnj /* 1815105Swnj * Start or restart output on interface. 1825105Swnj * If interface is already active, then this is a retransmit 1835105Swnj * after a collision, and just restuff registers and delay. 1845105Swnj * If interface is not already active, get another datagram 1855105Swnj * to send off of the interface queue, and map it to the interface 1865105Swnj * before starting the output. 1875105Swnj */ 1884688Swnj enstart(dev) 1894686Swnj dev_t dev; 1904686Swnj { 1915171Swnj int unit = ENUNIT(dev); 1925171Swnj struct uba_device *ui = eninfo[unit]; 1935171Swnj register struct en_softc *es = &en_softc[unit]; 1945083Swnj register struct endevice *addr; 1955083Swnj struct mbuf *m; 1965083Swnj int dest; 1974686Swnj 1985083Swnj if (es->es_oactive) 1995083Swnj goto restart; 2005105Swnj 2015105Swnj /* 2025105Swnj * Not already active: dequeue another request 2035105Swnj * and map it to the UNIBUS. If no more requests, 2045105Swnj * just return. 2055105Swnj */ 2065105Swnj IF_DEQUEUE(&es->es_if.if_snd, m); 2075083Swnj if (m == 0) { 2085083Swnj es->es_oactive = 0; 2094686Swnj return; 2104686Swnj } 2115213Swnj dest = mtod(m, struct en_header *)->en_dhost; 2125105Swnj es->es_olen = if_wubaput(&es->es_ifuba, m); 2135105Swnj 2145105Swnj /* 2155105Swnj * Ethernet cannot take back-to-back packets (no 2166471Sroot * buffering in interface. To help avoid overrunning 2176471Sroot * receivers, enforce a small delay (about 1ms) in interface: 2186471Sroot * * between all packets when enalldelay 2196471Sroot * * whenever last packet was broadcast 2206471Sroot * * whenever this packet is to same host as last packet 2215105Swnj */ 2226471Sroot if (enalldelay || es->es_lastx == 0 || es->es_lastx == dest) { 2235083Swnj es->es_delay = enlastdel; 2246471Sroot es->es_mask = enlastmask; 2256471Sroot } 2266471Sroot es->es_lastx = dest; 2275105Swnj 2285083Swnj restart: 2295105Swnj /* 2305105Swnj * Have request mapped to UNIBUS for transmission. 2315105Swnj * Purge any stale data from this BDP, and start the otput. 2325105Swnj */ 2336335Ssam if (es->es_ifuba.ifu_flags & UBA_NEEDBDP) 2346335Ssam UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_w.ifrw_bdp); 2354686Swnj addr = (struct endevice *)ui->ui_addr; 2365160Swnj addr->en_oba = (int)es->es_ifuba.ifu_w.ifrw_info; 2375083Swnj addr->en_odelay = es->es_delay; 2385083Swnj addr->en_owc = -((es->es_olen + 1) >> 1); 2394771Swnj addr->en_ostat = EN_IEN|EN_GO; 2405083Swnj es->es_oactive = 1; 2414686Swnj } 2424686Swnj 2435105Swnj /* 2445105Swnj * Ethernet interface transmitter interrupt. 2455105Swnj * Start another output if more data to send. 2465105Swnj */ 2474686Swnj enxint(unit) 2484686Swnj int unit; 2494686Swnj { 2505171Swnj register struct uba_device *ui = eninfo[unit]; 2515171Swnj register struct en_softc *es = &en_softc[unit]; 2526242Sroot register struct endevice *addr = (struct endevice *)ui->ui_addr; 2534686Swnj 2545083Swnj if (es->es_oactive == 0) 2555083Swnj return; 2566242Sroot if (es->es_mask && (addr->en_ostat&EN_OERROR)) { 2576242Sroot es->es_if.if_oerrors++; 2586242Sroot endocoll(unit); 2596242Sroot return; 2606242Sroot } 2615171Swnj es->es_if.if_opackets++; 2625083Swnj es->es_oactive = 0; 2635083Swnj es->es_delay = 0; 2645083Swnj es->es_mask = ~0; 2655696Sroot if (es->es_ifuba.ifu_xtofree) { 2665696Sroot m_freem(es->es_ifuba.ifu_xtofree); 2675696Sroot es->es_ifuba.ifu_xtofree = 0; 2685696Sroot } 2695105Swnj if (es->es_if.if_snd.ifq_head == 0) { 2706471Sroot es->es_lastx = 256; /* putatively illegal */ 2714686Swnj return; 2724686Swnj } 2735083Swnj enstart(unit); 2744686Swnj } 2754686Swnj 2765105Swnj /* 2775105Swnj * Collision on ethernet interface. Do exponential 2785105Swnj * backoff, and retransmit. If have backed off all 2796335Ssam * the way print warning diagnostic, and drop packet. 2805105Swnj */ 2814686Swnj encollide(unit) 2824686Swnj int unit; 2834686Swnj { 2846242Sroot struct en_softc *es = &en_softc[unit]; 2854686Swnj 2865105Swnj es->es_if.if_collisions++; 2875083Swnj if (es->es_oactive == 0) 2884686Swnj return; 2896242Sroot endocoll(unit); 2906242Sroot } 2916242Sroot 2926242Sroot endocoll(unit) 2936242Sroot int unit; 2946242Sroot { 2956242Sroot register struct en_softc *es = &en_softc[unit]; 2966242Sroot 2975171Swnj /* 2985171Swnj * Es_mask is a 16 bit number with n low zero bits, with 2995171Swnj * n the number of backoffs. When es_mask is 0 we have 3005171Swnj * backed off 16 times, and give up. 3015171Swnj */ 3025083Swnj if (es->es_mask == 0) { 3035213Swnj printf("en%d: send error\n", unit); 3045083Swnj enxint(unit); 3055171Swnj return; 3064686Swnj } 3075171Swnj /* 3085171Swnj * Another backoff. Restart with delay based on n low bits 3095171Swnj * of the interval timer. 3105171Swnj */ 3115171Swnj es->es_mask <<= 1; 3125171Swnj es->es_delay = mfpr(ICR) &~ es->es_mask; 3135171Swnj enstart(unit); 3144686Swnj } 3154686Swnj 3166027Ssam struct sockaddr_pup pupsrc = { AF_PUP }; 3176027Ssam struct sockaddr_pup pupdst = { AF_PUP }; 3186027Ssam struct sockproto pupproto = { PF_PUP }; 3195105Swnj /* 3205105Swnj * Ethernet interface receiver interrupt. 3215105Swnj * If input error just drop packet. 3225105Swnj * Otherwise purge input buffered data path and examine 3235105Swnj * packet to determine type. If can't determine length 3245105Swnj * from type, then have to drop packet. Othewise decapsulate 3255105Swnj * packet based on type and pass to type specific higher-level 3265105Swnj * input routine. 3275105Swnj */ 3284686Swnj enrint(unit) 3294686Swnj int unit; 3304686Swnj { 3315171Swnj register struct en_softc *es = &en_softc[unit]; 3325171Swnj struct endevice *addr = (struct endevice *)eninfo[unit]->ui_addr; 3335171Swnj register struct en_header *en; 3345083Swnj struct mbuf *m; 3356471Sroot int len, plen; short resid; 3365171Swnj register struct ifqueue *inq; 3375083Swnj int off; 3384686Swnj 3395171Swnj es->es_if.if_ipackets++; 3405105Swnj 3415105Swnj /* 3425171Swnj * Purge BDP; drop if input error indicated. 3435105Swnj */ 3446335Ssam if (es->es_ifuba.ifu_flags & UBA_NEEDBDP) 3456335Ssam UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_r.ifrw_bdp); 3464771Swnj if (addr->en_istat&EN_IERROR) { 3475105Swnj es->es_if.if_ierrors++; 3485083Swnj goto setup; 3494686Swnj } 3505105Swnj 3515105Swnj /* 3526471Sroot * Calculate input data length. 3535105Swnj * Get pointer to ethernet header (in input buffer). 3545105Swnj * Deal with trailer protocol: if type is PUP trailer 3555105Swnj * get true type from first 16-bit word past data. 3565105Swnj * Remember that type was trailer by setting off. 3575105Swnj */ 3586471Sroot resid = addr->en_iwc; 3596471Sroot if (resid) 3606471Sroot resid |= 0176000; 3616925Swnj len = (((sizeof (struct en_header) + ENMRU) >> 1) + resid) << 1; 3626471Sroot len -= sizeof (struct en_header); 3636925Swnj if (len > ENMRU) 3646471Sroot goto setup; /* sanity */ 3655105Swnj en = (struct en_header *)(es->es_ifuba.ifu_r.ifrw_addr); 3665083Swnj #define endataaddr(en, off, type) ((type)(((caddr_t)((en)+1)+(off)))) 3675083Swnj if (en->en_type >= ENPUP_TRAIL && 3685083Swnj en->en_type < ENPUP_TRAIL+ENPUP_NTRAILER) { 3695083Swnj off = (en->en_type - ENPUP_TRAIL) * 512; 3706925Swnj if (off > ENMTU) 3715171Swnj goto setup; /* sanity */ 3725083Swnj en->en_type = *endataaddr(en, off, u_short *); 3736471Sroot resid = *(endataaddr(en, off+2, u_short *)); 3746471Sroot if (off + resid > len) 3756471Sroot goto setup; /* sanity */ 3766471Sroot len = off + resid; 3775083Swnj } else 3785083Swnj off = 0; 3795083Swnj if (len == 0) 3805083Swnj goto setup; 3815105Swnj /* 3825105Swnj * Pull packet off interface. Off is nonzero if packet 3835105Swnj * has trailing header; if_rubaget will then force this header 3845105Swnj * information to be at the front, but we still have to drop 3856471Sroot * the type and length which are at the front of any trailer data. 3865105Swnj */ 3875105Swnj m = if_rubaget(&es->es_ifuba, len, off); 3885213Swnj if (m == 0) 3895213Swnj goto setup; 3905105Swnj if (off) { 3916471Sroot m->m_off += 2 * sizeof (u_short); 3926471Sroot m->m_len -= 2 * sizeof (u_short); 3935105Swnj } 3946027Ssam switch (en->en_type) { 3956027Ssam 3966027Ssam #ifdef INET 3976027Ssam case ENPUP_IPTYPE: 3986260Swnj schednetisr(NETISR_IP); 3996027Ssam inq = &ipintrq; 4006027Ssam break; 4016027Ssam #endif 4026335Ssam #ifdef PUP 4036027Ssam case ENPUP_PUPTYPE: { 4046027Ssam struct pup_header *pup = mtod(m, struct pup_header *); 4056027Ssam 4066027Ssam pupproto.sp_protocol = pup->pup_type; 4076027Ssam pupdst.spup_addr = pup->pup_dport; 4086027Ssam pupsrc.spup_addr = pup->pup_sport; 4096526Ssam raw_input(m, &pupproto, (struct sockaddr *)&pupsrc, 4106526Ssam (struct sockaddr *)&pupdst); 4116027Ssam goto setup; 4126027Ssam } 4136335Ssam #endif 4146476Swnj default: 4156476Swnj m_freem(m); 4166476Swnj goto setup; 4176335Ssam } 4186335Ssam 4196207Swnj if (IF_QFULL(inq)) { 4206207Swnj IF_DROP(inq); 4216335Ssam m_freem(m); 4226207Swnj } else 4236207Swnj IF_ENQUEUE(inq, m); 4245105Swnj 4254688Swnj setup: 4265105Swnj /* 4275105Swnj * Reset for next packet. 4285105Swnj */ 4295105Swnj addr->en_iba = es->es_ifuba.ifu_r.ifrw_info; 4306925Swnj addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1; 4314771Swnj addr->en_istat = EN_IEN|EN_GO; 4324688Swnj } 4334686Swnj 4345083Swnj /* 4355083Swnj * Ethernet output routine. 4365083Swnj * Encapsulate a packet of type family for the local net. 4375105Swnj * Use trailer local net encapsulation if enough data in first 4385105Swnj * packet leaves a multiple of 512 bytes of data in remainder. 4395083Swnj */ 4406335Ssam enoutput(ifp, m0, dst) 4415083Swnj struct ifnet *ifp; 4425083Swnj struct mbuf *m0; 4436335Ssam struct sockaddr *dst; 4444686Swnj { 4456503Ssam int type, dest, s, error; 4465105Swnj register struct mbuf *m = m0; 4475083Swnj register struct en_header *en; 4486335Ssam register int off; 4494686Swnj 4506335Ssam switch (dst->sa_family) { 4515083Swnj 4525083Swnj #ifdef INET 4536335Ssam case AF_INET: 4546484Swnj dest = ((struct sockaddr_in *)dst)->sin_addr.s_addr; 4556503Ssam if (dest & 0x00ffff00) { 4566503Ssam error = EPERM; /* ??? */ 4576486Swnj goto bad; 4586503Ssam } 4596484Swnj dest = (dest >> 24) & 0xff; 4606335Ssam off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len; 4616335Ssam if (off > 0 && (off & 0x1ff) == 0 && 4626471Sroot m->m_off >= MMINOFF + 2 * sizeof (u_short)) { 4635083Swnj type = ENPUP_TRAIL + (off>>9); 4646471Sroot m->m_off -= 2 * sizeof (u_short); 4656471Sroot m->m_len += 2 * sizeof (u_short); 4665105Swnj *mtod(m, u_short *) = ENPUP_IPTYPE; 4676471Sroot *(mtod(m, u_short *) + 1) = m->m_len; 4685105Swnj goto gottrailertype; 4695083Swnj } 4705105Swnj type = ENPUP_IPTYPE; 4715105Swnj off = 0; 4725105Swnj goto gottype; 4735083Swnj #endif 4746027Ssam #ifdef PUP 4756335Ssam case AF_PUP: 4766335Ssam dest = ((struct sockaddr_pup *)dst)->spup_addr.pp_host; 4776027Ssam type = ENPUP_PUPTYPE; 4786027Ssam off = 0; 4796027Ssam goto gottype; 4806027Ssam #endif 4816027Ssam 4825083Swnj default: 4836335Ssam printf("en%d: can't handle af%d\n", ifp->if_unit, 4846335Ssam dst->sa_family); 4856503Ssam error = EAFNOSUPPORT; 4866503Ssam goto bad; 4874686Swnj } 4885105Swnj 4895171Swnj gottrailertype: 4905105Swnj /* 4915105Swnj * Packet to be sent as trailer: move first packet 4925105Swnj * (control information) to end of chain. 4935105Swnj */ 4945105Swnj while (m->m_next) 4955105Swnj m = m->m_next; 4965105Swnj m->m_next = m0; 4975105Swnj m = m0->m_next; 4985105Swnj m0->m_next = 0; 4995171Swnj m0 = m; 5005105Swnj 5015171Swnj gottype: 5025105Swnj /* 5035105Swnj * Add local net header. If no space in first mbuf, 5045105Swnj * allocate another. 5055105Swnj */ 5065213Swnj if (m->m_off > MMAXOFF || 5075213Swnj MMINOFF + sizeof (struct en_header) > m->m_off) { 5085584Sroot m = m_get(M_DONTWAIT); 5095083Swnj if (m == 0) { 5106503Ssam error = ENOBUFS; 5116503Ssam goto bad; 5125083Swnj } 5135083Swnj m->m_next = m0; 5145083Swnj m->m_off = MMINOFF; 5155083Swnj m->m_len = sizeof (struct en_header); 5165083Swnj } else { 5175083Swnj m->m_off -= sizeof (struct en_header); 5185083Swnj m->m_len += sizeof (struct en_header); 5195083Swnj } 5205083Swnj en = mtod(m, struct en_header *); 5215083Swnj en->en_shost = ifp->if_host[0]; 5225083Swnj en->en_dhost = dest; 5235083Swnj en->en_type = type; 5245105Swnj 5255105Swnj /* 5265105Swnj * Queue message on interface, and start output if interface 5275105Swnj * not yet active. 5285105Swnj */ 5295083Swnj s = splimp(); 5306207Swnj if (IF_QFULL(&ifp->if_snd)) { 5316207Swnj IF_DROP(&ifp->if_snd); 5326503Ssam error = ENOBUFS; 5336503Ssam goto qfull; 5346207Swnj } 5355083Swnj IF_ENQUEUE(&ifp->if_snd, m); 5365083Swnj if (en_softc[ifp->if_unit].es_oactive == 0) 5375083Swnj enstart(ifp->if_unit); 5385275Swnj splx(s); 5396503Ssam return (0); 5406503Ssam qfull: 5416503Ssam m0 = m; 5426503Ssam splx(s); 5436484Swnj bad: 5446503Ssam m_freem(m0); 5456503Ssam return (error); 5464686Swnj } 547