Created
March 13, 2013 09:45
-
-
Save tuxillo/5150622 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/sys/net/bpf.c b/sys/net/bpf.c | |
| index 4f7ce91..57c35a9 100644 | |
| --- a/sys/net/bpf.c | |
| +++ b/sys/net/bpf.c | |
| @@ -383,13 +383,11 @@ bpfclose(struct dev_close_args *ap) | |
| lwkt_gettoken(&bpf_token); | |
| funsetown(&d->bd_sigio); | |
| - crit_enter(); | |
| if (d->bd_state == BPF_WAITING) | |
| callout_stop(&d->bd_callout); | |
| d->bd_state = BPF_IDLE; | |
| if (d->bd_bif != NULL) | |
| bpf_detachd(d); | |
| - crit_exit(); | |
| bpf_freed(d); | |
| dev->si_drv1 = NULL; | |
| if (dev->si_uminor >= BPF_PREALLOCATED_UNITS) { | |
| @@ -434,7 +432,6 @@ bpfread(struct dev_read_args *ap) | |
| return(EINVAL); | |
| } | |
| - crit_enter(); | |
| if (d->bd_state == BPF_WAITING) | |
| callout_stop(&d->bd_callout); | |
| timed_out = (d->bd_state == BPF_TIMED_OUT); | |
| @@ -466,19 +463,16 @@ bpfread(struct dev_read_args *ap) | |
| * it before using it again. | |
| */ | |
| if (d->bd_bif == NULL) { | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| return(ENXIO); | |
| } | |
| if (ap->a_ioflag & IO_NDELAY) { | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| return(EWOULDBLOCK); | |
| } | |
| error = tsleep(d, PCATCH, "bpf", d->bd_rtout); | |
| if (error == EINTR || error == ERESTART) { | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| return(error); | |
| } | |
| @@ -497,7 +491,6 @@ bpfread(struct dev_read_args *ap) | |
| break; | |
| if (d->bd_slen == 0) { | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| return(0); | |
| } | |
| @@ -506,22 +499,15 @@ bpfread(struct dev_read_args *ap) | |
| } | |
| } | |
| /* | |
| - * At this point, we know we have something in the hold slot. | |
| - */ | |
| - crit_exit(); | |
| - | |
| - /* | |
| * Move data from hold buffer into user space. | |
| * We know the entire buffer is transferred since | |
| * we checked above that the read buffer is bpf_bufsize bytes. | |
| */ | |
| error = uiomove(d->bd_hbuf, d->bd_hlen, ap->a_uio); | |
| - crit_enter(); | |
| d->bd_fbuf = d->bd_hbuf; | |
| d->bd_hbuf = NULL; | |
| d->bd_hlen = 0; | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| return(error); | |
| @@ -675,11 +661,9 @@ bpfioctl(struct dev_ioctl_args *ap) | |
| int error = 0; | |
| lwkt_gettoken(&bpf_token); | |
| - crit_enter(); | |
| if (d->bd_state == BPF_WAITING) | |
| callout_stop(&d->bd_callout); | |
| d->bd_state = BPF_IDLE; | |
| - crit_exit(); | |
| if (d->bd_locked == 1) { | |
| switch (ap->a_cmd) { | |
| @@ -716,11 +700,9 @@ bpfioctl(struct dev_ioctl_args *ap) | |
| { | |
| int n; | |
| - crit_enter(); | |
| n = d->bd_slen; | |
| if (d->bd_hbuf) | |
| n += d->bd_hlen; | |
| - crit_exit(); | |
| *(int *)ap->a_data = n; | |
| break; | |
| @@ -779,9 +761,7 @@ bpfioctl(struct dev_ioctl_args *ap) | |
| * Flush read packet buffer. | |
| */ | |
| case BIOCFLUSH: | |
| - crit_enter(); | |
| bpf_resetd(d); | |
| - crit_exit(); | |
| break; | |
| /* | |
| @@ -795,13 +775,11 @@ bpfioctl(struct dev_ioctl_args *ap) | |
| error = EINVAL; | |
| break; | |
| } | |
| - crit_enter(); | |
| if (d->bd_promisc == 0) { | |
| error = ifpromisc(d->bd_bif->bif_ifp, 1); | |
| if (error == 0) | |
| d->bd_promisc = 1; | |
| } | |
| - crit_exit(); | |
| break; | |
| /* | |
| @@ -1509,7 +1487,6 @@ bpfdetach(struct ifnet *ifp) | |
| struct bpf_d *d; | |
| lwkt_gettoken(&bpf_token); | |
| - crit_enter(); | |
| /* Locate BPF interface information */ | |
| bp_prev = NULL; | |
| @@ -1521,7 +1498,6 @@ bpfdetach(struct ifnet *ifp) | |
| /* Interface wasn't attached */ | |
| if (bp->bif_ifp == NULL) { | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| kprintf("bpfdetach: %s was not attached\n", ifp->if_xname); | |
| return; | |
| @@ -1539,7 +1515,6 @@ bpfdetach(struct ifnet *ifp) | |
| kfree(bp, M_BPF); | |
| - crit_exit(); | |
| lwkt_reltoken(&bpf_token); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment