Messages in this thread | | | Subject | Re: [PATCH net-next v6 06/15] ethtool: netlink bitset handling | From | Johannes Berg <> | Date | Thu, 04 Jul 2019 15:10:11 +0200 |
| |
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
| |