[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180829082428.0da2d748@xeon-e3>
Date: Wed, 29 Aug 2018 08:24:28 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Jiri Pirko <jiri@...nulli.us>
Cc: Marcel Holtmann <marcel@...tmann.org>, netdev@...r.kernel.org,
davem@...emloft.net
Subject: Re: [PATCH] rtnetlink: expose value from SET_NETDEV_DEVTYPE via
IFLA_DEVTYPE attribute
On Wed, 29 Aug 2018 09:18:55 +0200
Jiri Pirko <jiri@...nulli.us> wrote:
> Tue, Aug 28, 2018 at 10:58:11PM CEST, marcel@...tmann.org wrote:
> >The name value from SET_NETDEV_DEVTYPE only ended up in the uevent sysfs
> >file as DEVTYPE= information. To avoid any kind of race conditions
> >between netlink messages and reading from sysfs, it is useful to add the
> >same string as new IFLA_DEVTYPE attribute included in the RTM_NEWLINK
> >messages.
> >
> >For network managing daemons that have to classify ARPHRD_ETHER network
> >devices into different types (like Wireless LAN, Bluetooth etc.), this
> >avoids the extra round trip to sysfs and parsing of the uevent file.
> >
> >Signed-off-by: Marcel Holtmann <marcel@...tmann.org>
> >---
> > include/uapi/linux/if_link.h | 2 ++
> > net/core/rtnetlink.c | 12 ++++++++++++
> > 2 files changed, 14 insertions(+)
> >
> >diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> >index 43391e2d1153..781294972bb4 100644
> >--- a/include/uapi/linux/if_link.h
> >+++ b/include/uapi/linux/if_link.h
> >@@ -166,6 +166,8 @@ enum {
> > IFLA_NEW_IFINDEX,
> > IFLA_MIN_MTU,
> > IFLA_MAX_MTU,
> >+ IFLA_DEVTYPE, /* Name value from SET_NETDEV_DEVTYPE */
>
> This is not something netdev-related. dev->dev.type is struct device_type.
> This is a generic "device" thing. Incorrect to expose over
> netdev-specific API. Please use "device" API for this.
There is no device API in netlink. The whole point of this patch is to
do it in one message. It might be a performance optimization, but I can't
see how it could be a race condition. Devices set type before registering.
Powered by blists - more mailing lists