mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-15 15:06:42 +00:00
Add module data and version to the atm_subr and reference this info from the
(currently) only consumer (en). Add a sysctl node hw.atm where the atm drivers will hook on their hardware sysctl sub-trees. Make atm_ifattach call if_attach and remove the corresponding call to if_attach from en. Create atm_ifdetach and use that in en. While the last change actually changes the interface this is not a problem in practice because the only other consumer of this API is an older LANAI driver on the net, that is not ready for current anyway. Reviewed by: -atm
This commit is contained in:
parent
0ba311ef3a
commit
d2c96fc51f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114201
@ -66,6 +66,9 @@
|
||||
#include <dev/en/midwayreg.h>
|
||||
#include <dev/en/midwayvar.h>
|
||||
|
||||
MODULE_DEPEND(en, pci, 1, 1, 1);
|
||||
MODULE_DEPEND(en, atm, 1, 1, 1);
|
||||
|
||||
/*
|
||||
* local structures
|
||||
*/
|
||||
@ -262,7 +265,7 @@ en_pci_attach(device_t dev)
|
||||
en_intr, sc, &scp->ih);
|
||||
if (error) {
|
||||
en_reset(sc);
|
||||
if_detach(&sc->enif);
|
||||
atm_ifdetach(&sc->enif);
|
||||
device_printf(dev, "could not setup irq\n");
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, scp->irq);
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, PCI_CBMA, scp->res);
|
||||
@ -297,7 +300,7 @@ en_pci_detach(device_t dev)
|
||||
* Close down routes etc.
|
||||
*/
|
||||
en_reset(sc);
|
||||
if_detach(&sc->enif);
|
||||
atm_ifdetach(&sc->enif);
|
||||
|
||||
/*
|
||||
* Deallocate resources.
|
||||
|
@ -173,7 +173,7 @@ enum {
|
||||
#define ENOTHER_DRAIN 0x02 /* almost free (drain DRQ dma) */
|
||||
#define ENOTHER_SWSL 0x08 /* in software service list */
|
||||
|
||||
SYSCTL_NODE(_hw, OID_AUTO, en, CTLFLAG_RW, 0, "ENI 155p");
|
||||
SYSCTL_DECL(_hw_atm);
|
||||
|
||||
/*
|
||||
* dma tables
|
||||
@ -2767,7 +2767,7 @@ en_attach(struct en_softc *sc)
|
||||
sysctl_ctx_init(&sc->sysctl_ctx);
|
||||
|
||||
if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_hw_en), OID_AUTO,
|
||||
SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO,
|
||||
device_get_nameunit(sc->dev), CTLFLAG_RD, 0, "")) == NULL)
|
||||
goto fail;
|
||||
|
||||
@ -2877,7 +2877,6 @@ en_attach(struct en_softc *sc)
|
||||
/*
|
||||
* final commit
|
||||
*/
|
||||
if_attach(ifp);
|
||||
atm_ifattach(ifp);
|
||||
|
||||
#ifdef ENABLE_BPF
|
||||
|
@ -99,6 +99,7 @@ struct atmllc {
|
||||
|
||||
#ifdef _KERNEL
|
||||
void atm_ifattach(struct ifnet *);
|
||||
void atm_ifdetach(struct ifnet *);
|
||||
void atm_input(struct ifnet *, struct atm_pseudohdr *,
|
||||
struct mbuf *, void *);
|
||||
int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *,
|
||||
|
@ -45,11 +45,14 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mac.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/netisr.h>
|
||||
@ -68,6 +71,8 @@
|
||||
#include <netnatm/natm.h>
|
||||
#endif
|
||||
|
||||
SYSCTL_NODE(_hw, OID_AUTO, atm, CTLFLAG_RW, 0, "ATM hardware");
|
||||
|
||||
#ifndef ETHERTYPE_IPV6
|
||||
#define ETHERTYPE_IPV6 0x86dd
|
||||
#endif
|
||||
@ -283,7 +288,7 @@ atm_input(ifp, ah, m, rxhand)
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform common duties while attaching to interface list
|
||||
* Perform common duties while attaching to interface list.
|
||||
*/
|
||||
void
|
||||
atm_ifattach(ifp)
|
||||
@ -295,6 +300,7 @@ atm_ifattach(ifp)
|
||||
ifp->if_type = IFT_ATM;
|
||||
ifp->if_addrlen = 0;
|
||||
ifp->if_hdrlen = 0;
|
||||
if_attach(ifp);
|
||||
ifp->if_mtu = ATMMTU;
|
||||
ifp->if_output = atm_output;
|
||||
#if 0
|
||||
@ -321,3 +327,21 @@ atm_ifattach(ifp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Common stuff for detaching an ATM interface
|
||||
*/
|
||||
void
|
||||
atm_ifdetach(struct ifnet *ifp)
|
||||
{
|
||||
if_detach(ifp);
|
||||
}
|
||||
|
||||
static moduledata_t atm_mod = {
|
||||
"atm",
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
DECLARE_MODULE(atm, atm_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
|
||||
MODULE_VERSION(atm, 1);
|
||||
|
@ -66,6 +66,9 @@
|
||||
#include <dev/en/midwayreg.h>
|
||||
#include <dev/en/midwayvar.h>
|
||||
|
||||
MODULE_DEPEND(en, pci, 1, 1, 1);
|
||||
MODULE_DEPEND(en, atm, 1, 1, 1);
|
||||
|
||||
/*
|
||||
* local structures
|
||||
*/
|
||||
@ -262,7 +265,7 @@ en_pci_attach(device_t dev)
|
||||
en_intr, sc, &scp->ih);
|
||||
if (error) {
|
||||
en_reset(sc);
|
||||
if_detach(&sc->enif);
|
||||
atm_ifdetach(&sc->enif);
|
||||
device_printf(dev, "could not setup irq\n");
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, scp->irq);
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, PCI_CBMA, scp->res);
|
||||
@ -297,7 +300,7 @@ en_pci_detach(device_t dev)
|
||||
* Close down routes etc.
|
||||
*/
|
||||
en_reset(sc);
|
||||
if_detach(&sc->enif);
|
||||
atm_ifdetach(&sc->enif);
|
||||
|
||||
/*
|
||||
* Deallocate resources.
|
||||
|
Loading…
Reference in New Issue
Block a user