From owner-p4-projects@FreeBSD.ORG Fri Feb 2 21:58:31 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9044716A406; Fri, 2 Feb 2007 21:58:31 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 47FDF16A402 for ; Fri, 2 Feb 2007 21:58:31 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 383E013C46B for ; Fri, 2 Feb 2007 21:58:31 +0000 (UTC) (envelope-from csjp@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 l12LwV6n023874 for ; Fri, 2 Feb 2007 21:58:31 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l12LwUYo023871 for perforce@freebsd.org; Fri, 2 Feb 2007 21:58:30 GMT (envelope-from csjp@freebsd.org) Date: Fri, 2 Feb 2007 21:58:30 GMT Message-Id: <200702022158.l12LwUYo023871@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 113921 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2007 21:58:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=113921 Change 113921 by csjp@csjp_rnd01 on 2007/02/02 21:58:07 - Drop the Giant requirement for the system calls - Fix a problem which resulted in select(2)/poll(2) waking up constantly indicating that the file descriptor was ready to read. This occured because the old old simply looked at the size of the hold buffer and used that to indicate that there was data ready to read. In the old world order we used set the hold buffer length to 0 after bpf_uiomove() returned. In the zero copy world, we tell the kernel we are done with the buffer by incrementing the user generation number, leaving the hold buffer length un-touched. This change basically looks to see if the user and kernel generation numbers are different, and if so, wakes up the reader Affected files ... .. //depot/projects/zcopybpf/src/sys/net/bpf.c#10 edit Differences ... ==== //depot/projects/zcopybpf/src/sys/net/bpf.c#10 (text+ko) ==== @@ -141,7 +141,6 @@ static struct cdevsw bpf_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, .d_open = bpfopen, .d_close = bpfclose, .d_read = bpfread, @@ -809,7 +808,7 @@ // printf("bpf_ready: hlen: %d, immediate %d, state %d, slen %d\n", // d->bd_hlen, d->bd_immediate, d->bd_state, d->bd_slen); - if (d->bd_hlen != 0) + if (!bpf_buffree(d) && d->bd_hlen != 0) return (1); if ((d->bd_immediate || d->bd_state == BPF_TIMED_OUT) && d->bd_slen != 0)