From: Guillaume Nault <gnault@redhat.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: Vladimir Vdovin <deliran@verdict.gg>,
netdev@vger.kernel.org, dsahern@kernel.org, davem@davemloft.net,
edumazet@google.com, linux-kselftest@vger.kernel.org,
kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org,
horms@kernel.org
Subject: Re: [PATCH net-next v7] net: ipv4: Cache pmtu for all packet paths if multipath enabled
Date: Wed, 6 Nov 2024 16:26:09 +0100 [thread overview]
Message-ID: <ZyuKkekr2QSF3jUS@debian> (raw)
In-Reply-To: <ZykH_fdcMBdFgXix@shredder>
On Mon, Nov 04, 2024 at 07:44:29PM +0200, Ido Schimmel wrote:
> 1. We should set the same MTU in both paths as otherwise we don't know
> which MTU will be cached and what to pass to check_pmtu_value() as the
> expected value. I did see that check_pmtu_value() accepts "any", but I
> think it's better to check for a specific value.
>
> 2. route_get_dst_pmtu_from_exception() is not very flexible in the
> keywords it accepts for "ip route get" and we need to pass "oif". It can
> be solved by [1] (please test), but Guillaume might have a better idea.
> Then, the above hunk can be replaced by [2].
Thanks for bringing this to my attention Ido!
I fully agree with this approach (and I also fully agree with your other
feedbacks).
Nice to see this bug fixed and get a selftest!
> [1]
> diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
> index 569bce8b6383..6e790d38e5d9 100755
> --- a/tools/testing/selftests/net/pmtu.sh
> +++ b/tools/testing/selftests/net/pmtu.sh
> @@ -1076,23 +1076,15 @@ link_get_mtu() {
> }
>
> route_get_dst_exception() {
> - ns_cmd="${1}"
> - dst="${2}"
> - dsfield="${3}"
> -
> - if [ -z "${dsfield}" ]; then
> - dsfield=0
> - fi
> + ns_cmd="${1}"; shift
>
> - ${ns_cmd} ip route get "${dst}" dsfield "${dsfield}"
> + ${ns_cmd} ip route get "$@"
> }
>
> route_get_dst_pmtu_from_exception() {
> - ns_cmd="${1}"
> - dst="${2}"
> - dsfield="${3}"
> + ns_cmd="${1}"; shift
>
> - mtu_parse "$(route_get_dst_exception "${ns_cmd}" "${dst}" "${dsfield}")"
> + mtu_parse "$(route_get_dst_exception "${ns_cmd}" "$@")"
> }
>
> check_pmtu_value() {
> @@ -1235,10 +1227,10 @@ test_pmtu_ipv4_dscp_icmp_exception() {
> run_cmd "${ns_a}" ping -q -M want -Q "${dsfield}" -c 1 -w 1 -s "${len}" "${dst2}"
>
> # Check that exceptions have been created with the correct PMTU
> - pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst1}" "${policy_mark}")"
> + pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1} dsfield ${policy_mark})"
> check_pmtu_value "1400" "${pmtu_1}" "exceeding MTU" || return 1
>
> - pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst2}" "${policy_mark}")"
> + pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2} dsfield ${policy_mark})"
> check_pmtu_value "1500" "${pmtu_2}" "exceeding MTU" || return 1
> }
>
> @@ -1285,9 +1277,9 @@ test_pmtu_ipv4_dscp_udp_exception() {
> UDP:"${dst2}":50000,tos="${dsfield}"
>
> # Check that exceptions have been created with the correct PMTU
> - pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst1}" "${policy_mark}")"
> + pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1} dsfield ${policy_mark})"
> check_pmtu_value "1400" "${pmtu_1}" "exceeding MTU" || return 1
> - pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst2}" "${policy_mark}")"
> + pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2} dsfield ${policy_mark})"
> check_pmtu_value "1500" "${pmtu_2}" "exceeding MTU" || return 1
> }
>
> [2]
> diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
> index a3c3f7f99e5b..10b8ac2d7f47 100755
> --- a/tools/testing/selftests/net/pmtu.sh
> +++ b/tools/testing/selftests/net/pmtu.sh
> @@ -2399,19 +2399,11 @@ test_pmtu_ipv4_mp_exceptions() {
> # Ping and expect two nexthop exceptions for two routes in nh group
> run_cmd ${ns_a} ping -q -M want -i 0.1 -c 1 -s 1800 "${dummy4_b_addr}"
>
> - # Do route lookup before checking cached exceptions.
> - # The following commands are needed for dst entries to be cached
> - # in both paths exceptions and therefore dumped to user space
> - run_cmd ${ns_a} ip route get ${dummy4_b_addr} oif veth_A-R1
> - run_cmd ${ns_a} ip route get ${dummy4_b_addr} oif veth_A-R2
> -
> - # Check cached exceptions
> - if [ "$(${ns_a} ip -oneline route list cache | grep mtu | wc -l)" -ne 2 ]; then
> - err " there are not enough cached exceptions"
> - fail=1
> - fi
> -
> - return ${fail}
> + # Check that exceptions have been created with the correct PMTU
> + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dummy4_b_addr} oif veth_A-R1)"
> + check_pmtu_value "1500" "${pmtu}" "exceeding MTU (veth_A-R1)" || return 1
> + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dummy4_b_addr} oif veth_A-R2)"
> + check_pmtu_value "1500" "${pmtu}" "exceeding MTU (veth_A-R2)" || return 1
> }
>
> usage() {
>
prev parent reply other threads:[~2024-11-06 15:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 7:27 [PATCH net-next v7] net: ipv4: Cache pmtu for all packet paths if multipath enabled Vladimir Vdovin
2024-11-04 17:44 ` Ido Schimmel
2024-11-06 13:29 ` Vladimir Vdovin
2024-11-06 15:26 ` Guillaume Nault [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyuKkekr2QSF3jUS@debian \
--to=gnault@redhat.com \
--cc=davem@davemloft.net \
--cc=deliran@verdict.gg \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@idosch.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).