From owner-freebsd-hackers@FreeBSD.ORG Sun Sep 5 21:38:26 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B473916A4CE; Sun, 5 Sep 2004 21:38:26 +0000 (GMT) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id F178F43D45; Sun, 5 Sep 2004 21:38:25 +0000 (GMT) (envelope-from glebius@freebsd.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.11/8.12.8) with ESMTP id i85LcNiE081695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 Sep 2004 01:38:24 +0400 (MSD) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.sick.ru (8.12.11/8.12.11/Submit) id i85LcNHO081694; Mon, 6 Sep 2004 01:38:23 +0400 (MSD) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@freebsd.org using -f Date: Mon, 6 Sep 2004 01:38:23 +0400 From: Gleb Smirnoff To: Luigi Rizzo Message-ID: <20040905213823.GA81610@cell.sick.ru> References: <20040905205249.GA81337@cell.sick.ru> <20040905142036.A23213@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20040905142036.A23213@xorpc.icir.org> User-Agent: Mutt/1.5.6i cc: hackers@freebsd.org cc: net@freebsd.org Subject: Re: bridge callbacks in if_ed.c? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2004 21:38:26 -0000 On Sun, Sep 05, 2004 at 02:20:36PM -0700, Luigi Rizzo wrote: L> > I see that bridge callbacks are still living in if_ed.c L> > from FreeBSD 2.x times. See if_ed.c:2816. I think this is L> > not correct. L> > L> > Bridge code is called from ether_input(), which is L> > indirectly called from if_ed.c:2836. L> > L> > Any objections about attached patch? L> L> there are performance reasons to do this way -- grabbing L> the entire packet is expensive because it is done via programmed L> I/O, so the current code only grabs the header, does the L> filtering, and grabs the rest of the packet only if L> needed. Well, what percentage of packets is usually dropped by bridge in normal operation? Performance degradation applies only to them. L> Probably the current code runs bridge_in_ptr() twice, but I L> believe this is still cheaper than grabbing all packets L> entirely. L> I'd rather not apply the patch unless you can show that L> the current code leads to incorrect behaviour. The problem is with layer intermixing. ed(4) is a device driver, it must pass its frames to Ethernet stack without any hacks. By the way ed(4) is the only driver which does this. Actually I'm working on the problem decribed here http://lists.freebsd.org/mailman/htdig/freebsd-net/2004-May/003881.html and one of the approaches I'm considering is to push the block (lines 569-615) from if_ethersubr.c into bridge.c. This probably requires small changes to bridge_in()/bdg_forward() logic, so it's caller must take care. We have only two callers now - ether_input(), which is OK and if_ed, which looks like a hack. P.S. Sam said, that there are plans to convert bridge to use pfil-hooks. If this happens, the code in if_ed.c will be on the way again. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE