From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 64D4536DA18 for ; Sat, 30 May 2026 10:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780138316; cv=none; b=KBY2Awk0y8CNovXmsXVLxLjKx2Au7T9XVzhZWeV5gElcZ/MAvFXo+Ea5Bb7QPNZ1xc7B1s0i8XkQPXjP5w/fXEersnHMIuvf881/z6PI3EIhHuw4R55Yo/6RGuBawhDCz6L1bhCm828ICgKVHv/m++s0NSNDIbppdkoNQo/asT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780138316; c=relaxed/simple; bh=36XMk2k2Fl/t7QP9Bqz24fQRkYSOVQHJH4oxIRIgBrY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zrfq0iIJzxQM93X40r/Fn2OMxI8nLMDHBNQ72RXQqaWaiTOaGjLtU2CKMeuxatFb6bcQK4U0TbHkaPRqN1n0aYFZ1gAAoeoOVaysY7+ru99YVMTcfy5YjXUs2QEJKp+0a57HJra8QS0RzCvoyekiVUTpc6eQMR1W9jHLfMhHEnc= 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=j+CiORB4; arc=none smtp.client-ip=209.85.128.175 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j+CiORB4" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-7dbcb505578so34028767b3.3 for ; Sat, 30 May 2026 03:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780138314; x=1780743114; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ozA/ZpsGC4M1Jr3f58tsEBgX6Dr0vSgjMtMPt46Upe0=; b=j+CiORB4mudnvy4yWJMX5PlSZL4mYSUNFi4k1SrRNlkOTFNju+pK3SG46bWZYMwtyB YcwtN6h48Q/5r3n3etV74lU5xzPQQCF36hicsM4Mop8gsnNdFxI6DOKznj8CmWWN8DRd 3pMoquQ2mhukVlT+gGOK5wcU4hgJbxsW4MKIlCqzoF/DFJxLWZS950G8+VZ2ABkrcSxy vxrYP4N7VfuoDBmn4w/75onw0GrCik5nhwOwp4yCSKv7Dfifh9Y7A5aTAGqmhTZOzoms nhyllxCDOkabWpHGUBFiMbFKqd0mDbvwulrEH7g6pjjvtGhxyHOEAfwwvfXlqOA3rM9l v2IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780138314; x=1780743114; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ozA/ZpsGC4M1Jr3f58tsEBgX6Dr0vSgjMtMPt46Upe0=; b=ZVf/aAZCWj8XWu/RUUiNbOLinaQH1gOQw6Vbwf95Ito66RFruBYbkArin/OQBUd5V9 CXynGg0Ob8ZrT0cgMl+7rCbMsEiG/QYuEZc/nUx6PXq3NIHJwXGNhgxFT3MOfPJHpDe0 eWuDb3QQfXfasyjBaS2f4dvYtk0iOnI0P2jKVipDuoWqC1tXpNkYjrh9A2TensrxDQM4 1x1jOoAWtXv7qjETkY4cmaP4pTYwvM9k1Gq9lC8SrLcgJjEudAbu+QxQiL22te4VMuF+ 75jGEBKSvoZqH7qWU8NmW3GzctEqp6A6ICEBNVtdSnXaGYvbf2ud33vMpPb0bcHojwrF KQGw== X-Forwarded-Encrypted: i=1; AFNElJ9AjEoMxsf68RmtYwKBqilsdIOX4YXxx1j3ubaoyiILtysagLrkq6wYgK+tyg/X5iMGrMRtenfaokNdf5o=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6haNLg/BC6r3wGwUClJ76bE9jbEdWwT82hnuVUm9kdk4VguiP dgjcxe+V+vFDdpq3WE/y60+I8QRLjRnXv0Tu4gr5rJ5EdoOL9ycGyJ93 X-Gm-Gg: Acq92OHuYQ2mnyKDVkylAYxoxLd9jRfmHMb+/tyCECEXOoqxb4YPpiEVSw1j0RgNNj6 mWwSqhvML1AmuamJQUJOAOdiF1usMNmqHAnvuLV5fsXhHOqwW6HQyxD9IIZiI36jAjbjWHejG1e 8LEAZ73KOVmtlqBby6nC/ZiCuQ4L7RuFIiJ4wn1dCuPIZpJSSMD8j8NKyQ3lMvTUVyjSPaGUdkV +UZvbVahv8Nqi83abCr+Q0WTtbrh1/ZdTm+Idr50lNsvrWqwAkD6CH+ni2RZ66bpH+j8M+7dKdv 3afbddlPSvZFIIOjv1zBJ+N7VRO8YVypNNPmU87Iif30W4hl3qji2XfeRfPKXcrUaFnIfEPESJw lq8McTjTPAWxphubYezVr/xQ8LzQ194Hkqg1GJrYaqQc7qZZloD9E5wHJvNEzbZDJ0a+RLO53xz eTF7D87fm0DJ6BFMFZsgEexwUQ7QARxtFkBye+iIJKPb9AwYoUkqq7+pa7XSUn X-Received: by 2002:a05:690c:7088:b0:7dd:1616:4559 with SMTP id 00721157ae682-7e05c94fc7bmr30614357b3.22.1780138314585; Sat, 30 May 2026 03:51:54 -0700 (PDT) Received: from tresc054937.tre-sc.gov.br ([187.65.210.13]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7e176d6ff86sm5579357b3.16.2026.05.30.03.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 May 2026 03:51:53 -0700 (PDT) From: Luiz Angelo Daros de Luca Date: Sat, 30 May 2026 07:51:07 -0300 Subject: [net-next PATCH v10 2/9] net: dsa: realtek: rtl8365mb: reject unsupported topologies Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260530-realtek_forward-v10-2-d14b51e6a69d@gmail.com> References: <20260530-realtek_forward-v10-0-d14b51e6a69d@gmail.com> In-Reply-To: <20260530-realtek_forward-v10-0-d14b51e6a69d@gmail.com> To: Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Linus Walleij , =?utf-8?q?Alvin_=C5=A0ipraga?= , Yury Norov , Rasmus Villemoes , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Luiz Angelo Daros de Luca X-Mailer: b4 0.15.2 Explicitly enforce the presence of a CPU port (-EINVAL) and reject DSA cascade links (-EOPNOTSUPP) during setup to prevent silent failures. These topologies were already non-functional. Without a CPU port, the driver does not activate CPU tagging. Additionally, the switch hardware was not designed to be cascaded, and DSA links never worked because CPU tagging is not enabled for them. Signed-off-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/realtek/rtl8365mb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c index 2637884fe472..a1641378fcbb 100644 --- a/drivers/net/dsa/realtek/rtl8365mb.c +++ b/drivers/net/dsa/realtek/rtl8365mb.c @@ -1999,6 +1999,13 @@ static int rtl8365mb_setup(struct dsa_switch *ds) cpu->trap_port = cpu_dp->index; } cpu->enable = cpu->mask > 0; + + if (!cpu->enable) { + dev_err(priv->dev, "no upstream (CPU, Link) port defined\n"); + ret = -EINVAL; + goto out_teardown_irq; + } + ret = rtl8365mb_cpu_config(priv); if (ret) goto out_teardown_irq; @@ -2010,6 +2017,18 @@ static int rtl8365mb_setup(struct dsa_switch *ds) if (dsa_is_unused_port(ds, i)) continue; + if (dsa_is_dsa_port(ds, i)) { + /* Cascading (DSA links) is not supported yet. + * Historically, the driver has always been broken + * without a dedicated CPU port because CPU tagging + * would be disabled, rendering the switch entirely + * non-functional for DSA operations. + */ + dev_err(ds->dev, "Cascading (DSA link) not supported\n"); + ret = -EOPNOTSUPP; + goto out_teardown_irq; + } + /* Forward only to the CPU */ ret = rtl8365mb_port_set_isolation(priv, i, cpu->mask); if (ret) -- 2.54.0