Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 May 2015 19:33:52 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r282427 - stable/10/sys/net
Message-ID:  <201505041933.t44JXqZG097993@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon May  4 19:33:51 2015
New Revision: 282427
URL: https://svnweb.freebsd.org/changeset/base/282427

Log:
  MFC r281765:
  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.
  
  Sponsored by:	iXsystems, Inc.

Modified:
  stable/10/sys/net/bpf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/bpf.c
==============================================================================
--- stable/10/sys/net/bpf.c	Mon May  4 18:49:25 2015	(r282426)
+++ stable/10/sys/net/bpf.c	Mon May  4 19:33:51 2015	(r282427)
@@ -600,7 +600,7 @@ bpf_attachd(struct bpf_d *d, struct bpf_
 	 * 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);
@@ -802,6 +802,8 @@ bpfopen(struct cdev *dev, int flags, int
 	 * 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505041933.t44JXqZG097993>