# Tunables
NUM_PKTS=1000
STREAM_VID=100
STREAM_PRIO=6 # Use a conservative cycle of 10 ms to allow the test to still pass when the # kernel has some extra overhead like lockdep etc
CYCLE_TIME_NS=10000000 # Create two Gate Control List entries, one OPEN and one CLOSE, of equal # durations
GATE_DURATION_NS=$((${CYCLE_TIME_NS} / 2)) # Give 2/3 of the cycle time to user space and 1/3 to the kernel
FUDGE_FACTOR=$((${CYCLE_TIME_NS} / 3)) # Shift the isochron base time by half the gate time, so that packets are # always received by swp1 close to the middle of the time slot, to minimize # inaccuracies due to network sync
SHIFT_TIME_NS=$((${GATE_DURATION_NS} / 2))
switch_create()
{
local h2_mac_addr=$(mac_get $h2)
ip link set ${swp1} up
ip link set ${swp2} up
ip link add br0 type bridge vlan_filtering 1
ip link set ${swp1} master br0
ip link set ${swp2} master br0
ip link set br0 up
bridge vlan add dev ${swp2} vid ${STREAM_VID}
bridge vlan add dev ${swp1} vid ${STREAM_VID} # PSFP on Ocelot requires the filter to also be added to the bridge # FDB, and not be removed
bridge fdb add dev ${swp2} \
${h2_mac_addr} vlan ${STREAM_VID} static master
switch_destroy()
{
psfp_chain_destroy ${swp1}
ip link del br0
}
txtime_setup()
{
local if_name=$1
tc qdisc add dev ${if_name} clsact # Classify PTP on TC 7 and isochron on TC 6
tc filter add dev ${if_name} egress protocol 0x88f7 \
flower action skbedit priority 7
tc filter add dev ${if_name} egress protocol 802.1Q \
flower vlan_ethtype 0xdead action skbedit priority 6
tc qdisc add dev ${if_name} handle 100: parent root mqprio num_tc 8 \
queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
map 0 1 2 3 4 5 6 7 \
hw 1 # Set up TC 6 for SO_TXTIME. tc-mqprio queues count from 1.
tc qdisc replace dev ${if_name} parent 100:$((${STREAM_PRIO} + 1)) etf \
clockid CLOCK_TAI offload delta ${FUDGE_FACTOR}
}
txtime_cleanup()
{
local if_name=$1
tc qdisc del dev ${if_name} root
tc qdisc del dev ${if_name} clsact
}
setup_prepare()
{
vrf_prepare
h1_create
h2_create
switch_create
txtime_setup ${h1}
# Set up swp1 as a master PHC for h1, synchronized to the local # CLOCK_REALTIME.
phc2sys_start ${UDS_ADDRESS_SWP1}
# Assumption true for LS1028A: h1 and h2 use the same PHC. So by # synchronizing h1 to swp1 via PTP, h2 is also implicitly synchronized # to swp1 (and both to CLOCK_REALTIME).
ptp4l_start ${h1} true ${UDS_ADDRESS_H1}
ptp4l_start ${swp1} false ${UDS_ADDRESS_SWP1}
# Make sure there are no filter matches at the beginning of the test
psfp_filter_check 0
}
received=$(isochron_report_num_received "${isochron_dat}") if [ "${received}" = "${expected}" ]; then
RET=0 else
RET=1 echo"Expected isochron to receive ${expected} packets but received ${received}" fi
log_test "${test_name}"
if [ "$RET" = "1" ]; then
${debug} "${isochron_dat}" fi
rm ${isochron_dat} 2> /dev/null
}
test_gate_in_band()
{ # Send packets in-band with the OPEN gate entry
run_test 0.000000000 ${NUM_PKTS} "In band" \
debug_incorrectly_dropped_packets
psfp_filter_check ${NUM_PKTS}
}
test_gate_out_of_band()
{ # Send packets in-band with the CLOSE gate entry
run_test 0.005000000 0 "Out of band" \
debug_incorrectly_received_packets
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.