From owner-freebsd-net Thu Oct 11 11:42:36 2001 Delivered-To: freebsd-net@freebsd.org Received: from beppo.feral.com (beppo.feral.com [192.67.166.79]) by hub.freebsd.org (Postfix) with ESMTP id 0034137B403 for ; Thu, 11 Oct 2001 11:42:32 -0700 (PDT) Received: from wonky.feral.com (wonky.feral.com [192.67.166.7]) by beppo.feral.com (8.11.3/8.11.3) with ESMTP id f9BIgUH84156; Thu, 11 Oct 2001 11:42:30 -0700 (PDT) (envelope-from mjacob@feral.com) Date: Thu, 11 Oct 2001 11:42:30 -0700 (PDT) From: Matthew Jacob Reply-To: To: Luigi Rizzo Cc: Subject: Re: review of change to bridge.h In-Reply-To: <200110111835.f9BIZTn12830@iguana.aciri.org> Message-ID: <20011011114158.G84793-100000@wonky.feral.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Maybe bcmp is right. I believe having IS_ETHER_BROADCAST is too useful a macro.... On Thu, 11 Oct 2001, Luigi Rizzo wrote: > > > > > > On Thu, 11 Oct 2001, Luigi Rizzo wrote: > > > > > I guess it might be marginally more efficient to > > > call bcmp() (and rely on it being optimized), or do 3 > > > comparisons with unsigned short * > > > > > > > +#define IS_ETHER_BROADCAST(a) ( \ > > > > + ((unsigned short *)(a))[0] == 0xffff && \ > > > > + ((unsigned short *)(a))[1] == 0xffff && \ > > > > + ((unsigned short *)(a))[2] == 0xffff) > > > > You can't assume a short * is aligned either. > > well, in this case a is always on > an even boundary, but whether this is also a multiple of 4 > is very driver-specific. > > Anyways, feel free to commit whatever version you prefer -- it > is better than the current code anyways. > > I would probably use bcmp... i find myself trying to rely > more and more on compiler optimizations, because the hand > optimization that we all liked to do in the early years are > very architecture specific and tend to become bad ideas as > architectures evolve. > > There are parts of the code (e.g. in mbuf handling) where "optimized" > versions of some routines (e.g. m_copym vs. m_copypacket) save > maybe a couple of jumps/calls at the price of 500-1000 bytes of > extra code (and associated cache pollution). > > cheers > luigi > ----------------------------------+----------------------------------------- > Luigi RIZZO, luigi@iet.unipi.it . ACIRI/ICSI (on leave from Univ. di Pisa) > http://www.iet.unipi.it/~luigi/ . 1947 Center St, Berkeley CA 94704 > Phone: (510) 666 2927 > ----------------------------------+----------------------------------------- > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message