Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1065873lqt; Fri, 7 Jun 2024 07:12:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTPd2fCaH+MOzfJE8G8flQw6MIiDbJTA7o769kkTUcZ9ZASAOiSZ670AprPIxAPSFwD4arwhFYHeAXTAlKlsykSy4LesJwE9hcdU7neg== X-Google-Smtp-Source: AGHT+IGUyvw8BE8FG5Qw0fZhqNGfypOAQhmPvvM6mJTa2pi2BKa6qZ9BssKSIEIuVSG6Ff47WMrI X-Received: by 2002:a05:6a20:4306:b0:1af:d35f:f282 with SMTP id adf61e73a8af0-1b2f96dec04mr2910421637.14.1717769535905; Fri, 07 Jun 2024 07:12:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717769535; cv=pass; d=google.com; s=arc-20160816; b=mPYHquql4EY2Y2H/4tJD5vmxOtcgNMSMxToMPBR3KMuKxe8/ceQtp0CRBxJNLQkzoT jV1Jlki9Dy1bZaM+2p7FVMo0bOz8gvt7Bd/hA36OrnufJIO4zmnEmJldVg+UAVMg8H/d XePULuHNZj/EJyUedtKnOn1xALa+IDTy0lwrd6Kklx+hbNoiSuZZDj4/1jhvutEWMNjM 4Nxqcg23nuAuueldziH14FGaf11K3iKRLTUI7g71dTrpbcEc/raEAxLubjAtR5xJRJj7 2Zt50RjCJADaWt3zL/8U7b2rp0wvho2oepwCXYaMZHHSAvM6FZICYNNZggfvWiTDwLyt 5OaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pTnve0OlkP/Svwep8TruSEF3Sh0+kENp9G4xdXwTQa4=; fh=2dRx9qzjoOQndVuulvKYH37RMF3YAe2uGNhxSUBDsnM=; b=pjlvjU95ZRm20rwSSoGSkcvKqQmTBNRU6FCEPIRqE/BbXlSfi8vm8KcyIrsHuVoUf+ 1gHSixqdRbd8HP9L0keuf/MbnUcPqjwAoGm7BltTlqbJGz9XZyjS5aalCKiUPH0c9aub VTfq94C1IGmDDSs6ejbfGuSD3su1qywWyiB1qz4HZyqyX7VYoNQ1c97f09hjuuUaFUP8 p49AeW5GUAXHWI//380vERW39de1RZi6NzgEtKnc2UsTTtyx01rrYdy9vOy+TZxK3y8D l4kaS7EwN9ScvgacKlBf4zrs7os09KXRqFvj3UYFAqG0//o/grYhMs+SG7nc66yhzRWU cKtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IuwDDmZ8; 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-206194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206194-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de261c9a83si3143071a12.253.2024.06.07.07.12.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 07:12:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IuwDDmZ8; 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-206194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206194-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F3CDBB2738F for ; Fri, 7 Jun 2024 13:49:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78662194ACD; Fri, 7 Jun 2024 13:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IuwDDmZ8" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 1840C194A66; Fri, 7 Jun 2024 13:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717768182; cv=none; b=qPLGXdUz+NuvdqlGKPhzeSUKX8FPSuDa75LIcxj5Mh98bIQXx+ymB8BenjGyLQcL8U9wJtjn2HfXi7QSucnbALtWpmgkkVgj25jU6qDYnDPchDckGHqGQkt7QKMuWfwAlGg0sGPKLTjN5AM10zHqvUfRmSCoTzd/6jcz3egyo+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717768182; c=relaxed/simple; bh=eRfiCS4lXI/9Sd/hQTfclFr+REQx+PxoR+f/dcqGGoU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GR7HT2VicuGEv0xEsgBhc0hRQ+gyiV65+7Vz17dVyjb4cknnMMKO/gnQaJetDS+L5jEB+QRryNZJwi0qrguIy4zMTtP2o3PqhMH+KpkwvxV5GuDQhida7AkuAuMS1MqvOVc0mwkydLqp72bt4NnX7qO9YB0j7dlMN/8XSdYigSk= 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=IuwDDmZ8; arc=none smtp.client-ip=209.85.208.43 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-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-572c65cea55so2255649a12.0; Fri, 07 Jun 2024 06:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717768179; x=1718372979; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pTnve0OlkP/Svwep8TruSEF3Sh0+kENp9G4xdXwTQa4=; b=IuwDDmZ8kSvsCD+avgRTY9Uf9SEbJU41aCufgm9PLe2HhXH/Xz2bKkHuzjjLPOvKEw PG9G8gdg2XSB4g1fWHlPLcusGwv9SzYqs/qT4l6dXuIvMbvmgBzzX0d9jbygpfIvKnIe Dw+sUvtfVvDzMLE1XXuI5COTXRjPx0nTVbNQBcXfrPTFnNdon2uQo+eFJUV9+209gj2x tEeFJgaVr9+sUuWcO7ZtE2WD5GVPG/a35OuggTQq3HmHL1BthUaivDtNB12g15rJvn69 KufY3w1xBtUjaPGQmY8orsVp+d8FzURGfNwuKSAnlgYKf8PL9wsJHxWfuIUReAGXMZo+ 3Cdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717768179; x=1718372979; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pTnve0OlkP/Svwep8TruSEF3Sh0+kENp9G4xdXwTQa4=; b=CSnWk1iyikWGoXunmd6/MFAlNTBjeUsO70oa8hf++QNCqywWQcUwN79V3ohGtszWMq 3FaUmDwURf26vYVIyL+D2Jz4sGTZkRf8NCJPaTwGQEwb1va9EvDGAaZ2CnJqjUeK7ZJY 3pDxAeUQyaF2AhlXjX/ThcT32N2V8TlQfafKIb/3thUGiErhyo+ALZIX4FJ8whYD3Lor 3tBuiNBm1m5UlPURpEMsk2DbBnT5iMt9IJ68V4/JSTiOeHnKHNnfE95efUwkoRXJg+bK iNPchrj/xwnFP+ajfYVI/1YEAH9atTZIQU25ix1Cauity8NjaOkWLzLBZfBVB1Pyei+H LF9Q== X-Forwarded-Encrypted: i=1; AJvYcCXc0RPqmvtnPyuai6PG+vFQ6IV8loY6gbiVKDEM8cFN+kMYmxhRsgXulRJRv5xwbLZRalyDjMJLu4+p8Elyz8kJB/bFpHL5VSlf7sVL6rZg5HWPv/JmYbV2zcOVg9sy6AGRv3hUavyacfjq7bDTFggiLIAqY28m8OuqbAydBr10lA== X-Gm-Message-State: AOJu0YxH7GQHKHiKkGNLB742dF+Fq16BUIiaNqFoQvNGGXbruqH3g0mg zFDPHDfL5erMrGJUBFjMOf4/RmbtDSEIUs0fJXRcpNow0TV5eJSw X-Received: by 2002:a50:cdc2:0:b0:574:ebf4:f786 with SMTP id 4fb4d7f45d1cf-57c4e3f5be7mr2329947a12.16.1717768179012; Fri, 07 Jun 2024 06:49:39 -0700 (PDT) Received: from skbuf ([188.25.55.166]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57c67432820sm89269a12.75.2024.06.07.06.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 06:49:38 -0700 (PDT) Date: Fri, 7 Jun 2024 16:49:35 +0300 From: Vladimir Oltean To: Martin Schiller Cc: martin.blumenstingl@googlemail.com, hauke@hauke-m.de, andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 09/13] net: dsa: lantiq_gswip: Forbid gswip_add_single_port_br on the CPU port Message-ID: <20240607134935.k4lrierqlfwpic7n@skbuf> References: <20240606085234.565551-1-ms@dev.tdt.de> <20240606085234.565551-10-ms@dev.tdt.de> <20240607112628.igcf6ytqe6wbmbq5@skbuf> 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=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jun 07, 2024 at 03:31:57PM +0200, Martin Schiller wrote: > On 2024-06-07 13:26, Vladimir Oltean wrote: > > On Thu, Jun 06, 2024 at 10:52:30AM +0200, Martin Schiller wrote: > > > From: Martin Blumenstingl > > > > > > Calling gswip_add_single_port_br() with the CPU port would be a bug > > > because then only the CPU port could talk to itself. Add the CPU > > > port to > > > the validation at the beginning of gswip_add_single_port_br(). > > > > > > Signed-off-by: Martin Blumenstingl > > > > > > --- > > > drivers/net/dsa/lantiq_gswip.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/dsa/lantiq_gswip.c > > > b/drivers/net/dsa/lantiq_gswip.c > > > index ee8296d5b901..d2195271ffe9 100644 > > > --- a/drivers/net/dsa/lantiq_gswip.c > > > +++ b/drivers/net/dsa/lantiq_gswip.c > > > @@ -657,7 +657,7 @@ static int gswip_add_single_port_br(struct > > > gswip_priv *priv, int port, bool add) > > > unsigned int max_ports = priv->hw_info->max_ports; > > > int err; > > > > > > - if (port >= max_ports) { > > > + if (port >= max_ports || dsa_is_cpu_port(priv->ds, port)) { > > > dev_err(priv->dev, "single port for %i supported\n", port); > > > return -EIO; > > > } > > > -- > > > 2.39.2 > > > > > > > Isn't the new check effectively dead code? > > As long as the dsa_switch_ops .port_bridge_join and .port_bridge_leave are not > executed for the cpu port, I agree with you. They aren't. The primary trigger for dsa_port_bridge_join() is dsa_user_changeupper(), along with other code paths that replay the operation in certain circumstances, again only for user ports.