* [PATCH net-next v2] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner
@ 2024-02-23 4:12 Jones Syue 薛懷宗
2024-02-23 7:48 ` Hangbin Liu
0 siblings, 1 reply; 3+ messages in thread
From: Jones Syue 薛懷宗 @ 2024-02-23 4:12 UTC (permalink / raw)
To: netdev@vger.kernel.org
Cc: j.vosburgh@gmail.com, andy@greyhouse.net, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
corbet@lwn.net, netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
They are verifying the same thing: if aggregator has a partner or not.
Replaces macro with inline function would look more clear to understand.
Signed-off-by: Jones Syue <jonessyue@qnap.com>
---
v2:
- Add correct CC list by './scripts/get_maintainer.pl -f Documentation/networking/bonding.rst'
v1: https://lore.kernel.org/netdev/SI2PR04MB50977DA9BB51D9C8FAF6928ADC562@SI2PR04MB5097.apcprd04.prod.outlook.com/
---
drivers/net/bonding/bond_3ad.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index f2942e8..eb3c2d1 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2036,9 +2036,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 +2076,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner
2024-02-23 4:12 [PATCH net-next v2] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner Jones Syue 薛懷宗
@ 2024-02-23 7:48 ` Hangbin Liu
2024-02-23 10:03 ` Jones Syue 薛懷宗
0 siblings, 1 reply; 3+ messages in thread
From: Hangbin Liu @ 2024-02-23 7:48 UTC (permalink / raw)
To: Jones Syue 薛懷宗
Cc: netdev@vger.kernel.org, j.vosburgh@gmail.com, andy@greyhouse.net,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, corbet@lwn.net, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Hi Jones,
On Fri, Feb 23, 2024 at 04:12:00AM +0000, Jones Syue 薛懷宗 wrote:
> They are verifying the same thing: if aggregator has a partner or not.
> Replaces macro with inline function would look more clear to understand.
MAC_ADDRESS_EQUAL and __agg_has_partner are not the same thing.
MAC_ADDRESS_EQUAL() is only same with __agg_has_partner() when verifying
agg partner mac addr with null_mac_addr. The description could be more
accurate.
Since you want to replace the null_mac_addr checking for MAC_ADDRESS_EQUAL().
Maybe we can also replace the null_mac_addr checking in
ad_port_selection_logic(). This should be safe as the
aggregator->partner_system and port->partner_oper.system has been compared.
e.g.
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index f2942e8c6c91..bd46dcb4013c 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1588,7 +1588,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 */
)
) {
With this the null_mac_addr definition could be removed.
Thanks
Hangbin
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner
2024-02-23 7:48 ` Hangbin Liu
@ 2024-02-23 10:03 ` Jones Syue 薛懷宗
0 siblings, 0 replies; 3+ messages in thread
From: Jones Syue 薛懷宗 @ 2024-02-23 10:03 UTC (permalink / raw)
To: Hangbin Liu
Cc: netdev@vger.kernel.org, j.vosburgh@gmail.com, andy@greyhouse.net,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, corbet@lwn.net, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Hello Hangbin,
> MAC_ADDRESS_EQUAL and __agg_has_partner are not the same thing.
>
> MAC_ADDRESS_EQUAL() is only same with __agg_has_partner() when verifying
> agg partner mac addr with null_mac_addr. The description could be more
> accurate.
Thank you for kindly reply! Yes you are right my description is not clear.
> Since you want to replace the null_mac_addr checking for MAC_ADDRESS_EQUAL().
> Maybe we can also replace the null_mac_addr checking in
> ad_port_selection_logic(). This should be safe as the
> aggregator->partner_system and port->partner_oper.system has been compared.
> e.g.
> ...
> With this the null_mac_addr definition could be removed.
This new one looks better! Will come out a v3 and test it :)
--
Regards,
Jones Syue | 薛懷宗
QNAP Systems, Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-23 10:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 4:12 [PATCH net-next v2] bonding: 802.3ad replace MAC_ADDRESS_EQUAL with __agg_has_partner Jones Syue 薛懷宗
2024-02-23 7:48 ` Hangbin Liu
2024-02-23 10:03 ` Jones Syue 薛懷宗
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox