Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: netdev@vger.kernel.org
Cc: roopa@nvidia.com, bridge@lists.linux-foundation.org,
	davem@davemloft.net,
	Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Subject: [PATCH net-next 07/15] net: bridge: mdb: push notifications in __br_mdb_add/del
Date: Mon, 31 Aug 2020 18:08:37 +0300	[thread overview]
Message-ID: <20200831150845.1062447-8-nikolay@cumulusnetworks.com> (raw)
In-Reply-To: <20200831150845.1062447-1-nikolay@cumulusnetworks.com>

This change is in preparation for using the mdb port group entries when
sending a notification, so their full state and additional attributes can
be filled in.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 net/bridge/br_mdb.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 07cb07cd3691..a3ebc2d3b8f6 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -662,7 +662,7 @@ static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh,
 }
 
 static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
-			    struct br_ip *group, unsigned char state)
+			    struct br_ip *group, struct br_mdb_entry *entry)
 {
 	struct net_bridge_mdb_entry *mp;
 	struct net_bridge_port_group *p;
@@ -681,12 +681,13 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
 	/* host join */
 	if (!port) {
 		/* don't allow any flags for host-joined groups */
-		if (state)
+		if (entry->state)
 			return -EINVAL;
 		if (mp->host_joined)
 			return -EEXIST;
 
 		br_multicast_host_join(mp, false);
+		__br_mdb_notify(br->dev, NULL, entry, RTM_NEWMDB);
 
 		return 0;
 	}
@@ -700,13 +701,14 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
 			break;
 	}
 
-	p = br_multicast_new_port_group(port, group, *pp, state, NULL);
+	p = br_multicast_new_port_group(port, group, *pp, entry->state, NULL);
 	if (unlikely(!p))
 		return -ENOMEM;
 	p->filter_mode = MCAST_EXCLUDE;
 	rcu_assign_pointer(*pp, p);
-	if (state == MDB_TEMPORARY)
+	if (entry->state == MDB_TEMPORARY)
 		mod_timer(&p->timer, now + br->multicast_membership_interval);
+	__br_mdb_notify(br->dev, port, entry, RTM_NEWMDB);
 
 	return 0;
 }
@@ -735,7 +737,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br,
 	__mdb_entry_to_br_ip(entry, &ip);
 
 	spin_lock_bh(&br->multicast_lock);
-	ret = br_mdb_add_group(br, p, &ip, entry->state);
+	ret = br_mdb_add_group(br, p, &ip, entry);
 	spin_unlock_bh(&br->multicast_lock);
 	return ret;
 }
@@ -780,12 +782,9 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
 			err = __br_mdb_add(net, br, entry);
 			if (err)
 				break;
-			__br_mdb_notify(dev, p, entry, RTM_NEWMDB);
 		}
 	} else {
 		err = __br_mdb_add(net, br, entry);
-		if (!err)
-			__br_mdb_notify(dev, p, entry, RTM_NEWMDB);
 	}
 
 	return err;
@@ -813,6 +812,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
 	if (entry->ifindex == mp->br->dev->ifindex && mp->host_joined) {
 		br_multicast_host_leave(mp, false);
 		err = 0;
+		__br_mdb_notify(br->dev, NULL, entry, RTM_DELMDB);
 		if (!mp->ports && netif_running(br->dev))
 			mod_timer(&mp->timer, jiffies);
 		goto unlock;
@@ -875,13 +875,9 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
 		list_for_each_entry(v, &vg->vlan_list, vlist) {
 			entry->vid = v->vid;
 			err = __br_mdb_del(br, entry);
-			if (!err)
-				__br_mdb_notify(dev, p, entry, RTM_DELMDB);
 		}
 	} else {
 		err = __br_mdb_del(br, entry);
-		if (!err)
-			__br_mdb_notify(dev, p, entry, RTM_DELMDB);
 	}
 
 	return err;
-- 
2.25.4


  parent reply	other threads:[~2020-08-31 15:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 15:08 [PATCH net-next 00/15] net: bridge: mcast: initial IGMPv3 support (part 1) Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 01/15] net: bridge: mdb: arrange internal structs so fast-path fields are close Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 02/15] net: bridge: mcast: add support for group source list Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 03/15] net: bridge: mcast: add support for src list and filter mode dumping Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 04/15] net: bridge: mcast: add support for group-and-source specific queries Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 05/15] net: bridge: mcast: factor out port group del Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 06/15] net: bridge: mcast: add support for group query retransmit Nikolay Aleksandrov
2020-08-31 15:08 ` Nikolay Aleksandrov [this message]
2020-08-31 15:08 ` [PATCH net-next 08/15] net: bridge: mdb: use mdb and port entries in notifications Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 09/15] net: bridge: mcast: delete expired port groups without srcs Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 10/15] net: bridge: mcast: support for IGMPv3 IGMPV3_ALLOW_NEW_SOURCES report Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 11/15] net: bridge: mcast: support for IGMPV3_MODE_IS_INCLUDE/EXCLUDE report Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 12/15] net: bridge: mcast: support for IGMPV3_CHANGE_TO_INCLUDE/EXCLUDE report Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 13/15] net: bridge: mcast: support for IGMPV3_BLOCK_OLD_SOURCES report Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 14/15] net: bridge: mcast: improve v3 query processing Nikolay Aleksandrov
2020-08-31 15:08 ` [PATCH net-next 15/15] net: bridge: mcast: destroy all entries via gc Nikolay Aleksandrov
2020-09-01  9:22 ` [PATCH net-next 00/15] net: bridge: mcast: initial IGMPv3 support (part 1) Nikolay Aleksandrov

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=20200831150845.1062447-8-nikolay@cumulusnetworks.com \
    --to=nikolay@cumulusnetworks.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@nvidia.com \
    --subject='Re: [PATCH net-next 07/15] net: bridge: mdb: push notifications in __br_mdb_add/del' \
    /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).