lkml.org 
[lkml]   [2019]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next v6 06/15] ethtool: netlink bitset handling
From
Date
On Thu, 2019-07-04 at 14:53 +0200, Michal Kubecek wrote:
>
> > value: 0b00000000'000000xx'xxxxxxxx'xxxxxxxx
> > mask: 0b00000000'00000011'11111111'11111111
>
> One scenario that I can see from the top of my head would be user
> running
>
> ethtool -s <dev> advertise 0x...

The "0x..." here would be the *value* in the NLA_BITFIELD32 parlance,
right?

What would the "selector" be? I assume the selector would be "whatever
ethtool knows about"?

> with hex value representing some subset of link modes. Now if ethtool
> version is behind kernel and recognizes fewer link modes than kernel
> but in a way that the number rounded up to bytes or words would be the
> same, kernel has no way to recognize of those zero bits on top of the
> mask are zero on purpose or just because userspace doesn't know about
> them. In general, I believe the absence of bit length information is
> something protocols would have to work around sometimes.
>
> The submitted implementation doesn't have this problem as it can tell
> kernel "this is a list" (i.e. I'm not sending a value/mask pair, I want
> exactly these bits to be set).

OK, here I guess I see what you mean. You're saying if ethtool were to
send a value/mask of "0..0100/0..0111" you wouldn't know what to do with
BIT(4) as long as the kernel knows about that bit?

I guess the difference now is depending on the operation. NLA_BITFIELD32
is sort of built on the assumption of having a "toggle" operation. If
you want to have a "set to" operation, then you don't really need the
selector/mask at all, just the value.

johannes

\
 
 \ /
  Last update: 2019-07-04 15:11    [W:0.253 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site