From patchwork Mon Aug 30 21:48:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12466039 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 74302C432BE for ; Mon, 30 Aug 2021 21:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52A5C60ED8 for ; Mon, 30 Aug 2021 21:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238842AbhH3Vxz (ORCPT ); Mon, 30 Aug 2021 17:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237167AbhH3Vxv (ORCPT ); Mon, 30 Aug 2021 17:53:51 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBBA1C06175F for ; Mon, 30 Aug 2021 14:52:56 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id f2so28418607ljn.1 for ; Mon, 30 Aug 2021 14:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=90s4wpKUIcwIEvdTTZxL4JGPoTprkT4Ft/euRw6mn8k=; b=MHlrErK7NQ3Ky/kK8DzH2Px7FATj7UAsOrCRLH5vTGWa0V2LXb3UhFmH1dLEX+rLui Mk/RDykwIN4Ccv7AkL5GsZCcer4+Hyb3VEv+Zyiqb3awJrofWwFkehOl78NmuJEsQ4OJ gufmSopoedLkVhkY3mxB+WTt7GYKNUxSedxxJk2eX2kIreEonBBYXnb8OgJHi4QDov7n AeRfq4zhmuHdCX2N3VXqy8NDi8W9Dh2ks63DK6kCaAOt/5bBLPvDCkg1D2f3IPK+VcIf faUBZS4JppGIvKQe4BdhxXHE24idvqsogttT80Qxk0QjlAdRc1Xg7H8nVjtNGdTk6J42 4nzQ== 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=90s4wpKUIcwIEvdTTZxL4JGPoTprkT4Ft/euRw6mn8k=; b=fGcUkS2mvy85rqVJ1IR6ig/mhLMB/j4OM4dIq+HnngUycr//SQtPyH9ka9kfjjBTna ZbmJeVemUiOkN81HQ8HpO9im/6s58pL0XfmVf603Cb8FAE2bHYjJJuH4icm3xxZdWUVx Mo52iU3eJgF/6jDMabGh0Fy1UvLtOWdao0d6C55Z49LXYcOXbTTsptJ9ttx+637C1VJt 7XFHnJdibSCD9Ygdy/e8OsseqM/vUtGLprFRher6XgEm5bNP2rkd4BnMlwivqtN8v5oi fV+Z7J7YgxOH70oUFP8QsnRiWdLGRnkbMJqQV7Kr5zRTXumsCB6s4DhQAe+QIBvF3asu eABg== X-Gm-Message-State: AOAM532uldLLYgUPPhzPXlwidrhop6T80ZsrhLrgnHIdRCXWGBDE2Y5I S7kGBMO1LahJIviisEN+AvexDg== X-Google-Smtp-Source: ABdhPJzPxORbmoU7WVlv4KC9wL2YIshT3p+5xKnZ/bx7GEKfXoofQesNnV/sAgd899mewd3L4YpUbQ== X-Received: by 2002:a2e:6808:: with SMTP id c8mr22729019lja.70.1630360375088; Mon, 30 Aug 2021 14:52:55 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id h4sm1514049lft.184.2021.08.30.14.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 14:52:54 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , =?utf-8?q?Alvin_=C5=A0ipraga?= , Mauri Sandberg , DENG Qingfang Subject: [PATCH net-next 5/5 v2] net: dsa: rtl8366rb: Support fast aging Date: Mon, 30 Aug 2021 23:48:59 +0200 Message-Id: <20210830214859.403100-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210830214859.403100-1-linus.walleij@linaro.org> References: <20210830214859.403100-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This implements fast aging per-port using the special "security" register, which will flush any L2 LUTs on a port. Suggested-by: Vladimir Oltean Cc: Alvin Šipraga Cc: Mauri Sandberg Cc: DENG Qingfang Signed-off-by: Linus Walleij Reviewed-by: Alvin Šipraga --- ChangeLog v1->v2: - New patch suggested by Vladimir. --- drivers/net/dsa/rtl8366rb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 4cb0e336ce6b..548282119cc4 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1219,6 +1219,19 @@ rtl8366rb_port_bridge_flags(struct dsa_switch *ds, int port, return 0; } +static void +rtl8366rb_port_fast_age(struct dsa_switch *ds, int port) +{ + struct realtek_smi *smi = ds->priv; + + /* This will age out any L2 entries */ + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, + BIT(port), BIT(port)); + /* Restore the normal state of things */ + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, + BIT(port), 0); +} + static int rtl8366rb_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *bridge) @@ -1673,6 +1686,7 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops = { .port_disable = rtl8366rb_port_disable, .port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags, .port_bridge_flags = rtl8366rb_port_bridge_flags, + .port_fast_age = rtl8366rb_port_fast_age, .port_change_mtu = rtl8366rb_change_mtu, .port_max_mtu = rtl8366rb_max_mtu, };