Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4744048rwb; Mon, 8 Aug 2022 06:26:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR47uc4Wqv/9pry2aHAz/f+t20YL6IW0ujJDYquQHH/gVWHcZ4HigQpfgvRLmfk7kPHhzKYO X-Received: by 2002:a65:6692:0:b0:41d:5001:f0d4 with SMTP id b18-20020a656692000000b0041d5001f0d4mr6611855pgw.28.1659965165702; Mon, 08 Aug 2022 06:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659965165; cv=none; d=google.com; s=arc-20160816; b=OMktmtXnrYIqDNqCcfWLNyOwvyk0zGmlkGXEb5GkIX7R3hJRRBBnt1hyD5UTG7O3sM mEW2GVNvCVpnkU2a8IketyBWtC15XNwJZYTA5/xJ2itamTOLqtmjYK/L/veQ9gQ6QUgH EqS16jJ1xRqc0EMudlZXk7RNtzIFl0h6Ez5K9enkRlRnJIV3LFOueebS7WDKqRnhC8Tt dke4A20/fQCt82oOigzHPL/3nyf+Pczxux+71DvDBsXaZIuQSRx+QzrGTvaFkFOoaNsC KdHqidPXYHIRk5Gl1Liu2fTycZyebMiWpdr7KvokrLbvyLMs7J7UCay2PACE2YuQiQvF XTmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=bgQjFRSLa2xwB4CS5aSMut/Qn8ytzGfpdDtj3UKw97A=; b=INmRGeytUdSQx8w2ZGqsLsHkF7M9yeWjxXSjGlSyzxFlJEBuoKisupkySrU0itslJ5 FNz5FU4UGIjRyb1r1/O+78zc7viNu+ldqzvYhDgfm1lqUldfSOeUD6g91NuJEubntbYj il0nNzapHIBsFGAc2XesvNG8/64+e9xFjHJBhiACD3G1VOhYd+QfmNgxg8ESZEt+oJSD nu0itOMMa8sOAN6DoOL2kwj39oaC51QYIqoqkiP7f/ZAqogivemaDS4NT6h66xhUtx3n uqT8ePoHcs6oQ7AFWuqHSBaDo4oS40zTvu+Voxl3c3y7hf6mRPbx0L5XJGWDnwiP5RrD BDqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=MYgq8XxO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i193-20020a6287ca000000b0052abccd715csi7410106pfe.118.2022.08.08.06.25.50; Mon, 08 Aug 2022 06:26:05 -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=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=MYgq8XxO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243088AbiHHNGg (ORCPT + 99 others); Mon, 8 Aug 2022 09:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243036AbiHHNGe (ORCPT ); Mon, 8 Aug 2022 09:06:34 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 920BA60CE for ; Mon, 8 Aug 2022 06:06:32 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id kb8so16502705ejc.4 for ; Mon, 08 Aug 2022 06:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=bgQjFRSLa2xwB4CS5aSMut/Qn8ytzGfpdDtj3UKw97A=; b=MYgq8XxOOEc57m/ecEPlAH4rjCGi/yR46Iins5wrCHU86d9lytN7WP72HojoDPX3dq Pn5EjkJk6igW2D1f03WkODG6LKERiiQjVsY3JdOItAWf3U/+CXaQt9YYGKtkLos5pRsm gBMPt4gRgq4lQyJmdjmEhlxFdWKGoDz40qaoEQGSdOHweB4ekEBiJWAhsIxlTNN07xbP t8rmI51RNdlOLs7j0Kceu0IJl/ci8/C3mVBdg1P6q27SJgoAWmmtGFajJWx38wLd4dG6 JTUk4mj5NQ7ODWqG+rvoSxC6CiKBDBGPJmCXOsNde5/jrRvMgQfY/yIdrlGbdtNz4jUB rHNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=bgQjFRSLa2xwB4CS5aSMut/Qn8ytzGfpdDtj3UKw97A=; b=ig+jY6SnTamOlj1jWaTQoOyvMcYu2s0CczsZKyaeAiqcorkoYwW8VqnbpP1Z/FSHVG xjFOviDtCTagHUKWJmCqEDm6HXXnWOBYjbwCw54JflSHuaTYBxHoo1nnRrC1t4um/BhE UhAyyB9HpkUMFN3lYL3uhASclR/PR8Ogp0QyK4Mym9+5lp9zYnit8KPk03eGJCTbecHC w2wFlBHgCb53zuMTdGxlLESmb6XaoHzTuF01BbnjH++dj0A51JTc6ACIBQdrdrYcSuYY WaYlrY6p+gikG6H4aPnNx9kaJEanqS9WT+wvwuSx69EZ4P0TQV7Zen29bVyf4e7ywJvM jEmQ== X-Gm-Message-State: ACgBeo0CGhOBFzG/nG3lqSNm6LYMFI9GEr1Li+i5Keho79oYw57X7Els JDc1CBDD2n+wczNkN1jpg8sgb+iE6q6xtuld X-Received: by 2002:a17:906:fc6:b0:72f:d080:416 with SMTP id c6-20020a1709060fc600b0072fd0800416mr13638743ejk.1.1659963990811; Mon, 08 Aug 2022 06:06:30 -0700 (PDT) Received: from [192.168.0.111] (87-243-81-1.ip.btc-net.bg. [87.243.81.1]) by smtp.gmail.com with ESMTPSA id cn15-20020a0564020caf00b0043ba0cf5dbasm4524616edb.2.2022.08.08.06.06.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Aug 2022 06:06:30 -0700 (PDT) Message-ID: Date: Mon, 8 Aug 2022 16:06:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v1] net:bonding:support balance-alb interface with vlan to bridge Content-Language: en-US From: Nikolay Aleksandrov To: Sun Shouxin , j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, huyd12@chinatelecom.cn References: <20220808094107.6150-1-sunshouxin@chinatelecom.cn> <278221fe-e836-9794-374f-0955cc10f8be@blackwall.org> In-Reply-To: <278221fe-e836-9794-374f-0955cc10f8be@blackwall.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 On 08/08/2022 15:44, Nikolay Aleksandrov wrote: > On 08/08/2022 12:41, Sun Shouxin wrote: >> In my test, balance-alb bonding with two slaves eth0 and eth1, >> and then Bond0.150 is created with vlan id attached bond0. >> After adding bond0.150 into one linux bridge, I noted that Bond0, >> bond0.150 and bridge were assigned to the same MAC as eth0. >> Once bond0.150 receives a packet whose dest IP is bridge's >> and dest MAC is eth1's, the linux bridge cannot process it as expected. >> The patch fix the issue, and diagram as below: >> >> eth1(mac:eth1_mac)--bond0(balance-alb,mac:eth0_mac)--eth0(mac:eth0_mac) >> | >> bond0.150(mac:eth0_mac) >> | >> bridge(ip:br_ip, mac:eth0_mac)--other port >> >> Suggested-by: Hu Yadi >> Signed-off-by: Sun Shouxin >> --- >> drivers/net/bonding/bond_alb.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c >> index 007d43e46dcb..0dea04f00f12 100644 >> --- a/drivers/net/bonding/bond_alb.c >> +++ b/drivers/net/bonding/bond_alb.c >> @@ -654,6 +654,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) >> { >> struct slave *tx_slave = NULL; >> struct arp_pkt *arp; >> + struct net_device *dev; > > reverse xmas tree order > >> >> if (!pskb_network_may_pull(skb, sizeof(*arp))) >> return NULL; >> @@ -665,6 +666,13 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) >> if (!bond_slave_has_mac_rx(bond, arp->mac_src)) >> return NULL; >> >> + dev = ip_dev_find(dev_net(bond->dev), arp->ip_src); >> + if (dev) { >> + if (netif_is_bridge_master(dev)) { >> + return NULL; >> + } > > nit: the {} aren't needed > >> + } >> + >> if (arp->op_code == htons(ARPOP_REPLY)) { >> /* the arp must be sent on the selected rx channel */ >> tx_slave = rlb_choose_channel(skb, bond, arp); > > Aside from the small cosmetic comments, have you tried adding the second mac address > as permanent in the bridge? > i.e.: > $ bridge fdb add dev bond0.150 master permanent > > That should fix your problem without any bonding hacks. > > Cheers, > Nik Ah, I just found your original submission and understood the problem better. The fix sounds good, as Jay explained there, but the commit message can use a bit more explanation of what exactly is wrong and why the bond shouldn't load balance these. :) Anyway, nevermind my last comment.