Debian Codegraph @

tests/lib/igb.sh

raw symbols SCIP
1 # -*- mode: shell-script; sh-shell: bash -*-
2 #
3 # Copyright (C) 2020-2025 Linutronix GmbH
4 # Author Kurt Kanzenbach <[email protected]>
5 #
6 # SPDX-License-Identifier: BSD-2-Clause
7 #
8 # Test setup library.
9 #
10
11 #
12 # igb_start($interface)
13 #
14 igb_start() {
15 local interface=$1
16
17 #
18 # Disable VLAN Rx offload for eBPF XDP programs.
19 #
20 ethtool -K "${interface}" rx-vlan-offload off
21
22 #
23 # Increase the number of Rx and Tx queues in case of $num_cpus < 4.
24 #
25 ethtool -L "${interface}" combined 4
26 }
27
28 #
29 # igb_end($interface)
30 #
31 igb_end() {
32 local interface=$1
33
34 #
35 # Increase Tx and Rx ring sizes.
36 #
37 ethtool -G "${interface}" rx 4096 tx 4096
38 }
39
40 #
41 # igb_rx_queues_assign($interface, @rx_queues)
42 #
43 # Rx queues assignment based on PCP values and EtherType.
44 #
45 igb_rx_queues_assign() {
46 local interface=$1
47 local -n rx_queues=$2
48 local len
49
50 len=${#rx_queues[@]}
51
52 if [ "$len" -ne 10 ]; then
53 echo "igb_rx_queues_assign: rx_queues array len has to be 10!"
54 return
55 fi
56
57 ethtool -K "${interface}" ntuple on
58
59 # PCP 7
60 ethtool -N "${interface}" flow-type ether vlan 0xe000 m 0x1fff action "${rx_queues[0]}"
61
62 # PCP 6
63 ethtool -N "${interface}" flow-type ether vlan 0xc000 m 0x1fff action "${rx_queues[1]}"
64
65 # PCP 5
66 ethtool -N "${interface}" flow-type ether vlan 0xa000 m 0x1fff action "${rx_queues[2]}"
67
68 # PCP 4
69 ethtool -N "${interface}" flow-type ether vlan 0x8000 m 0x1fff action "${rx_queues[3]}"
70
71 # PCP 3
72 ethtool -N "${interface}" flow-type ether vlan 0x6000 m 0x1fff action "${rx_queues[4]}"
73
74 # PCP 2
75 ethtool -N "${interface}" flow-type ether vlan 0x4000 m 0x1fff action "${rx_queues[5]}"
76
77 # PCP 1
78 ethtool -N "${interface}" flow-type ether vlan 0x2000 m 0x1fff action "${rx_queues[6]}"
79
80 # PCP 0
81 ethtool -N "${interface}" flow-type ether vlan 0x0000 m 0x1fff action "${rx_queues[7]}"
82
83 #
84 # PTP and LLDP are transmitted untagged. Steer them via EtherType.
85 #
86 ethtool -N "${interface}" flow-type ether proto 0x88f7 action "${rx_queues[8]}"
87 ethtool -N "${interface}" flow-type ether proto 0x88cc action "${rx_queues[9]}"
88 }