1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Hans J. Schultz <netdev@kapio-technology.com>
10 #include <net/switchdev.h>
13 #include "switchdev.h"
15 struct mv88e6xxx_fid_search_ctx
{
20 static int __mv88e6xxx_find_vid(struct mv88e6xxx_chip
*chip
,
21 const struct mv88e6xxx_vtu_entry
*entry
,
24 struct mv88e6xxx_fid_search_ctx
*ctx
= priv
;
26 if (ctx
->fid_search
== entry
->fid
) {
27 ctx
->vid_found
= entry
->vid
;
34 static int mv88e6xxx_find_vid(struct mv88e6xxx_chip
*chip
, u16 fid
, u16
*vid
)
36 struct mv88e6xxx_fid_search_ctx ctx
;
40 mv88e6xxx_reg_lock(chip
);
41 err
= mv88e6xxx_vtu_walk(chip
, __mv88e6xxx_find_vid
, &ctx
);
42 mv88e6xxx_reg_unlock(chip
);
53 int mv88e6xxx_handle_miss_violation(struct mv88e6xxx_chip
*chip
, int port
,
54 struct mv88e6xxx_atu_entry
*entry
, u16 fid
)
56 struct switchdev_notifier_fdb_info info
= {
60 struct net_device
*brport
;
65 err
= mv88e6xxx_find_vid(chip
, fid
, &vid
);
70 dp
= dsa_to_port(chip
->ds
, port
);
73 brport
= dsa_port_to_bridge_port(dp
);
78 err
= call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE
,
79 brport
, &info
.info
, NULL
);