[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f439b8c4-8f2c-49eb-b670-2b2344d3d6ad@redhat.com>
Date: Thu, 16 Oct 2025 13:55:29 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: David Wilder <wilder@...ibm.com>, netdev@...r.kernel.org
Cc: jv@...sburgh.net, pradeep@...ibm.com, i.maximets@....org,
amorenoz@...hat.com, haliu@...hat.com, stephen@...workplumber.org,
horms@...nel.org, kuba@...nel.org, andrew+netdev@...n.ch, edumazet@...gle.com
Subject: Re: [PATCH net-next v13 7/7] bonding: Selftest and documentation for
the arp_ip_target parameter.
On 10/14/25 1:52 AM, David Wilder wrote:
> +# Build stacked vlans on top of an interface.
> +stack_vlans()
> +{
> + RET=0
> + local interface="$1"
> + local ns=$2
> + local last="$interface"
> + local tags="10 20"
> +
> + if ! ip -n "${ns}" link show "${interface}" > /dev/null; then
> + RET=1
> + msg="Failed to create ${interface}"
> + return 1
> + fi
> +
> + if [ "$ns" == "${s_ns}" ]; then host=1; else host=10;fi
> +
> + for tag in $tags; do
> + ip -n "${ns}" link add link "$last" name "$last"."$tag" type vlan id "$tag"
> + ip -n "${ns}" address add 192."$tag".2."$host"/24 dev "$last"."$tag"
> + ip -n "${ns}" link set up dev "$last"."$tag"
> + last=$last.$tag
> + done
> +}
> +
> +wait_for_arp_request()
> +{
> + local target=$1
The indentation is inconsistent. Please always use a single tab.
> + local ip
> + local interface
> +
> + ip=$(echo "${target}" | awk -F "[" '{print $1}')
> + interface="$(ip -n "${c_ns}" -br addr show | grep "${ip}" | awk -F @ '{print $1}')"
> +
> + tc -n "${c_ns}" qdisc add dev "${interface}" clsact
> + tc -n "${c_ns}" filter add dev "${interface}" ingress protocol arp \
> + handle 101 flower skip_hw arp_op request arp_tip "${ip}" action pass
> +
> + slowwait_for_counter 5 5 tc_rule_handle_stats_get \
> + "dev ${interface} ingress" 101 ".packets" "-n ${c_ns}" &> /dev/null || RET=1
> +
> + tc -n "${c_ns}" filter del dev "${interface}" ingress
> + tc -n "${c_ns}" qdisc del dev "${interface}" clsact
> +
> + if [ "$RET" -ne 0 ]; then
> + msg="Arp probe not received by ${interface}"
> + return 1
> + fi
> +}
> +
> +# Check for link flapping.
> +# First verify the arp requests are being received
> +# by the target. Then verify that the Link Failure
> +# Counts are not increasing over time.
> +# Arp probes are sent every 100ms, two probes must
> +# be missed to trigger a slave failure. A one second
> +# wait should be sufficient.
> +check_failure_count()
> +{
> + local bond=$1
> + local target=$2
> + local proc_file=/proc/net/bonding/${bond}
> +
> + wait_for_arp_request "${target}" || return 1
> +
> + LinkFailureCount1=$(ip netns exec "${s_ns}" grep -F "Link Failure Count" "${proc_file}" \
> + | awk -F: '{ sum += $2 } END { print sum }')
> + sleep 1
> + LinkFailureCount2=$(ip netns exec "${s_ns}" grep -F "Link Failure Count" "${proc_file}" \
> + | awk -F: '{ sum += $2 } END { print sum }')
> +
> + [ "$LinkFailureCount1" != "$LinkFailureCount2" ] && RET=1
> +}
> +
> +setup_bond_topo()
> +{
> + setup_prepare
> + setup_wait
> + stack_vlans bond0 "${s_ns}"
> + stack_vlans eth0 "${c_ns}"
> +}
> +
> +skip_with_vlan_hints()
> +{
> + # check if iproute supports arp_ip_target with vlans option.
> + if ! ip -n "${s_ns}" link add bond2 type bond arp_ip_target 10.0.0.1[10]; then
> + ip -n "${s_ns}" link del bond2 2> /dev/null
> + return 0
> + fi
> + return 1
> +}
> +
> +no_vlan_hints()
> +{
> + RET=0
> + local targets="${c_ip4} ${c_ip4v10} ${c_ip4v20}"
> + local target
> + msg=""
> +
> + for target in $targets; do
> + bond_reset "mode $mode arp_interval 100 arp_ip_target ${target}"
> + stack_vlans bond0 "${s_ns}"
> + if [ "$RET" -ne 0 ]; then
> + log_test "no_vlan_hints" "${msg}"
> + return
> + fi
> + check_failure_count bond0 "${target}"
> + log_test "arp_ip_target=${target} ${msg}"
Please fix the alignment above.
/P
Powered by blists - more mailing lists