Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1742997rwb; Fri, 19 Aug 2022 08:40:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ekPK3PbGQ5pn5r0lZCIlW3Uqbkn6bve+r9V9waGIUB02vlXqk9GNz/G+jtcOEqfZhbqXp X-Received: by 2002:a17:90b:3843:b0:1fa:efaf:876d with SMTP id nl3-20020a17090b384300b001faefaf876dmr2231031pjb.144.1660923623484; Fri, 19 Aug 2022 08:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660923623; cv=none; d=google.com; s=arc-20160816; b=w/NdlgnCy8vATg5ywDsFSwqgR1noqYOaBjJoYE9sFCA7Int1oNonI37xEpzsDhoR8a LMATGVOZROyZOFGV1WTHORxVml5j6PEQkssnsoCsuGQccPZ9YfHVSpCotDJVO5wFxkWj 8/6B+ShZG/pVG/fHX2yVKhFBZvRyl5Sb9TR11Sz/gXpIorLWI1CVaRkg0NcPXfslGGDX bh50h/OkuT/Gw6zIdb8N/IZ5jVqhuAu3RUuxjqkBDvCPKv7dl78sN1R6ndJ0IX4aaFqu ODw5JYmsTnAi72Kf7XV6KPwLwmsF0EdylMCyyamjVqZG/VLxRoa9y7T8dlA13C8yBSqp NCkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PhaID+X1Mqgrgk1tAzS4wrDrYfG7IsiSyF0efNhSA9o=; b=rJvK0Jyineft3/OKE22dg5FR5gIWnUzBUbEq2uXrdT8FGbgKpTZzlLrWnMeMu1Reii q+oXS1Hc7f93sTrdBXmvc8/sVGFBOrxUtt7e4u4oPCOO90rL0/jiNhB5jQ1/YBTT4lP4 uGhRJT35CTFiWYOmy247DrNDdlSws2FKGV/dHz5Z5Khix8VX1Ud8oEOHTWWIKlc1eTTY geNdY8NBi5GnunnDstkSzfDrYz2Edu80yjBv/fxNIldF2xuAUlxXdMKFBCox0cxjZJOh wHpMjvoD2Vfb+CV2YJoHZzD2P1lwd66ouaOJRTHkZVsgRl3FTqJryDq6dTaSa7yacT3V IAGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iiN91Zcd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a634d4c000000b0041b557cea68si4513108pgl.25.2022.08.19.08.40.11; Fri, 19 Aug 2022 08:40:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iiN91Zcd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349110AbiHSPPt (ORCPT + 99 others); Fri, 19 Aug 2022 11:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349689AbiHSPPo (ORCPT ); Fri, 19 Aug 2022 11:15:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1592DFAC42 for ; Fri, 19 Aug 2022 08:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660922142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PhaID+X1Mqgrgk1tAzS4wrDrYfG7IsiSyF0efNhSA9o=; b=iiN91Zcd9DrJGm6mchimOWs6i+BCbUnc1ZTPWpLEPyGpmvaBj7iEIsvIGHAYil6cmFsun3 QxyQP9tRNBiJTAcWDHCEhXWA62brOMUA1MjoYtCpzQmfue3WdlnHNofw9ZBshRj4u4y3f0 NHI8fF8wYzmHE+Lv4nWYuoi+2BswFBw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-55-ZwCElc1OPm-XVkkuDNlEWQ-1; Fri, 19 Aug 2022 11:15:31 -0400 X-MC-Unique: ZwCElc1OPm-XVkkuDNlEWQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5819A101AA4E; Fri, 19 Aug 2022 15:15:30 +0000 (UTC) Received: from jtoppins.rdu.csb (unknown [10.22.34.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4A62404C6E3; Fri, 19 Aug 2022 15:15:29 +0000 (UTC) From: Jonathan Toppins To: netdev@vger.kernel.org, jay.vosburgh@canonical.com Cc: liuhangbin@gmail.com, Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nikolay Aleksandrov , linux-kernel@vger.kernel.org Subject: [PATCH net v5 2/3] bonding: 802.3ad: fix no transmission of LACPDUs Date: Fri, 19 Aug 2022 11:15:13 -0400 Message-Id: <5fe2a41fa0c2d726a9ba92244b272b21d4bae3a4.1660919940.git.jtoppins@redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is caused by the global variable ad_ticks_per_sec being zero as demonstrated by the reproducer script discussed below. This causes all timer values in __ad_timer_to_ticks to be zero, resulting in the periodic timer to never fire. To reproduce: Run the script in `tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh` which puts bonding into a state where it never transmits LACPDUs. line 44: ip link add fbond type bond mode 4 miimon 200 \ xmit_hash_policy 1 ad_actor_sys_prio 65535 lacp_rate fast setting bond param: ad_actor_sys_prio given: params.ad_actor_system = 0 call stack: bond_option_ad_actor_sys_prio() -> bond_3ad_update_ad_actor_settings() -> set ad.system.sys_priority = bond->params.ad_actor_sys_prio -> ad.system.sys_mac_addr = bond->dev->dev_addr; because params.ad_actor_system == 0 results: ad.system.sys_mac_addr = bond->dev->dev_addr line 48: ip link set fbond address 52:54:00:3B:7C:A6 setting bond MAC addr call stack: bond->dev->dev_addr = new_mac line 52: ip link set fbond type bond ad_actor_sys_prio 65535 setting bond param: ad_actor_sys_prio given: params.ad_actor_system = 0 call stack: bond_option_ad_actor_sys_prio() -> bond_3ad_update_ad_actor_settings() -> set ad.system.sys_priority = bond->params.ad_actor_sys_prio -> ad.system.sys_mac_addr = bond->dev->dev_addr; because params.ad_actor_system == 0 results: ad.system.sys_mac_addr = bond->dev->dev_addr line 60: ip link set veth1-bond down master fbond given: params.ad_actor_system = 0 params.mode = BOND_MODE_8023AD ad.system.sys_mac_addr == bond->dev->dev_addr call stack: bond_enslave -> bond_3ad_initialize(); because first slave -> if ad.system.sys_mac_addr != bond->dev->dev_addr return results: Nothing is run in bond_3ad_initialize() because dev_addr equals sys_mac_addr leaving the global ad_ticks_per_sec zero as it is never initialized anywhere else. The if check around the contents of bond_3ad_initialize() is no longer needed due to commit 5ee14e6d336f ("bonding: 3ad: apply ad_actor settings changes immediately") which sets ad.system.sys_mac_addr if any one of the bonding parameters whos set function calls bond_3ad_update_ad_actor_settings(). This is because if ad.system.sys_mac_addr is zero it will be set to the current bond mac address, this causes the if check to never be true. Fixes: 5ee14e6d336f ("bonding: 3ad: apply ad_actor settings changes immediately") Signed-off-by: Jonathan Toppins --- Notes: v2: * split this fix from the reproducer v3: * rebased to latest net/master v4: * instead of setting ad_ticks_per_sec remove the if statement around the body of the function of bond_3ad_initialize(). v5: * no changes drivers/net/bonding/bond_3ad.c | 38 ++++++++++++++-------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index d7fb33c078e8..1f0120cbe9e8 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -2007,30 +2007,24 @@ void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout) */ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution) { - /* check that the bond is not initialized yet */ - if (!MAC_ADDRESS_EQUAL(&(BOND_AD_INFO(bond).system.sys_mac_addr), - bond->dev->dev_addr)) { - - BOND_AD_INFO(bond).aggregator_identifier = 0; - - BOND_AD_INFO(bond).system.sys_priority = - bond->params.ad_actor_sys_prio; - if (is_zero_ether_addr(bond->params.ad_actor_system)) - BOND_AD_INFO(bond).system.sys_mac_addr = - *((struct mac_addr *)bond->dev->dev_addr); - else - BOND_AD_INFO(bond).system.sys_mac_addr = - *((struct mac_addr *)bond->params.ad_actor_system); + BOND_AD_INFO(bond).aggregator_identifier = 0; + BOND_AD_INFO(bond).system.sys_priority = + bond->params.ad_actor_sys_prio; + if (is_zero_ether_addr(bond->params.ad_actor_system)) + BOND_AD_INFO(bond).system.sys_mac_addr = + *((struct mac_addr *)bond->dev->dev_addr); + else + BOND_AD_INFO(bond).system.sys_mac_addr = + *((struct mac_addr *)bond->params.ad_actor_system); - /* initialize how many times this module is called in one - * second (should be about every 100ms) - */ - ad_ticks_per_sec = tick_resolution; + /* initialize how many times this module is called in one + * second (should be about every 100ms) + */ + ad_ticks_per_sec = tick_resolution; - bond_3ad_initiate_agg_selection(bond, - AD_AGGREGATOR_SELECTION_TIMER * - ad_ticks_per_sec); - } + bond_3ad_initiate_agg_selection(bond, + AD_AGGREGATOR_SELECTION_TIMER * + ad_ticks_per_sec); } /** -- 2.31.1