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: 504343 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2191589jai; Mon, 30 Aug 2021 14:53:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvyjfehZuyyQARc1eg2ORfVYxJFVSYm2w3vheFWOFjaC7VhbadetdNOEc0x12UqF4cdrni X-Received: by 2002:a92:c80e:: with SMTP id v14mr18904524iln.57.1630360382512; Mon, 30 Aug 2021 14:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630360382; cv=none; d=google.com; s=arc-20160816; b=gCyYXVml8ZNWmitB4wbYFpaKmhCDMbbUGmjzPD+Y9Ju4CXB31OCC75PX5Yz9kADPR8 v48kG3mvUGibwi0ThFYPkp8FO8GY+ODmPMiomI7zBqrs/fAQE0Dqf0DjB3q9yXfZ6KQT T2nbjMRmX1PIAzDw5NMsyF7eaGYnMStSErYz6mS/rrXjunzvFiRzMqJZB391nKgeOsOe FINNMJ3rLPGSscg1hiF0ktTNbo0efBNShL0Cz92ZEbmxDo/9EjxeYSMQBLoul374RnNg DDOZACCGztz38hVl6hJhYElPSsIdSXGI5tOwp8vFZDPpZGccw7tpge92XeHvECAxlXmj T5kg== 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=90s4wpKUIcwIEvdTTZxL4JGPoTprkT4Ft/euRw6mn8k=; b=LTLIDcW8JTjdTAe7U2UiUknHHFYVrV+vetofUgfDRhRhyIo9pF/OIL+I7HmXrskZsF +2Yt8bogBaCSQTikdf0TdxqbSLTjy7FHizijBV1J8B3PD/vRwfN9M1TUSgjAC7Q/fMX2 unvDTC4c+vqgAvos1hynnnYrJKumJw8IfYqTHBmnZYJ6ukZ5F6oaPJFw2J1B40hPz3I0 Ue34l58NPq6GWfNynQekavVymQCfpdh7KxQzFfFZUkVSSpjC4fxNtTvOWI8xu8FdAC4D FwwFpI4LMjBuuGB4TkZackePmIwC/Mv8qJBDdLUtVREiqZHirSatBxbBotPCPupyS5IP /9YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHlrErK7; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si15195253ioe.21.2021.08.30.14.53.02; Mon, 30 Aug 2021 14:53:02 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MHlrErK7; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238842AbhH3Vxz (ORCPT + 8 others); 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-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 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 --- ChangeLog v1->v2: - New patch suggested by Vladimir. --- drivers/net/dsa/rtl8366rb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.31.1 Reviewed-by: Alvin Šipraga 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, };