From patchwork Sun Jul 30 07:41:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 128227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1508698vqg; Sun, 30 Jul 2023 06:45:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlGmUCWAas5THCvbvMIR1t/JRaQQDW9/sSm3eY+cDBB4OnDO8ZoFG0GqC1NFBhx1JIbhxHZn X-Received: by 2002:a05:6a00:2d23:b0:67f:d4e2:3dd7 with SMTP id fa35-20020a056a002d2300b0067fd4e23dd7mr8388166pfb.21.1690724754502; Sun, 30 Jul 2023 06:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690724754; cv=none; d=google.com; s=arc-20160816; b=I0aQ016S0G7PV+i2iWIWZesLCaBwjEvQpAsSYuB6RyuKcvPoPD97sFdaf1/haJFoS/ 0D7bZVqLJK+tY77A+Zl9HYwq6pM4RIi8Jjsn+yJh3kiC8w0Z+8WtFq5UmlVxXmcy00wM PQD1z99NLPIUURNLfDkclUCGkx/YtDdcz0YZ6KWmFj8aPrDZu6mOwM+8l3k7gkPCdLXt AwQJYP4d4+S6gbdbSnwo/ioOHNSDiNi/yK3PuC3ZKZOLqBfdo1C7UHhcBuYrqPgz9RJZ Bh10PHDUmxTCcz7KH5ZlFg8/wXzetqXx4Ee8wEGuEGl160ozoSU+sZLUL3fCHR21lEil +5+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f0o7VzxAYYYRY+ih+jmVhcGfTwDx92myBTFzgRxJi4g=; fh=4Kg3l5zis6WIABGLRaUIw3JMQczAglYDh1n+zAW+gtc=; b=OAbVg+fWED6GSqcKQ9FpDaynjLTGBwfswcX5JiZ/KRLKfrdDKU6FsxsWppAYTS806+ mK82m9tLiFbJOPILs8rr9tRDYevGhOwkZ5I1E9j9gXaFyBsyndvnre4R2Hps7yJYEyPt 5VbSb2y0BqdqNzVJKSp9O2LIf3Cm0o4c9M+rHEMiNUIptyY/CvqHX1i+70v96Dvzpx/Y OwljtHnalZgftrBhLLx0DdRJfNlTYRFbJaBDt+Cd4Z8aUGV/XxmMQwOOq4mwfDAkznSj 68b9HfYIi1e/rD2o9khD0GxTXAbaXU/acoxBox6Oc0LE4d2J0bdgaTqv0dPj/WnotB3/ aCsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=eDCyRE4P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br7-20020a056a00440700b006872a5420ecsi1404393pfb.81.2023.07.30.06.45.40; Sun, 30 Jul 2023 06:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=eDCyRE4P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjG3JkD (ORCPT + 99 others); Sun, 30 Jul 2023 05:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjG3Jj5 (ORCPT ); Sun, 30 Jul 2023 05:39:57 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F27E1BDA; Sun, 30 Jul 2023 02:39:56 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-317715ec496so3845921f8f.3; Sun, 30 Jul 2023 02:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690709994; x=1691314794; 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=f0o7VzxAYYYRY+ih+jmVhcGfTwDx92myBTFzgRxJi4g=; b=eDCyRE4PUu0oXJ4JpVM96uLRV/9x/dZihtzq8iNCND0fPYQ7XiGgVSsUwPvayG7ORH M9gHKOw62H/RVqC3WhXKNb3CP1ErlLFJc9vgv7s0WiKz1VQlN0B738hwQT3MW2idV4h/ tHXHDmT2dCpQu8WFQV9M4nw3jaUxHAfMs8ViaCwwxvI0TNu8eDuyfwGYL34dJiir7wDF xRsZ9fzVsqk3DSRuVVFoxzwwDYzMlkjNKAR3Z1ZZ2oEQm38tAnlApt/9mJNnQfgtHs/I MWXSVoIcF/rzOex8A1LpqamC2yzD0ajLWR02k49C7BX3aD2FbadZztHWYy5wV5G0zROl ZmTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690709994; x=1691314794; 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=f0o7VzxAYYYRY+ih+jmVhcGfTwDx92myBTFzgRxJi4g=; b=ZrwwsKLtYoVddDuN7Crq2oHUCbkWuGKXlrShJ5rKTzzZ09KFCONXP1j90+Z1zmKeMy uPT2MdcfNEvm0xKZH6k5oIrpzMwUV49NL5vu/06lYxP05svKSn3WO7cpgP0hnepVQCR8 AawBuqlb2URHp1OaJI6EMQqm5cKbCv69L1LwFaNy+l/I01CzqQI9P5aDDdOYfc7nWp+g XTmJ1QI7cs3erEvJl1ahzbOP89VVXmUFyjDQ+Lx0IppmzbH/CkH7YPqRQz3ImXFOgj5m X14xV1JMu9ZbWq78dINEcAXvo83J6kpuqiSBD4pPz8NSxYbX10Uv31DGLwHmLHB64C0E EtcA== X-Gm-Message-State: ABy/qLbIdzFqqUPdbyYC5IgXrKCzbl0qUArpXHrG17ACcU9O5Q4KWYA4 Bxs4HxP+nglX94kSY5ZEuY4= X-Received: by 2002:a5d:4746:0:b0:314:2e77:afec with SMTP id o6-20020a5d4746000000b003142e77afecmr6107859wrs.57.1690709994376; Sun, 30 Jul 2023 02:39:54 -0700 (PDT) Received: from localhost.localdomain (host-87-11-86-47.retail.telecomitalia.it. [87.11.86.47]) by smtp.googlemail.com with ESMTPSA id h16-20020adffa90000000b0031423a8f4f7sm9574599wrr.56.2023.07.30.02.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jul 2023 02:39:54 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Marangi , Yang Yingliang , "Russell King (Oracle)" , Atin Bainada , Michal Kubiak , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Simon Horman , Florian Fainelli Subject: [net-next PATCH v3 3/5] net: dsa: qca8k: limit user ports access to the first CPU port on setup Date: Sun, 30 Jul 2023 09:41:11 +0200 Message-Id: <20230730074113.21889-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230730074113.21889-1-ansuelsmth@gmail.com> References: <20230730074113.21889-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772853400264601341 X-GMAIL-MSGID: 1772853400264601341 In preparation for multi-CPU support, set CPU port LOOKUP MEMBER outside the port loop and setup the LOOKUP MEMBER mask for user ports only to the first CPU port. This is to handle flooding condition where every CPU port is set as target and prevent packet duplication for unknown frames from user ports. Secondary CPU port LOOKUP MEMBER mask will be setup later when port_change_master will be implemented. Signed-off-by: Christian Marangi Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli Reviewed-by: Vladimir Oltean --- changes v2: - Add review tag drivers/net/dsa/qca/qca8k-8xxx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 31552853fdd4..6286a64a2fe3 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -1850,18 +1850,16 @@ qca8k_setup(struct dsa_switch *ds) if (ret) return ret; + /* CPU port gets connected to all user ports of the switch */ + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port), + QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); + if (ret) + return ret; + /* Setup connection between CPU port & user ports * Configure specific switch configuration for ports */ for (i = 0; i < QCA8K_NUM_PORTS; i++) { - /* CPU port gets connected to all user ports of the switch */ - if (dsa_is_cpu_port(ds, i)) { - ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), - QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); - if (ret) - return ret; - } - /* Individual user ports get connected to CPU port only */ if (dsa_is_user_port(ds, i)) { ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),