From: Tobias Waldekranz <tobias@waldekranz.com> To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com, netdev@vger.kernel.org Subject: [RFC net-next 1/7] net: bridge: switchdev: Refactor br_switchdev_fdb_notify Date: Sat, 16 Jan 2021 02:25:09 +0100 [thread overview] Message-ID: <20210116012515.3152-2-tobias@waldekranz.com> (raw) In-Reply-To: <20210116012515.3152-1-tobias@waldekranz.com> Instead of having to add more and more arguments to br_switchdev_fdb_call_notifiers, get rid of it and build the info struct directly in br_switchdev_fdb_notify. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> --- net/bridge/br_switchdev.c | 41 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index a9c23ef83443..ff470add8e52 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -102,46 +102,27 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, return 0; } -static void -br_switchdev_fdb_call_notifiers(bool adding, const unsigned char *mac, - u16 vid, struct net_device *dev, - bool added_by_user, bool offloaded) -{ - struct switchdev_notifier_fdb_info info; - unsigned long notifier_type; - - info.addr = mac; - info.vid = vid; - info.added_by_user = added_by_user; - info.offloaded = offloaded; - notifier_type = adding ? SWITCHDEV_FDB_ADD_TO_DEVICE : SWITCHDEV_FDB_DEL_TO_DEVICE; - call_switchdev_notifiers(notifier_type, dev, &info.info, NULL); -} - void br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) { + struct switchdev_notifier_fdb_info info = { + .addr = fdb->key.addr.addr, + .vid = fdb->key.vlan_id, + .added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags), + .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), + }; + if (!fdb->dst) return; switch (type) { case RTM_DELNEIGH: - br_switchdev_fdb_call_notifiers(false, fdb->key.addr.addr, - fdb->key.vlan_id, - fdb->dst->dev, - test_bit(BR_FDB_ADDED_BY_USER, - &fdb->flags), - test_bit(BR_FDB_OFFLOADED, - &fdb->flags)); + call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE, + fdb->dst->dev, &info.info, NULL); break; case RTM_NEWNEIGH: - br_switchdev_fdb_call_notifiers(true, fdb->key.addr.addr, - fdb->key.vlan_id, - fdb->dst->dev, - test_bit(BR_FDB_ADDED_BY_USER, - &fdb->flags), - test_bit(BR_FDB_OFFLOADED, - &fdb->flags)); + call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE, + fdb->dst->dev, &info.info, NULL); break; } } -- 2.17.1
next prev parent reply other threads:[~2021-01-16 1:26 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-16 1:25 [RFC net-next 0/7] net: dsa: Sync local bridge FDB addresses to hardware Tobias Waldekranz 2021-01-16 1:25 ` Tobias Waldekranz [this message] 2021-01-17 17:24 ` [RFC net-next 1/7] net: bridge: switchdev: Refactor br_switchdev_fdb_notify Vladimir Oltean 2021-01-16 1:25 ` [RFC net-next 2/7] net: bridge: switchdev: Include local flag in FDB notifications Tobias Waldekranz 2021-01-17 19:30 ` Vladimir Oltean 2021-01-18 18:58 ` Tobias Waldekranz 2021-01-18 19:27 ` Vladimir Oltean 2021-01-18 20:19 ` Tobias Waldekranz 2021-01-18 21:03 ` Vladimir Oltean 2021-01-18 21:17 ` Nikolay Aleksandrov 2021-01-18 21:22 ` Nikolay Aleksandrov 2021-01-18 21:39 ` Nikolay Aleksandrov 2021-01-18 21:50 ` Vladimir Oltean 2021-01-18 21:53 ` Nikolay Aleksandrov 2021-01-18 22:06 ` Vladimir Oltean 2021-01-18 22:09 ` Vladimir Oltean 2021-01-18 22:42 ` Nikolay Aleksandrov 2021-01-19 0:42 ` Vladimir Oltean 2021-01-19 10:14 ` Nikolay Aleksandrov 2021-01-18 19:28 ` Ido Schimmel 2021-01-16 1:25 ` [RFC net-next 3/7] net: bridge: switchdev: Send FDB notifications for host addresses Tobias Waldekranz 2021-01-18 11:28 ` Vladimir Oltean 2021-01-16 1:25 ` [RFC net-next 4/7] net: dsa: Include local addresses in assisted CPU port learning Tobias Waldekranz 2021-01-16 1:25 ` [RFC net-next 5/7] net: dsa: Include bridge " Tobias Waldekranz 2021-01-16 1:25 ` [RFC net-next 6/7] net: dsa: Sync static FDB entries on foreign interfaces to hardware Tobias Waldekranz 2021-01-16 1:25 ` [RFC net-next 7/7] net: dsa: mv88e6xxx: Request assisted learning on CPU port Tobias Waldekranz 2021-02-01 6:24 ` DENG Qingfang 2021-02-03 9:27 ` Tobias Waldekranz 2021-02-03 10:14 ` Vladimir Oltean 2021-02-03 10:42 ` Tobias Waldekranz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210116012515.3152-2-tobias@waldekranz.com \ --to=tobias@waldekranz.com \ --cc=andrew@lunn.ch \ --cc=davem@davemloft.net \ --cc=f.fainelli@gmail.com \ --cc=kuba@kernel.org \ --cc=netdev@vger.kernel.org \ --cc=nikolay@nvidia.com \ --cc=olteanv@gmail.com \ --cc=roopa@nvidia.com \ --cc=vivien.didelot@gmail.com \ --subject='Re: [RFC net-next 1/7] net: bridge: switchdev: Refactor br_switchdev_fdb_notify' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).