Date: Tue, 3 May 2005 01:35:39 +0200 (CEST) From: Sten Spans <sten@blinkenlights.nl> To: Mike Silbersack <silby@silby.com> Cc: jmg@FreeBSD.org Subject: Re: if_tap unaligned access problem Message-ID: <Pine.SOC.4.61.0505030116500.709@tea.blinkenlights.nl> In-Reply-To: <20050502180353.T787@odysseus.silby.com> References: <20050428135120.GB21428@cell.sick.ru> <427111BF.2050607@savvis.net><20050502180353.T787@odysseus.silby.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2 May 2005, Mike Silbersack wrote: > > On Thu, 28 Apr 2005, Bruce M Simpson wrote: > >> jmg's suggestion of bringing in the NetBSD patches to allow the entire >> network stack to be compiled with unaligned accesses (for those platforms >> which support it) is interesting because it can simplify or eliminate >> some of the acrobatics needed in network drivers to deal with the mbuf >> alignment. > > I'm too lazy to benchmark, but I suspect that having the ethernet code shift > the packet backwards by two bytes after it strips off the ethernet header is > going to be faster than requiring ip_input to allocate a new mbuf for each > received packet. > > Such a change would also ensure that we don't break all the other protocols > that jmg didn't touch in his patch. For the if_tap case fixing the driver ( or rather changing m_uiotombuf ) is definately the correct solution. No sensible person would say otherwise. Once the if_tap change is properly tested and signed off it should make it into the tree. But on the proposed alignment changes: If you would look at the netbsd url ( http://mail-index.netbsd.org/source-changes/2002/07/01/0001.html ) You would see that: 1- This code only triggers for strict alignment architectures No inpact for i386 and amd64. 2- This code only triggers when the protocol header is unaligned. If the l2 driver is ok then this code won't be triggered. 3- Only the link headers are aligned, not the entire mbuf(chain). This should limit the performance impact quite a bit. It might even alow us to eliminate quite a bit of ugly mbuf juggling in certain drivers. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet/ip_input.c.diff?r1=1.153&r2=1.154&f=h ( Or the comments are incorrect, and I need to do more code reading :) To summarize: These changes will stop kernel crashes on alpha and sparc for drivers which are currently broken. All the drivers which currently work will not trigger this code. I haven't looked at every drivers but this change looks quite a bit cleaner than most of the tricks pulled in ethernet drivers, especially when jumboframes are involved. Netbsd has had 3 years to test this code, it can't be all bad :) -- Sten Spans "There is a crack in everything, that's how the light gets in." Leonard Cohen - Anthem
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOC.4.61.0505030116500.709>