netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, stephen@networkplumber.org,
	sfeldma@cumulusnetworks.com, arvid.brodin@alten.se,
	sucheta.chakraborty@qlogic.com
Subject: [patch net-next 3/5] bridge: implement rtnl_link_ops->slave_changelink
Date: Fri,  5 Sep 2014 15:51:30 +0200	[thread overview]
Message-ID: <1409925092-17808-4-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1409925092-17808-1-git-send-email-jiri@resnulli.us>

Allow rtnetlink users to set port info via IFLA_INFO_SLAVE_DATA attr

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 net/bridge/br_netlink.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 80d2347..05aeea1 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -276,7 +276,7 @@ static int br_afspec(struct net_bridge *br,
 	return err;
 }
 
-static const struct nla_policy ifla_brport_policy[IFLA_BRPORT_MAX + 1] = {
+static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = {
 	[IFLA_BRPORT_STATE]	= { .type = NLA_U8 },
 	[IFLA_BRPORT_COST]	= { .type = NLA_U32 },
 	[IFLA_BRPORT_PRIORITY]	= { .type = NLA_U16 },
@@ -382,7 +382,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh)
 	if (p && protinfo) {
 		if (protinfo->nla_type & NLA_F_NESTED) {
 			err = nla_parse_nested(tb, IFLA_BRPORT_MAX,
-					       protinfo, ifla_brport_policy);
+					       protinfo, br_port_policy);
 			if (err)
 				return err;
 
@@ -461,6 +461,16 @@ static int br_dev_newlink(struct net *src_net, struct net_device *dev,
 	return register_netdevice(dev);
 }
 
+static int br_port_slave_changelink(struct net_device *brdev,
+				    struct net_device *dev,
+				    struct nlattr *tb[],
+				    struct nlattr *data[])
+{
+	if (!data)
+		return 0;
+	return br_setport(br_port_get_rtnl(dev), data);
+}
+
 static int br_port_fill_slave_info(struct sk_buff *skb,
 				   const struct net_device *brdev,
 				   const struct net_device *dev)
@@ -504,6 +514,10 @@ struct rtnl_link_ops br_link_ops __read_mostly = {
 	.validate		= br_validate,
 	.newlink		= br_dev_newlink,
 	.dellink		= br_dev_delete,
+
+	.slave_maxtype		= IFLA_BRPORT_MAX,
+	.slave_policy		= br_port_policy,
+	.slave_changelink	= br_port_slave_changelink,
 	.get_slave_size		= br_port_get_slave_size,
 	.fill_slave_info	= br_port_fill_slave_info,
 };
-- 
1.9.3

  parent reply	other threads:[~2014-09-05 13:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 13:51 [patch net-next 0/5] bridge: implement rtnl_link options for getting and setting bridge options Jiri Pirko
2014-09-05 13:51 ` [patch net-next 1/5] bridge: switch order of rx_handler reg and upper dev link Jiri Pirko
2014-09-05 13:51 ` [patch net-next 2/5] bridge: implement rtnl_link_ops->get_slave_size and rtnl_link_ops->fill_slave_info Jiri Pirko
2014-09-05 13:51 ` Jiri Pirko [this message]
2014-09-05 13:51 ` [patch net-next 4/5] bridge: implement rtnl_link_ops->get_size and rtnl_link_ops->fill_info Jiri Pirko
2014-09-05 13:51 ` [patch net-next 5/5] bridge: implement rtnl_link_ops->changelink Jiri Pirko
2014-09-05 13:55 ` [patch iproute2 1/2] add bridge_slave device support Jiri Pirko
2014-09-05 13:55   ` [patch iproute2 2/2] add bridge master " Jiri Pirko
2014-09-28 23:09   ` [patch iproute2 1/2] add bridge_slave " Stephen Hemminger
2014-09-28 23:33   ` Stephen Hemminger
2014-09-29 18:20   ` Or Gerlitz
2014-09-30  8:05     ` Jiri Pirko
2014-09-05 17:06 ` [patch net-next 0/5] bridge: implement rtnl_link options for getting and setting bridge options Stephen Hemminger
2014-09-07 23:06 ` David Miller
2014-09-09 18:30 ` David Miller

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=1409925092-17808-4-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=arvid.brodin@alten.se \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    --cc=sucheta.chakraborty@qlogic.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).