netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value
@ 2021-03-19 14:33 Hangbin Liu
  2021-03-19 21:00 ` patchwork-bot+netdevbpf
  2021-03-21 17:20 ` Ido Schimmel
  0 siblings, 2 replies; 4+ messages in thread
From: Hangbin Liu @ 2021-03-19 14:33 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Petr Machata, Ido Schimmel, Guillaume Nault,
	Hangbin Liu

The ECN bit defines ECT(1) = 1, ECT(0) = 2. So inner 0x02 + outer 0x01
should be inner ECT(0) + outer ECT(1). Based on the description of
__INET_ECN_decapsulate, the final decapsulate value should be
ECT(1). So fix the test expect value to 0x01.

Before the fix:
TEST: VXLAN: ECN decap: 01/02->0x02                                 [FAIL]
        Expected to capture 10 packets, got 0.

After the fix:
TEST: VXLAN: ECN decap: 01/02->0x01                                 [ OK ]

Fixes: a0b61f3d8ebf ("selftests: forwarding: vxlan_bridge_1d: Add an ECN decap test")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
index ce6bea9675c0..0ccb1dda099a 100755
--- a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
+++ b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
@@ -658,7 +658,7 @@ test_ecn_decap()
 	# In accordance with INET_ECN_decapsulate()
 	__test_ecn_decap 00 00 0x00
 	__test_ecn_decap 01 01 0x01
