2020-09-21 14:55:20 +00:00
|
|
|
#!/usr/bin/env atf-sh
|
|
|
|
|
|
|
|
. $(atf_get_srcdir)/../test_env.sh
|
|
|
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/ethtool"
|
|
|
|
|
|
|
|
tests_init \
|
|
|
|
pre_up_msglvl \
|
|
|
|
pre_up_ethernet_port \
|
|
|
|
up_speed \
|
|
|
|
up_duplex \
|
|
|
|
up_wol \
|
|
|
|
up_wol_sopass \
|
|
|
|
up_autoneg_simple \
|
2020-09-21 15:10:01 +00:00
|
|
|
up_autoneg_mask \
|
|
|
|
up_pause_autoneg \
|
|
|
|
up_pause_tx \
|
2020-09-21 15:18:08 +00:00
|
|
|
up_pause_rx \
|
|
|
|
up_offload_gro \
|
|
|
|
up_offload_gso \
|
|
|
|
up_offload_lro \
|
|
|
|
up_offload_rx \
|
|
|
|
up_offload_sg \
|
|
|
|
up_offload_tso \
|
|
|
|
up_offload_tx \
|
2020-09-21 15:38:39 +00:00
|
|
|
up_offload_ufo \
|
|
|
|
up_dma_ring_rx \
|
|
|
|
up_dma_ring_rx_jumbo \
|
|
|
|
up_dma_ring_rx_mini \
|
|
|
|
up_dma_ring_tx
|
2020-09-21 14:55:20 +00:00
|
|
|
|
|
|
|
pre_up_msglvl_body() {
|
|
|
|
export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'msglvl debug on' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_up_ethernet_port_body() {
|
|
|
|
export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_ETHERNET_PORT="4" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'port 4' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_speed_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_LINK_SPEED="1000" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'speed 1000' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_duplex_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_LINK_DUPLEX="full" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'duplex full' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_wol_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_WOL="g" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'wol g' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_wol_sopass_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_WOL="s abc123" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'wol s sopass abc123' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_autoneg_simple_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'autoneg on' \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'autoneg off' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_autoneg_mask_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="1000/full" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --change eth0' \
|
|
|
|
-o match:'autoneg on advertise 1000/full' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
2020-09-21 15:10:01 +00:00
|
|
|
|
|
|
|
up_pause_autoneg_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --pause eth0' \
|
|
|
|
-o match:"autoneg 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --pause eth0' \
|
|
|
|
-o match:"autoneg 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_pause_tx_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --pause eth0' \
|
|
|
|
-o match:"tx 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --pause eth0' \
|
|
|
|
-o match:"tx 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_pause_rx_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --pause eth0' \
|
|
|
|
-o match:"rx 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --pause eth0' \
|
|
|
|
-o match:"rx 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
2020-09-21 15:18:08 +00:00
|
|
|
|
|
|
|
up_offload_gro_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"gro 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"gro 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_gso_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"gso 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"gso 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_lro_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"lro 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"lro 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_rx_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"rx 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"rx 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_sg_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"sg 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"sg 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_tso_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"tso 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"tso 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_tx_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"tx 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"tx 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_offload_ufo_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="on" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"ufo 'on'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="off" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --offload eth0' \
|
|
|
|
-o match:"ufo 'off'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
2020-09-21 15:38:39 +00:00
|
|
|
|
|
|
|
up_dma_ring_rx_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX="1024" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --set-ring eth0' \
|
|
|
|
-o match:"rx '1024'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_dma_ring_rx_jumbo_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_JUMBO="1024" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --set-ring eth0' \
|
|
|
|
-o match:"rx-jumbo '1024'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_dma_ring_rx_mini_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_MINI="1024" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --set-ring eth0' \
|
|
|
|
-o match:"rx-mini '1024'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
up_dma_ring_tx_body() {
|
|
|
|
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_TX="1024" MOCK="echo"
|
|
|
|
atf_check -s exit:0 \
|
|
|
|
-o match:'ethtool --set-ring eth0' \
|
|
|
|
-o match:"tx '1024'" \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|