From patchwork Mon May 24 13:14:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12276209 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE93C2B9F7 for ; Mon, 24 May 2021 13:15:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF40C613B6 for ; Mon, 24 May 2021 13:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232918AbhEXNQf (ORCPT ); Mon, 24 May 2021 09:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232785AbhEXNQT (ORCPT ); Mon, 24 May 2021 09:16:19 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327DEC061756 for ; Mon, 24 May 2021 06:14:50 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id a25so31890266edr.12 for ; Mon, 24 May 2021 06:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MUTbtxOtQ/6z77dwQCG2+h1G+nVZENByOptkDcJd1rA=; b=lYrCWXbWHF4cW9LtgpxJx9cI0SsrYtXIHdou6AXnliJPzBM83yTRcSuKS5mHIOFxFV 1Z6RxFdGG5aUaEJ61lDgSnurzVTUWnuYu9oRFmBvyS6L4+i/PLiZWOrgrzw5YVpHtlAZ jcoO7YRHvZm5LVqqcVq0PQt2FLzWGZl5DQ0WqS0QAtlnkvqzl2eA0P5emxqnJ1RXqM+/ pXv5eCxjTHS6WBro7nh2fG/zmSN3kuae+jsGUD/dPPez65X2lcewp4gIRj2afIz63hF3 fpxvEcmkr+eci8kxy8pQK91PMJDfdkmgr0vwfm89/8HFSzT7eoEqwgzj8Zf+MzjFZU/c c4dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MUTbtxOtQ/6z77dwQCG2+h1G+nVZENByOptkDcJd1rA=; b=C8NwHrqJjMKrhBqpMNVBeYpp//FPCMYOV4VeyGJarZ2xKeakw4A2+zZZECh87UtWVr l0ijelTtmWq6yuK6gzZGuM9W15zkyLC+6GOlVP+QOUtBeGlh5TS1s/5+FOa81e9VvTpz oFBDd7Rz7aRRlj9bspKgrL+el6wbFP0ApuZZhzzJNkQHhkrzcQNh4TSyi1rDV6X788sb KsLbZbMWbrlim8ekWN0+Ffsxs8hvUYb2jXBRSwAM4SD5wrizdQ9KPVw4b1Z+Dv6ondVG c9oL2/fD9rISXlLXfWmYDCfAZva6LGOvRk5CXde34jSJZ0m/kmUPzKLF7A6TMZFtQrUK ROHQ== X-Gm-Message-State: AOAM532D9aTnSzUDNTodUJVWn6uB7+opqxbsEMW6gg1D2T2qqJdi4ZKt pCWcCvIyiXok+7dL1ZlNgoU= X-Google-Smtp-Source: ABdhPJxuV2ChrHg24j2XlmSj2/tZPTIatVYHFyGpuQnUmUHDPI+Whui4/0NY+OPz87orLLtwkP752Q== X-Received: by 2002:aa7:d550:: with SMTP id u16mr23821211edr.72.1621862088862; Mon, 24 May 2021 06:14:48 -0700 (PDT) Received: from localhost.localdomain ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id g13sm8009139ejz.24.2021.05.24.06.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 06:14:48 -0700 (PDT) From: Vladimir Oltean To: Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org Cc: Andrew Lunn , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next 8/9] net: dsa: sja1105: configure the multicast policers, if present Date: Mon, 24 May 2021 16:14:20 +0300 Message-Id: <20210524131421.1030789-9-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210524131421.1030789-1-olteanv@gmail.com> References: <20210524131421.1030789-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vladimir Oltean The SJA1110 policer array is similar in layout with SJA1105, except it contains one multicast policer per port at the end. Detect the presence of multicast policers based on the maximum number of supported L2 Policing Table entries, and make those policers have a shared index equal to the port's default policer. Letting the user configure these policers is not supported at the moment. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 937cbdb89686..6850f03be1f3 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -719,12 +719,16 @@ static int sja1105_init_l2_policing(struct sja1105_private *priv) /* Setup shared indices for the matchall policers */ for (port = 0; port < ds->num_ports; port++) { + int mcast = (ds->num_ports * (SJA1105_NUM_TC + 1)) + port; int bcast = (ds->num_ports * SJA1105_NUM_TC) + port; for (tc = 0; tc < SJA1105_NUM_TC; tc++) policing[port * SJA1105_NUM_TC + tc].sharindx = port; policing[bcast].sharindx = port; + /* Only SJA1110 has multicast policers */ + if (mcast <= table->ops->max_entry_count) + policing[mcast].sharindx = port; } /* Setup the matchall policer parameters */