Skip to content

Commit

Permalink
selftests/net: optmem_max became per netns
Browse files Browse the repository at this point in the history
/proc/sys/net/core/optmem_max is now per netns, change two tests
that were saving/changing/restoring its value on the parent netns.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Dec 15, 2023
1 parent f5769fa commit 18872ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions tools/testing/selftests/net/io_uring_zerocopy_tx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,22 @@ case "${TXMODE}" in
esac

# Start of state changes: install cleanup handler
save_sysctl_mem="$(sysctl -n ${path_sysctl_mem})"

cleanup() {
ip netns del "${NS2}"
ip netns del "${NS1}"
sysctl -w -q "${path_sysctl_mem}=${save_sysctl_mem}"
}

trap cleanup EXIT

# Configure system settings
sysctl -w -q "${path_sysctl_mem}=1000000"

# Create virtual ethernet pair between network namespaces
ip netns add "${NS1}"
ip netns add "${NS2}"

# Configure system settings
ip netns exec "${NS1}" sysctl -w -q "${path_sysctl_mem}=1000000"
ip netns exec "${NS2}" sysctl -w -q "${path_sysctl_mem}=1000000"

ip link add "${DEV}" mtu "${DEV_MTU}" netns "${NS1}" type veth \
peer name "${DEV}" mtu "${DEV_MTU}" netns "${NS2}"

Expand Down
9 changes: 4 additions & 5 deletions tools/testing/selftests/net/msg_zerocopy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,22 @@ case "${TXMODE}" in
esac

# Start of state changes: install cleanup handler
save_sysctl_mem="$(sysctl -n ${path_sysctl_mem})"

cleanup() {
ip netns del "${NS2}"
ip netns del "${NS1}"
sysctl -w -q "${path_sysctl_mem}=${save_sysctl_mem}"
}

trap cleanup EXIT

# Configure system settings
sysctl -w -q "${path_sysctl_mem}=1000000"

# Create virtual ethernet pair between network namespaces
ip netns add "${NS1}"
ip netns add "${NS2}"

# Configure system settings
ip netns exec "${NS1}" sysctl -w -q "${path_sysctl_mem}=1000000"
ip netns exec "${NS2}" sysctl -w -q "${path_sysctl_mem}=1000000"

ip link add "${DEV}" mtu "${DEV_MTU}" netns "${NS1}" type veth \
peer name "${DEV}" mtu "${DEV_MTU}" netns "${NS2}"

Expand Down

0 comments on commit 18872ba

Please sign in to comment.