From nobody Thu Aug 08 16:39:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wft7307Cgz5TC6j; Thu, 08 Aug 2024 16:39:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wft726V12z4NfM; Thu, 8 Aug 2024 16:39:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723135182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pg1sdWDLbSH0x6u3zWRq4E7sm+jCGeA44hAdJ2+tjXg=; b=oqOl6rM9kclCpYPyOAT32A2BkXyaitvC7TkfqZV4/5wXMLquUHZhSS/DmlIPYG7odzGU4j GJIDTF/r8+Ecti5Cy4dtX2ae5kOmCaXA2sj11bfD7ydiG6im7q7Ls6rmZZFTebE3+xLFAv stm0ker0mrx0kegkYzRJAQ0IbyjykW/2zjFHgyeN2aS14oat4EHfOM1Tumz3Nswh67+AyF 34XjIXA+aSzLqCJXABGjLwj38zB4+MGEGeJYNE3wfcSkx/N7iqNB3P234gU+2itQsa0PMH UqHYLQxQLNhg8LFlgNPSwTlcMjTHwMg2gM4i/2kKKBODyaZTqj7Cc8B9xiTARQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723135182; a=rsa-sha256; cv=none; b=GY6SVLA+snkl+LBJR3444g0FqcIWC5FurcswKCzUBQePdxZKmPOsRJtrPX4oqV/BMBJB/D w7zQ14zrlxAmZ426NHtTWvRIbmGIQRpGHugmQphdl6/YcFlh5YsinfoCH3ZbytghhnYZ4E VE4GmeKxXtI3Z0Rt5gOoGSQS+TCD6V3/Sr4Vrl3UTGvZvhPP4ZBzmkLTz9eWKRCg67NYhD Lrf1elKVQYp5NSiDcE6eevVjYDIwvODf/WTb1IvsOrrPXXhzf6NpceGrDilRpUZUgbLpRv wEyV9LoZkoBC791PT5jq85ZfVhPQ8+fM0nYzZTvw1Hj58pCTcBm5CIpvUcKuSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723135182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pg1sdWDLbSH0x6u3zWRq4E7sm+jCGeA44hAdJ2+tjXg=; b=fkTyYxy9AB/BkT0u+f7L9nfoT3AsUUcDpZysRPKzqXCXmf/Cn/NNg5ewP6rZJrM5tNIBs5 RasvuONSEQQtzdkE+0CHEJOhF5YeY+K5Y4rKA31ECBaLV2YQdshJGOFCl869+gjqSTFC7Y tIAZmlbYUzuLtnU567NvnxOXSRjC0V9n0X/g7kEHCYY3hViInC29BI7j7q2CxsPmhgjllW 2EQYocNcdcgu47WA6eWwF0YDaS3nJaLEW74TL3r10l2al40+M6jO35zJnjqz2RIivrSeBo SEIcrZzzu6zOvkC8Up0gg+D9/3ZqvEeYbMctEUMjwf/WS4ff0e1DrqIN4PTHrQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Wft725ylnzgsD; Thu, 8 Aug 2024 16:39:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 478GdgqW060746; Thu, 8 Aug 2024 16:39:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 478GdgkB060743; Thu, 8 Aug 2024 16:39:42 GMT (envelope-from git) Date: Thu, 8 Aug 2024 16:39:42 GMT Message-Id: <202408081639.478GdgkB060743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a1295b24842d - main - linuxkpi: use canonical tests for is_{zero,broadcast}_ether_addr List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1295b24842d209e6bf93a4823193d56ad2db064 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a1295b24842d209e6bf93a4823193d56ad2db064 commit a1295b24842d209e6bf93a4823193d56ad2db064 Author: Ed Maste AuthorDate: 2024-08-08 00:00:00 +0000 Commit: Ed Maste CommitDate: 2024-08-08 16:39:14 +0000 linuxkpi: use canonical tests for is_{zero,broadcast}_ether_addr They are functionally equivalent, but the updated form mirrors the tests in sys/net/ethernet.h and avoids confusion. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21037 --- sys/compat/linuxkpi/common/include/linux/etherdevice.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h index 89cd4c8e0ba0..5d3df744ae0e 100644 --- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h @@ -53,7 +53,8 @@ struct ethtool_modinfo { static inline bool is_zero_ether_addr(const u8 * addr) { - return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00); + return ((addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]) == + 0x00); } static inline bool @@ -65,7 +66,8 @@ is_multicast_ether_addr(const u8 * addr) static inline bool is_broadcast_ether_addr(const u8 * addr) { - return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff)); + return ((addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == + 0xff); } static inline bool