From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcel Holtmann Subject: Re: [PATCH] rtnetlink: expose value from SET_NETDEV_DEVTYPE via IFLA_DEVTYPE attribute Date: Wed, 29 Aug 2018 08:23:58 -0700 Message-ID: <2E0F93BA-74CD-4E5E-8FDC-CC2B8A373B69@holtmann.org> References: <20180828205811.125925-1-marcel@holtmann.org> <20180829071855.GB2181@nanopsycho> Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Cc: netdev , "David S. Miller" To: Jiri Pirko Return-path: Received: from coyote.holtmann.net ([212.227.132.17]:56766 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728701AbeH2TV3 (ORCPT ); Wed, 29 Aug 2018 15:21:29 -0400 In-Reply-To: <20180829071855.GB2181@nanopsycho> Sender: netdev-owner@vger.kernel.org List-ID: Hi Jiri, >> 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 >> --- >> 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. it is not just "device" related since this is a sub-classification of ARPHRD_ETHER type as a wrote above. Don't get hang up that this information is part of struct device. The dev->dev.type contains strings like "wlan", "bluetooth", "wimax", "gadget" etc. so that you can tell what kind of Ethernet card you have. We can revive the patches for adding this information as IFLA_INFO_KIND, but last time they where reverted since NetworkManager did all the wrong decisions based on that. That part is fixed now and we can put that back and declare the sub-type classification of Ethernet device in two places. Or we just take the information that we added a long time ago for exactly this sub-classification and provide them to userspace via RTNL. Regards Marcel