Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: tc-testing: add mirred to block tdc tests

Add 8 new mirred tdc tests that target mirred to block:

- Add mirred mirror to egress block action
- Add mirred mirror to ingress block action
- Add mirred redirect to egress block action
- Add mirred redirect to ingress block action
- Try to add mirred action with both dev and block
- Try to add mirred action without specifying neither dev nor block
- Replace mirred redirect to dev action with redirect to block
- Replace mirred redirect to block action with mirror to dev

Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20240202020726.529170-1-victor@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Victor Nogueira and committed by
Jakub Kicinski
f51470c5 709990df

+396
+396
tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json
··· 649 649 "teardown": [ 650 650 "$TC actions flush action mirred" 651 651 ] 652 + }, 653 + { 654 + "id": "456d", 655 + "name": "Add mirred mirror to egress block action", 656 + "category": [ 657 + "actions", 658 + "mirred" 659 + ], 660 + "plugins": { 661 + "requires": "nsPlugin" 662 + }, 663 + "setup": [ 664 + [ 665 + "$TC actions flush action mirred", 666 + 0, 667 + 1, 668 + 255 669 + ], 670 + [ 671 + "$TC qdisc add dev $DEV1 egress_block 21 clsact", 672 + 0 673 + ] 674 + ], 675 + "cmdUnderTest": "$TC actions add action mirred egress mirror index 1 blockid 21", 676 + "expExitCode": "0", 677 + "verifyCmd": "$TC -j actions get action mirred index 1", 678 + "matchJSON": [ 679 + { 680 + "total acts": 0 681 + }, 682 + { 683 + "actions": [ 684 + { 685 + "order": 1, 686 + "kind": "mirred", 687 + "mirred_action": "mirror", 688 + "direction": "egress", 689 + "to_blockid": 21, 690 + "control_action": { 691 + "type": "pipe" 692 + }, 693 + "index": 1, 694 + "ref": 1, 695 + "bind": 0, 696 + "not_in_hw": true 697 + } 698 + ] 699 + } 700 + ], 701 + "matchCount": "1", 702 + "teardown": [ 703 + "$TC qdisc del dev $DEV1 egress_block 21 clsact", 704 + "$TC actions flush action mirred" 705 + ] 706 + }, 707 + { 708 + "id": "2358", 709 + "name": "Add mirred mirror to ingress block action", 710 + "category": [ 711 + "actions", 712 + "mirred" 713 + ], 714 + "plugins": { 715 + "requires": "nsPlugin" 716 + }, 717 + "setup": [ 718 + [ 719 + "$TC actions flush action mirred", 720 + 0, 721 + 1, 722 + 255 723 + ], 724 + [ 725 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 726 + 0 727 + ] 728 + ], 729 + "cmdUnderTest": "$TC actions add action mirred ingress mirror index 1 blockid 21", 730 + "expExitCode": "0", 731 + "verifyCmd": "$TC -j actions get action mirred index 1", 732 + "matchJSON": [ 733 + { 734 + "total acts": 0 735 + }, 736 + { 737 + "actions": [ 738 + { 739 + "order": 1, 740 + "kind": "mirred", 741 + "mirred_action": "mirror", 742 + "direction": "ingress", 743 + "to_blockid": 21, 744 + "control_action": { 745 + "type": "pipe" 746 + }, 747 + "index": 1, 748 + "ref": 1, 749 + "bind": 0, 750 + "not_in_hw": true 751 + } 752 + ] 753 + } 754 + ], 755 + "matchCount": "1", 756 + "teardown": [ 757 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 758 + "$TC actions flush action mirred" 759 + ] 760 + }, 761 + { 762 + "id": "fdb1", 763 + "name": "Add mirred redirect to egress block action", 764 + "category": [ 765 + "actions", 766 + "mirred" 767 + ], 768 + "plugins": { 769 + "requires": "nsPlugin" 770 + }, 771 + "setup": [ 772 + [ 773 + "$TC actions flush action mirred", 774 + 0, 775 + 1, 776 + 255 777 + ], 778 + [ 779 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 780 + 0 781 + ] 782 + ], 783 + "cmdUnderTest": "$TC actions add action mirred egress redirect index 1 blockid 21", 784 + "expExitCode": "0", 785 + "verifyCmd": "$TC -j actions get action mirred index 1", 786 + "matchJSON": [ 787 + { 788 + "total acts": 0 789 + }, 790 + { 791 + "actions": [ 792 + { 793 + "order": 1, 794 + "kind": "mirred", 795 + "mirred_action": "redirect", 796 + "direction": "egress", 797 + "to_blockid": 21, 798 + "control_action": { 799 + "type": "stolen" 800 + }, 801 + "index": 1, 802 + "ref": 1, 803 + "bind": 0, 804 + "not_in_hw": true 805 + } 806 + ] 807 + } 808 + ], 809 + "matchCount": "1", 810 + "teardown": [ 811 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 812 + "$TC actions flush action mirred" 813 + ] 814 + }, 815 + { 816 + "id": "20cc", 817 + "name": "Add mirred redirect to ingress block action", 818 + "category": [ 819 + "actions", 820 + "mirred" 821 + ], 822 + "plugins": { 823 + "requires": "nsPlugin" 824 + }, 825 + "setup": [ 826 + [ 827 + "$TC actions flush action mirred", 828 + 0, 829 + 1, 830 + 255 831 + ], 832 + [ 833 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 834 + 0 835 + ] 836 + ], 837 + "cmdUnderTest": "$TC actions add action mirred ingress redirect index 1 blockid 21", 838 + "expExitCode": "0", 839 + "verifyCmd": "$TC -j actions get action mirred index 1", 840 + "matchJSON": [ 841 + { 842 + "total acts": 0 843 + }, 844 + { 845 + "actions": [ 846 + { 847 + "order": 1, 848 + "kind": "mirred", 849 + "mirred_action": "redirect", 850 + "direction": "ingress", 851 + "to_blockid": 21, 852 + "control_action": { 853 + "type": "stolen" 854 + }, 855 + "index": 1, 856 + "ref": 1, 857 + "bind": 0, 858 + "not_in_hw": true 859 + } 860 + ] 861 + } 862 + ], 863 + "matchCount": "1", 864 + "teardown": [ 865 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 866 + "$TC actions flush action mirred" 867 + ] 868 + }, 869 + { 870 + "id": "e739", 871 + "name": "Try to add mirred action with both dev and block", 872 + "category": [ 873 + "actions", 874 + "mirred" 875 + ], 876 + "plugins": { 877 + "requires": "nsPlugin" 878 + }, 879 + "setup": [ 880 + [ 881 + "$TC actions flush action mirred", 882 + 0, 883 + 1, 884 + 255 885 + ], 886 + [ 887 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 888 + 0 889 + ] 890 + ], 891 + "cmdUnderTest": "$TC actions add action mirred ingress redirect index 1 blockid 21 dev $DEV1", 892 + "expExitCode": "255", 893 + "verifyCmd": "$TC -j actions list action mirred", 894 + "matchJSON": [], 895 + "matchCount": "1", 896 + "teardown": [ 897 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 898 + "$TC actions flush action mirred" 899 + ] 900 + }, 901 + { 902 + "id": "2f47", 903 + "name": "Try to add mirred action without specifying neither dev nor block", 904 + "category": [ 905 + "actions", 906 + "mirred" 907 + ], 908 + "plugins": { 909 + "requires": "nsPlugin" 910 + }, 911 + "setup": [ 912 + [ 913 + "$TC actions flush action mirred", 914 + 0, 915 + 1, 916 + 255 917 + ], 918 + [ 919 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 920 + 0 921 + ] 922 + ], 923 + "cmdUnderTest": "$TC actions add action mirred ingress redirect index 1", 924 + "expExitCode": "255", 925 + "verifyCmd": "$TC -j actions list action mirred", 926 + "matchJSON": [], 927 + "matchCount": "1", 928 + "teardown": [ 929 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 930 + "$TC actions flush action mirred" 931 + ] 932 + }, 933 + { 934 + "id": "3188", 935 + "name": "Replace mirred redirect to dev action with redirect to block", 936 + "category": [ 937 + "actions", 938 + "mirred" 939 + ], 940 + "plugins": { 941 + "requires": "nsPlugin" 942 + }, 943 + "setup": [ 944 + [ 945 + "$TC actions flush action mirred", 946 + 0, 947 + 1, 948 + 255 949 + ], 950 + [ 951 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 952 + 0 953 + ], 954 + [ 955 + "$TC actions add action mirred ingress redirect index 1 dev $DEV1", 956 + 0 957 + ] 958 + ], 959 + "cmdUnderTest": "$TC actions replace action mirred egress redirect index 1 blockid 21", 960 + "expExitCode": "0", 961 + "verifyCmd": "$TC -j actions get action mirred index 1", 962 + "matchJSON": [ 963 + { 964 + "total acts": 0 965 + }, 966 + { 967 + "actions": [ 968 + { 969 + "order": 1, 970 + "kind": "mirred", 971 + "mirred_action": "redirect", 972 + "direction": "egress", 973 + "to_blockid": 21, 974 + "control_action": { 975 + "type": "stolen" 976 + }, 977 + "index": 1, 978 + "ref": 1, 979 + "bind": 0, 980 + "not_in_hw": true 981 + } 982 + ] 983 + } 984 + ], 985 + "matchCount": "1", 986 + "teardown": [ 987 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 988 + "$TC actions flush action mirred" 989 + ] 990 + }, 991 + { 992 + "id": "83cc", 993 + "name": "Replace mirred redirect to block action with mirror to dev", 994 + "category": [ 995 + "actions", 996 + "mirred" 997 + ], 998 + "plugins": { 999 + "requires": "nsPlugin" 1000 + }, 1001 + "setup": [ 1002 + [ 1003 + "$TC actions flush action mirred", 1004 + 0, 1005 + 1, 1006 + 255 1007 + ], 1008 + [ 1009 + "$TC qdisc add dev $DEV1 ingress_block 21 clsact", 1010 + 0 1011 + ], 1012 + [ 1013 + "$TC actions add action mirred egress redirect index 1 blockid 21", 1014 + 0 1015 + ] 1016 + ], 1017 + "cmdUnderTest": "$TC actions replace action mirred ingress mirror index 1 dev lo", 1018 + "expExitCode": "0", 1019 + "verifyCmd": "$TC -j actions get action mirred index 1", 1020 + "matchJSON": [ 1021 + { 1022 + "total acts": 0 1023 + }, 1024 + { 1025 + "actions": [ 1026 + { 1027 + "order": 1, 1028 + "kind": "mirred", 1029 + "mirred_action": "mirror", 1030 + "direction": "ingress", 1031 + "to_dev": "lo", 1032 + "control_action": { 1033 + "type": "pipe" 1034 + }, 1035 + "index": 1, 1036 + "ref": 1, 1037 + "bind": 0, 1038 + "not_in_hw": true 1039 + } 1040 + ] 1041 + } 1042 + ], 1043 + "matchCount": "1", 1044 + "teardown": [ 1045 + "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 1046 + "$TC actions flush action mirred" 1047 + ] 652 1048 } 653 1049 ]