Commit a53581d5 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

net: bridge: mcast: br_multicast_set_port_router takes multicast context as argument

Change br_multicast_set_port_router to take port multicast context as
its first argument so we can later use it to control port/vlan mcast
router option.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a515e5b5
...@@ -4246,15 +4246,16 @@ br_multicast_rport_del_notify(struct net_bridge_mcast_port *pmctx, bool deleted) ...@@ -4246,15 +4246,16 @@ br_multicast_rport_del_notify(struct net_bridge_mcast_port *pmctx, bool deleted)
pmctx->multicast_router = MDB_RTR_TYPE_TEMP_QUERY; pmctx->multicast_router = MDB_RTR_TYPE_TEMP_QUERY;
} }
int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val) int br_multicast_set_port_router(struct net_bridge_mcast_port *pmctx,
unsigned long val)
{ {
struct net_bridge_mcast *brmctx = &p->br->multicast_ctx; struct net_bridge_mcast *brmctx;
struct net_bridge_mcast_port *pmctx = &p->multicast_ctx;
unsigned long now = jiffies; unsigned long now = jiffies;
int err = -EINVAL; int err = -EINVAL;
bool del = false; bool del = false;
spin_lock(&p->br->multicast_lock); brmctx = br_multicast_port_ctx_get_global(pmctx);
spin_lock(&brmctx->br->multicast_lock);
if (pmctx->multicast_router == val) { if (pmctx->multicast_router == val) {
/* Refresh the temp router port timer */ /* Refresh the temp router port timer */
if (pmctx->multicast_router == MDB_RTR_TYPE_TEMP) { if (pmctx->multicast_router == MDB_RTR_TYPE_TEMP) {
...@@ -4304,7 +4305,7 @@ int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val) ...@@ -4304,7 +4305,7 @@ int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val)
} }
err = 0; err = 0;
unlock: unlock:
spin_unlock(&p->br->multicast_lock); spin_unlock(&brmctx->br->multicast_lock);
return err; return err;
} }
......
...@@ -932,7 +932,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[], ...@@ -932,7 +932,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[],
if (tb[IFLA_BRPORT_MULTICAST_ROUTER]) { if (tb[IFLA_BRPORT_MULTICAST_ROUTER]) {
u8 mcast_router = nla_get_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER]); u8 mcast_router = nla_get_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER]);
err = br_multicast_set_port_router(p, mcast_router); err = br_multicast_set_port_router(&p->multicast_ctx,
mcast_router);
if (err) if (err)
return err; return err;
} }
......
...@@ -879,7 +879,8 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, struct sk_buff *skb, ...@@ -879,7 +879,8 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, struct sk_buff *skb,
struct net_bridge_mcast *brmctx, struct net_bridge_mcast *brmctx,
bool local_rcv, bool local_orig); bool local_rcv, bool local_orig);
int br_multicast_set_router(struct net_bridge_mcast *brmctx, unsigned long val); int br_multicast_set_router(struct net_bridge_mcast *brmctx, unsigned long val);
int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val); int br_multicast_set_port_router(struct net_bridge_mcast_port *pmctx,
unsigned long val);
int br_multicast_toggle(struct net_bridge *br, unsigned long val, int br_multicast_toggle(struct net_bridge *br, unsigned long val,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val); int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val);
......
...@@ -250,7 +250,7 @@ static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) ...@@ -250,7 +250,7 @@ static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
static int store_multicast_router(struct net_bridge_port *p, static int store_multicast_router(struct net_bridge_port *p,
unsigned long v) unsigned long v)
{ {
return br_multicast_set_port_router(p, v); return br_multicast_set_port_router(&p->multicast_ctx, v);
} }
static BRPORT_ATTR(multicast_router, 0644, show_multicast_router, static BRPORT_ATTR(multicast_router, 0644, show_multicast_router,
store_multicast_router); store_multicast_router);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment