Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp967100rwb; Wed, 28 Sep 2022 11:19:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59KupDXkiE+HAvba5klFMQ/tshIclZE1T/nYR9WZ+TX9GfOgeOWyHir0h4yTuBf62F5oGx X-Received: by 2002:a05:6402:380a:b0:451:ae08:7a6c with SMTP id es10-20020a056402380a00b00451ae087a6cmr33607045edb.161.1664389186394; Wed, 28 Sep 2022 11:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664389186; cv=none; d=google.com; s=arc-20160816; b=loAND2xT31ksXwwqGYU5Fbc3/MwWeADM0s8nK7pQvi+0+sf0xn7JnnwFHw3D4mNwz1 QBB1E1scagVk/7p4yJxHAyoSOBMWk53nizVyzrevTjY2KMqP3/M4TKLLx6Yz2jH0oNdM YpIsTY2Q32QiAbMDYZfSd5h/MueE8LHhy1fD01Zo66i/1L8fANlgmfkPBBekChIru+v6 gnVwhE5mHcwOJEZkxPRjCPxFWKKNXqGk0IswIkb2lbirFBSJrCIXUxOw4flnqRYyQ1Jh IHRigkE272G5aHSNLXWzuwMFUZ9nJAbO442haCZsGjjYqrky42cD158ux4Ni0jYcmbAM eGjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=ExJh+cb1V8qWVVh48kLwCt4xrjbEorn6J5h3tmHFQFE=; b=GLx0I4BacHhM/Y6skkGaUpwIvkm0YxictzZXOvl8GTrPMC1AcqUzDV/Xa7phtkl1a+ va+bJQzkaGlAKLJGP+tzWhfKjgXRpxxiCULb9fufImLiSL8N1+x/ptmjq7FxhUsWEK1x Heph6LHPCdq804gTvbY6VT0PIcWuX9MB7I/hRXPP5YPn1x9XppkbPcfBTA4v9hEzBlL3 KIokhE5ub9TrF/2b8YqfyJJ4RdBTY162HQ2bDdFoDy5kBpAcECjw3lNAN3/yFza80QWB DlEi5dtdORxqZbvqhUeD4nd1Sd3cE3Wtu52ZPpvyjrdZHcd7cteHpTeRfgV35HybiHZV xQHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=d16n9C5P; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go41-20020a1709070da900b0077cb9bc7918si6432712ejc.30.2022.09.28.11.19.20; Wed, 28 Sep 2022 11:19:46 -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=@broadcom.com header.s=google header.b=d16n9C5P; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234665AbiI1R7J (ORCPT + 99 others); Wed, 28 Sep 2022 13:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234449AbiI1R7E (ORCPT ); Wed, 28 Sep 2022 13:59:04 -0400 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1E8FB334 for ; Wed, 28 Sep 2022 10:58:54 -0700 (PDT) Received: by mail-qk1-x734.google.com with SMTP id i17so5369312qkk.12 for ; Wed, 28 Sep 2022 10:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date; bh=ExJh+cb1V8qWVVh48kLwCt4xrjbEorn6J5h3tmHFQFE=; b=d16n9C5P4oXfbN5NOQEUPzWxjG/RW8l8Y7Bs97iRgZHjp4u1qtfS506wo23d6nkZ37 Gp0MQeq/S+sYoNs4oGgZ6RNaA04fCoh1mU84MhUp8EWINLUQxIEgHekP4c5GKz7/KSK7 3ZbXfAlFcIRAnmqKZnmdco6L4RbF8TnO9o1Mg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date; bh=ExJh+cb1V8qWVVh48kLwCt4xrjbEorn6J5h3tmHFQFE=; b=71n9QladH0l9xGIFUofOa5swKDFmw4ByBk+dJWL8m1S16JNnq6I/UCyM1kOK8dwGKn 03vJ5qqMNWXVsn3Z6P3z3vWbWIEfWc342WyGo4ZTyDU/uoF8brO6yS/EE/PW+Nssz1SF uQ+jT5Mx2yVq2+MPkXYMM99zoXjNl/iOXUdmNfXbCMLtDxESOcvprJKToo/RoPzWB9vS Z7aPNgE02FwStDAO4hP6c5e6cN45yMTnZgNOr1kt4fRzWW4Qe/sxgos2RADYX3RYna2x /qSeh8XLJl1QLUJ1fkZyexYVS1YCE0zkEHW8smUqiADUKmmC+3ZGuS9Lt2nvjxgWUeFb UdrA== X-Gm-Message-State: ACrzQf355TwZoXPMTSPI6sekmTkACcvleVFD0TacEZQEy8LZgv4d1VUD YMNEnhLEqIdUvy2P+4o5q7BXHbAA7I9RscXzdy40etZm0xrDC+R0dNkXg0auZt2DalLWUiXdhcI Qo7mKAdre6sRYQG8= X-Received: by 2002:a05:620a:2627:b0:6b8:c8c3:78f9 with SMTP id z39-20020a05620a262700b006b8c8c378f9mr22204177qko.641.1664387932617; Wed, 28 Sep 2022 10:58:52 -0700 (PDT) Received: from linuxpc-ThinkServer-TS140.dhcp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id dt35-20020a05620a47a300b006ce580c2663sm3706932qkb.35.2022.09.28.10.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 10:58:51 -0700 (PDT) From: Steven Hsieh To: Steven Hsieh Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Nikolay Aleksandrov , Paolo Abeni , Roopa Prabhu , bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next] net: bridge: assign path_cost for 2.5G and 5G link speed Date: Wed, 28 Sep 2022 10:57:58 -0700 Message-Id: <20220928175758.2106806-1-steven.hsieh@broadcom.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000838d0705e9c08361" X-Spam-Status: No, score=-2.2 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 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 --000000000000838d0705e9c08361 Content-Type: text/plain; charset="US-ASCII" As 2.5G, 5G ethernet ports are more common and affordable, these ports are being used in LAN bridge devices. STP port_cost() is missing path_cost assignment for these link speeds, causes highest cost 100 being used. This result in lower speed port being picked when there is loop between 5G and 1G ports. Original path_cost: 10G=2, 1G=4, 100m=19, 10m=100 Adjusted path_cost: 10G=2, 5G=3, 2.5G=4, 1G=5, 100m=19, 10m=100 speed greater than 10G = 1 Signed-off-by: Steven Hsieh --- net/bridge/br_if.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index a84a7cfb9d6d..a24a1e782e8f 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -40,12 +40,21 @@ static int port_cost(struct net_device *dev) switch (ecmd.base.speed) { case SPEED_10000: return 2; - case SPEED_1000: + case SPEED_5000: + return 3; + case SPEED_2500: return 4; + case SPEED_1000: + return 5; case SPEED_100: return 19; case SPEED_10: return 100; + case SPEED_UNKNOWN: + return 100; + default: + if (ecmd.base.speed > SPEED_10000) + return 1; } } -- 2.34.1 -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it. --000000000000838d0705e9c08361 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQbQYJKoZIhvcNAQcCoIIQXjCCEFoCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3EMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iYWxTaWduIEdDQyBS MyBQZXJzb25hbFNpZ24gMiBDQSAyMDIwMIIB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