From nobody Tue Oct 7 19:25:31 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1ECB22B8D0; Tue, 8 Jul 2025 09:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751966883; cv=none; b=Z0evZUMv5GwWibP2xlHZWm7kKAaA0jLTPFSy0xnhnLL3IKmO45920B8zwFINOlE/DMXDQhkOOOBaVg9YNaXDgS/6GXE+yx8CQ6Pp3XKSTJFK0fsT1acpF9mlVnnMZY/aCA9JsT4mEcQIXjjLqimXo5rOhKfy21Z+dOGBcHT5/cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751966883; c=relaxed/simple; bh=KVrzRmQGG2cdaeFhNKeIxvEvNE+9YXP1pbh5qNJxgq8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kpxQXikfcQelqT81F661StTWWqXPdhTfiPeQo7zYH9BDxxgkOo8ayZxUU4d8eAlt2CmNF1SxclbqJ2uInMHRlGYex3AM+ZFlO73xLVRq6+yZi64Wl+oQwP5uB2s628XctCiDWaW3F+e6J6OYWO60FWUIEUjzTEgickLQ3J5+Szk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: il9EKbu7SK2cU6f8KfR/wQ== X-CSE-MsgGUID: Lben6mkeQcS2kDFHnXzE3Q== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 08 Jul 2025 18:27:57 +0900 Received: from [127.0.1.1] (unknown [10.226.78.19]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 5630B400A8B4; Tue, 8 Jul 2025 18:27:54 +0900 (JST) From: Michael Dege Date: Tue, 08 Jul 2025 11:27:38 +0200 Subject: [PATCH v2 2/4] net: renesas: rswitch: configure default ageing time 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250708-add_l2_switching-v2-2-f91f5556617a@renesas.com> References: <20250708-add_l2_switching-v2-0-f91f5556617a@renesas.com> In-Reply-To: <20250708-add_l2_switching-v2-0-f91f5556617a@renesas.com> To: Yoshihiro Shimoda , =?utf-8?q?Niklas_S=C3=B6derlund?= , Paul Barker , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Nikita Yushchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751966866; l=2858; i=michael.dege@renesas.com; s=20250523; h=from:subject:message-id; bh=KVrzRmQGG2cdaeFhNKeIxvEvNE+9YXP1pbh5qNJxgq8=; b=TVnx45njwCp5BH422RmcAWnWYLfBWfhSbieDx2qYNcrjlsh8qsDkLLtd6co8er8O9ZfNhgnQU 0IBwPdg3H8lCbYhmqbCKrqcjihxRJfmovVNoPK2t8AmcQzhYmZNmn8V X-Developer-Key: i=michael.dege@renesas.com; a=ed25519; pk=+gYTlVQ3/MlOju88OuKnXA7MlapP4lYqJn1F81HZGSo= Enable MAC ageing by setting up the timer and setting the ageging time to the default of 300s. Signed-off-by: Michael Dege --- drivers/net/ethernet/renesas/rswitch.h | 13 ++++++++++++- drivers/net/ethernet/renesas/rswitch_main.c | 11 ++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/= renesas/rswitch.h index 532192cbca4b520e06a7e35653929d8364f1ccb2..feb62b99bceb50e1d68345ff9eb= a581f7c38edbe 100644 --- a/drivers/net/ethernet/renesas/rswitch.h +++ b/drivers/net/ethernet/renesas/rswitch.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Renesas Ethernet Switch device driver * - * Copyright (C) 2022 Renesas Electronics Corporation + * Copyright (C) 2022-2025 Renesas Electronics Corporation */ =20 #ifndef __RSWITCH_H__ @@ -826,6 +826,17 @@ enum rswitch_gwca_mode { =20 #define FWPBFCSDC(j, i) (FWPBFCSDC00 + (i) * 0x10 + (j) * 0x04) =20 +#define FWMACAGUSPC_MACAGUSP GENMASK(9, 0) +#define FWMACAGC_MACAGT GENMASK(15, 0) +#define FWMACAGC_MACAGE BIT(16) +#define FWMACAGC_MACAGSL BIT(17) +#define FWMACAGC_MACAGPM BIT(18) +#define FWMACAGC_MACDES BIT(24) +#define FWMACAGC_MACAGOG BIT(28) +#define FWMACAGC_MACDESOG BIT(29) + +#define RSW_AGEING_TIME 300 + /* TOP */ #define TPEMIMC7(queue) (TPEMIMC70 + (queue) * 4) =20 diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethe= rnet/renesas/rswitch_main.c index aba772e14555d30891dc74a5a123121dad77e92b..2474271cac7f057fffb472131f5= a7a72a0fa9a87 100644 --- a/drivers/net/ethernet/renesas/rswitch_main.c +++ b/drivers/net/ethernet/renesas/rswitch_main.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Renesas Ethernet Switch device driver * - * Copyright (C) 2022 Renesas Electronics Corporation + * Copyright (C) 2022-2025 Renesas Electronics Corporation */ =20 #include @@ -113,6 +113,7 @@ static void rswitch_fwd_init(struct rswitch_private *pr= iv) { u32 all_ports_mask =3D GENMASK(RSWITCH_NUM_AGENTS - 1, 0); unsigned int i; + u32 reg_val; =20 /* Start with empty configuration */ for (i =3D 0; i < RSWITCH_NUM_AGENTS; i++) { @@ -128,6 +129,14 @@ static void rswitch_fwd_init(struct rswitch_private *p= riv) iowrite32(0, priv->addr + FWPBFC(i)); } =20 + /* Configure MAC table aging */ + rswitch_modify(priv->addr, FWMACAGUSPC, FWMACAGUSPC_MACAGUSP, + FIELD_PREP(FWMACAGUSPC_MACAGUSP, 0x140)); + + reg_val =3D FIELD_PREP(FWMACAGC_MACAGT, RSW_AGEING_TIME); + reg_val |=3D FWMACAGC_MACAGE | FWMACAGC_MACAGSL; + iowrite32(reg_val, priv->addr + FWMACAGC); + /* For enabled ETHA ports, setup port based forwarding */ rswitch_for_each_enabled_port(priv, i) { /* Port based forwarding from port i to GWCA port */ --=20 2.49.0