Init the decriptors at boot time rather than at interface attach time.
Now that we have pcmcia hot-plug, it's not the same. Fixes kern/3189.
This commit is contained in:
parent
cdbe530495
commit
433c02431e
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: bpf.c,v 1.45 1998/11/05 22:50:15 jonathan Exp $ */
|
/* $NetBSD: bpf.c,v 1.46 1998/12/04 11:04:37 bouyer Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990, 1991, 1993
|
* Copyright (c) 1990, 1991, 1993
|
||||||
@ -107,19 +107,6 @@ int bpf_bufsize = BPF_BUFSIZE;
|
|||||||
struct bpf_if *bpf_iflist;
|
struct bpf_if *bpf_iflist;
|
||||||
struct bpf_d bpf_dtab[NBPFILTER];
|
struct bpf_d bpf_dtab[NBPFILTER];
|
||||||
|
|
||||||
#if BSD >= 199207 || NetBSD0_9 >= 2
|
|
||||||
/*
|
|
||||||
* bpfilterattach() is called at boot time in new systems. We do
|
|
||||||
* nothing here since old systems will not call this.
|
|
||||||
*/
|
|
||||||
/* ARGSUSED */
|
|
||||||
void
|
|
||||||
bpfilterattach(n)
|
|
||||||
int n;
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int bpf_allocbufs __P((struct bpf_d *));
|
static int bpf_allocbufs __P((struct bpf_d *));
|
||||||
static int bpf_allocbufs __P((struct bpf_d *));
|
static int bpf_allocbufs __P((struct bpf_d *));
|
||||||
static void bpf_freed __P((struct bpf_d *));
|
static void bpf_freed __P((struct bpf_d *));
|
||||||
@ -349,6 +336,23 @@ bpf_detachd(d)
|
|||||||
#define D_MARKFREE(d) ((d)->bd_next = (d))
|
#define D_MARKFREE(d) ((d)->bd_next = (d))
|
||||||
#define D_MARKUSED(d) ((d)->bd_next = 0)
|
#define D_MARKUSED(d) ((d)->bd_next = 0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpfilterattach() is called at boot time.
|
||||||
|
*/
|
||||||
|
/* ARGSUSED */
|
||||||
|
void
|
||||||
|
bpfilterattach(n)
|
||||||
|
int n;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
/*
|
||||||
|
* Mark all the descriptors free.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < NBPFILTER; ++i)
|
||||||
|
D_MARKFREE(&bpf_dtab[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open ethernet device. Returns ENXIO for illegal minor device number,
|
* Open ethernet device. Returns ENXIO for illegal minor device number,
|
||||||
* EBUSY if file is open by another process.
|
* EBUSY if file is open by another process.
|
||||||
@ -1301,7 +1305,6 @@ bpfattach(driverp, ifp, dlt, hdrlen)
|
|||||||
u_int dlt, hdrlen;
|
u_int dlt, hdrlen;
|
||||||
{
|
{
|
||||||
struct bpf_if *bp;
|
struct bpf_if *bp;
|
||||||
int i;
|
|
||||||
#if BSD < 199103
|
#if BSD < 199103
|
||||||
static struct bpf_if bpf_ifs[NBPFILTER];
|
static struct bpf_if bpf_ifs[NBPFILTER];
|
||||||
static int bpfifno;
|
static int bpfifno;
|
||||||
@ -1331,13 +1334,6 @@ bpfattach(driverp, ifp, dlt, hdrlen)
|
|||||||
*/
|
*/
|
||||||
bp->bif_hdrlen = BPF_WORDALIGN(hdrlen + SIZEOF_BPF_HDR) - hdrlen;
|
bp->bif_hdrlen = BPF_WORDALIGN(hdrlen + SIZEOF_BPF_HDR) - hdrlen;
|
||||||
|
|
||||||
/*
|
|
||||||
* Mark all the descriptors free if this hasn't been done.
|
|
||||||
*/
|
|
||||||
if (!D_ISFREE(&bpf_dtab[0]))
|
|
||||||
for (i = 0; i < NBPFILTER; ++i)
|
|
||||||
D_MARKFREE(&bpf_dtab[i]);
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("bpf: %s attached\n", ifp->if_xname);
|
printf("bpf: %s attached\n", ifp->if_xname);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user