summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dege <michael.dege@renesas.com>2025-09-01 06:58:08 +0200
committerPaolo Abeni <pabeni@redhat.com>2025-09-04 09:43:23 +0200
commit92e913a3df3c4567309bd98d7a3f2fcd5b0d0191 (patch)
treea43ab063a32dfc6d8e1192880327c63dd4488408
parentb7502b1043de86967ff341819d05e09a8dbe8b2b (diff)
net: renesas: rswitch: add modifiable ageing time
Allow the setting of the MAC table aging in the R-Car S4 Rswitch using the SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute. Signed-off-by: Michael Dege <michael.dege@renesas.com> Link: https://patch.msgid.link/20250901-add_l2_switching-v5-4-5f13e46860d5@renesas.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--drivers/net/ethernet/renesas/rswitch_l2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/ethernet/renesas/rswitch_l2.c b/drivers/net/ethernet/renesas/rswitch_l2.c
index 49a24464dbb0..4a69ec77d69c 100644
--- a/drivers/net/ethernet/renesas/rswitch_l2.c
+++ b/drivers/net/ethernet/renesas/rswitch_l2.c
@@ -193,6 +193,24 @@ static int rswitch_netdevice_event(struct notifier_block *nb,
return NOTIFY_OK;
}
+static int rswitch_update_ageing_time(struct net_device *ndev, clock_t time)
+{
+ struct rswitch_device *rdev = netdev_priv(ndev);
+ u32 reg_val;
+
+ if (!is_rdev(ndev))
+ return -ENODEV;
+
+ if (!FIELD_FIT(FWMACAGC_MACAGT, time))
+ return -EINVAL;
+
+ reg_val = FIELD_PREP(FWMACAGC_MACAGT, time);
+ reg_val |= FWMACAGC_MACAGE | FWMACAGC_MACAGSL;
+ iowrite32(reg_val, rdev->priv->addr + FWMACAGC);
+
+ return 0;
+}
+
static int rswitch_port_attr_set(struct net_device *ndev, const void *ctx,
const struct switchdev_attr *attr,
struct netlink_ext_ack *extack)
@@ -200,6 +218,8 @@ static int rswitch_port_attr_set(struct net_device *ndev, const void *ctx,
switch (attr->id) {
case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
return rswitch_port_update_stp_state(ndev, attr->u.stp_state);
+ case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
+ return rswitch_update_ageing_time(ndev, attr->u.ageing_time);
default:
return -EOPNOTSUPP;
}