linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Michal Kubecek <mkubecek@suse.cz>,
	David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>,
	Jiri Pirko <jiri@resnulli.us>, Andrew Lunn <andrew@lunn.ch>,
	John Linville <linville@tuxdriver.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v8 03/14] ethtool: netlink bitset handling
Date: Mon, 23 Dec 2019 20:15:22 -0800	[thread overview]
Message-ID: <b36ee759-2d7a-8237-6f3d-a93e8c22ba66@gmail.com> (raw)
In-Reply-To: <0fcbf623c390b30ca34ab0f83645b86a88558b32.1577052887.git.mkubecek@suse.cz>



On 12/22/2019 3:45 PM, Michal Kubecek wrote:
> The ethtool netlink code uses common framework for passing arbitrary
> length bit sets to allow future extensions. A bitset can be a list (only
> one bitmap) or can consist of value and mask pair (used e.g. when client
> want to modify only some bits). A bitset can use one of two formats:
> verbose (bit by bit) or compact.
> 
> Verbose format consists of bitset size (number of bits), list flag and
> an array of bit nests, telling which bits are part of the list or which
> bits are in the mask and which of them are to be set. In requests, bits
> can be identified by index (position) or by name. In replies, kernel
> provides both index and name. Verbose format is suitable for "one shot"
> applications like standard ethtool command as it avoids the need to
> either keep bit names (e.g. link modes) in sync with kernel or having to
> add an extra roundtrip for string set request (e.g. for private flags).
> 
> Compact format uses one (list) or two (value/mask) arrays of 32-bit
> words to store the bitmap(s). It is more suitable for long running
> applications (ethtool in monitor mode or network management daemons)
> which can retrieve the names once and then pass only compact bitmaps to
> save space.
> 
> Userspace requests can use either format; ETHTOOL_FLAG_COMPACT_BITSETS
> flag in request header tells kernel which format to use in reply.
> Notifications always use compact format.
> 
> As some code uses arrays of unsigned long for internal representation and
> some arrays of u32 (or even a single u32), two sets of parse/compose
> helpers are introduced. To avoid code duplication, helpers for unsigned
> long arrays are implemented as wrappers around helpers for u32 arrays.
> There are two reasons for this choice: (1) u32 arrays are more frequent in
> ethtool code and (2) unsigned long array can be always interpreted as an
> u32 array on little endian 64-bit and all 32-bit architectures while we
> would need special handling for odd number of u32 words in the opposite
> direction.
> 
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

  reply	other threads:[~2019-12-24  4:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22 23:45 [PATCH net-next v8 00/14] ethtool netlink interface, part 1 Michal Kubecek
2019-12-22 23:45 ` [PATCH net-next v8 01/14] ethtool: introduce ethtool netlink interface Michal Kubecek
2019-12-24  4:01   ` Florian Fainelli
2019-12-24  9:45   ` Andrew Lunn
2019-12-22 23:45 ` [PATCH net-next v8 02/14] ethtool: helper functions for " Michal Kubecek
2019-12-24  4:08   ` Florian Fainelli
2019-12-25 11:07     ` Michal Kubecek
2019-12-22 23:45 ` [PATCH net-next v8 03/14] ethtool: netlink bitset handling Michal Kubecek
2019-12-24  4:15   ` Florian Fainelli [this message]
2019-12-22 23:45 ` [PATCH net-next v8 04/14] ethtool: support for netlink notifications Michal Kubecek
2019-12-24  4:16   ` Florian Fainelli
2019-12-22 23:45 ` [PATCH net-next v8 05/14] ethtool: default handlers for GET requests Michal Kubecek
2019-12-24  4:23   ` Florian Fainelli
2019-12-22 23:45 ` [PATCH net-next v8 06/14] ethtool: provide string sets with STRSET_GET request Michal Kubecek
2019-12-24  4:28   ` Florian Fainelli
2019-12-22 23:45 ` [PATCH net-next v8 07/14] ethtool: provide link settings with LINKINFO_GET request Michal Kubecek
2019-12-24  4:32   ` Florian Fainelli
2019-12-22 23:45 ` [PATCH net-next v8 08/14] ethtool: set link settings with LINKINFO_SET request Michal Kubecek
2019-12-24  4:30   ` Florian Fainelli
2019-12-22 23:45 ` [PATCH net-next v8 09/14] ethtool: add default notification handler Michal Kubecek
2019-12-24  4:31   ` Florian Fainelli
2019-12-22 23:46 ` [PATCH net-next v8 10/14] ethtool: add LINKINFO_NTF notification Michal Kubecek
2019-12-24  4:34   ` Florian Fainelli
2019-12-22 23:46 ` [PATCH net-next v8 11/14] ethtool: provide link mode information with LINKMODES_GET request Michal Kubecek
2019-12-24  4:35   ` Florian Fainelli
2019-12-22 23:46 ` [PATCH net-next v8 12/14] ethtool: set link modes related data with LINKMODES_SET request Michal Kubecek
2019-12-24  4:40   ` Florian Fainelli
2019-12-22 23:46 ` [PATCH net-next v8 13/14] ethtool: add LINKMODES_NTF notification Michal Kubecek
2019-12-24  4:41   ` Florian Fainelli
2019-12-22 23:46 ` [PATCH net-next v8 14/14] ethtool: provide link state with LINKSTATE_GET request Michal Kubecek
2019-12-24  4:44   ` Florian Fainelli
2019-12-27 12:47     ` Michal Kubecek
2019-12-23 16:52 ` [PATCH net-next v8 00/14] ethtool netlink interface, part 1 Florian Fainelli
2019-12-23 22:05   ` Michal Kubecek
2019-12-24  4:45     ` Florian Fainelli
2019-12-25  7:18 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b36ee759-2d7a-8237-6f3d-a93e8c22ba66@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@resnulli.us \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).