From owner-svn-src-all@freebsd.org Sun Aug 7 08:59:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1136ABB03FE; Sun, 7 Aug 2016 08:59:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D002014B0; Sun, 7 Aug 2016 08:59:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C84201FE024; Sun, 7 Aug 2016 10:59:00 +0200 (CEST) Subject: Re: svn commit: r303811 - in head/sys: net net80211 To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201608070348.u773mXXt030939@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <46183559-343f-401b-6471-3822e3383a50@selasky.org> Date: Sun, 7 Aug 2016 11:03:23 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201608070348.u773mXXt030939@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2016 08:59:03 -0000 On 08/07/16 05:48, Adrian Chadd wrote: > Author: adrian > Date: Sun Aug 7 03:48:33 2016 > New Revision: 303811 > URL: https://svnweb.freebsd.org/changeset/base/303811 > > Log: > Extract out the various local definitions of ETHER_IS_BROADCAST() and > turn them into a shared definition. > > Set M_MCAST/M_BCAST appropriately upon packet reception in net80211, just > before they are delivered up to the ethernet stack. > > Submitted by: rstone > > Modified: > head/sys/net/ethernet.h > head/sys/net/if_ethersubr.c > head/sys/net/if_gif.c > head/sys/net80211/ieee80211_input.c > > Modified: head/sys/net/ethernet.h > ============================================================================== > --- head/sys/net/ethernet.h Sun Aug 7 01:32:37 2016 (r303810) > +++ head/sys/net/ethernet.h Sun Aug 7 03:48:33 2016 (r303811) > @@ -71,6 +71,9 @@ struct ether_addr { > } __packed; > > #define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */ > +#define ETHER_IS_BROADCAST(addr) \ > + (((addr)[0] & (addr)[1] & (addr)[2] & \ > + (addr)[3] & (addr)[4] & (addr)[5]) == 0xff) > Hi, The compiler might be able to produce more optimal code if you use "+" instead of "&", because there are instructions on x86, that can add multiple variables at the same time. With "&" you need to process every one as a single instructions usually I think. > +#define ETHER_IS_BROADCAST(addr) \ > + (((addr)[0] + (addr)[1] + (addr)[2] + \ > + (addr)[3] + (addr)[4] + (addr)[5]) == (6*0xff)) --HPS