- Rely on ether_ifattach() to initialize part of our struct ifnet
rather than doing it ourself. - Set ifq_maxlen. - Include the size of the ethernet header when we allocate our mbuf chain in ieget().
This commit is contained in:
parent
15147731b7
commit
7e5f2c0d45
@ -784,13 +784,10 @@ ieattach(struct isa_device *dvp)
|
|||||||
ie->arpcom.ac_enaddr, ":");
|
ie->arpcom.ac_enaddr, ":");
|
||||||
|
|
||||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||||
ifp->if_output = ether_output;
|
|
||||||
ifp->if_start = iestart;
|
ifp->if_start = iestart;
|
||||||
ifp->if_ioctl = ieioctl;
|
ifp->if_ioctl = ieioctl;
|
||||||
ifp->if_init = ieinit;
|
ifp->if_init = ieinit;
|
||||||
ifp->if_type = IFT_ETHER;
|
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
|
||||||
ifp->if_addrlen = 6;
|
|
||||||
ifp->if_hdrlen = 14;
|
|
||||||
|
|
||||||
if (ie->hard_type == IE_EE16)
|
if (ie->hard_type == IE_EE16)
|
||||||
EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
|
EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
|
||||||
@ -1124,6 +1121,7 @@ ie_packet_len(int unit, struct ie_softc * ie)
|
|||||||
static __inline int
|
static __inline int
|
||||||
ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
|
ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
|
||||||
{
|
{
|
||||||
|
struct ether_header eh;
|
||||||
struct mbuf *m, *top, **mymp;
|
struct mbuf *m, *top, **mymp;
|
||||||
int offset;
|
int offset;
|
||||||
int totlen, resid;
|
int totlen, resid;
|
||||||
@ -1134,18 +1132,10 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
|
|||||||
if (totlen <= 0)
|
if (totlen <= 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
|
||||||
if (!m) {
|
|
||||||
ie_drop_packet_buffer(unit, ie);
|
|
||||||
/* XXXX if_ierrors++; */
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Snarf the Ethernet header.
|
* Snarf the Ethernet header.
|
||||||
*/
|
*/
|
||||||
bcopy((v_caddr_t) ie->cbuffs[ie->rbhead], mtod(m, caddr_t),
|
bcopy((caddr_t)ie->cbuffs[ie->rbhead], &eh, sizeof(struct ether_header));
|
||||||
sizeof (struct ether_header));
|
|
||||||
/* ignore cast-qual warning here */
|
/* ignore cast-qual warning here */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1154,7 +1144,7 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
|
|||||||
* This is only a consideration when FILTER is defined; i.e., when
|
* This is only a consideration when FILTER is defined; i.e., when
|
||||||
* we are either running BPF or doing multicasting.
|
* we are either running BPF or doing multicasting.
|
||||||
*/
|
*/
|
||||||
if (!check_eh(ie, mtod(m, struct ether_header *))) {
|
if (!check_eh(ie, &eh)) {
|
||||||
m_free(m);
|
m_free(m);
|
||||||
ie_drop_packet_buffer(unit, ie);
|
ie_drop_packet_buffer(unit, ie);
|
||||||
ie->arpcom.ac_if.if_ierrors--; /* just this case, it's not an
|
ie->arpcom.ac_if.if_ierrors--; /* just this case, it's not an
|
||||||
@ -1163,16 +1153,19 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX way too complicated, check carefully XXXX */
|
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||||
|
if (!m) {
|
||||||
|
ie_drop_packet_buffer(unit, ie);
|
||||||
|
/* XXXX if_ierrors++; */
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
*mp = m;
|
*mp = m;
|
||||||
m->m_pkthdr.rcvif = &ie->arpcom.ac_if;
|
m->m_pkthdr.rcvif = &ie->arpcom.ac_if;
|
||||||
/* deduct header just copied; m_len must reflect space avail below */
|
m->m_len = MHLEN;
|
||||||
m->m_len = MHLEN - sizeof (struct ether_header);
|
resid = m->m_pkthdr.len = totlen;
|
||||||
m->m_pkthdr.len = totlen;
|
top = 0;
|
||||||
|
|
||||||
resid = totlen - sizeof (struct ether_header); /* remaining data */
|
|
||||||
top = NULL;
|
|
||||||
mymp = ⊤
|
mymp = ⊤
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1213,10 +1206,11 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
|
|||||||
mymp = &m->m_next;
|
mymp = &m->m_next;
|
||||||
} while (resid > 0);
|
} while (resid > 0);
|
||||||
|
|
||||||
resid = totlen - sizeof (struct ether_header); /* remaining data */
|
resid = totlen; /* remaining data */
|
||||||
offset = sizeof (struct ether_header); /* packet offset */
|
offset = 0; /* packet offset */
|
||||||
|
thismboff = 0; /* offset in m */
|
||||||
|
|
||||||
m = top; /* current mbuf */
|
m = top; /* current mbuf */
|
||||||
thismboff = sizeof (struct ether_header); /* offset in m */
|
|
||||||
head = ie->rbhead; /* current rx buffer */
|
head = ie->rbhead; /* current rx buffer */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user