Message ID | SI2PR04MB5097BCA8FF2A2F03D9A5A3EEDC5A2@SI2PR04MB5097.apcprd04.prod.outlook.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-80405-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1830598dyb; Sun, 25 Feb 2024 18:25:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXd3OOsEqYQRtBNU34pVUcQrR5ZIAUlOTlOUlYqVHSznO8a++9nPhRJYKhG6Zm4YO8OAe+iVsfW7EFNyTNPX4YU7BuNSw== X-Google-Smtp-Source: AGHT+IFI9HSoJF1bmsK/fkQR0Fh0ijI9wfTDtVtP5KmSOKqFlzqzBSCULePQmsbS/9edYyZE4ipA X-Received: by 2002:a05:6358:4410:b0:17b:57db:6c10 with SMTP id z16-20020a056358441000b0017b57db6c10mr6572159rwc.4.1708914317132; Sun, 25 Feb 2024 18:25:17 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w191-20020a6382c8000000b005d5d74411fasi2883110pgd.207.2024.02.25.18.25.17 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 18:25:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80405-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@qnap.com header.s=selector1 header.b=tUuqVXKn; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-80405-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80405-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qnap.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DA12F280F99 for <ouuuleilei@gmail.com>; Mon, 26 Feb 2024 02:25:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ECAF14AB2; Mon, 26 Feb 2024 02:25:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qnap.com header.i=@qnap.com header.b="tUuqVXKn" Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2115.outbound.protection.outlook.com [40.107.215.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DE4EEEB5; Mon, 26 Feb 2024 02:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.115 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708914299; cv=fail; b=m6jpylnwx/NyplIeqcQRweB5ba1MPvU56ePyEwRmkYdy1g6p+GihFitmmSviJZPUQ7B75IgwgfBDZDmmRKvE3pUCA+DYzCio2ZUXz8sntGNDvUFmBx0Qt+vengJ2HqsXaBT/OdQEYfImwJYUOftvOl+3OBQis66+9+P5mnsVk/E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708914299; c=relaxed/simple; bh=RQGJTp3q/ZnOcc6gPKZAuikIuPmdQPWVDg4ag7dJ0uc=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=p8N3UeVy4A885vJ1N72cxOMwCeWuAB/L16MqLxsMZGnY0LYAm7ZPXMoyO6//ABnBiE3ZC2BrGoLFc5NY66/9gl44i3SVCj0h4uFTVGkXS7gr405ec5HNNQutP9AQlv/aLvWLkFw23kbWPOvhvfqz+bBDS+DcZB6/HGC2YT3vpfs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qnap.com; spf=pass smtp.mailfrom=qnap.com; dkim=pass (2048-bit key) header.d=qnap.com header.i=@qnap.com header.b=tUuqVXKn; arc=fail smtp.client-ip=40.107.215.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qnap.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qnap.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g8xB12N3TTPBNbRp0j2hh1Kl4GhPy34ugKN8kkQaylX7ieW/iztYBic/vmOFcK1aTg/KGK/uEAUFctcVPmm/+Ii+PDKe6LPraQn9GNJImIw2fku4aaphI7ucMh3bPQAe4xi0o07wMhC1G61k9/av+6mEraKMS7Wt9NbGnGGFeVuuGVD9mhCjFzj+X902/GxAqfWBX0lMaTd8KilA7aZPT3Vy+o2XUUTagyTqIjaLEdGlnWsq7dY2hAEcsqTxAY65WJblLJkG04wsPgS+27H0ZCUSacMIYb6D2LQAdtQlwf7CitmF4V9Qa91xckhieaj/j9v1ShFBE8n0c5J93Vj9Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mgcZ7yehYF9wQxmG0pQM3P+OzlWDfXOj/uAp//Ck7m8=; b=XvsQsekp3pOT8RG10qMatcXpP6eIB/kDbvp3PmQJdShYKXsQ2nSim/TWIHHjegQolvsxAFL1RvbGqo/yLRxD3Iw23rswrnKnxVPPEVV6WtpxMwb7fKFc9WCs/0dNHlKGfdo3yyW+/pPHI+CWkJ5JyGkA6JEW69CbO7N3Ll3Sqh3ZpimkEL6o29zSZwwYsfGQGkA4sPdxsGCWhF1Is9ErcmawGBiGlzbINwvKmZx0OFGmHT0Cel/T9bMPH9vxpwJYqKsazsLYZQLAztWBidyPvArpeZNyNbQcPyzRJaC+RdWgnSBFK+xJWQNyJbW3AdhgWSZ0+SvuMUGeKwUKqYkyeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=qnap.com; dmarc=pass action=none header.from=qnap.com; dkim=pass header.d=qnap.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qnap.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mgcZ7yehYF9wQxmG0pQM3P+OzlWDfXOj/uAp//Ck7m8=; b=tUuqVXKnqiUppUfnZ/MrAOarGNeAiuBHfeVTYMlmf9MonlnkH32XojwByh/Nl6HQaqjN7pV0B0sRliJWliGKEfRgkpM5ILrcZKNK2jpBwYyYIST80fg6q8oWgERd/NJyakML2PI1z6gVMcuqNCFnR/TRJZb/KdEDM9+FgZytASCfUGxWrYRMbovAvvka4uuwzyvUdhdG2T6/5sqrFHwmsVgk/RNpWUoJ3ssv6fj138zvHMUvgh3nPOWXtKWPsb6b7cXC6RAFEUtWZdZ5BreoJy5f/bXDFh9yJocf6bovUXJq8pPyEVRlpucu+jqkGnwkdtdwl8kIkbatD59hB2uocw== Received: from SI2PR04MB5097.apcprd04.prod.outlook.com (2603:1096:4:14d::9) by TY0PR04MB5863.apcprd04.prod.outlook.com (2603:1096:400:214::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 02:24:52 +0000 Received: from SI2PR04MB5097.apcprd04.prod.outlook.com ([fe80::d7ad:6be5:d8bf:6f92]) by SI2PR04MB5097.apcprd04.prod.outlook.com ([fe80::d7ad:6be5:d8bf:6f92%4]) with mapi id 15.20.7316.031; Mon, 26 Feb 2024 02:24:52 +0000 From: =?iso-2022-jp?b?Sm9uZXMgU3l1ZSAbJEJpLVhnPSEbKEI=?= <jonessyue@qnap.com> To: "netdev@vger.kernel.org" <netdev@vger.kernel.org> CC: "j.vosburgh@gmail.com" <j.vosburgh@gmail.com>, "andy@greyhouse.net" <andy@greyhouse.net>, "davem@davemloft.net" <davem@davemloft.net>, "edumazet@google.com" <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, "pabeni@redhat.com" <pabeni@redhat.com>, "corbet@lwn.net" <corbet@lwn.net>, Jiri Pirko <jiri@resnulli.us>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: [PATCH net-next v3] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner Thread-Topic: [PATCH net-next v3] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner Thread-Index: AQHaaFbWkhUe2N25ukCQQErH1cvW8A== Date: Mon, 26 Feb 2024 02:24:52 +0000 Message-ID: <SI2PR04MB5097BCA8FF2A2F03D9A5A3EEDC5A2@SI2PR04MB5097.apcprd04.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=qnap.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SI2PR04MB5097:EE_|TY0PR04MB5863:EE_ x-ms-office365-filtering-correlation-id: b18f80f6-5ec2-462d-0116-08dc36721d1b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a+Vbj4LbILJVswpYzDj6rQdSBdBIXYzD3UVNKfvYP3UuswVcbK7m0ftYcuCYoWHjX64WI38vZ4gm6HcAO26Q/ec7NOLNNcEyQMHHEG9M3T1KtAfMEW9qmlBgtdvZJWii9yh+8B9ElGacQjfRqwqCA10dtsfgzIAjci9L6XqGsDINLGPeRcMzatkxVVFTumorhKewqEpTvSb9xIfNRLcVQYfZ3oHzFuCBTETc+BhlCLPiEhTi0EkgRzzdjFb6ZFiHfZt01QCO6ThbhuUnrTxm9n3yKZFncQtk2bB/kNBADnQsleR6IYs5csbyI/hmKbbEmDmsMgWqZyp1nezDAMCrZG+uZEHniPLLPXRIxPF9qYLxWnEEf3e5rhdmEpYhwpH60bd6Rxn+akF+qM5/hum5OSro3hKn7k3sOMmxNDwGxSmZI7BW7mYHLsfHhxlCo61HXdU4x0NAFwmgQn/mC5tdSQ3PJ7gZFI3E0FXp1jw+C3eJbb0dSm5BbpbZX9lzySN2ByVW8Opc9NEmVG14ZGxC5u7/cn9fNRvM9+njjb3OX2KrLjFNM8wHZ18NoK+8CSTZngh8DuwImfdUMGMVUzMBj498cJkBWUxqF2zzpN5jrceJ2WCkiIEI4qYf9dPI62zgP3FTyCpM70gQ9SajsYdQwO9q2TCDx5EjhIGFM464jgzek4xyddNHUVEdeZG3aCBYwIjqVi8TFubyddmtv/8/Sg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:ja;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SI2PR04MB5097.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38070700009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?b?RGNsdlJWSi9jc29DbDAx?= =?iso-2022-jp?b?SWlVSDIyaWZScEF0ejFFWEswWi9naGlqTzlMNzhmOEY0NlhDSml6U2Fz?= =?iso-2022-jp?b?c3ZteWRoNnBVdEdWRHpLMy9FZnR3RWROL085YXBDWGFzZCtoUDkxTG9E?= =?iso-2022-jp?b?S0xjeUNwSz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dC9H?= =?iso-2022-jp?b?d0FFUUpsK05QZUlqU1JaTFNNRWRkdTJhL0hyT1V2YVFpVXRoNTgvR0R2?= =?iso-2022-jp?b?bHZ6cWtpU0FibTRzSUx0VmpSeGpLR25PVkdKQjVxMkFLbUNJNUNNcW10?= =?iso-2022-jp?b?L01FcXFTcERGT1lNNkE5dkxoM1U3TVV6bUpuQXU1Y3k1QjZyc1g2dERj?= =?iso-2022-jp?b?ZUhmUTNsQzRsZlovSEgyYkNNUkR1T0RXQkpkSWpvbExVcXdNQlN4NEVk?= =?iso-2022-jp?b?VnhKam9kZlZ3NkNXS0liaGxiaFBFSnRNV2RpZjV0NWZibmVSMVNSTkI3?= =?iso-2022-jp?b?OHRjNlJLUkxacz0=?= Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-OriginatorOrg: qnap.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SI2PR04MB5097.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b18f80f6-5ec2-462d-0116-08dc36721d1b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2024 02:24:52.1705 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6eba8807-6ef0-4e31-890c-a6ecfbb98568 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bNjodppTAmHdDI4DooNCoh1o3DpLImrIEYNYBP/RYsstadMsxSAQ/fwQhpg6S8atYEyGX2VJaiXI4StQXlaIlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR04MB5863 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791926538800379337 X-GMAIL-MSGID: 1791926538800379337 |
Series |
[net-next,v3] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner
|
|
Commit Message
Jones Syue 薛懷宗
Feb. 26, 2024, 2:24 a.m. UTC
Replace macro MAC_ADDRESS_EQUAL() for null_mac_addr checking with inline
function__agg_has_partner(). When MAC_ADDRESS_EQUAL() is verifiying
aggregator's partner mac addr with null_mac_addr, means that seeing if
aggregator has a valid partner or not. Using __agg_has_partner() makes it
more clear to understand.
In ad_port_selection_logic(), since aggregator->partner_system and
port->partner_oper.system has been compared first as a prerequisite, it is
safe to replace the upcoming MAC_ADDRESS_EQUAL() for null_mac_addr checking
with __agg_has_partner().
Delete null_mac_addr, which is not required anymore in bond_3ad.c, since
all references to it are gone.
Signed-off-by: Jones Syue <jonessyue@qnap.com>
---
v3:
- replace macro with inline function in ad_port_selection_logic()
- delete static variable null_mac_addr in bond_3ad.c
- re-phrase patch description with more precise text
- re-phrase patch description in imperative mood
v2: https://lore.kernel.org/netdev/SI2PR04MB5097AA23EE6799B3E56C0762DC552@SI2PR04MB5097.apcprd04.prod.outlook.com/
- add correct CC list by 'get_maintainer.pl -f .../bonding.rst'
v1: https://lore.kernel.org/netdev/SI2PR04MB50977DA9BB51D9C8FAF6928ADC562@SI2PR04MB5097.apcprd04.prod.outlook.com/
---
drivers/net/bonding/bond_3ad.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
Comments
On Mon, Feb 26, 2024 at 02:24:52AM +0000, Jones Syue 薛懷宗 wrote: > Replace macro MAC_ADDRESS_EQUAL() for null_mac_addr checking with inline > function__agg_has_partner(). When MAC_ADDRESS_EQUAL() is verifiying nit: function __agg_has_partner() > aggregator's partner mac addr with null_mac_addr, means that seeing if > aggregator has a valid partner or not. Using __agg_has_partner() makes it > more clear to understand. > > In ad_port_selection_logic(), since aggregator->partner_system and > port->partner_oper.system has been compared first as a prerequisite, it is > safe to replace the upcoming MAC_ADDRESS_EQUAL() for null_mac_addr checking > with __agg_has_partner(). > > Delete null_mac_addr, which is not required anymore in bond_3ad.c, since > all references to it are gone. > > Signed-off-by: Jones Syue <jonessyue@qnap.com> Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Mon, Feb 26, 2024 at 03:24:52AM CET, jonessyue@qnap.com wrote: >Replace macro MAC_ADDRESS_EQUAL() for null_mac_addr checking with inline >function__agg_has_partner(). When MAC_ADDRESS_EQUAL() is verifiying >aggregator's partner mac addr with null_mac_addr, means that seeing if >aggregator has a valid partner or not. Using __agg_has_partner() makes it >more clear to understand. > >In ad_port_selection_logic(), since aggregator->partner_system and >port->partner_oper.system has been compared first as a prerequisite, it is >safe to replace the upcoming MAC_ADDRESS_EQUAL() for null_mac_addr checking >with __agg_has_partner(). > >Delete null_mac_addr, which is not required anymore in bond_3ad.c, since >all references to it are gone. > >Signed-off-by: Jones Syue <jonessyue@qnap.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Jones Syue 薛懷宗 <jonessyue@qnap.com> wrote: >Replace macro MAC_ADDRESS_EQUAL() for null_mac_addr checking with inline >function__agg_has_partner(). When MAC_ADDRESS_EQUAL() is verifiying >aggregator's partner mac addr with null_mac_addr, means that seeing if >aggregator has a valid partner or not. Using __agg_has_partner() makes it >more clear to understand. > >In ad_port_selection_logic(), since aggregator->partner_system and >port->partner_oper.system has been compared first as a prerequisite, it is >safe to replace the upcoming MAC_ADDRESS_EQUAL() for null_mac_addr checking >with __agg_has_partner(). > >Delete null_mac_addr, which is not required anymore in bond_3ad.c, since >all references to it are gone. > >Signed-off-by: Jones Syue <jonessyue@qnap.com> >--- >v3: > - replace macro with inline function in ad_port_selection_logic() > - delete static variable null_mac_addr in bond_3ad.c > - re-phrase patch description with more precise text > - re-phrase patch description in imperative mood >v2: https://lore.kernel.org/netdev/SI2PR04MB5097AA23EE6799B3E56C0762DC552@SI2PR04MB5097.apcprd04.prod.outlook.com/ > - add correct CC list by 'get_maintainer.pl -f .../bonding.rst' >v1: https://lore.kernel.org/netdev/SI2PR04MB50977DA9BB51D9C8FAF6928ADC562@SI2PR04MB5097.apcprd04.prod.outlook.com/ >--- > drivers/net/bonding/bond_3ad.c | 14 +++----------- > 1 file changed, 3 insertions(+), 11 deletions(-) > >diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3adc >index f2942e8c6c91..c6807e473ab7 100644 >--- a/drivers/net/bonding/bond_3ad.c >+++ b/drivers/net/bonding/bond_3ad.c >@@ -82,10 +82,6 @@ enum ad_link_speed_type { > #define MAC_ADDRESS_EQUAL(A, B) \ > ether_addr_equal_64bits((const u8 *)A, (const u8 *)B) > >-static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { >- 0, 0, 0, 0, 0, 0 >-}; >- > static const u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL; > static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; > >@@ -1588,7 +1584,7 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) > (aggregator->partner_system_priority == port->partner_oper.system_priority) && > (aggregator->partner_oper_aggregator_key == port->partner_operkey) > ) && >- ((!MAC_ADDRESS_EQUAL(&(port->partner_oper.system), &(null_mac_addr)) && /* partner answers */ >+ ((__agg_has_partner(aggregator) && /* partner answers */ I'm not sure this is an equivalent swap, as it is replacing a test for non-empty of the port's partner MAC with a test of the aggregator's partner MAC. In the port case, it is validating that this specific port has received a response from its link partner. In the aggregator case, it's checking that the aggregator as a whole has received response from the link partners of members of the aggregator, which does not include the port under consideration for inclusion into the aggregator. As the port is not yet a member of the aggregator, how is checking the aggregator's MAC for being non-empty an equivalent test to the one it replaces? -J > !aggregator->is_individual) /* but is not individual OR */ > ) > ) { >@@ -2036,9 +2032,7 @@ static void ad_enable_collecting(struct port *port) > */ > static void ad_disable_distributing(struct port *port, bool *update_slave_arr) > { >- if (port->aggregator && >- !MAC_ADDRESS_EQUAL(&port->aggregator->partner_system, >- &(null_mac_addr))) { >+ if (port->aggregator && __agg_has_partner(port->aggregator)) { > slave_dbg(port->slave->bond->dev, port->slave->dev, > "Disabling distributing on port %d (LAG %d)\n", > port->actor_port_number, >@@ -2078,9 +2072,7 @@ static void ad_enable_collecting_distributing(struct port *port, > static void ad_disable_collecting_distributing(struct port *port, > bool *update_slave_arr) > { >- if (port->aggregator && >- !MAC_ADDRESS_EQUAL(&(port->aggregator->partner_system), >- &(null_mac_addr))) { >+ if (port->aggregator && __agg_has_partner(port->aggregator)) { > slave_dbg(port->slave->bond->dev, port->slave->dev, > "Disabling port %d (LAG %d)\n", > port->actor_port_number, >-- >2.1.4 > --- -Jay Vosburgh, jay.vosburgh@canonical.com
Jones Syue 薛懷宗 <jonessyue@qnap.com> wrote: >Replace macro MAC_ADDRESS_EQUAL() for null_mac_addr checking with inline >function__agg_has_partner(). When MAC_ADDRESS_EQUAL() is verifiying >aggregator's partner mac addr with null_mac_addr, means that seeing if >aggregator has a valid partner or not. Using __agg_has_partner() makes it >more clear to understand. > >In ad_port_selection_logic(), since aggregator->partner_system and >port->partner_oper.system has been compared first as a prerequisite, it is >safe to replace the upcoming MAC_ADDRESS_EQUAL() for null_mac_addr checking >with __agg_has_partner(). Ok, I missed this bit when I read the patch this morning, so you can ignore my earlier email's question. Patch looks good to me, glad to see null_mac_addr get the boot. >Delete null_mac_addr, which is not required anymore in bond_3ad.c, since >all references to it are gone. > >Signed-off-by: Jones Syue <jonessyue@qnap.com> Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com> -J >--- >v3: > - replace macro with inline function in ad_port_selection_logic() > - delete static variable null_mac_addr in bond_3ad.c > - re-phrase patch description with more precise text > - re-phrase patch description in imperative mood >v2: https://lore.kernel.org/netdev/SI2PR04MB5097AA23EE6799B3E56C0762DC552@SI2PR04MB5097.apcprd04.prod.outlook.com/ > - add correct CC list by 'get_maintainer.pl -f .../bonding.rst' >v1: https://lore.kernel.org/netdev/SI2PR04MB50977DA9BB51D9C8FAF6928ADC562@SI2PR04MB5097.apcprd04.prod.outlook.com/ >--- > drivers/net/bonding/bond_3ad.c | 14 +++----------- > 1 file changed, 3 insertions(+), 11 deletions(-) > >diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3adc >index f2942e8c6c91..c6807e473ab7 100644 >--- a/drivers/net/bonding/bond_3ad.c >+++ b/drivers/net/bonding/bond_3ad.c >@@ -82,10 +82,6 @@ enum ad_link_speed_type { > #define MAC_ADDRESS_EQUAL(A, B) \ > ether_addr_equal_64bits((const u8 *)A, (const u8 *)B) > >-static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { >- 0, 0, 0, 0, 0, 0 >-}; >- > static const u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL; > static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; > >@@ -1588,7 +1584,7 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) > (aggregator->partner_system_priority == port->partner_oper.system_priority) && > (aggregator->partner_oper_aggregator_key == port->partner_operkey) > ) && >- ((!MAC_ADDRESS_EQUAL(&(port->partner_oper.system), &(null_mac_addr)) && /* partner answers */ >+ ((__agg_has_partner(aggregator) && /* partner answers */ > !aggregator->is_individual) /* but is not individual OR */ > ) > ) { >@@ -2036,9 +2032,7 @@ static void ad_enable_collecting(struct port *port) > */ > static void ad_disable_distributing(struct port *port, bool *update_slave_arr) > { >- if (port->aggregator && >- !MAC_ADDRESS_EQUAL(&port->aggregator->partner_system, >- &(null_mac_addr))) { >+ if (port->aggregator && __agg_has_partner(port->aggregator)) { > slave_dbg(port->slave->bond->dev, port->slave->dev, > "Disabling distributing on port %d (LAG %d)\n", > port->actor_port_number, >@@ -2078,9 +2072,7 @@ static void ad_enable_collecting_distributing(struct port *port, > static void ad_disable_collecting_distributing(struct port *port, > bool *update_slave_arr) > { >- if (port->aggregator && >- !MAC_ADDRESS_EQUAL(&(port->aggregator->partner_system), >- &(null_mac_addr))) { >+ if (port->aggregator && __agg_has_partner(port->aggregator)) { > slave_dbg(port->slave->bond->dev, port->slave->dev, > "Disabling port %d (LAG %d)\n", > port->actor_port_number, >-- >2.1.4 >
Thank you for kind feedback! Hangbin, Jiri, Jakub, and Jay. > Ok, I missed this bit when I read the patch this morning, so you > can ignore my earlier email's question. Patch looks good to me, glad to > see null_mac_addr get the boot. > Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com> -- Regards, Jones Syue | 薛懷宗 QNAP Systems, Inc.
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Mon, 26 Feb 2024 02:24:52 +0000 you wrote: > Replace macro MAC_ADDRESS_EQUAL() for null_mac_addr checking with inline > function__agg_has_partner(). When MAC_ADDRESS_EQUAL() is verifiying > aggregator's partner mac addr with null_mac_addr, means that seeing if > aggregator has a valid partner or not. Using __agg_has_partner() makes it > more clear to understand. > > In ad_port_selection_logic(), since aggregator->partner_system and > port->partner_oper.system has been compared first as a prerequisite, it is > safe to replace the upcoming MAC_ADDRESS_EQUAL() for null_mac_addr checking > with __agg_has_partner(). > > [...] Here is the summary with links: - [net-next,v3] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner https://git.kernel.org/netdev/net-next/c/4440873f3655 You are awesome, thank you!
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index f2942e8c6c91..c6807e473ab7 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -82,10 +82,6 @@ enum ad_link_speed_type { #define MAC_ADDRESS_EQUAL(A, B) \ ether_addr_equal_64bits((const u8 *)A, (const u8 *)B) -static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { - 0, 0, 0, 0, 0, 0 -}; - static const u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL; static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; @@ -1588,7 +1584,7 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) (aggregator->partner_system_priority == port->partner_oper.system_priority) && (aggregator->partner_oper_aggregator_key == port->partner_oper.key) ) && - ((!MAC_ADDRESS_EQUAL(&(port->partner_oper.system), &(null_mac_addr)) && /* partner answers */ + ((__agg_has_partner(aggregator) && /* partner answers */ !aggregator->is_individual) /* but is not individual OR */ ) ) { @@ -2036,9 +2032,7 @@ static void ad_enable_collecting(struct port *port) */ static void ad_disable_distributing(struct port *port, bool *update_slave_arr) { - if (port->aggregator && - !MAC_ADDRESS_EQUAL(&port->aggregator->partner_system, - &(null_mac_addr))) { + if (port->aggregator && __agg_has_partner(port->aggregator)) { slave_dbg(port->slave->bond->dev, port->slave->dev, "Disabling distributing on port %d (LAG %d)\n", port->actor_port_number, @@ -2078,9 +2072,7 @@ static void ad_enable_collecting_distributing(struct port *port, static void ad_disable_collecting_distributing(struct port *port, bool *update_slave_arr) { - if (port->aggregator && - !MAC_ADDRESS_EQUAL(&(port->aggregator->partner_system), - &(null_mac_addr))) { + if (port->aggregator && __agg_has_partner(port->aggregator)) { slave_dbg(port->slave->bond->dev, port->slave->dev, "Disabling port %d (LAG %d)\n", port->actor_port_number,