Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 15:21:06 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        freebsd-hackers@freebsd.org, freebsd-net@freebsd.org, Mitya <mitya@cabletv.dp.ua>, Warner Losh <imp@bsdimp.com>, Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Subject:   Re: Replace bcopy() to update ether_addr
Message-ID:  <201208221521.06954.jhb@freebsd.org>
In-Reply-To: <CAJ-Vmo=1cbJn3pkSvoCq7y-kEGig-h1Vxo6M5V0=b9=MkfuMRA@mail.gmail.com>
References:  <50324DB4.6080905@cabletv.dp.ua> <201208220802.14588.jhb@freebsd.org> <CAJ-Vmo=1cbJn3pkSvoCq7y-kEGig-h1Vxo6M5V0=b9=MkfuMRA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, August 22, 2012 2:54:07 pm Adrian Chadd wrote:
> On 22 August 2012 05:02, John Baldwin <jhb@freebsd.org> wrote:
> > On Tuesday, August 21, 2012 12:34:42 pm Adrian Chadd wrote:
> >> Hi,
> >>
> >> What about just creating an ETHER_ADDR_COPY(dst, src) and putting that
> >> in a relevant include file, then hide the ugliness there?
> >>
> >> The same benefits will likely appear when copying wifi MAC addresses
> >> to/from headers.
> >>
> >> Thanks, I'm glad someone noticed this.
> >
> > I doubt we even _need_ the ugliness.  We should just use *dst = *src
> > unless there is a compelling reason not to.
> 
> Because it's not very clear? :-) I'd much prefer my array-of-things
> copies to be explicit.

Eh?  'struct foo *src, *dst; *dst = *src' is pretty bog-standard C.  That 
isn't really all that obtuse.

> Also, the optimisation and compiler silliness may not be THAT obvious
> on intel (except when you're luigi and using netmap) but I can't help
> but wonder whether the same does hold for MIPS/ARM. Getting it wrong
> there will lead to some very very poor performing code.

Don't you think there's a really good chance the compiler knows how to copy a 
structure appropriately for each architecture already?

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208221521.06954.jhb>