Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp96897rbb; Fri, 23 Feb 2024 13:06:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXABwiakGU65YniJGfkuAE9u92cA4x5dAsIraO7YiU/F8PsGcjtFkLrPSTwSIExfRavkTKZYhkxxWnDyeo09bgi7kOukd1zaSJGnWTgxQ== X-Google-Smtp-Source: AGHT+IHhd8sF7o7Z++cDpAFeSd6I51SUksBR5tHS9tU6LEv14O5RRBRELUcJYrN9s76glqBghdfJ X-Received: by 2002:a05:6870:35c8:b0:21e:efd6:5ccf with SMTP id c8-20020a05687035c800b0021eefd65ccfmr1129340oak.33.1708722375532; Fri, 23 Feb 2024 13:06:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708722375; cv=pass; d=google.com; s=arc-20160816; b=ln6fEnMLHYZbhjuPU9gv3MyZLhBk01YquOvsoNAix+1tcktR9dZHYeQqth5j60GS5Y YPMepIaOV/4XFsvKsKomtm0Z4PTNJPSX4H1VTBNTCL1GfR93RKdWLg6ygMPpXjTDlXOs lWq1K4KGPNnF73s3jnUi65nrBBttXHCoTbsLSiOktEtGfqn8xSeZdDti+tzOVoqrVsuA PBgTBNftDcbDjTg80ALDtqniwdp2/ijQwFzkuSQoh7RlUNmgHstiglhHpEWx8A7eVECm PU9mDFdztuUreGqHW2xan1LhG5XinEEpbZhe6IV38iN1rIOWG3mIC0/B/8XDHAtEDAiC T7zQ== 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=CsgqUU+5bw6FiOn7ZlwWk12GQwooTmRMzEUA6afssIg=; fh=Rbl2WgLHw7bTGX4xpkN6FQkjwtnhHMHkX3lIbYtjgxM=; b=g6auHA7WlhdlArZwlzVXjnwrBMlAYWcZrhXiYd24spPlWRVARUTHlqYWJcdyzzFfpR kZI2mGRF2v8D4TAaYe6+WIy0KKk0XzRSqSqzpvq5uuy+JOgdqDci6IcsDecszJPPbdXi C4cxlrux0Ut8oqk9tdTEukH4eJtx8UTee6f4WEGPleQSv2YmyyJXj4bilJWhoUSSJW9W nKH2KJfXjCdfEKStVi9scj8JGaTnAHShjuIIFZL0GevKf7G/qifGpI6MEZKpPym87agq 9or5fVCj/JLYPmkr8XiZtwNBhrxEl5vZG2TM+5XEMp4oOv5UCBO9jTs7pOu6/H7jdiPl 4I/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=g4DjGv+m; 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-79174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z23-20020a056122149700b004c000d92f39si2571557vkp.36.2024.02.23.13.06.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79174-linux.lists.archive=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=g4DjGv+m; 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-79174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79174-linux.lists.archive=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 165FB1C20CA1 for ; Fri, 23 Feb 2024 21:06:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3770914CAC4; Fri, 23 Feb 2024 21:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g4DjGv+m" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.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 B859514939E; Fri, 23 Feb 2024 21:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708722188; cv=none; b=P447Cq64vuYL2agoJSGtqL9C/2485/Krv5qCUSTO22JnJSesHksusPQXGYmgd/PgY43OakvU62kXUxAPJId5ZeHxlLBDM3pJMjhbA+uSAWIfn56rL+aZ2rVfVq4ZJDDpEcr1X28UWripa3NhL0NahOwtI0UN2D0y8DLatlb+5RQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708722188; c=relaxed/simple; bh=zxFuSdqwAGFS78xhXJ+6ExlfTO7DkUchW5bvMLNLJ+E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RktHnUm2BH6hG8WasWpWJC1RA9DGzDOqlxaAdeLYsPil+Mm4bCbIPUbW0/E+5amRzEpjgaYD52P2I70iZMBCByphTf+PczoPPAUoa49VWSBeq5C9ctKZ501sVTPXKopp1Ax5nxPCkUef7Os/l0k5Np04nT5XX3VxVPAitn9ttV8= 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=g4DjGv+m; arc=none smtp.client-ip=209.85.167.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-lf1-f41.google.com with SMTP id 2adb3069b0e04-512ab55fde6so1070090e87.2; Fri, 23 Feb 2024 13:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708722185; x=1709326985; 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=CsgqUU+5bw6FiOn7ZlwWk12GQwooTmRMzEUA6afssIg=; b=g4DjGv+mj114mgehuOiE327nRVIHyPZD12UNw5jv5s0l8nzPFfFmn71gceighoIMg8 gJbTdUdzdLLMx7B9CQq0ZK8gU7rxVyqSybThf1d4yDPPiXzHTOSGSkfAFT2XPuZMPuR5 xE1xlQMaM183O4O5c9c8hL7UjLOdUWCR0owKIR/RIXkUG1v33LaOmLlMHVPqVN+7iVOA UP1ngFKBjbvttHgiX/8NAevP4kmn+YcZc2OP3RwYd2zrD6regxutCZ5ABkA/aagtg3P9 AsA2pBksVUEbSvv0etBjU74xui56BM1sIKP+4UTsXIi0WjI3//HA+Ac4R/s9aZlDxeJF WUnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708722185; x=1709326985; 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=CsgqUU+5bw6FiOn7ZlwWk12GQwooTmRMzEUA6afssIg=; b=SxHUkwVW9wUmsGubEd0xvEs5QX8dqf81apxcATpjtAm0s8p73bwI8+wca8+o22dYMV UdTyLIGtj1XAicUCBjm2PCp5bTmiXK9ziuGaG+V2wbZza3G8qwMWgwDtlFTNgMU8+wyx +Rm4UjpyhmiQrsyKi+yVTxEwwFc3nTbAXP9GYu70S+xyogoE72ka5cJaXAoeQ4oz1DRX dE9MceneSJ95ado1nO269I4WJZCKNRdQrQH53vgqeYopx7avTmtQYFvRaH6SYsmScINQ dhrE9I73Bfc+bdNZETnm5gYKCavRxNrwkymoCDd2aX2K9ErEv3Qjr0x9Ucz921Mrw01R OPBA== X-Forwarded-Encrypted: i=1; AJvYcCVfYY+ZbX5vVc0iSibu/WFE82dJ4Uqrb7DD478Nnyqwm3GTvWTHIGoe/qC5Fn6TSRara5SoEsYKytVOdtvglZIXPj2OOwrD8E5IQI2B X-Gm-Message-State: AOJu0Yx47WW5Dl/hALRZp69MQEToaw+oHjANbjPKS4oZnBb2NMOSrPfc c4V4V16EvIH86KjkUBL4ql5PT1mTwcGdKXwiFD3+sAx1fOrcHOtzBB2bCFr8x4w= X-Received: by 2002:a05:6512:324a:b0:512:d689:51cb with SMTP id c10-20020a056512324a00b00512d68951cbmr499841lfr.26.1708722184723; Fri, 23 Feb 2024 13:03:04 -0800 (PST) Received: from WBEC325.dom.lan ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id st11-20020a170907c08b00b00a3e559aaff9sm6185424ejc.29.2024.02.23.13.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:03:04 -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 v5 15/16] net: dsa: vsc73xx: Add bridge support Date: Fri, 23 Feb 2024 22:00:45 +0100 Message-Id: <20240223210049.3197486-16-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223210049.3197486-1-paweldembicki@gmail.com> References: <20240223210049.3197486-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch adds bridge support for vsc73xx driver. It introduce two functions for port_bridge_join and vsc73xx_port_bridge_leave handling. Those functions implement forwarding adjust and use dsa_tag_8021q_bridge_* api for adjust VLAN configuration. Reviewed-by: Linus Walleij Signed-off-by: Pawel Dembicki Reviewed-by: Vladimir Oltean --- v5: - added 'Reviewed-by' only v4: - remove forward configuration after stp patch refactoring - implement new define with max num of bridges for tag8021q devices v3: - All vlan commits was reworked - move VLAN_AWR and VLAN_DBLAWR to port setup in other commit - drop vlan table upgrade v2: - no changes done drivers/net/dsa/vitesse-vsc73xx-core.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index 1132a86538a3..8dc366461b9c 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -687,6 +687,9 @@ static int vsc73xx_setup(struct dsa_switch *ds) dev_info(vsc->dev, "set up the switch\n"); + ds->untag_bridge_pvid = true; + ds->max_num_bridges = DSA_TAG_8021Q_MAX_NUM_BRIDGES; + /* Issue RESET */ vsc73xx_write(vsc, VSC73XX_BLOCK_SYSTEM, 0, VSC73XX_GLORESET, VSC73XX_GLORESET_MASTER_RESET); @@ -1587,6 +1590,22 @@ static int vsc73xx_tag_8021q_vlan_del(struct dsa_switch *ds, int port, u16 vid) return vsc73xx_update_vlan_table(vsc, port, vid, false); } +static int vsc73xx_port_bridge_join(struct dsa_switch *ds, int port, + struct dsa_bridge bridge, + bool *tx_fwd_offload, + struct netlink_ext_ack *extack) +{ + *tx_fwd_offload = true; + + return dsa_tag_8021q_bridge_join(ds, port, bridge); +} + +static void vsc73xx_port_bridge_leave(struct dsa_switch *ds, int port, + struct dsa_bridge bridge) +{ + dsa_tag_8021q_bridge_leave(ds, port, bridge); +} + static int vsc73xx_port_setup(struct dsa_switch *ds, int port) { struct vsc73xx *vsc = ds->priv; @@ -1721,6 +1740,8 @@ static const struct dsa_switch_ops vsc73xx_ds_ops = { .port_setup = vsc73xx_port_setup, .port_enable = vsc73xx_port_enable, .port_disable = vsc73xx_port_disable, + .port_bridge_join = vsc73xx_port_bridge_join, + .port_bridge_leave = vsc73xx_port_bridge_leave, .port_change_mtu = vsc73xx_change_mtu, .port_max_mtu = vsc73xx_get_max_mtu, .port_stp_state_set = vsc73xx_port_stp_state_set, -- 2.34.1