From owner-freebsd-net Thu Oct 11 11:18:49 2001 Delivered-To: freebsd-net@freebsd.org Received: from iguana.aciri.org (iguana.aciri.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id D2F7137B403 for ; Thu, 11 Oct 2001 11:18:45 -0700 (PDT) Received: (from rizzo@localhost) by iguana.aciri.org (8.11.3/8.11.1) id f9BIFaT12658; Thu, 11 Oct 2001 11:15:36 -0700 (PDT) (envelope-from rizzo) From: Luigi Rizzo Message-Id: <200110111815.f9BIFaT12658@iguana.aciri.org> Subject: Re: review of change to bridge.h In-Reply-To: <20011011111056.R84793-100000@wonky.feral.com> from Matthew Jacob at "Oct 11, 2001 11:11:35 am" To: mjacob@feral.com Date: Thu, 11 Oct 2001 11:15:36 -0700 (PDT) Cc: freebsd-net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 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) Apart from this, have you actually tested bridging on the alpha ? The purpose of the warning was also to say "look, this code might not work on architectures not supporting unaligned accesses, so you might need to hack on the code yourself" cheers luigi > Fix the silly warning: > > Index: bridge.h > =================================================================== > RCS file: /home/ncvs/src/sys/net/bridge.h,v > retrieving revision 1.8 > diff -u -r1.8 bridge.h > --- bridge.h 2001/10/05 05:45:26 1.8 > +++ bridge.h 2001/10/11 18:11:51 > @@ -92,8 +92,17 @@ > *((unsigned int *)(a)) == 0xffffffff && \ > ((unsigned short *)(a))[2] == 0xffff ) > #else > -#warning... must complete these for the alpha etc. > +/* > + * unaligned version > + */ > #define BDG_MATCH(a,b) (!bcmp(a, b, ETHER_ADDR_LEN) ) > +#define IS_ETHER_BROADCAST(a) ( \ > + ((unsigned char *)(a))[0] == 0xff && \ > + ((unsigned char *)(a))[1] == 0xff && \ > + ((unsigned char *)(a))[2] == 0xff && \ > + ((unsigned char *)(a))[3] == 0xff && \ > + ((unsigned char *)(a))[4] == 0xff && \ > + ((unsigned char *)(a))[5] == 0xff) > #endif > /* > * The following constants are not legal ifnet pointers, and are used > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message