diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-08-15 03:07:51 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-08-15 03:07:51 +0000 |
commit | 42bdbaebec711114c89ecca6eca64e016694fc63 (patch) | |
tree | 8c6a8696f475d7a43f8e3b3f28c7fb4dbe30505c | |
parent | de387024d42f155efcaa9041f988541522b10e6c (diff) |
hook up the ether and ifmedia layers. you can see nxe in ifconfig output
now. just the lladdr though, i havent filled in enough of the ioctl handler
for more yet.
-rw-r--r-- | sys/dev/pci/if_nxe.c | 74 |
1 files changed, 72 insertions, 2 deletions
diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c index 53cea3f334e..5a1b99a9f28 100644 --- a/sys/dev/pci/if_nxe.c +++ b/sys/dev/pci/if_nxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxe.c,v 1.23 2007/08/15 02:49:42 dlg Exp $ */ +/* $OpenBSD: if_nxe.c,v 1.24 2007/08/15 03:07:50 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -613,9 +613,18 @@ int nxe_user_info(struct nxe_softc *); int nxe_init(struct nxe_softc *); void nxe_mountroot(void *); -/* runtime entry points */ +/* chip state */ void nxe_sensor_tick(void *); +/* interface operations */ +int nxe_ioctl(struct ifnet *, u_long, caddr_t); +void nxe_start(struct ifnet *); +void nxe_watchdog(struct ifnet *); + +/* ifmedia operations */ +int nxe_media_change(struct ifnet *); +void nxe_media_status(struct ifnet *, struct ifmediareq *); + /* wrapper around dmaable memory allocations */ struct nxe_dmamem *nxe_dmamem_alloc(struct nxe_softc *, bus_size_t, bus_size_t); @@ -684,6 +693,7 @@ nxe_attach(struct device *parent, struct device *self, void *aux) { struct nxe_softc *sc = (struct nxe_softc *)self; struct pci_attach_args *pa = aux; + struct ifnet *ifp; sc->sc_dmat = pa->pa_dmat; sc->sc_function = pa->pa_function; @@ -711,6 +721,25 @@ nxe_attach(struct device *parent, struct device *self, void *aux) goto unmap; } + ifp = &sc->sc_ac.ac_if; + ifp->if_softc = sc; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_capabilities = IFCAP_VLAN_MTU; + ifp->if_ioctl = nxe_ioctl; + ifp->if_start = nxe_start; + ifp->if_watchdog = nxe_watchdog; + ifp->if_hardmtu = MCLBYTES - ETHER_HDR_LEN - ETHER_CRC_LEN; + strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); + IFQ_SET_MAXLEN(&ifp->if_snd, 512); /* XXX */ + IFQ_SET_READY(&ifp->if_snd); + + ifmedia_init(&sc->sc_media, 0, nxe_media_change, nxe_media_status); + ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_AUTO); + + if_attach(ifp); + ether_ifattach(ifp); + printf(": firmware %d.%d.%d address %s\n", sc->sc_fw_major, sc->sc_fw_minor, sc->sc_fw_build, ether_sprintf(sc->sc_ac.ac_enaddr)); @@ -776,6 +805,47 @@ nxe_intr(void *xsc) } int +nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) +{ + struct nxe_softc *sc = ifp->if_softc; + int error; + + error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); + if (error > 0) + goto err; + + /* switch statement goes here */ + error = ENOTTY; + +err: + return (error); +} + +void +nxe_start(struct ifnet *ifp) +{ + +} + +void +nxe_watchdog(struct ifnet *ifp) +{ + /* do nothing */ +} + +int +nxe_media_change(struct ifnet *ifp) +{ + /* ignore for now */ + return (0); +} + +void +nxe_media_status(struct ifnet *ifp, struct ifmediareq *imr) +{ +} + +int nxe_board_info(struct nxe_softc *sc) { struct nxe_info *ni; |