Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6606554rwb; Tue, 9 Aug 2022 19:58:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5++mHTXh6V5exvufn7VgrHC0m3xtTJ6VksPRIXVouIm/pPqa1lhMrSnZyU7y5tJhfSFugE X-Received: by 2002:a17:902:cec5:b0:170:d100:e6c0 with SMTP id d5-20020a170902cec500b00170d100e6c0mr8646366plg.132.1660100286070; Tue, 09 Aug 2022 19:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660100286; cv=none; d=google.com; s=arc-20160816; b=AKRbq43Fco1RgYFa0tQDd5Ri2RUamX2ATUKqZVfK2c9KmyIl6t/ZL+IVs1TctiPAbq 9Fgl5rACYcEPJRwJkuFcLvW8QG2Af5KTWqhyUWH3mnfRvBmwjb7UOKYPo7I+qPsfS3St ohZCRMKqd63tjDGaF6v3dn9IuAv9CUhYJEjTRzsy9Bw7KHb07nyy+RQ1waekSSiXlffv TWfq1gUT5IYpTJsBiMij9xxgz8RvfizTHph7lQ3kQQWAEfXzI0UqSSQ9gD1Lqx3opV41 HtqGABhvRJ76NB4a4jeopqlR8gBwiuh9CTBgjyLRwvhfE8QcdyRlCrsEYG/6h6GXkz6h L+8A== 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=suhGPSWhT6dIpWdeH1NJXj9NgY38OxY1SzPNsuD/rYs=; b=Th4sOr44+DHM5Esihzk0vmVS8VJOwInMpQ/V3FhtxubliF0CPGmwSAAlDYl2CHLtek OVO0NwDUPotNJK/QXRh8GBRyt5740j4GTDuOYE0XaMcstcJIbKjPAdTn5Rd4KRLZlYIk ptPouuZcCFDhsLN45w/H1VXv2QsbCvOq6lkzl+xqwAB5iE7Ga7hULNOvtev7oDsuCUbu bA1TzxF5mKfuRJDxuPrwwZkSKoC3pT7XqY0MdJcio0gCH+6Gqh2EIuyVYHSOFPSTenY4 0kgpsEOw3TlX0/aluQTPkZAu+d2wMb6G6oJ71I1M0+wpeIAjuMMSgwP8oOWSS9SLWM83 azUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="BgEfML/g"; 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 e20-20020a056a001a9400b0052e4de9b806si1455619pfv.342.2022.08.09.19.57.52; Tue, 09 Aug 2022 19:58:06 -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="BgEfML/g"; 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 S229987AbiHJCeZ (ORCPT + 99 others); Tue, 9 Aug 2022 22:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiHJCd5 (ORCPT ); Tue, 9 Aug 2022 22:33:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D4EB280F7B for ; Tue, 9 Aug 2022 19:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660098835; 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=suhGPSWhT6dIpWdeH1NJXj9NgY38OxY1SzPNsuD/rYs=; b=BgEfML/gSGAViU3Be8kjtvtjwqEfz5dKgVZ09bm9z3U/IENf4HDnCyZqKOyPhmUvRhemtJ vyUOMmxUUB4PO92Y6sNTRbDwuCuKldo99vaRrCtmgRkyRKVW/kx54mWLakYQLeHZ/F7Gsw xdQZkt9N5GsF7pJVAVSnlOb5edcl4Ck= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-10-g-OvmarIMQqC1ktWa0MFLA-1; Tue, 09 Aug 2022 22:33:48 -0400 X-MC-Unique: g-OvmarIMQqC1ktWa0MFLA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FA4A38005C2; Wed, 10 Aug 2022 02:33:48 +0000 (UTC) Received: from jtoppins.rdu.csb (unknown [10.22.10.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA2E82026D4C; Wed, 10 Aug 2022 02:33:47 +0000 (UTC) From: Jonathan Toppins To: netdev@vger.kernel.org Cc: liuhangbin@gmail.com, Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net v2 2/2] bonding: 802.3ad: fix no transmission of LACPDUs Date: Tue, 9 Aug 2022 22:33:22 -0400 Message-Id: <6cc59ad0a2aabea17a9361c374237f674a8b27b9.1660098382.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.78 on 10.11.54.4 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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_add equals sys_mac_addr leaving the global ad_ticks_per_sec zero as it is never initialized anywhere else. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jonathan Toppins --- Notes: v2: * split this fix from the reproducer drivers/net/bonding/bond_3ad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index d7fb33c078e8..957d30db6f95 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -84,7 +84,8 @@ enum ad_link_speed_type { static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { 0, 0, 0, 0, 0, 0 }; -static u16 ad_ticks_per_sec; + +static u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL; static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = -- 2.31.1