diff mbox series

net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset()

Message ID 20211123223208.1117871-1-zenczykowski@gmail.com (mailing list archive)
State Accepted
Commit 305e95bb893cc50f7c59edf2b47d95effe73498a
Delegated to: Netdev Maintainers
Headers show
Series net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset() | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Maciej Żenczykowski Nov. 23, 2021, 10:32 p.m. UTC
From: Maciej Żenczykowski <maze@google.com>

This is to match ipv4 behaviour, see __ip_sock_set_tos()
implementation.

Technically for ipv6 this might not be required because normally we
do not allow tclass to influence routing, yet the cli tooling does
support it:

lpk11:~# ip -6 rule add pref 5 tos 45 lookup 5
lpk11:~# ip -6 rule
5:      from all tos 0x45 lookup 5

and in general dscp/tclass based routing does make sense.

We already have cases where dscp can affect vlan priority and/or
transmit queue (especially on wifi).

So let's just make things match.  Easier to reason about and no harm.

Cc: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/ipv6_sockglue.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Nov. 25, 2021, 3:01 a.m. UTC | #1
On Tue, 23 Nov 2021 14:32:08 -0800 Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> This is to match ipv4 behaviour, see __ip_sock_set_tos()
> implementation.
> 
> Technically for ipv6 this might not be required because normally we
> do not allow tclass to influence routing, yet the cli tooling does
> support it:
> 
> lpk11:~# ip -6 rule add pref 5 tos 45 lookup 5
> lpk11:~# ip -6 rule
> 5:      from all tos 0x45 lookup 5
> 
> and in general dscp/tclass based routing does make sense.
> 
> We already have cases where dscp can affect vlan priority and/or
> transmit queue (especially on wifi).
> 
> So let's just make things match.  Easier to reason about and no harm.
> 
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Please send related patches as a series. There are dependencies here
which prevent the build bot from doing its job (plus it's less work 
for me since I apply by series :)).
patchwork-bot+netdevbpf@kernel.org Nov. 25, 2021, 3:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 23 Nov 2021 14:32:08 -0800 you wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> This is to match ipv4 behaviour, see __ip_sock_set_tos()
> implementation.
> 
> Technically for ipv6 this might not be required because normally we
> do not allow tclass to influence routing, yet the cli tooling does
> support it:
> 
> [...]

Here is the summary with links:
  - net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset()
    https://git.kernel.org/netdev/net-next/c/305e95bb893c

You are awesome, thank you!
Maciej Żenczykowski Nov. 25, 2021, 4:47 a.m. UTC | #3
On Wed, Nov 24, 2021 at 7:01 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 23 Nov 2021 14:32:08 -0800 Maciej Żenczykowski wrote:
> > From: Maciej Żenczykowski <maze@google.com>
> >
> > This is to match ipv4 behaviour, see __ip_sock_set_tos()
> > implementation.
> >
> > Technically for ipv6 this might not be required because normally we
> > do not allow tclass to influence routing, yet the cli tooling does
> > support it:
> >
> > lpk11:~# ip -6 rule add pref 5 tos 45 lookup 5
> > lpk11:~# ip -6 rule
> > 5:      from all tos 0x45 lookup 5
> >
> > and in general dscp/tclass based routing does make sense.
> >
> > We already have cases where dscp can affect vlan priority and/or
> > transmit queue (especially on wifi).
> >
> > So let's just make things match.  Easier to reason about and no harm.
> >
> > Cc: Eric Dumazet <edumazet@google.com>
> > Cc: Neal Cardwell <ncardwell@google.com>
> > Signed-off-by: Maciej Żenczykowski <maze@google.com>
>
> Please send related patches as a series. There are dependencies here
> which prevent the build bot from doing its job (plus it's less work
> for me since I apply by series :)).

Ah, sorry, while the patches were stacked on each other, they're kind
of orthogonal to each other,
and neither one actually depends on the other (outside of their being
a conflict because of touching nearby code).
That's why I sent them out separately.

Additionally, I've also noticed that often the first patch out of two
won't be merged if there's disagreement on the second, even though the
first might be entirely acceptable.
diff mbox series

Patch

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 204b0b4d10c8..3a66f2394b82 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -603,7 +603,10 @@  static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 			val &= ~INET_ECN_MASK;
 			val |= np->tclass & INET_ECN_MASK;
 		}
-		np->tclass = val;
+		if (np->tclass != val) {
+			np->tclass = val;
+			sk_dst_reset(sk);
+		}
 		retv = 0;
 		break;