File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
drivers/net/dsa/mv88e6xxx Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -4253,6 +4253,8 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
4253
4253
4254
4254
ds -> priv = chip ;
4255
4255
ds -> ops = & mv88e6xxx_switch_ops ;
4256
+ ds -> ageing_time_min = chip -> info -> age_time_coeff ;
4257
+ ds -> ageing_time_max = chip -> info -> age_time_coeff * U8_MAX ;
4256
4258
4257
4259
dev_set_drvdata (dev , ds );
4258
4260
Original file line number Diff line number Diff line change @@ -233,6 +233,10 @@ struct dsa_switch {
233
233
u32 phys_mii_mask ;
234
234
struct mii_bus * slave_mii_bus ;
235
235
236
+ /* Ageing Time limits in msecs */
237
+ unsigned int ageing_time_min ;
238
+ unsigned int ageing_time_max ;
239
+
236
240
/* Dynamically allocated ports, keep last */
237
241
size_t num_ports ;
238
242
struct dsa_port ports [];
Original file line number Diff line number Diff line change @@ -419,8 +419,8 @@ static int dsa_slave_vlan_filtering(struct net_device *dev,
419
419
return 0 ;
420
420
}
421
421
422
- static int dsa_fastest_ageing_time (struct dsa_switch * ds ,
423
- unsigned int ageing_time )
422
+ static unsigned int dsa_fastest_ageing_time (struct dsa_switch * ds ,
423
+ unsigned int ageing_time )
424
424
{
425
425
int i ;
426
426
@@ -443,9 +443,13 @@ static int dsa_slave_ageing_time(struct net_device *dev,
443
443
unsigned long ageing_jiffies = clock_t_to_jiffies (attr -> u .ageing_time );
444
444
unsigned int ageing_time = jiffies_to_msecs (ageing_jiffies );
445
445
446
- /* bridge skips -EOPNOTSUPP, so skip the prepare phase */
447
- if (switchdev_trans_ph_prepare (trans ))
446
+ if (switchdev_trans_ph_prepare (trans )) {
447
+ if (ds -> ageing_time_min && ageing_time < ds -> ageing_time_min )
448
+ return - ERANGE ;
449
+ if (ds -> ageing_time_max && ageing_time > ds -> ageing_time_max )
450
+ return - ERANGE ;
448
451
return 0 ;
452
+ }
449
453
450
454
/* Keep the fastest ageing time in case of multiple bridges */
451
455
p -> dp -> ageing_time = ageing_time ;
You can’t perform that action at this time.
0 commit comments