Skip to content

Commit b48aa94

Browse files
mdegeNipaLocal
authored andcommitted
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 <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent c4c0c38 commit b48aa94

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/ethernet/renesas/rswitch_l2.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,33 @@ static int rswitch_netdevice_event(struct notifier_block *nb,
193193
return NOTIFY_OK;
194194
}
195195

196+
static int rswitch_update_ageing_time(struct net_device *ndev, clock_t time)
197+
{
198+
struct rswitch_device *rdev = netdev_priv(ndev);
199+
u32 reg_val;
200+
201+
if (!is_rdev(ndev))
202+
return -ENODEV;
203+
204+
if (!FIELD_FIT(FWMACAGC_MACAGT, time))
205+
return -EINVAL;
206+
207+
reg_val = FIELD_PREP(FWMACAGC_MACAGT, time);
208+
reg_val |= FWMACAGC_MACAGE | FWMACAGC_MACAGSL;
209+
iowrite32(reg_val, rdev->priv->addr + FWMACAGC);
210+
211+
return 0;
212+
}
213+
196214
static int rswitch_port_attr_set(struct net_device *ndev, const void *ctx,
197215
const struct switchdev_attr *attr,
198216
struct netlink_ext_ack *extack)
199217
{
200218
switch (attr->id) {
201219
case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
202220
return rswitch_port_update_stp_state(ndev, attr->u.stp_state);
221+
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
222+
return rswitch_update_ageing_time(ndev, attr->u.ageing_time);
203223
default:
204224
return -EOPNOTSUPP;
205225
}

0 commit comments

Comments
 (0)