From: Jiri Pirko <jiri@resnulli.us>
To: Scott Feldman <sfeldma@cumulusnetworks.com>
Cc: vfalico@redhat.com, fubar@us.ibm.com, andy@greyhouse.net,
netdev@vger.kernel.org, roopa@cumulusnetworks.com,
shm@cumulusnetworks.com
Subject: Re: [PATCH net-next 3/4] bonding: add ad_info attribute netlink support
Date: Sat, 28 Dec 2013 22:34:36 +0100 [thread overview]
Message-ID: <20131228213436.GD2447@minipsycho> (raw)
In-Reply-To: <20131228071556.6296.26489.stgit@monster-03.cumulusnetworks.com>
Sat, Dec 28, 2013 at 08:15:56AM CET, sfeldma@cumulusnetworks.com wrote:
>Add nested IFLA_BOND_AD_INFO for bonding 802.3ad info.
>
>Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
I'm okay with this patch. I think that we need a follow-up patch that
will create a nl event in case one of following values change.
>---
> drivers/net/bonding/bond_netlink.c | 38 ++++++++++++++++++++++++++++++++++++
> include/uapi/linux/if_link.h | 12 +++++++++++
> 2 files changed, 50 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
>index df66dd8..1b4013b 100644
>--- a/drivers/net/bonding/bond_netlink.c
>+++ b/drivers/net/bonding/bond_netlink.c
>@@ -45,6 +45,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
> [IFLA_BOND_PACKETS_PER_SLAVE] = { .type = NLA_U32 },
> [IFLA_BOND_AD_LACP_RATE] = { .type = NLA_U8 },
> [IFLA_BOND_AD_SELECT] = { .type = NLA_U8 },
>+ [IFLA_BOND_AD_INFO] = { .type = NLA_NESTED },
> };
>
> static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
>@@ -310,6 +311,12 @@ static size_t bond_get_size(const struct net_device *bond_dev)
> nla_total_size(sizeof(u32)) + /* IFLA_BOND_PACKETS_PER_SLAVE */
> nla_total_size(sizeof(u8)) + /* IFLA_BOND_AD_LACP_RATE */
> nla_total_size(sizeof(u8)) + /* IFLA_BOND_AD_SELECT */
>+ nla_total_size(sizeof(struct nlattr)) + /* IFLA_BOND_AD_INFO */
>+ nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_AGGREGATOR */
>+ nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_NUM_PORTS */
>+ nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_ACTOR_KEY */
>+ nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_PARTNER_KEY*/
>+ nla_total_size(ETH_ALEN) + /* IFLA_BOND_AD_INFO_PARTNER_MAC*/
> 0;
> }
>
>@@ -423,6 +430,37 @@ static int bond_fill_info(struct sk_buff *skb,
> bond->params.ad_select))
> goto nla_put_failure;
>
>+ if (bond->params.mode == BOND_MODE_8023AD) {
>+ struct ad_info info;
>+
>+ if (!bond_3ad_get_active_agg_info(bond, &info)) {
>+ struct nlattr *nest;
>+
>+ nest = nla_nest_start(skb, IFLA_BOND_AD_INFO);
>+ if (!nest)
>+ goto nla_put_failure;
>+
>+ if (nla_put_u16(skb, IFLA_BOND_AD_INFO_AGGREGATOR,
>+ info.aggregator_id))
>+ goto nla_put_failure;
>+ if (nla_put_u16(skb, IFLA_BOND_AD_INFO_NUM_PORTS,
>+ info.ports))
>+ goto nla_put_failure;
>+ if (nla_put_u16(skb, IFLA_BOND_AD_INFO_ACTOR_KEY,
>+ info.actor_key))
>+ goto nla_put_failure;
>+ if (nla_put_u16(skb, IFLA_BOND_AD_INFO_PARTNER_KEY,
>+ info.partner_key))
>+ goto nla_put_failure;
>+ if (nla_put(skb, IFLA_BOND_AD_INFO_PARTNER_MAC,
>+ sizeof(info.partner_system),
>+ &info.partner_system))
>+ goto nla_put_failure;
>+
>+ nla_nest_end(skb, nest);
>+ }
>+ }
>+
> return 0;
>
> nla_put_failure:
>diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
>index 0fbb018..3e6bd3c 100644
>--- a/include/uapi/linux/if_link.h
>+++ b/include/uapi/linux/if_link.h
>@@ -351,11 +351,23 @@ enum {
> IFLA_BOND_PACKETS_PER_SLAVE,
> IFLA_BOND_AD_LACP_RATE,
> IFLA_BOND_AD_SELECT,
>+ IFLA_BOND_AD_INFO,
> __IFLA_BOND_MAX,
> };
>
> #define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
>
>+enum {
>+ IFLA_BOND_AD_INFO_AGGREGATOR,
>+ IFLA_BOND_AD_INFO_NUM_PORTS,
>+ IFLA_BOND_AD_INFO_ACTOR_KEY,
>+ IFLA_BOND_AD_INFO_PARTNER_KEY,
>+ IFLA_BOND_AD_INFO_PARTNER_MAC,
>+ __IFLA_BOND_AD_INFO_MAX,
>+};
>+
>+#define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1)
>+
> /* SR-IOV virtual function management section */
>
> enum {
>
prev parent reply other threads:[~2013-12-28 21:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-28 7:15 [PATCH net-next 3/4] bonding: add ad_info attribute netlink support Scott Feldman
2013-12-28 21:34 ` Jiri Pirko [this message]
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=20131228213436.GD2447@minipsycho \
--to=jiri@resnulli.us \
--cc=andy@greyhouse.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=sfeldma@cumulusnetworks.com \
--cc=shm@cumulusnetworks.com \
--cc=vfalico@redhat.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).