|
51 | 51 | #include "core.h"
|
52 | 52 | #include "reg.h"
|
53 | 53 |
|
| 54 | +static u16 mlxsw_sp_port_vid_to_fid_get(struct mlxsw_sp_port *mlxsw_sp_port, |
| 55 | + u16 vid) |
| 56 | +{ |
| 57 | + u16 fid = vid; |
| 58 | + |
| 59 | + if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) { |
| 60 | + u16 vfid = mlxsw_sp_vport_vfid_get(mlxsw_sp_port); |
| 61 | + |
| 62 | + fid = mlxsw_sp_vfid_to_fid(vfid); |
| 63 | + } |
| 64 | + |
| 65 | + if (!fid) |
| 66 | + fid = mlxsw_sp_port->pvid; |
| 67 | + |
| 68 | + return fid; |
| 69 | +} |
| 70 | + |
54 | 71 | static struct mlxsw_sp_port *
|
55 | 72 | mlxsw_sp_port_orig_get(struct net_device *dev,
|
56 | 73 | struct mlxsw_sp_port *mlxsw_sp_port)
|
@@ -641,22 +658,16 @@ mlxsw_sp_port_fdb_static_add(struct mlxsw_sp_port *mlxsw_sp_port,
|
641 | 658 | const struct switchdev_obj_port_fdb *fdb,
|
642 | 659 | struct switchdev_trans *trans)
|
643 | 660 | {
|
644 |
| - u16 fid = fdb->vid; |
| 661 | + u16 fid = mlxsw_sp_port_vid_to_fid_get(mlxsw_sp_port, fdb->vid); |
645 | 662 | u16 lag_vid = 0;
|
646 | 663 |
|
647 | 664 | if (switchdev_trans_ph_prepare(trans))
|
648 | 665 | return 0;
|
649 | 666 |
|
650 | 667 | if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) {
|
651 |
| - u16 vfid = mlxsw_sp_vport_vfid_get(mlxsw_sp_port); |
652 |
| - |
653 |
| - fid = mlxsw_sp_vfid_to_fid(vfid); |
654 | 668 | lag_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
|
655 | 669 | }
|
656 | 670 |
|
657 |
| - if (!fid) |
658 |
| - fid = mlxsw_sp_port->pvid; |
659 |
| - |
660 | 671 | if (!mlxsw_sp_port->lagged)
|
661 | 672 | return mlxsw_sp_port_fdb_uc_op(mlxsw_sp_port->mlxsw_sp,
|
662 | 673 | mlxsw_sp_port->local_port,
|
@@ -787,13 +798,10 @@ static int
|
787 | 798 | mlxsw_sp_port_fdb_static_del(struct mlxsw_sp_port *mlxsw_sp_port,
|
788 | 799 | const struct switchdev_obj_port_fdb *fdb)
|
789 | 800 | {
|
790 |
| - u16 fid = fdb->vid; |
| 801 | + u16 fid = mlxsw_sp_port_vid_to_fid_get(mlxsw_sp_port, fdb->vid); |
791 | 802 | u16 lag_vid = 0;
|
792 | 803 |
|
793 | 804 | if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) {
|
794 |
| - u16 vfid = mlxsw_sp_vport_vfid_get(mlxsw_sp_port); |
795 |
| - |
796 |
| - fid = mlxsw_sp_vfid_to_fid(vfid); |
797 | 805 | lag_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
|
798 | 806 | }
|
799 | 807 |
|
|
0 commit comments