[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR12MB5481A464F99D1BAD60006AFEDC379@PH0PR12MB5481.namprd12.prod.outlook.com>
Date: Tue, 8 Jun 2021 16:54:06 +0000
From: Parav Pandit <parav@...dia.com>
To: Loic Poulain <loic.poulain@...aro.org>,
"kuba@...nel.org" <kuba@...nel.org>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"johannes.berg@...el.com" <johannes.berg@...el.com>,
"leon@...nel.org" <leon@...nel.org>,
"m.chetan.kumar@...el.com" <m.chetan.kumar@...el.com>,
Sergey Ryazanov <ryazanov.s.a@...il.com>
Subject: RE: [PATCH net-next 3/4] rtnetlink: fill IFLA_PARENT_DEV_NAME on link
dump
> From: Loic Poulain <loic.poulain@...aro.org>
> Sent: Tuesday, June 8, 2021 7:37 PM
>
> From: Sergey Ryazanov <ryazanov.s.a@...il.com>
>
> Return a parent device using the FLA_PARENT_DEV_NAME attribute during
> links dump. This should help a user figure out which links belong to a
> particular HW device. E.g. what data channels exists on a specific WWAN
> modem.
>
Please add the output sample in the commit message, for this additional field possibly for a more common netdevice of a pci device or some other one.
> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@...il.com>
> ---
> net/core/rtnetlink.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 56ac16a..120887c
> 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -1819,6 +1819,11 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
> if (rtnl_fill_prop_list(skb, dev))
> goto nla_put_failure;
>
> + if (dev->dev.parent &&
> + nla_put_string(skb, IFLA_PARENT_DEV_NAME,
> + dev_name(dev->dev.parent)))
> + goto nla_put_failure;
> +
A device name along with device bus establishes a unique identity in the system.
Hence you should add IFLA_PARENT_DEV_BUS_NAME and return it optionally if the device is on a bus.
If (dev->dev.parent->bus)
return parent->bus->name string.
> nlmsg_end(skb, nlh);
> return 0;
>
> --
> 2.7.4
Powered by blists - more mailing lists