On Thu, Aug 29, 2024 at 05:52:05PM +0300, Ido Schimmel wrote: > On Thu, Aug 29, 2024 at 01:54:46PM +0200, Guillaume Nault wrote: > > On Wed, Aug 28, 2024 at 03:09:19PM +0300, Ido Schimmel wrote: > > > On Tue, Aug 27, 2024 at 06:45:53PM +0300, Ido Schimmel wrote: > > > > On Tue, Aug 27, 2024 at 03:47:05PM +0200, Guillaume Nault wrote: > > > > > On Tue, Aug 27, 2024 at 02:18:01PM +0300, Ido Schimmel wrote: > > > > > > tl;dr - This patchset continues to unmask the upper DSCP bits in the > > > > > > IPv4 flow key in preparation for allowing IPv4 FIB rules to match on > > > > > > DSCP. No functional changes are expected. Part 1 was merged in commit > > > > > > ("Merge branch 'unmask-upper-dscp-bits-part-1'"). > > > > > > > > > > > > The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB > > > > > > lookup to match against the TOS selector in FIB rules and routes. > > > > > > > > > > > > It is currently impossible for user space to configure FIB rules that > > > > > > match on the DSCP value as the upper DSCP bits are either masked in the > > > > > > various call sites that initialize the IPv4 flow key or along the path > > > > > > to the FIB core. > > > > > > > > > > > > In preparation for adding a DSCP selector to IPv4 and IPv6 FIB rules, we > > > > > > > > > > Hum, do you plan to add a DSCP selector for IPv6? That shouldn't be > > > > > necessary as IPv6 already takes all the DSCP bits into account. Also we > > > > > don't need to keep any compatibility with the legacy TOS interpretation, > > > > > as it has never been defined nor used in IPv6. > > > > > > > > Yes. I want to add the DSCP selector for both families so that user > > > > space would not need to use different selectors for different families. > > > > > > Another approach could be to add a mask to the existing tos/dsfield. For > > > example: > > > > > > # ip -4 rule add dsfield 0x04/0xfc table 100 > > > # ip -6 rule add dsfield 0xf8/0xfc table 100 > > > > > > The default IPv4 mask (when user doesn't specify one) would be 0x1c and > > > the default IPv6 mask would be 0xfc. > > > > > > WDYT? > > > > For internal implementation, I find the mask option elegant (to avoid > > conditionals). But I don't really like the idea of letting user space > > provide its own mask. This would let the user create non-standard > > behaviours, likely by mistake (as nobody seem to ever have requested > > that flexibility). > > > > I think my favourite approach would be to have the new FRA_DSCP > > attribute work identically on both IPv4 and IPv6 FIB rules and keep > > the behaviour of the old "tos" field of struct fib_rule_hdr unchanged. > > > > This "tos" field would still work differently for IPv4 and IPv6, as it > > always did, but people wanting consistent behaviour could just use > > FRA_DSCP instead. Also, FRA_DSCP accepts real DSCP values as defined in > > RFCs, while "tos" requires the 2 bits shift. For all these reasons, I'm > > tempted to just consider "tos" as a legacy option used only for > > backward compatibility, while FRA_DSCP would be the "clean" interface. > > > > Is that approach acceptable for you? > > Yes. The patches I shared implement this approach :) Thanks for confirming. And sorry for the misunderstanding in v1.