[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <286fbbfa-d387-debe-bd9d-185376a2c9a5@gmail.com>
Date: Thu, 21 Sep 2017 11:16:59 -0600
From: David Ahern <dsahern@...il.com>
To: Florian Westphal <fw@...len.de>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/7] rtnetlink: add helper to put master ifindex
On 9/21/17 10:58 AM, Florian Westphal wrote:
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index a78fd61da0ec..c801212ee40e 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -1307,6 +1307,31 @@ static u32 rtnl_get_event(unsigned long event)
> return rtnl_event_type;
> }
>
> +static int put_master_ifindex(struct sk_buff *skb, struct net_device *dev)
> +{
> + const struct net_device *upper_dev;
> + int ret = 0;
> +
> + rcu_read_lock();
> +
> + upper_dev = netdev_master_upper_dev_get_rcu(dev);
> + if (upper_dev)
> + ret = nla_put_u32(skb, IFLA_MASTER, upper_dev->ifindex);
> +
> + rcu_read_unlock();
> + return ret;
> +}
> +
> +static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev)
> +{
> + int ifindex = dev_get_iflink(dev);
> +
> + if (dev->ifindex == ifindex)
> + return 0;
> +
> + return nla_put_u32(skb, IFLA_LINK, ifindex);
> +}
> +
> static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
> int type, u32 pid, u32 seq, u32 change,
> unsigned int flags, u32 ext_filter_mask,
Subject references only change for master index, put the patch is
converting 2 things to helpers.
Powered by blists - more mailing lists