Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2616588lqz; Wed, 3 Apr 2024 03:42:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYT4rIl1YMjnYRm57cBs/E7PnVbqAx0jWxt4vFqBlaHXpgTRNQZz9qdei6hRRKvYym/E3Ob7q5Hw5HL0/56on1RdbpGsncXJ2kgRqNKA== X-Google-Smtp-Source: AGHT+IHuU4vDmPjBexmnyTXgdg2lckw2LPVeWyxiCnVm61F2+AIjnTjy4YCR9qa0RZpB5kE9cX+E X-Received: by 2002:a05:6e02:1d05:b0:366:a703:24a3 with SMTP id i5-20020a056e021d0500b00366a70324a3mr19071791ila.25.1712140940028; Wed, 03 Apr 2024 03:42:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712140939; cv=pass; d=google.com; s=arc-20160816; b=KQww9vHK6ZspCPYOa4Clizkb4abxI/WKM/08+6LfFI+p99JTtu2cP20wy9oShr7Agt O4ZxA/V4+MG1XpYSvRYqKLRJTgm47YucmDCoUATvEGBejq3du7+UmN5hm/4S681YoPRo qvTVKw1Rsn9APTIj4TZgP6TWHbh1bnlBcaTpjJq/R2B6KD34t+bliTo5VLixbJeXz2UI lLVTqcjRoYpK2WhdZJuffwF0UQ7+eovD4Q6cWEaFcAaXT3mxi1kfdZaj8xknXGk8IRfL 5D8rB+35m7/LXelGyGhwmbY5N7Tfc8P9au+AD/97tyJ1CfGhG7+XfJjbjUzmhaz4QNEA lXow== 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=UvqfJFDT4uUbjd78hGNRHWQuDLmuXrnUhBRMXhjGdh0=; fh=4+8BQ6iHfYyPWJrLYR5WoamfrHp7y8+UGZDaaSnDcak=; b=Xe7s5rIGXPZhJxwQU/XdU7LSMwgR1dUK123BUr5lsB9zKp6wjfDk6074859wEdfhqh pu24/0KlGbF27jRJZG1NAi8U9z7Gp4jl67+z5l4tR2JTTltNwVu2a6aVN9sevkHtSOXG YmW4SXI5WRymysXXIsZcaNr+9tLCmswBsHu+WVxJ61CPjRHIBHwqk1CO81vygB4z9A3N nhaHPHR+fAaV9PKrZBALanqBSP4fvkxy0HtNBLEvO/fpZHWkediF9yde7eauYoTWIW3V QZ67a7FbqJSfkk32I2T/lrT040txwUIEZiZESIP02Ceqf74l3JMXuOMC2DwFeCwn9ysG 9S4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hDZ2kblY; 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-129584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id by18-20020a056a02059200b005e43cb39729si13690271pgb.870.2024.04.03.03.42.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 03:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hDZ2kblY; 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-129584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129584-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A4FA6283E43 for ; Wed, 3 Apr 2024 10:42:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63819149C53; Wed, 3 Apr 2024 10:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hDZ2kblY" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 DD1241494D8; Wed, 3 Apr 2024 10:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712140720; cv=none; b=SBk1mzX5Y3Hx6LrwFfY/P4dBK/hzkFHmKyChM3yH2g9h3Fgrw8P89rgB+w5spWYc90e8uwWsp0ICo4x7BSiKavKw8SkQaU9lPekz85/h3UzdJRgGOsMBC4L7zTNJ1y0uiL1C15BxiDtHnLnN0lsSBhZ+mBSDiA4J2p1xpPFpIBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712140720; c=relaxed/simple; bh=AYF8IxFjmPRIZ2yHjvMO4zqR30IMbbwHmMsj12fvFdk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mM1shno7xsMVCRtiXGB7qOqABBq62gG3sMlxREf1ECivQl/RAaitBexvi3h32ny3uLtHXn6/NBCQnG8+DdynIRg2/uE7SBa28jXhbBrCdZS740avtf3ksEuo9C/oodbjatkCUtR6AYHMfX6qM+B4QDquoibVRhi5OwWqUU2UADY= 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=hDZ2kblY; arc=none smtp.client-ip=209.85.218.45 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-f45.google.com with SMTP id a640c23a62f3a-a44ad785a44so710765366b.3; Wed, 03 Apr 2024 03:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712140717; x=1712745517; 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=UvqfJFDT4uUbjd78hGNRHWQuDLmuXrnUhBRMXhjGdh0=; b=hDZ2kblYEC2/DmJsCztHQ19e95ISbecvfdoOyFcyshzcqhrzJlQSYu2d5PNGCmRxY4 iD1NyvD/Z/rogZf9YLuxInojoHPUNlfiiHDX6CuaRDSRmI1d8e7ujqmDSfM5ATyfm7Om ftZlXm9YRDJMsnGTG8fnknISy+ANSvlzymoZI2ksJhpxDDM2Jj2p73YALR2G49moroMb XKGC1sQw6B8AwC1BGVfbVBoZ1+vh0urhDUt8oNOkZHD9zyWyFpsAIkWIK32V9XP5SL5Q BGyps7Cj4OQWp8ZGv0xR16pokOGzGFuW30bCUr1cvzHBFvbX/MfQAhfDX/RWZqQibncV JTHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712140717; x=1712745517; 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=UvqfJFDT4uUbjd78hGNRHWQuDLmuXrnUhBRMXhjGdh0=; b=HC2SePgUBbRks33sqpHutXRP88Bc+Kv1XyoS6LQ1tL0FFq9rHBFOfDAvhELg/wdoQ6 FiVTuiWiKGh9x5K3gIuUNadnCg9RtGRgOirklchvJywC+DYrqq7JKg3QdNE3jkU0n5Ba A9XkE0ShAWDK+LArdDJrqF9M/BPGlDXqjO1IdAU7BS69SWrX16BejP6skIg75izagF0O Kh++biyPLjuA1o3nkkX1BBhAOtp6VSYkIYeXOa87XzfQB0LUFV1XkT7XKTl5ApFQuSUA rTpdycfLQ7BAgzN4AOyiaJrPLD+jae+ierole+HwSaxYGn8/PNMk0KfPjJ30pKVc5sGg YHnw== X-Forwarded-Encrypted: i=1; AJvYcCWbWi5liIDOSh8uD7rO7Id2eu9vM9tL30LqxlMBYRkK0RnsWxDUe4MRT/CupXwuAcf1VqX7l6jeOR1GcCbYuM3LjJzBM5phcEZ9xARv X-Gm-Message-State: AOJu0YxGPZIwEJnwxll4viVwU1ep/tKu/9I9WVaUQes8g8XtTeCQ3tAU dGGMdJKp0Inhi4mpEnAafqMkUEbEEBNlJlPZsJNamBMiok2+DLi4LgwGmYvFZ/s= X-Received: by 2002:a17:907:7859:b0:a4e:2873:e94c with SMTP id lb25-20020a170907785900b00a4e2873e94cmr9333844ejc.1.1712140717065; Wed, 03 Apr 2024 03:38:37 -0700 (PDT) Received: from WBEC325.dom.lan ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id xd2-20020a170907078200b00a4e2e16805bsm6858169ejb.11.2024.04.03.03.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 03:38:36 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Linus Walleij , Simon Horman , Pawel Dembicki , Vladimir Oltean , Florian Fainelli , 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 v8 15/16] net: dsa: vsc73xx: Add bridge support Date: Wed, 3 Apr 2024 12:37:31 +0200 Message-Id: <20240403103734.3033398-16-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240403103734.3033398-1-paweldembicki@gmail.com> References: <20240403103734.3033398-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 Reviewed-by: Florian Fainelli --- v8: - resend only v7: - added 'Reviewed-by' only v6: - resend only 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 d0442ea8a610..87922804d1c1 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -691,6 +691,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); @@ -1585,6 +1588,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_portinfo *portinfo; @@ -1708,6 +1727,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