From patchwork Tue Feb 13 22:03:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Dembicki X-Patchwork-Id: 200695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp837227dyb; Tue, 13 Feb 2024 14:13:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXiI+LgzgvCnW0i5O2xjSk1KeWQnnMg5S0VQIxjH0l38AEVnU3LHb8MlN2/zssLICf3g+OWqwkZlHDDwhHc7jdhJKBo5A== X-Google-Smtp-Source: AGHT+IH1PiD49/SvuHbIBNXpctYyuUNcExVVE8YpcMDGkrz3MBlocOdtffWNmaHu/zcubtx/2g0o X-Received: by 2002:a05:620a:c18:b0:786:9b73:da23 with SMTP id l24-20020a05620a0c1800b007869b73da23mr963919qki.46.1707862437160; Tue, 13 Feb 2024 14:13:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707862437; cv=pass; d=google.com; s=arc-20160816; b=Uoaldis2oyCWcv11OeIqhclKy7++hb2bzywdhusOtC/VbdIZDPAjHwZYobUIWZCVrp rTWrPyl0Tr2RIr16YbAk8Pyc4OGhn9Ou8dF55srvL3YcVJJnKy+JLzjD7L0qoj+TQdf3 qCFLYFA7j95MAuF8QwZeWnazMmk9fA111NWu0Zi/u+JMHQ2sXpj2F89cbF7rBBTgKfm7 aIgDcO6350GET3wOIomfPRIcWzgX1iGWCH1RKCSg84fTFTJHFcJDzLj4gv+aZGf7PfHD 4Sf4Ms8GCTgqiTvuOZOlCbt9nRjtIDkNWQH+f1ATqR+P7lIc0AtQOdUBz9KKh6moIIRq ahpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5lfZKWMdVX06rkt/a2RPzvoVKkcprfsWZW9EdATKrus=; fh=udF9OvqOUv74WT/P/IrysM82m+WW3MvZ8gem/18VaH4=; b=lkxsRs3gR5qExJbEAbHi5AzjLHtllFTdvahIcg0jF+qjjwXyK+TskiFXTHrrzVskZf Fx3e7uB9d48blJTE8BJkjgCMeZr2bcLHPHRs4YZPxbMNczchuINDWeqjVLpUfQmqDJsW WKztjHpW/ZiwFnFLpb9k/0hkeHVySNL4jDn+wsEs/+xgPgG0GSZWYQ8xE+/JUlq7VGdG QebQQLeiXKCmQWV+i8+64Eh1MyvRT7LrX8arc0/zYiCCLPLXGn1QzTP5OpqMgrT71moy jtvXY5BoRFPphAdjergyJn/Fq5eEIAnxzzgDdKCkSs+VSBSjik0YVLnxO0h/YkGWU3bq bFvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ft7QnrOO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-64436-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64436-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCX1aF0cEbbIrfszzBsskNmlsoxtU8Kv/hFKC/oDpWi7Tb7H1t1Lo6p91UFnGnuSuvodFUYsx3opcNZUiFo58g0sLhqp/g== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id po30-20020a05620a385e00b00785b189cc93si9218994qkn.353.2024.02.13.14.13.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 14:13:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64436-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ft7QnrOO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-64436-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64436-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DFFD71C2209F for ; Tue, 13 Feb 2024 22:13:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 298A864AAA; Tue, 13 Feb 2024 22:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ft7QnrOO" Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C265A77A08; Tue, 13 Feb 2024 22:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707861985; cv=none; b=VtcXVl7BfyR0y1kP3do183A7sA5GXUFzA80IwPkZcEA1cYZ6+rCsJCa84V8efLYW639uXRoZQTDRgjvPc/MciVDFNviixZLTQTD787oM1X+GH7Sew/SWaXbLE5y1XaiH7Bk2emOrE6NKU1QENChObHN5QxazquPFik42LmXhYeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707861985; c=relaxed/simple; bh=hPoqurwpt0Nzd4K48f24Meg4YCMaFciuOSzhb8zDw9M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GSdWRA/QsSnyJFONPbAqYCNM+lsPClcJsH9iq0zhqP6xVK28glCMPvFbMgqBza+yhvo4XRswF7XQxSQU02OZyfl2ot4fg/cxHN036Bh8pTf4TO1iA0v5TNArOgsqUUUIomhaCaSpPiymm88OZqRDFxQLTqcIyBybvHYKm4lUHUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ft7QnrOO; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3d39b2c269so14278066b.3; Tue, 13 Feb 2024 14:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707861982; x=1708466782; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5lfZKWMdVX06rkt/a2RPzvoVKkcprfsWZW9EdATKrus=; b=ft7QnrOOe5JHSaAnVzT1evB3OFB5yfsZepKX/hYRC6p9YF0MntKZX9aQGzhP6IUggK DFRmuzlfHL2rbB1vkD0n5cuD4ZuwqOYoph1sXVY/LxB74SkYiwDD38XVDUk2BmPKJlCx +HF38OKglRghokU9/1b8+8uRLPqV3zMWty1KXiOmWk14Ckut/Ra/gkvT2Z+zWkepqH+v 3m/3ZIEJYtgg7yhAekcRhGBWOuU/zQtzUeC+8tz2VLnpsOonJZ/kXwiRE/bBOa0abGN1 gb/OYoFCwTxTdFpfm3pk59RAYDYOUTSeqAvV95aeM9ZUe8WFu3FRT9N4/ZfkOo+P+Zh6 9Vgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707861982; x=1708466782; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5lfZKWMdVX06rkt/a2RPzvoVKkcprfsWZW9EdATKrus=; b=fptdPLAMdjUwTEDauSuf5518CL5jbzsgJzKAMEluYdRhqe4JnTpheV73vckOZFyxRT +W82BpiuPrCknRZ1/npaoQvxGwMHYxMdTT82L8JxqqlqMIBQUo28tXBghS5+89+LTk+W ED7nS+0K3Xtnlyy8hc6t3vVxlV35mBAmswuyRoLo6cr7sSAXx14wfxpKyYkecZM15bKL XJHOiYPfgS6Jn10smboEqZlESG/30BAXKqm+uH66B9wM1YY8PMYGz4Veuil303Bm9czu kYWHInPqslU1PHpQDBF7L9DnSz89+beh2GBI9ICLBKwRmX+7kEo5bPtILnTvabqzod+M W5+A== X-Forwarded-Encrypted: i=1; AJvYcCW5U5PS9aRUoOlv2fMPzMUoguEHah7boxtxPu3airIuLQQV6DyhCiQZEXMupxNQ3TuRYijyzkHOFs86Ttu+OpdQls96rEhizURJeGzS X-Gm-Message-State: AOJu0Yz5GC2xuN/ibWsEyXbKjsAdkVNNFenI/j4BospKJ5sznFP7MGQA lVTFk33IxFo7eR7xgNDXOe6Uj4cFXV13IdG2k9/HCIU6H0ScdsG8kzTf3tNDQAs= X-Received: by 2002:a17:906:f10a:b0:a3c:fc34:d5c7 with SMTP id gv10-20020a170906f10a00b00a3cfc34d5c7mr435072ejb.61.1707861981841; Tue, 13 Feb 2024 14:06:21 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXlF7wPfzwC0FthiObG9mNggVsgoTXaW6orPkdbuVmifEyHR9vHn1/XxFTlRk3S9x1v+rPWep99t3BhAdOJLT3qtCEjLKegPqPeQlJytzkvL2nFaY1C6oJ65cnsP6YJ+shZidDyisFRajnSReRVWkMPw9IzfdjJeSJK0QbJJWaZ3M0wXflSrF3TLrimvcggo/FfraRWS3FCuV4OuRvuRU6pJclAwWKHxi4/mIfhDeUUW/44RsLIJvgF6y2QhAkGs0WBFKQK1Z8+Dl+G0B0LdZ1OT3MUnmFOBRH8sM84PZbJMGmgKxS+cuVH2ZZdgjFOD1X7bi9jocNMZGwqFVtpA9M8Q0IygPTXaUyq1qrucZHWn82432b/v61I6prmM93L/JAf46kvb8iiGf+a/W5hBUUAem1oHjZ76AEZalmnVjaE2HAgnCltP/n+2KHKMJlMD4mJ/1Tbzt6O3A== Received: from WBEC325.dom.lan ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id p12-20020a170906b20c00b00a3bdf8ae86asm1706800ejz.10.2024.02.13.14.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 14:06:21 -0800 (PST) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: linus.walleij@linaro.org, Pawel Dembicki , Vladimir Oltean , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 14/15] net: dsa: Define max num of bridges in tag8021q implementation Date: Tue, 13 Feb 2024 23:03:27 +0100 Message-Id: <20240213220331.239031-15-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240213220331.239031-1-paweldembicki@gmail.com> References: <20240213220331.239031-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790823562920871156 X-GMAIL-MSGID: 1790823562920871156 Max number of bridges in tag8021q implementation is strictly limited by VBID size: 3 bits. But zero is reserved and only 7 values can be used. This patch adds define which describe maximum possible value. Suggested-by: Vladimir Oltean Signed-off-by: Pawel Dembicki Reviewed-by: Florian Fainelli --- v4: - introduce patch drivers/net/dsa/sja1105/sja1105_main.c | 3 +-- include/linux/dsa/8021q.h | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 6646f7fb0f90..6e22d7a6bfa3 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -3156,8 +3156,7 @@ static int sja1105_setup(struct dsa_switch *ds) ds->vlan_filtering_is_global = true; ds->untag_bridge_pvid = true; ds->fdb_isolation = true; - /* tag_8021q has 3 bits for the VBID, and the value 0 is reserved */ - ds->max_num_bridges = 7; + ds->max_num_bridges = DSA_TAG_8021Q_MAX_NUM_BRIDGES; /* Advertise the 8 egress queues */ ds->num_tx_queues = SJA1105_NUM_TC; diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h index f3664ee12170..1dda2a13b832 100644 --- a/include/linux/dsa/8021q.h +++ b/include/linux/dsa/8021q.h @@ -8,6 +8,11 @@ #include #include +/* VBID is limited to three bits only and zero is reserved. + * Only 7 bridges can be enumerated. + */ +#define DSA_TAG_8021Q_MAX_NUM_BRIDGES 7 + int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto); void dsa_tag_8021q_unregister(struct dsa_switch *ds);