1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# Regression tests for the SO_TXTIME interface
5
6# Run in network namespace
7if [[ $# -eq 0 ]]; then
8	./in_netns.sh $0 __subprocess
9	exit $?
10fi
11
12set -e
13
14tc qdisc add dev lo root fq
15./so_txtime -4 -6 -c mono a,-1 a,-1
16./so_txtime -4 -6 -c mono a,0 a,0
17./so_txtime -4 -6 -c mono a,10 a,10
18./so_txtime -4 -6 -c mono a,10,b,20 a,10,b,20
19./so_txtime -4 -6 -c mono a,20,b,10 b,20,a,20
20
21if tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 200000; then
22	! ./so_txtime -4 -6 -c tai a,-1 a,-1
23	! ./so_txtime -4 -6 -c tai a,0 a,0
24	./so_txtime -4 -6 -c tai a,10 a,10
25	./so_txtime -4 -6 -c tai a,10,b,20 a,10,b,20
26	./so_txtime -4 -6 -c tai a,20,b,10 b,10,a,20
27else
28	echo "tc ($(tc -V)) does not support qdisc etf. skipping"
29fi
30
31echo OK. All tests passed
32