Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2288890pxt; Sun, 8 Aug 2021 18:33:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgEZefs/2KTl00RzH5szYZm+lxYzskd7T+IoamA6Ax388KR/f21nvwcfct+B6guw3xiAj3 X-Received: by 2002:a17:906:4d94:: with SMTP id s20mr19574636eju.152.1628472799487; Sun, 08 Aug 2021 18:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628472799; cv=none; d=google.com; s=arc-20160816; b=XxggdZMOxQ/Xs/jclIMCo49y6b+HER/Ixz+yy3b6EHU7Kaa6OCo5Z8fgXB7bU/kQxN GurecIGEyaj98OsZZGK8gLp23t95puiClFdd9UZoJejN3FJiauRO4DviGoM9C1VkOYEG aWGOulfihQcYNGhDqdqVUnql1UJxtdXFh8xk0swQrxbJY3/EDCD/BQIaBUNvjIKpWqmM S3SL14VyWKW0sI7j5h2TqO+kAIFdXMMP8HjO3PTKzFTkFcJ/hy6tVjnoXr5DJsq5A/8V 1+UVjLac0ewMFkWXCEhFr9I03oYHQcQkXPcbDbn/sUvk2t2X/DlmXZ673hVHtKqqCagZ onfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=6AtH3MREBeTH78AEq1clPuVC+0bJN9ncER27UcApork=; b=nc/1ZRwQR6LAfzb5ToV9dmUL2TPEgFcy280rPocKBGxAJtWnszzFemkG/eLAFSvnOH FcMhZD/8JdJ0FDDEoPyYcpI6A4stn+NA+5MWDN8RhZ7VKrWjvF0+6YGcKMd6AX9Ql1tb KlJGgNTeb7sMAH3xOL8KYk44FqLO5yBLhujp8KLafNM2SrW/kkU+QLXfIAUz7v8GRyO7 8kpjCZVAgZaBMycPgaY+Zt99I7CRVaJOod87vAZlTB+MgMtNskY3epI4F3/IZJrKOrga 2YAtBmCkAoSSB/mxyxaxFyDuybTc0dXzqwPmwGqZwWfWnGbZIkBLP3SRJjySoNFWlmLy HWOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W3gapVLS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si15077564edw.18.2021.08.08.18.32.55; Sun, 08 Aug 2021 18:33:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W3gapVLS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232640AbhHIBcE (ORCPT + 99 others); Sun, 8 Aug 2021 21:32:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20358 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232634AbhHIBcD (ORCPT ); Sun, 8 Aug 2021 21:32:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628472703; 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=6AtH3MREBeTH78AEq1clPuVC+0bJN9ncER27UcApork=; b=W3gapVLSBcx2yl+zS6Lfxv7CxjT03RiaECN9r560CyJv87tKs944U0o3mFtS4pQB2Gxvwm g9uEy+rTc0FYBe8/xMCNv1Ff01TxvzcmTOgqKRY9LrckU9+WXJTPhhCkw6HZmFWhWFAQRz QRlASRdFiMCBzL0k+PDweT9vMuTv8p0= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-zdX9WxoMPueP2tZAYk50Lw-1; Sun, 08 Aug 2021 21:31:42 -0400 X-MC-Unique: zdX9WxoMPueP2tZAYk50Lw-1 Received: by mail-qk1-f200.google.com with SMTP id a72-20020ae9e84b0000b02903d1f6aa7886so3480958qkg.21 for ; Sun, 08 Aug 2021 18:31:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6AtH3MREBeTH78AEq1clPuVC+0bJN9ncER27UcApork=; b=CPjagToJia+QV4QFwkNV5URM1o1z38nXCeqCdpa49i4NOYjetM7yUP1zdFNuL6jpby VrSfnA/UpR9qe3QFWW/dC7s4uwWBtVuIhREaxT6Uunt7QuycCHuxajs9+tHr4fcbd7nH mMo88IFtMckNFJR2MzLYwzY/d12D0jncFTXezPg44cXHw443umPvATR6fN3yAIgxnOEl AcfQxPv9YVXY2BPfIiwEZ3p2Wm3hitdKO/3sayT2GaZ7GM19JbSTVmKdNzyqPjbIegIf eUvzySrw4kAwwaBDikJWxUBW2CY3/T5kBSpcEaIGDkSJYyynBU0w9Os0PSX8VXCnD242 7hdA== X-Gm-Message-State: AOAM5316zaJ6uoPkJDdqvZO6R78+px3YhX+aycGm2EqKRx1DZhjiDXbN C9qCP97w7HWah5HtxDXW2WYQ62IrXGLlGe1o1Rr8tX20Y5+TiHrwZ3HdZZxCTuIWhrdAnY93aso dbgkQwOtaXZ/HbsCmZd8dyIBq/FkHNm5iOVH3mLfxlo6w5K0OPF2UdNtYlBT37U9Za3eIqeiaWy c5 X-Received: by 2002:a0c:8525:: with SMTP id n34mr10231138qva.19.1628472701785; Sun, 08 Aug 2021 18:31:41 -0700 (PDT) X-Received: by 2002:a0c:8525:: with SMTP id n34mr10231126qva.19.1628472701572; Sun, 08 Aug 2021 18:31:41 -0700 (PDT) Received: from jtoppins.rdu.csb ([107.15.110.69]) by smtp.gmail.com with ESMTPSA id h2sm8768555qkf.106.2021.08.08.18.31.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Aug 2021 18:31:41 -0700 (PDT) Subject: Re: bonding: link state question To: Willy Tarreau Cc: Jay Vosburgh , "netdev@vger.kernel.org" , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , LKML References: <020577f3-763d-48fd-73ce-db38c3c7fdf9@redhat.com> <22626.1628376134@famine> <20210808044912.GA10092@1wt.eu> From: Jonathan Toppins Message-ID: <79019b7e-1c2e-7186-4908-cf085b33fb59@redhat.com> Date: Sun, 8 Aug 2021 21:31:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210808044912.GA10092@1wt.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/8/21 12:49 AM, Willy Tarreau wrote: > On Sat, Aug 07, 2021 at 08:09:31PM -0400, Jonathan Toppins wrote: >> setting miimon = 100 does appear to fix it. >> >> It is interesting that there is no link monitor on by default. For example >> when I enslave enp0s31f6 to a new bond with miimon == 0, enp0s31f6 starts >> admin down and will never de-assert NO-CARRIER the bond always results in an >> operstate of up. It seems like miimon = 100 should be the default since some >> modes cannot use arpmon. > > Historically when miimon was implemented, not all NICs nor drivers had > support for link state checking at all! In addition, there are certain > deployments where you could rely on many devices by having a bond device > on top of a vlan or similar device, and where monitoring could cost a > lot of resources and you'd prefer to rely on external monitoring to set > all of them up or down at once. > > I do think however that there remains a case with a missing state > transition in the driver: on my laptop I have a bond interface attached > to eth0, and I noticed that if I suspend the laptop with the link up, > when I wake it up with no interface connected, the bond will not turn > down, regardless of miimon. I have not looked closer yet, but I > suspect that we're relying too much on a state change between previous > and current and that one historically impossible transition does not > exist there and/or used to work because it was handled as part of > another change. I'll eventually have a look. > > Willy > I am likely very wrong but the lack of a recalculation of the bond carrier state after a lower notifies of an up/down event seemed incorrect. Maybe a place to start? diff --git i/drivers/net/bonding/bond_main.c w/drivers/net/bonding/bond_main.c index 9018fcc59f78..2b2c4b937142 100644 --- i/drivers/net/bonding/bond_main.c +++ w/drivers/net/bonding/bond_main.c @@ -3308,6 +3308,7 @@ static int bond_slave_netdev_event(unsigned long event, */ if (bond_mode_can_use_xmit_hash(bond)) bond_update_slave_arr(bond, NULL); + bond_set_carrier(bond); break; case NETDEV_CHANGEMTU: /* TODO: Should slaves be allowed to