Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp853134imm; Wed, 18 Jul 2018 11:50:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeMidKS+mhzOFNEAcdiMEwHVn+4aLKfiicsSGkVi7dRKvEW5skFQjXXRbiNIh6UZ7gw3XQO X-Received: by 2002:a63:cc04:: with SMTP id x4-v6mr6788728pgf.33.1531939844684; Wed, 18 Jul 2018 11:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531939844; cv=none; d=google.com; s=arc-20160816; b=vG46sFDyAH8TMDXK9+lkt8lFOzxjQ25RNyxUIGhJuCqu0lUcKHQmO6M3aX2TJIUB14 l4sW1m7jTgDSuNbOFCBkuNe8xyaT7agrgYMwt1hSJlKQP7YhmHzChzlq2yTBLA0S5fLh niM0l1t+UPbXrzgh/uC+0aZ26YX2q8Z5AZAKd0z1BPIPphflEwlUT/LdqulReYgDOXnS VVNNyJ3FCYgwIS2BlQL/EyEUv+JG2/2AthAGg2zoCVVHpXZD6dJeoElQ7SWTLONOVUJz aAvUh84c6ddNYd0tB9JTDh5oIeP1rlTV4tSmXIO+Z6Q0KeJ+16BlwjTOhMlSPAWq6rNF XImw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=65pe8yg3f+Nf8DXrBdws0OhCZYf6T6U8S2qnCd+JtXw=; b=gliP2aNUve/8oEl98IntV4w+49WHS4hEOZmAnDA9CMsc/xDfl2r0wMZyOiSjCiCx8M u47tD87XWjWwOetyCzPjPO6z5G0BRGeQRlRRkhIfqar8TBti5bOkNYdqCzUlvVltl47T bdiHp0Xq8W023FY/zwMRrrmfjgPJ1JLYM0RQ8Y12NuSJruY+uj3JNj0GWw5RzLALeqWW k9zO+PLCsf71GMxseyQ/WXAsjUEDewGzNquOFXphoFqp8eJL2pIrSlF6lb4Pba3xUBoi MegtGQadIP96ZdiMUHnxQizddYsN1rD+Lux45J30a7a4XFxMvQQ9A0ro8i/cInk5Az2l UAQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z77-v6si4078839pff.100.2018.07.18.11.50.28; Wed, 18 Jul 2018 11:50:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729251AbeGRT3G (ORCPT + 99 others); Wed, 18 Jul 2018 15:29:06 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58458 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728038AbeGRT3F (ORCPT ); Wed, 18 Jul 2018 15:29:05 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 4CFA1401CC41; Wed, 18 Jul 2018 18:49:52 +0000 (UTC) Received: from hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com (hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com [10.16.184.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id B51B52026D69; Wed, 18 Jul 2018 18:49:51 +0000 (UTC) From: Jarod Wilson To: linux-kernel@vger.kernel.org Cc: Jarod Wilson , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , Mahesh Bandewar , "David S . Miller" , netdev@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net] bonding: set default miimon value for non-arp modes if not set Date: Wed, 18 Jul 2018 14:49:36 -0400 Message-Id: <20180718184936.16037-1-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 18 Jul 2018 18:49:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 18 Jul 2018 18:49:52 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jarod@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For some time now, if you load the bonding driver and configure bond parameters via sysfs using minimal config options, such as specifying nothing but the mode, relying on defaults for everything else, modes that cannot use arp monitoring (802.3ad, balance-tlb, balance-alb) all wind up with both arp_interval=0 (as it should be) and miimon=0, which means the miimon monitor thread never actually runs. This is particularly problematic for 802.3ad. For example, from an LNST recipe I've set up: $ modprobe bonding max_bonds=0" $ echo "+t_bond0" > /sys/class/net/bonding_masters" $ ip link set t_bond0 down" $ echo "802.3ad" > /sys/class/net/t_bond0/bonding/mode" $ ip link set ens1f1 down" $ echo "+ens1f1" > /sys/class/net/t_bond0/bonding/slaves" $ ip link set ens1f0 down" $ echo "+ens1f0" > /sys/class/net/t_bond0/bonding/slaves" $ ethtool -i t_bond0" $ ip link set ens1f1 up" $ ip link set ens1f0 up" $ ip link set t_bond0 up" $ ip addr add 192.168.9.1/24 dev t_bond0" $ ip addr add 2002::1/64 dev t_bond0" This bond comes up okay, but things look slightly suspect in /proc/net/bonding/t_bond0 output: $ grep -i mii /proc/net/bonding/t_bond0 MII Status: up MII Polling Interval (ms): 0 MII Status: up MII Status: up Now, pull a cable on one of the ports in the bond, then reconnect it, and you'll see: Slave Interface: ens1f0 MII Status: down Speed: 1000 Mbps Duplex: full I believe this became a major issue as of commit 4d2c0cda0744, which for 802.3ad bonds, sets slave->link = BOND_LINK_DOWN, with a comment about relying on link monitoring via miimon to set it correctly, but since the miimon work queue never runs, the link just stays marked down. If we simply tweak bond_option_mode_set() slightly, we can check for the non-arp modes having no miimon value set, and insert BOND_DEFAULT_MIIMON, which gets things back in full working order. This problem exists as far back as 4.14, and might be worth fixing in all stable trees since, though the work-around is to simply specify an miimon value yourself. Reported-by: Bob Ball CC: Jay Vosburgh CC: Veaceslav Falico CC: Andy Gospodarek CC: Mahesh Bandewar CC: David S. Miller CC: netdev@vger.kernel.org CC: stable@vger.kernel.org Signed-off-by: Jarod Wilson --- drivers/net/bonding/bond_options.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 98663c50ded0..4d5d01cb8141 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -743,15 +743,20 @@ const struct bond_option *bond_opt_get(unsigned int option) static int bond_option_mode_set(struct bonding *bond, const struct bond_opt_value *newval) { - if (!bond_mode_uses_arp(newval->value) && bond->params.arp_interval) { - netdev_dbg(bond->dev, "%s mode is incompatible with arp monitoring, start mii monitoring\n", - newval->string); - /* disable arp monitoring */ - bond->params.arp_interval = 0; - /* set miimon to default value */ - bond->params.miimon = BOND_DEFAULT_MIIMON; - netdev_dbg(bond->dev, "Setting MII monitoring interval to %d\n", - bond->params.miimon); + if (!bond_mode_uses_arp(newval->value)) { + if (bond->params.arp_interval) { + netdev_dbg(bond->dev, "%s mode is incompatible with arp monitoring, start mii monitoring\n", + newval->string); + /* disable arp monitoring */ + bond->params.arp_interval = 0; + } + + if (!bond->params.miimon) { + /* set miimon to default value */ + bond->params.miimon = BOND_DEFAULT_MIIMON; + netdev_dbg(bond->dev, "Setting MII monitoring interval to %d\n", + bond->params.miimon); + } } if (newval->value == BOND_MODE_ALB) -- 2.16.1