Skip to content

Commit d3a4706

Browse files
committed
Merge branch 'rocker-two-small-changes'
Ido Schimmel says: ==================== rocker: Two small changes Patch #1 avoids allocating and scheduling a work item when it is not doing any work. Patch #2 aligns rocker with other switchdev drivers to explicitly mark FDB entries as offloaded. Needed for upcoming MAB offload [1]. [1] https://lore.kernel.org/netdev/[email protected]/ ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 3319dbb + 386b417 commit d3a4706

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/net/ethernet/rocker/rocker_ofdpa.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,19 +1821,17 @@ static void ofdpa_port_fdb_learn_work(struct work_struct *work)
18211821
const struct ofdpa_fdb_learn_work *lw =
18221822
container_of(work, struct ofdpa_fdb_learn_work, work);
18231823
bool removing = (lw->flags & OFDPA_OP_FLAG_REMOVE);
1824-
bool learned = (lw->flags & OFDPA_OP_FLAG_LEARNED);
18251824
struct switchdev_notifier_fdb_info info = {};
1825+
enum switchdev_notifier_type event;
18261826

18271827
info.addr = lw->addr;
18281828
info.vid = lw->vid;
1829+
info.offloaded = !removing;
1830+
event = removing ? SWITCHDEV_FDB_DEL_TO_BRIDGE :
1831+
SWITCHDEV_FDB_ADD_TO_BRIDGE;
18291832

18301833
rtnl_lock();
1831-
if (learned && removing)
1832-
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE,
1833-
lw->ofdpa_port->dev, &info.info, NULL);
1834-
else if (learned && !removing)
1835-
call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
1836-
lw->ofdpa_port->dev, &info.info, NULL);
1834+
call_switchdev_notifiers(event, lw->ofdpa_port->dev, &info.info, NULL);
18371835
rtnl_unlock();
18381836

18391837
kfree(work);
@@ -1865,6 +1863,9 @@ static int ofdpa_port_fdb_learn(struct ofdpa_port *ofdpa_port,
18651863
if (!ofdpa_port_is_bridged(ofdpa_port))
18661864
return 0;
18671865

1866+
if (!(flags & OFDPA_OP_FLAG_LEARNED))
1867+
return 0;
1868+
18681869
lw = kzalloc(sizeof(*lw), GFP_ATOMIC);
18691870
if (!lw)
18701871
return -ENOMEM;

0 commit comments

Comments
 (0)