-	__test_ecn_decap 02 01 0x02
+	__test_ecn_decap 02 01 0x01
 	__test_ecn_decap 01 03 0x03
 	__test_ecn_decap 02 03 0x03
 	test_ecn_decap_error
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value
  2021-03-19 14:33 [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value Hangbin Liu
@ 2021-03-19 21:00 ` patchwork-bot+netdevbpf
  2021-03-21 17:20 ` Ido Schimmel
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-19 21:00 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: netdev, davem, petrm, idosch, gnault

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 19 Mar 2021 22:33:14 +0800 you wrote:
> The ECN bit defines ECT(1) = 1, ECT(0) = 2. So inner 0x02 + outer 0x01
> should be inner ECT(0) + outer ECT(1). Based on the description of
> __INET_ECN_decapsulate, the final decapsulate value should be
> ECT(1). So fix the test expect value to 0x01.
> 
> Before the fix:
> TEST: VXLAN: ECN decap: 01/02->0x02                                 [FAIL]
>         Expected to capture 10 packets, got 0.
> 
> [...]

Here is the summary with links:
  - [net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value
    https://git.kernel.org/netdev/net/c/5aa3c334a449

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value
  2021-03-19 14:33 [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value Hangbin Liu
  2021-03-19 21:00 ` patchwork-bot+netdevbpf
@ 2021-03-21 17:20 ` Ido Schimmel
  2021-03-22  1:16   ` Hangbin Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Ido Schimmel @ 2021-03-21 17:20 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, David Miller, Petr Machata, Ido Schimmel, Guillaume Nault

On Fri, Mar 19, 2021 at 10:33:14PM +0800, Hangbin Liu wrote:
> The ECN bit defines ECT(1) = 1, ECT(0) = 2. So inner 0x02 + outer 0x01
> should be inner ECT(0) + outer ECT(1). Based on the description of
> __INET_ECN_decapsulate, the final decapsulate value should be
> ECT(1). So fix the test expect value to 0x01.
> 
> Before the fix:
> TEST: VXLAN: ECN decap: 01/02->0x02                                 [FAIL]
>         Expected to capture 10 packets, got 0.
> 
> After the fix:
> TEST: VXLAN: ECN decap: 01/02->0x01                                 [ OK ]
> 
> Fixes: a0b61f3d8ebf ("selftests: forwarding: vxlan_bridge_1d: Add an ECN decap test")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>

Fixes: b723748750ec ("tunnel: Propagate ECT(1) when decapsulating as recommended by RFC6040")

The commit you cited is from 2018 whereas this one is from 2020. The
test stopped working after the latter. The reason I didn't see it is
because this commit only changed one caller of __INET_ECN_decapsulate().
Another caller is mlxsw which uses the function to understand how to
program the hardware to perform decapsulation. See commit 28e450333d4d
("inet: Refactor INET_ECN_decapsulate()").

After your patch I get:

TEST: VXLAN: ECN decap: 01/02->0x01                                 [FAIL]
        Expected to capture 10 packets, got 0.

Fixed by:

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
index b8b08a6a1d10..61eb34e20fde 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
@@ -341,7 +341,12 @@ static int mlxsw_sp_ipip_ecn_decap_init_one(struct mlxsw_sp *mlxsw_sp,
        u8 new_inner_ecn;
 
        trap_en = __INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce);
-       new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn;
+       if (set_ce)
+               new_inner_ecn = INET_ECN_CE;
+       else if (outer_ecn == INET_ECN_ECT_1)
+               new_inner_ecn = INET_ECN_ECT_1;
+       else
+               new_inner_ecn = inner_ecn;
 
        mlxsw_reg_tidem_pack(tidem_pl, outer_ecn, inner_ecn, new_inner_ecn,
                             trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
index e5ec595593f4..74f2c4ce7063 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
@@ -913,7 +913,12 @@ static int __mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp,
        u8 new_inner_ecn;
 
        trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce);
-       new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn;
+       if (set_ce)
+               new_inner_ecn = INET_ECN_CE;
+       else if (outer_ecn == INET_ECN_ECT_1)
+               new_inner_ecn = INET_ECN_ECT_1;
+       else
+               new_inner_ecn = inner_ecn;
 
        mlxsw_reg_tndem_pack(tndem_pl, outer_ecn, inner_ecn, new_inner_ecn,
                             trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0);

I will prepare a patch

> ---
>  tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
> index ce6bea9675c0..0ccb1dda099a 100755
> --- a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
> +++ b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
> @@ -658,7 +658,7 @@ test_ecn_decap()
>  	# In accordance with INET_ECN_decapsulate()
>  	__test_ecn_decap 00 00 0x00
>  	__test_ecn_decap 01 01 0x01
> -	__test_ecn_decap 02 01 0x02
> +	__test_ecn_decap 02 01 0x01
>  	__test_ecn_decap 01 03 0x03
>  	__test_ecn_decap 02 03 0x03
>  	test_ecn_decap_error
> -- 
> 2.26.2
> 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value
  2021-03-21 17:20 ` Ido Schimmel
@ 2021-03-22  1:16   ` Hangbin Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2021-03-22  1:16 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: netdev, David Miller, Petr Machata, Ido Schimmel, Guillaume Nault

On Sun, Mar 21, 2021 at 07:20:55PM +0200, Ido Schimmel wrote:
> On Fri, Mar 19, 2021 at 10:33:14PM +0800, Hangbin Liu wrote:
> > The ECN bit defines ECT(1) = 1, ECT(0) = 2. So inner 0x02 + outer 0x01
> > should be inner ECT(0) + outer ECT(1). Based on the description of
> > __INET_ECN_decapsulate, the final decapsulate value should be
> > ECT(1). So fix the test expect value to 0x01.
> > 
> > Before the fix:
> > TEST: VXLAN: ECN decap: 01/02->0x02                                 [FAIL]
> >         Expected to capture 10 packets, got 0.
> > 
> > After the fix:
> > TEST: VXLAN: ECN decap: 01/02->0x01                                 [ OK ]
> > 
> > Fixes: a0b61f3d8ebf ("selftests: forwarding: vxlan_bridge_1d: Add an ECN decap test")
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> 
> Fixes: b723748750ec ("tunnel: Propagate ECT(1) when decapsulating as recommended by RFC6040")
> 
> The commit you cited is from 2018 whereas this one is from 2020. The
> test stopped working after the latter. The reason I didn't see it is
> because this commit only changed one caller of __INET_ECN_decapsulate().
> Another caller is mlxsw which uses the function to understand how to
> program the hardware to perform decapsulation. See commit 28e450333d4d
> ("inet: Refactor INET_ECN_decapsulate()").

Hi Ido,

Thanks for this info. I don't have mlxsw card in hand, so I never
run the driver test before.

Cheers
Hangbin

> 
> After your patch I get:
> 
> TEST: VXLAN: ECN decap: 01/02->0x01                                 [FAIL]
>         Expected to capture 10 packets, got 0.
> 
> Fixed by:
> 
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
> index b8b08a6a1d10..61eb34e20fde 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
> @@ -341,7 +341,12 @@ static int mlxsw_sp_ipip_ecn_decap_init_one(struct mlxsw_sp *mlxsw_sp,
>         u8 new_inner_ecn;
>  
>         trap_en = __INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce);
> -       new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn;
> +       if (set_ce)
> +               new_inner_ecn = INET_ECN_CE;
> +       else if (outer_ecn == INET_ECN_ECT_1)
> +               new_inner_ecn = INET_ECN_ECT_1;
> +       else
> +               new_inner_ecn = inner_ecn;
>  
>         mlxsw_reg_tidem_pack(tidem_pl, outer_ecn, inner_ecn, new_inner_ecn,
>                              trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0);
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
> index e5ec595593f4..74f2c4ce7063 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
> @@ -913,7 +913,12 @@ static int __mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp,
>         u8 new_inner_ecn;
>  
>         trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce);
> -       new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn;
> +       if (set_ce)
> +               new_inner_ecn = INET_ECN_CE;
> +       else if (outer_ecn == INET_ECN_ECT_1)
> +               new_inner_ecn = INET_ECN_ECT_1;
> +       else
> +               new_inner_ecn = inner_ecn;
>  
>         mlxsw_reg_tndem_pack(tndem_pl, outer_ecn, inner_ecn, new_inner_ecn,
>                              trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0);
> 
> I will prepare a patch

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-22  1:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-19 14:33 [PATCH net] selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value Hangbin Liu
2021-03-19 21:00 ` patchwork-bot+netdevbpf
2021-03-21 17:20 ` Ido Schimmel
2021-03-22  1:16   ` Hangbin Liu

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).