diff options
author | Jakub Kicinski <kuba@kernel.org> | 2022-11-02 20:45:26 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-02 20:45:27 -0700 |
commit | d3a4706339da26633316357efe7ab9a92ff29b2a (patch) | |
tree | 731e7ee19282d22c208f33890c53e40a99dbad73 | |
parent | 3319dbb3e755398f254c3daa04b9030197137efe (diff) | |
parent | 386b4174827ce0c7ecc789a6c8bf98e994dc2dee (diff) | |
download | linux-d3a4706339da26633316357efe7ab9a92ff29b2a.tar.bz2 |
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/20221025100024.1287157-1-idosch@nvidia.com/
====================
Link: https://lore.kernel.org/r/20221101123936.1900453-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | drivers/net/ethernet/rocker/rocker_ofdpa.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c index 58cf7cc54f40..826990459fa4 100644 --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -1821,19 +1821,17 @@ static void ofdpa_port_fdb_learn_work(struct work_struct *work) const struct ofdpa_fdb_learn_work *lw = container_of(work, struct ofdpa_fdb_learn_work, work); bool removing = (lw->flags & OFDPA_OP_FLAG_REMOVE); - bool learned = (lw->flags & OFDPA_OP_FLAG_LEARNED); struct switchdev_notifier_fdb_info info = {}; + enum switchdev_notifier_type event; info.addr = lw->addr; info.vid = lw->vid; + info.offloaded = !removing; + event = removing ? SWITCHDEV_FDB_DEL_TO_BRIDGE : + SWITCHDEV_FDB_ADD_TO_BRIDGE; rtnl_lock(); - if (learned && removing) - call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_BRIDGE, - lw->ofdpa_port->dev, &info.info, NULL); - else if (learned && !removing) - call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE, - lw->ofdpa_port->dev, &info.info, NULL); + call_switchdev_notifiers(event, lw->ofdpa_port->dev, &info.info, NULL); rtnl_unlock(); kfree(work); @@ -1865,6 +1863,9 @@ static int ofdpa_port_fdb_learn(struct ofdpa_port *ofdpa_port, if (!ofdpa_port_is_bridged(ofdpa_port)) return 0; + if (!(flags & OFDPA_OP_FLAG_LEARNED)) + return 0; + lw = kzalloc(sizeof(*lw), GFP_ATOMIC); if (!lw) return -ENOMEM; |