aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/isa/if_rdp.c
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2002-11-15 00:00:15 +0000
committerSam Leffler <sam@FreeBSD.org>2002-11-15 00:00:15 +0000
commit6fc32a24955d1548f39d120cc7ac9e0d0161a80a (patch)
tree2a5611d45149f91e7ddfd0e32391f1ef7d8590e1 /sys/i386/isa/if_rdp.c
parent2f907a97c73adc46da1cf009e6b4fbf74816aae0 (diff)
network interface and link layer changes:
o on input don't strip the Ethernet header from packets o input packet handling is now done with if_input o track changes to ether_ifattach/ether_ifdetach API o track changes to bpf tapping o call ether_ioctl for default handling of ioctl's o use constants from net/ethernet.h where possible Reviewed by: many Approved by: re
Notes
Notes: svn path=/head/; revision=106939
Diffstat (limited to 'sys/i386/isa/if_rdp.c')
-rw-r--r--sys/i386/isa/if_rdp.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/sys/i386/isa/if_rdp.c b/sys/i386/isa/if_rdp.c
index 45eccf1a6d2e..574d3e76a9fa 100644
--- a/sys/i386/isa/if_rdp.c
+++ b/sys/i386/isa/if_rdp.c
@@ -602,7 +602,6 @@ rdp_attach(struct isa_device *isa_dev)
ifp->if_softc = sc;
ifp->if_unit = unit;
ifp->if_name = "rdp";
- ifp->if_output = ether_output;
ifp->if_start = rdp_start;
ifp->if_ioctl = rdp_ioctl;
ifp->if_watchdog = rdp_watchdog;
@@ -613,7 +612,7 @@ rdp_attach(struct isa_device *isa_dev)
/*
* Attach the interface
*/
- ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+ ether_ifattach(ifp, sc->arpcom.ac_enaddr);
}
/*
@@ -807,9 +806,7 @@ outloop:
/*
* Tap off here if there is a bpf listener.
*/
- if (ifp->if_bpf) {
- bpf_mtap(ifp, m);
- }
+ BPF_MTAP(ifp, m);
m_freem(m);
@@ -832,12 +829,6 @@ rdp_ioctl(struct ifnet *ifp, IOCTL_CMD_T command, caddr_t data)
switch (command) {
- case SIOCSIFADDR:
- case SIOCGIFADDR:
- case SIOCSIFMTU:
- error = ether_ioctl(ifp, command, data);
- break;
-
case SIOCSIFFLAGS:
/*
* If the interface is marked up and stopped, then start it.
@@ -873,7 +864,8 @@ rdp_ioctl(struct ifnet *ifp, IOCTL_CMD_T command, caddr_t data)
break;
default:
- error = EINVAL;
+ error = ether_ioctl(ifp, command, data);
+ break;
}
(void) splx(s);
return (error);
@@ -1097,7 +1089,7 @@ rdp_rint(struct rdp_softc *sc)
static void
rdp_get_packet(struct rdp_softc *sc, unsigned len)
{
- struct ether_header *eh;
+ struct ifnet *ifp = &sc->arpcom.ac_if;
struct mbuf *m;
u_char *packet_ptr;
size_t s;
@@ -1106,7 +1098,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return;
- m->m_pkthdr.rcvif = &sc->arpcom.ac_if;
+ m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = len;
/*
@@ -1115,7 +1107,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
* to the header. The +2 is to compensate for the alignment
* fixup below.
*/
- if ((len + 2) > MHLEN) {
+ if ((len + ETHER_ALIGN) > MHLEN) {
/* Attach an mbuf cluster */
MCLGET(m, M_DONTWAIT);
@@ -1130,8 +1122,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
* The +2 is to longword align the start of the real packet.
* This is important for NFS.
*/
- m->m_data += 2;
- eh = mtod(m, struct ether_header *);
+ m->m_data += ETHER_ALIGN;
/*
* Get packet, including link layer address, from interface.
@@ -1139,7 +1130,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
outb(sc->baseaddr + lpt_control, Ctrl_LNibRead);
outb(sc->baseaddr + lpt_data, RdAddr + MAR);
- packet_ptr = (u_char *)eh;
+ packet_ptr = mtod(m, u_char *);
if (sc->slow)
for (s = 0; s < len; s++, packet_ptr++)
*packet_ptr = RdByteA2(sc);
@@ -1151,13 +1142,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
outb(sc->baseaddr + lpt_control, Ctrl_SelData);
WrNib(sc, CMR1, CMR1_RDPAC);
- /*
- * Remove link layer address.
- */
- m->m_pkthdr.len = m->m_len = len - sizeof(struct ether_header);
- m->m_data += sizeof(struct ether_header);
-
- ether_input(&sc->arpcom.ac_if, eh, m);
+ (*ifp->if_input)(ifp, m);
}
/*