From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCH] rtnetlink: expose value from SET_NETDEV_DEVTYPE via IFLA_DEVTYPE attribute Date: Wed, 29 Aug 2018 09:18:55 +0200 Message-ID: <20180829071855.GB2181@nanopsycho> References: <20180828205811.125925-1-marcel@holtmann.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net To: Marcel Holtmann Return-path: Received: from mail-wr1-f67.google.com ([209.85.221.67]:45924 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbeH2LSI (ORCPT ); Wed, 29 Aug 2018 07:18:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id 20-v6so3732649wrb.12 for ; Wed, 29 Aug 2018 00:22:37 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180828205811.125925-1-marcel@holtmann.org> Sender: netdev-owner@vger.kernel.org List-ID: Tue, Aug 28, 2018 at 10:58:11PM CEST, marcel@holtmann.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 >--- > 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.