From owner-svn-src-all@FreeBSD.ORG Tue May 5 02:51:39 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D8602C7; Tue, 5 May 2015 02:51:39 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A54981B07; Tue, 5 May 2015 02:51:38 +0000 (UTC) Received: from Julian-MBP3.local (ppp121-45-241-118.lns20.per4.internode.on.net [121.45.241.118]) (authenticated bits=0) by vps1.elischer.org (8.14.9/8.14.9) with ESMTP id t452pXUI027825 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 4 May 2015 19:51:36 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <5548302F.2@freebsd.org> Date: Tue, 05 May 2015 10:51:27 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r282427 - stable/10/sys/net References: <201505041933.t44JXqZG097993@svn.freebsd.org> In-Reply-To: <201505041933.t44JXqZG097993@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 02:51:39 -0000 On 5/5/15 3:33 AM, Alexander Motin wrote: > 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. we probably should look at using a less weird way of sending raw packets. using bpf (which is supposed to be a read-only interface) is just wrong.. > > 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; > > >