From: David S. Miller Date: Sat, 28 Dec 2019 00:40:02 +0000 (-0800) Subject: Merge branch 'ethtool-netlink-part-one' X-Git-Tag: v5.15~4637^2~192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b3b289fd8daddf22eac89b8d185706bb7e822e9;p=platform%2Fkernel%2Flinux-starfive.git Merge branch 'ethtool-netlink-part-one' Michal Kubecek says: ==================== ethtool netlink interface, part 1 This is first part of netlink based alternative userspace interface for ethtool. It aims to address some long known issues with the ioctl interface, mainly lack of extensibility, raciness, limited error reporting and absence of notifications. The goal is to allow userspace ethtool utility to provide all features it currently does but without using the ioctl interface. However, some features provided by ethtool ioctl API will be available through other netlink interfaces (rtnetlink, devlink) if it's more appropriate. The interface uses generic netlink family "ethtool" and provides multicast group "monitor" which is used for notifications. Documentation for the interface is in Documentation/networking/ethtool-netlink.rst file. The netlink interface is optional, it is built when CONFIG_ETHTOOL_NETLINK (bool) option is enabled. There are three types of request messages distinguished by suffix "_GET" (query for information), "_SET" (modify parameters) and "_ACT" (perform an action). Kernel reply messages have name with additional suffix "_REPLY" (e.g. ETHTOOL_MSG_SETTINGS_GET_REPLY). Most "_SET" and "_ACT" message types do not have matching reply type as only some of them need additional reply data beyond numeric error code and extack. Kernel also broadcasts notification messages ("_NTF" suffix) on changes. Basic concepts: - make extensions easier not only by allowing new attributes but also by imposing as few artificial limits as possible, e.g. by using arbitrary size bit sets for most bitmap attributes or by not using fixed size strings - use extack for error reporting and warnings - send netlink notifications on changes (even if they were done using the ioctl interface) and actions - avoid the racy read/modify/write cycle between kernel and userspace by sending only attributes which userspace wants to change; there is still a read/modify/write cycle between generic kernel code and ethtool_ops handler in NIC driver but it is only in kernel and under RTNL lock - reduce the number of name lists that need to be kept in sync between kernel and userspace (e.g. recognized link modes) - where feasible, allow dump requests to query specific information for all network devices - as parsing and generating netlink messages is more complicated than simply copying data structures between userspace API and ethtool_ops handlers (which most ioctl commands do), split the code into multiple files in net/ethtool directory; move net/core/ethtool.c also to this directory and rename it to ioctl.c Changes between v8 and v9: - fix ethnl_update_u8() - fix description of ETHTOOL_A_LINKSTATE_LINK in rst file - add explanation of verbose vs. compact bitset usage to documentation - link ethtool-netlink.rst into toctree Main changes between v7 and v8: - preliminary patches sent as a separate series (already in net-next) - split notification related changes out of _SET patches - drop request specific flags from common header - use FLAG/flag rather than GFLAG/gflag for global flags (as there are only global flags now) - allow device names up to ALTIFNAMSIZ characters - rename ETHTOOL_A_BITSET_LIST to ETHTOOL_A_BITSET_NOMASK - rename ETHTOOL_A_BIT{,S}_* to ETHTOOL_A_BITSET_BIT{,S}_* - use standard bitset helpers for link modes (rather than in-place conversion) - use "default" rather than "standard" for unified _GET handlers - fixed 64-bit big endian bitset code Main changes between v6 and v7: - split complex messages into small single purpose ones (drop info and request masks and one level of nesting) - separate request information and reply data into two structures - refactor bitset handling (no simultaneous u32/ulong handling but avoid kmalloc() except for long bitmaps on 64-bit big endian architectures) - use only fixed size strings internally (will be replaced by char * eventually but that will require rewriting also existing ioctl code) - rework ethnl_update_* helpers to return error code - rename request flag constants (to ETHTOOL_[GR]FLAG_ prefix) - convert documentation to rst Main changes between v5 and v6: - use ETHTOOL_MSG_ prefix for message types - replace ETHA_ prefix for netlink attributes by ETHTOOL_A_ - replace ETH_x_IM_y for infomask bits by ETHTOOL_IM_x_y - split GET reply types from SET requests and notifications - split kernel and userspace message types into different enums - remove INFO_GET requests from submitted part - drop EVENT notifications (use rtnetlink and on-demand string set load) - reorganize patches to reduce the number of intermitent warnings - unify request/reply header and its processing - another nest around strings in a string set for consistency - more consistent identifier naming - coding style cleanup - get rid of some of the helpers - set bad attribute in extack where applicable - various bug fixes - improve documentation and code comments, more kerneldoc comments - more verbose commit messages Changes between v4 and v5: - do not panic on failed initialization, only WARN() Main changes between RFC v3 and v4: - use more kerneldoc style comments - strict attribute policy checking - use macros for tables of link mode names and parameters - provide permanent hardware address in rtnetlink - coding style cleanup - split too long patches, reorder - wrap more ETHA_SETTINGS_* attributes in nests - add also some SET_* implementation into submitted part Main changes between RFC v2 and RFC v3: - do not allow building as a module (no netdev notifiers needed) - drop some obsolete fields - add permanent hw address, timestamping and private flags support - rework bitset handling to get rid of variable length arrays - notify monitor on device renames - restructure GET_SETTINGS/SET_SETTINGS messages - split too long patches and submit only first part of the series Main changes between RFC v1 and RFC v2: - support dumps for all "get" requests - provide notifications for changes related to supported request types - support getting string sets (both global and per device) - support getting/setting device features - get rid of family specific header, everything passed as attributes - split netlink code into multiple files in net/ethtool/ directory ==================== Signed-off-by: David S. Miller --- 1b3b289fd8daddf22eac89b8d185706bb7e822e9