From owner-cvs-src@FreeBSD.ORG Mon Jul 24 15:42:06 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3ADDF16A4DF; Mon, 24 Jul 2006 15:42:06 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF0BB43D53; Mon, 24 Jul 2006 15:42:05 +0000 (GMT) (envelope-from dwmalone@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6OFg5U2098375; Mon, 24 Jul 2006 15:42:05 GMT (envelope-from dwmalone@repoman.freebsd.org) Received: (from dwmalone@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6OFg5ck098374; Mon, 24 Jul 2006 15:42:05 GMT (envelope-from dwmalone) Message-Id: <200607241542.k6OFg5ck098374@repoman.freebsd.org> From: David Malone Date: Mon, 24 Jul 2006 15:42:04 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/net bpf.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2006 15:42:06 -0000 dwmalone 2006-07-24 15:42:04 UTC FreeBSD src repository Modified files: sys/net bpf.c Log: Rather than calling mircotime() in catchpacket(), make catchpacket() take a timeval indicating when the packet was captured. Move microtime() to the calling functions and grab the timestamp as soon as we know that we're going to call catchpacket at least once. This means that we call microtime() once per matched packet, as opposed to once per matched packet per bpf listener. It also means that we return the same timestamp to all bpf listeners, rather than slightly different ones. It would be more accurate to call microtime() even earlier for all packets, as you have to grab (1+#listener) locks before you can determine if the packet will be logged. You could always grab a timestamp before the locks, but microtime() can be costly, so this didn't seem like a good idea. (I guess most ethernet interfaces will have a bpf listener these days because of dhclient. That means that we could be doing two bpf locks on most packets going through the interface.) PR: 71711 Revision Changes Path 1.170 +30 -6 src/sys/net/bpf.c