From owner-freebsd-net@FreeBSD.ORG Wed Aug 22 19:50:09 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03CB31065688 for ; Wed, 22 Aug 2012 19:50:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id A704A8FC29 for ; Wed, 22 Aug 2012 19:50:08 +0000 (UTC) Received: by yhfs35 with SMTP id s35so1231740yhf.13 for ; Wed, 22 Aug 2012 12:50:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=2nr5oaNJ/Yw6eN8tJNsoJaGPzKQjz8Q5DxvSC/Dz7I8=; b=aKPqKSHU5k/1VXzdEKjieTwSZu4ytXkWQwISMs/Fh77lfaIN6Lt3KdExZ9f9XWXrUZ YFZcuat1WZiN7Fvumlaj9wzUKhcwIGHSpOSCet5iSuPUdVhnOKuuwqPxKnfK7MQhDrM6 Xnk0ZH68SrYuU056y2grThQispiMPjPlJ8I3069Lmej+OdRSfNwx2Y0XGdtUSLAoxc/5 bm6N4BJWpkEl1GU7DuvQI32bImn2aARaIg7n7hUUIP5SHFBWHGs4YQxlSn80aIaqVRw7 juq01c7P/2MbyDSWvThE0KGcuOH0/UfFpdqWP9VJ/ErlXbJ2i50lj0l/eNgyaZgaJ7fT vFTQ== Received: by 10.60.29.169 with SMTP id l9mr16384557oeh.14.1345665007575; Wed, 22 Aug 2012 12:50:07 -0700 (PDT) Received: from monkey-bot.int.fusionio.com ([209.117.142.2]) by mx.google.com with ESMTPS id k3sm4706410obw.4.2012.08.22.12.50.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Aug 2012 12:50:06 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Wed, 22 Aug 2012 13:50:04 -0600 Content-Transfer-Encoding: 7bit Message-Id: <3952D2BB-2181-430C-86BC-F9F90706C7A0@bsdimp.com> References: <50324DB4.6080905@cabletv.dp.ua> <420BA06C-C776-47DB-B3BB-F1414C115F99@bsdimp.com> <201208220802.14588.jhb@freebsd.org> To: Adrian Chadd X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQmIOhfPGT6XBROu5PxDgFNQEqn+4nvk8cRlTOufh4V0gfTVEq4KbqNWKXf++4E535ZY/yMD Cc: freebsd-hackers@freebsd.org, freebsd-net@freebsd.org, Mitya , John Baldwin , Wojciech Puchar Subject: Re: Replace bcopy() to update ether_addr X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2012 19:50:09 -0000 On Aug 22, 2012, at 12:54 PM, Adrian Chadd wrote: > On 22 August 2012 05:02, John Baldwin 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. But it isn't an array of things. It is a structure.a > 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. Which is why we need to check that output to make sure it isn't too horrible. Warner