netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: roopa@cumulusnetworks.com, davem@davemloft.net,
	stephen@networkplumber.org, bridge@lists.linux-foundation.org,
	shm@cumulusnetworks.com,
	Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Subject: [PATCH net-next 3/8] bridge: netlink: export port's designated cost and port
Date: Tue,  6 Oct 2015 14:11:57 +0200	[thread overview]
Message-ID: <1444133522-16907-4-git-send-email-razor@blackwall.org> (raw)
In-Reply-To: <1444133522-16907-1-git-send-email-razor@blackwall.org>

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Add IFLA_BRPORT_DESIGNATED_(COST|PORT) to allow getting the port's
designated cost and port respectively via netlink.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 include/uapi/linux/if_link.h | 2 ++
 net/bridge/br_netlink.c      | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index e891c32c9993..837caf940135 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -294,6 +294,8 @@ enum {
 	IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */
 	IFLA_BRPORT_ROOT_ID,	/* designated root */
 	IFLA_BRPORT_BRIDGE_ID,	/* designated bridge */
+	IFLA_BRPORT_DESIGNATED_PORT,
+	IFLA_BRPORT_DESIGNATED_COST,
 	__IFLA_BRPORT_MAX
 };
 #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index c3e0b73d660d..678d22747044 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -129,6 +129,8 @@ static inline size_t br_port_info_size(void)
 		+ nla_total_size(1)	/* IFLA_BRPORT_PROXYARP_WIFI */
 		+ nla_total_size(sizeof(struct ifla_bridge_id))	/* IFLA_BRPORT_ROOT_ID */
 		+ nla_total_size(sizeof(struct ifla_bridge_id))	/* IFLA_BRPORT_BRIDGE_ID */
+		+ nla_total_size(sizeof(u16))	/* IFLA_BRPORT_DESIGNATED_PORT */
+		+ nla_total_size(sizeof(u16))	/* IFLA_BRPORT_DESIGNATED_COST */
 		+ 0;
 }
 
@@ -166,7 +168,9 @@ static int br_port_fill_attrs(struct sk_buff *skb,
 	    nla_put(skb, IFLA_BRPORT_ROOT_ID, sizeof(struct ifla_bridge_id),
 		    &p->designated_root) ||
 	    nla_put(skb, IFLA_BRPORT_BRIDGE_ID, sizeof(struct ifla_bridge_id),
-		    &p->designated_bridge))
+		    &p->designated_bridge) ||
+	    nla_put_u16(skb, IFLA_BRPORT_DESIGNATED_PORT, p->designated_port) ||
+	    nla_put_u16(skb, IFLA_BRPORT_DESIGNATED_COST, p->designated_cost))
 		return -EMSGSIZE;
 
 	return 0;
-- 
2.4.3

  parent reply	other threads:[~2015-10-06 12:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 12:11 [PATCH net-next 0/8] bridge: netlink: complete port attribute support Nikolay Aleksandrov
2015-10-06 12:11 ` [PATCH net-next 1/8] bridge: netlink: export port's root id Nikolay Aleksandrov
2015-10-06 12:30   ` kbuild test robot
2015-10-06 12:43     ` Nikolay Aleksandrov
2015-10-06 12:30   ` kbuild test robot
2015-10-06 12:11 ` [PATCH net-next 2/8] bridge: netlink: export port's bridge id Nikolay Aleksandrov
2015-10-06 12:11 ` Nikolay Aleksandrov [this message]
2015-10-06 12:11 ` [PATCH net-next 4/8] bridge: netlink: export port's id and number Nikolay Aleksandrov
2015-10-06 12:11 ` [PATCH net-next 5/8] bridge: netlink: export port's topology_change_ack and config_pending Nikolay Aleksandrov
2015-10-06 12:12 ` [PATCH net-next 6/8] bridge: netlink: export port's timer values Nikolay Aleksandrov
2015-10-06 12:12 ` [PATCH net-next 7/8] bridge: netlink: allow to flush port's fdb Nikolay Aleksandrov
2015-10-06 12:12 ` [PATCH net-next 8/8] bridge: netlink: add support for port's multicast_router attribute Nikolay Aleksandrov
2015-10-07 11:50 ` [PATCH net-next 0/8] bridge: netlink: complete port attribute support 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=1444133522-16907-4-git-send-email-razor@blackwall.org \
    --to=razor@blackwall.org \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=shm@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    /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).