Activate write-only optimization if bpf device opened with O_WRONLY.
dhclient opens bpf as write-only to send packets. It never reads received packets from that descriptor, but processing them in kernel takes time. Especially much time takes packet timestamping on systems with expensive timecounter, such as bhyve guest, where network speed dropped in half. MFC after: 2 weeks Sponsored by: iXsystems, Inc.
This commit is contained in:
parent
d9a6698393
commit
7144875388
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281765
@ -601,7 +601,7 @@ bpf_attachd(struct bpf_d *d, struct bpf_if *bp)
|
||||
* Save sysctl value to protect from sysctl change
|
||||
* between reads
|
||||
*/
|
||||
op_w = V_bpf_optimize_writers;
|
||||
op_w = V_bpf_optimize_writers || d->bd_writer;
|
||||
|
||||
if (d->bd_bif != NULL)
|
||||
bpf_detachd_locked(d);
|
||||
@ -864,6 +864,8 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
||||
* particular buffer method.
|
||||
*/
|
||||
bpf_buffer_init(d);
|
||||
if ((flags & FREAD) == 0)
|
||||
d->bd_writer = 2;
|
||||
d->bd_hbuf_in_use = 0;
|
||||
d->bd_bufmode = BPF_BUFMODE_BUFFER;
|
||||
d->bd_sig = SIGIO;
|
||||
|
Loading…
Reference in New Issue
Block a user