@@ -1395,6 +1395,9 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work)
13951395 switch (switchdev_work -> event ) {
13961396 case SWITCHDEV_FDB_ADD_TO_DEVICE :
13971397 fdb_info = & switchdev_work -> fdb_info ;
1398+ if (!fdb_info -> added_by_user )
1399+ break ;
1400+
13981401 err = dsa_port_fdb_add (dp , fdb_info -> addr , fdb_info -> vid );
13991402 if (err ) {
14001403 netdev_dbg (dev , "fdb add failed err=%d\n" , err );
@@ -1406,6 +1409,9 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work)
14061409
14071410 case SWITCHDEV_FDB_DEL_TO_DEVICE :
14081411 fdb_info = & switchdev_work -> fdb_info ;
1412+ if (!fdb_info -> added_by_user )
1413+ break ;
1414+
14091415 err = dsa_port_fdb_del (dp , fdb_info -> addr , fdb_info -> vid );
14101416 if (err ) {
14111417 netdev_dbg (dev , "fdb del failed err=%d\n" , err );
@@ -1441,7 +1447,6 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
14411447 unsigned long event , void * ptr )
14421448{
14431449 struct net_device * dev = switchdev_notifier_info_to_dev (ptr );
1444- struct switchdev_notifier_fdb_info * fdb_info = ptr ;
14451450 struct dsa_switchdev_event_work * switchdev_work ;
14461451
14471452 if (!dsa_slave_dev_check (dev ))
@@ -1459,10 +1464,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
14591464 switch (event ) {
14601465 case SWITCHDEV_FDB_ADD_TO_DEVICE : /* fall through */
14611466 case SWITCHDEV_FDB_DEL_TO_DEVICE :
1462- if (!fdb_info -> added_by_user )
1463- break ;
1464- if (dsa_slave_switchdev_fdb_work_init (switchdev_work ,
1465- fdb_info ))
1467+ if (dsa_slave_switchdev_fdb_work_init (switchdev_work , ptr ))
14661468 goto err_fdb_work_init ;
14671469 dev_hold (dev );
14681470 break ;
0 commit comments