diff options
Diffstat (limited to 'usr/src')
30 files changed, 790 insertions, 253 deletions
diff --git a/usr/src/test/net-tests/runfiles/default.run b/usr/src/test/net-tests/runfiles/default.run index ff5a3cac6e..c5c6c7dc91 100644 --- a/usr/src/test/net-tests/runfiles/default.run +++ b/usr/src/test/net-tests/runfiles/default.run @@ -20,10 +20,25 @@ timeout = 60 [/opt/net-tests/tests/forwarding] tests = [ - 'ip_fwd_no_cksum', - 'ip_fwd_partial_cksum', - 'ip_fwd_full_cksum', - 'ip_fwd_partial_cksum_lso', - 'ip_fwd_full_cksum_lso' - ] + 'ip_fwd_001', + 'ip_fwd_002', + 'ip_fwd_003', + 'ip_fwd_004', + 'ip_fwd_005', + 'ip_fwd_006', + 'ip_fwd_007', + 'ip_fwd_008', + 'ip_fwd_009', + 'ip_fwd_010', + 'ip_fwd_011', + 'ip_fwd_012', + 'ip_fwd_013', + 'ip_fwd_014', + 'ip_fwd_015', + 'ip_fwd_016', + 'ip_fwd_017', + 'ip_fwd_018', + 'ip_fwd_019', + 'ip_fwd_020' + ] user = root diff --git a/usr/src/test/net-tests/tests/forwarding/Makefile b/usr/src/test/net-tests/tests/forwarding/Makefile index 30a95b7fe9..566db8c86d 100644 --- a/usr/src/test/net-tests/tests/forwarding/Makefile +++ b/usr/src/test/net-tests/tests/forwarding/Makefile @@ -20,11 +20,27 @@ TESTDIR = $(ROOTOPTPKG)/tests/forwarding PROG = \ ip_forwarding \ - ip_fwd_no_cksum \ - ip_fwd_partial_cksum \ - ip_fwd_full_cksum \ - ip_fwd_partial_cksum_lso \ - ip_fwd_full_cksum_lso + ip_fwd_suite \ + ip_fwd_001 \ + ip_fwd_002 \ + ip_fwd_003 \ + ip_fwd_004 \ + ip_fwd_005 \ + ip_fwd_006 \ + ip_fwd_007 \ + ip_fwd_008 \ + ip_fwd_009 \ + ip_fwd_010 \ + ip_fwd_011 \ + ip_fwd_012 \ + ip_fwd_013 \ + ip_fwd_014 \ + ip_fwd_015 \ + ip_fwd_016 \ + ip_fwd_017 \ + ip_fwd_018 \ + ip_fwd_019 \ + ip_fwd_020 DOC = $(TESTDIR)/README diff --git a/usr/src/test/net-tests/tests/forwarding/README b/usr/src/test/net-tests/tests/forwarding/README index 626dbe55e4..b291d5d45b 100644 --- a/usr/src/test/net-tests/tests/forwarding/README +++ b/usr/src/test/net-tests/tests/forwarding/README @@ -16,51 +16,86 @@ different variations. All tests require three zones. The tests use these three zones, along with the simnet driver, to emulate a real IP forwarding scenario involving multiple hosts. All tests verify that TCP, UDP, ICMP, IPv4/IPv6, and fragmented IPv4/IPv6 traffic can cross -the IP forwarding datapath. All tests send traffic across both "the -wire" (simnet) and the special MAC-loopback path. Each test differs in -its emulation of various hardware offload features (which would -typically be presented by real NICs). There is no emulation of Rx -checksum offload; all packets will be software checksummed by IP -input. In the future we may want to add variations where Rx checksum -offload is in play as that's a typical feature provided by NICs. - -The diagram below gives a visual representation of the situation we -are testing and shows how the test components relate to each other. - -+----------------------------+ +----------------------------+ -|client host (ipft_nic0) | |server host (ipft_nic1) | -| | | +------------------------+ | -| +----------------------+ | | |router zone | | -| |ipft_client0 | | | | | | -| |192.168.77.2 |<-+----+ | |+----------------------+| | -| |fd00:0:1:4d::2 | | | | ||ipft_client_r0 || | -| +----------------------+ | Wire --+->|192.168.77.1 || | -+----------------------------+ | ||fd00:0:1:4d::1 || | - | |+----------------------+| | - | | ^ | | - | | | | | - | | IP | | | - | | forwarding | | | - | | | | | - | | v | | - | |+----------------------+| | - | ||ipft_server_r0 || | - | ||VLAN 5 || | - +-----+->|192.168.88.1 || | - | | ||fd00:0:1:58::1 || | - | | |+----------------------+| | - | | +------------------------+ | - MAC-loopback | | | - | | +------------------------+ | - | | |server zone | | - | | | | | - | | |+----------------------+| | - | | ||ipft_server0 || | - | | ||VLAN 5 || | - +-----+->|192.168.88.2 || | - | ||fd00:0:1:58::2 || | - | |+----------------------+| | - | +------------------------+ | +the IP forwarding datapath. Each test differs in its emulation of +various hardware offload features (which would typically be presented +by real NICs). The diagrams below gives a visual representation of the +situations we are testing and shows how the test components relate to +each other. + +no mac-loopback +--------------- + +In this configuration we make sure that the packet travels from server +to router via "the wire". + + +----------------------------+ ++----------------------------+ |router zone | +|client zone | | +-------------------------+| +|(ipft_client_nic0) | | |ipft_router_nic0 || +| +----------------------+ | | |+----------------------+ || +| |ipft_client0 | | | ||ipft_client_r0 | || +| |192.168.77.2 |<-+-- Wire --+->|192.168.77.1 | || +| |fd00:0:1:4d::2 | | | ||fd00:0:1:4d::1 | || +| +----------------------+ | | |+----------------------+ || ++----------------------------+ | +-------------------------+| + | ^ | + | | | + | | | + | | | + | | | + | IP | | + | forwarding | | + | | | + | | | + | | | ++----------------------------+ | v | +|server zone | |+-------------------------+ | +|(ipft_server_nic0) | ||ipft_router_nic1 | | +| +----------------------+ | || +----------------------+| | +| |ipft_server0 | | || |ipft_server_r0 || | +| |VLAN 5 | | Wire || |VLAN 5 || | +| |192.168.88.2 |<-+----------++>|192.168.88.1 || | +| |fd00:0:1:58::2 | | || |fd00:0:1:58::1 || | +| +----------------------+ | || +----------------------+| | ++----------------------------+ |+-------------------------+ | + +----------------------------+ + +mac-loopback +------------ + +In this configuration we make sure that the packet travels from server +to router via mac-loopback. + + +----------------------------+ ++----------------------------+ |router zone | +|client zone | | +-------------------------+| +|(ipft_nic0) | | |ipft_nic1 || +| +----------------------+ | | |+----------------------+ || +| |ipft_client0 | | | ||ipft_client_r0 | || +| |192.168.77.2 |<-+-- Wire --+->|192.168.77.1 | || +| |fd00:0:1:4d::2 | | | ||fd00:0:1:4d::1 | || +| +----------------------+ | | |+----------------------+ || ++----------------------------+ | +-------------------------+| + | ^ | + | | | + | | | + | | | + | | | + | IP | | + | forwarding | | + | | | + | | | + | | | ++----------------------------+ | v | +|server zone | |+-------------------------+ | +|(ipft_nic1) | ||ipft_nic1 | | +| +----------------------+ | || +----------------------+| | +| |ipft_server0 | | MAC || |ipft_server_r0 || | +| |VLAN 5 | | loopback || |VLAN 5 || | +| |192.168.88.2 |<-+----------++>|192.168.88.1 || | +| |fd00:0:1:58::2 | | || |fd00:0:1:58::1 || | +| +----------------------+ | || +----------------------+| | ++----------------------------+ |+-------------------------+ | +----------------------------+ Requirements @@ -87,38 +122,59 @@ ip_fowarding The main test script; it provides the logic for all the tests below. The different test variations are controlled by options - and it takes the three zones as arguments. This script is also - easily run by hand if you want to bypass the test-runner - framework. The rest of the test sripts are meant for - consumption by the test-runner framework and are wrappers - around this script. - -ip_fwd_no_cksum - - Tests IP forwarding with no hardware offloads on any of the - interfaces. - -ip_fwd_partial_cksum - - Tests IP forwarding with partial Tx checksum offload and IPv4 - header checksum offload enabled on both interfaces. - -ip_fwd_full_cksum + and it takes the three zones as arguments. This script may be + run by hand but it's easier to use ip_fwd_suite for that + purpose. - Tests IP forwarding with full Tx checksum offload and IPv4 - header checksum offload enabled on both interfaces. +ip_fwd_suite -ip_fwd_partial_cksum_lso + This script runs the various configurations of the IP + forwarding test suite. You can run the entire suite or just a + single test via the '-n' option. The "Test Matrix" section + below gives an overview of all the tests in the suite. - Tests IP forwarding with partial Tx checksum offload, IPv4 - header checksum offload, and TCP LSO on both interfaces. +ip_fwd_XXX -ip_fwd_full_cksum_lso + These scripts are mostly here to work around the fact that the + test-runner cannot pass arguments to individual tests. In + order to avoid running everything as the "ip_fwd_suite" test, + we create a file for each configuration. This gives individual + reporting of each test and steers us clear of tripping the + timeout. You can also run these scripts by hand like so: - Tests IP forwarding with full Tx checksum offload, IPv4 header - checksum offload, and TCP LSO on both interfaces. + NET_TESTS=/opt/net-tests /opt/net-tests/tests/forwarding/ip_fwd_001 config/ip_forwarding.config This file must be modified to contain the names of the zones - the user crated for running these tests.
\ No newline at end of file + the user crated for running these tests. + +Test Matrix +----------- + +This is a breakdown of all the tests in the IP forwarding test suite. +If a given offload is enabled or disable, it is done so for all +interfaces involved in the test. + +NAME Tx IP Tx ULP LSO Rx IP mac-loopback +001 off none off off no +002 on partial off off no +003 on partial on off no +004 on fullv4 off off no +005 on fullv4 on off no +006 off none off on no +007 on partial off on no +008 on partial on on no +009 on fullv4 off on no +010 on fullv4 on on no + +011 off none off off yes +012 on partial off off yes +013 on partial on off yes +014 on fullv4 off off yes +015 on fullv4 on off yes +016 off none off on yes +017 on partial off on yes +018 on partial on on yes +019 on fullv4 off on yes +020 on fullv4 on on yes diff --git a/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh b/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh index 74784fb494..d93260f86d 100644 --- a/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh +++ b/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh @@ -16,22 +16,27 @@ # # Usage: # -# ip_forwarding.ksh -flnpvu <client> <router> <server> +# ip_forwarding.ksh -bcflnpuv <client> <router> <server> # # Where client, router, and server are the UUIDs of three native # zones. The user must create and start these zones; but other # than that there is no special configuration required for them. # +# -b Place server and router on same underlying simnet, causing +# them to talk via MAC-loopback. +# # -c Run cleanup only. # -# -f Full ULP hardware checksum. +# -f Enable Tx ULP hardware checksum. # -# -l Hardware TCP LSO. +# -l Enable TCP LSO. # # -n No cleanup: the various artifacts created by this script will # remain after execution. # -# -p Partial ULP hardware checksum. +# -p Enabled partial Tx ULP hardware checksum. +# +# -r Enable Rx IPv4 header checksum offload. # # -u Run UDP tests. # @@ -47,6 +52,11 @@ fi function cleanup { + if ((nt_cleanup == 0)); then + dbg "skipping cleanup" + return 0 + fi + rm -rf ${nt_tdirprefix}* zlogin $nt_client rm -rf ${nt_tdirprefix}* zlogin $nt_server rm -rf ${nt_tdirprefix}* @@ -75,28 +85,31 @@ function cleanup delete_if $nt_router ipft_server_r0 delete_if $nt_server ipft_server0 - delete_vnic ipft_client0 ipft_nic0 0 $nt_client - delete_vnic ipft_client_r0 ipft_nic1 0 $nt_router - delete_vnic ipft_server_r0 ipft_nic1 5 $nt_router - delete_vnic ipft_server0 ipft_nic1 5 $nt_server + delete_vnic ipft_client0 0 $nt_client + delete_vnic ipft_client_r0 0 $nt_router + delete_vnic ipft_server_r0 5 $nt_router + delete_vnic ipft_server0 5 $nt_server - delete_simnet ipft_nic0 - delete_simnet ipft_nic1 + for nt_name in ${nt_nics[@]}; do + delete_simnet $nt_name + done } function usage { - echo "$nt_tname -cflnpuv <client> <router> <server>" >&2 + echo "$nt_tname -bcflnpruv <client> <router> <server>" >&2 } # # Set test defaults. # nt_tname=${NT_TNAME:-$(basename $0)} +nt_loopback=0 nt_ulp_full=0 nt_ulp_partial=0 nt_tcp_lso=0 nt_udp=0 +nt_rx_ip_cksum=0 nt_cleanup=1 nt_cleanup_only=0 @@ -120,9 +133,14 @@ nt_server_subnet6=fd00:0:1:58::/64 nt_server_router_ip6=fd00:0:1:58::1 nt_server_ip6=fd00:0:1:58::2 nt_port6=7776 +nt_bridge=ipft_switch +typeset -A nt_nics -while getopts "cflnpuv" opt; do +while getopts "bcflnpruv" opt; do case $opt in + b) + nt_loopback=1 + ;; c) nt_cleanup_only=1 ;; @@ -138,6 +156,9 @@ while getopts "cflnpuv" opt; do p) nt_ulp_partial=1 ;; + r) + nt_rx_ip_cksum=1 + ;; u) nt_udp=1 ;; @@ -188,6 +209,16 @@ if ! zlogin $nt_server ls /usr/bin/socat > /dev/null; then fail "zone $nt_client missing socat" fi +if ((nt_loopback == 0)); then + nt_nics[0]=ipft_client_nic0 + nt_nics[1]=ipft_router_nic0 + nt_nics[2]=ipft_router_nic1 + nt_nics[3]=ipft_server_nic0 +else + nt_nics[0]=ipft_nic0 + nt_nics[1]=ipft_nic1 +fi + # # Make a best effort to cleanup artifacts from a previous run. # @@ -203,34 +234,52 @@ mkdir $nt_tdir zlogin $nt_client mkdir $nt_tdir zlogin $nt_server mkdir $nt_tdir -create_simnet ipft_nic0 -create_simnet ipft_nic1 -link_simnets ipft_nic0 ipft_nic1 +trap cleanup ERR -if ((nt_ulp_partial == 1)); then - set_linkprop ipft_nic0 _tx_ulp_cksum partial - set_linkprop ipft_nic1 _tx_ulp_cksum partial -fi +for nt_name in ${nt_nics[@]}; do + create_simnet $nt_name +done -if ((nt_ulp_full == 1)); then - set_linkprop ipft_nic0 _tx_ulp_cksum fullv4 - set_linkprop ipft_nic1 _tx_ulp_cksum fullv4 +if ((nt_loopback == 0)); then + link_simnets ${nt_nics[0]} ${nt_nics[1]} + link_simnets ${nt_nics[2]} ${nt_nics[3]} +else + link_simnets ${nt_nics[0]} ${nt_nics[1]} fi -if ((nt_ulp_full == 1)) || ((nt_ulp_partial == 1)); then - set_linkprop ipft_nic0 _tx_ipv4_cksum on - set_linkprop ipft_nic1 _tx_ipv4_cksum on -fi +for nt_name in ${nt_nics[@]}; do + if ((nt_ulp_partial == 1)); then + set_linkprop $nt_name _tx_ulp_cksum partial + fi -if ((nt_tcp_lso == 1)); then - set_linkprop ipft_nic0 _lso on - set_linkprop ipft_nic1 _lso on -fi + if ((nt_ulp_full == 1)); then + set_linkprop $nt_name _tx_ulp_cksum fullv4 + fi + + if ((nt_ulp_full == 1)) || ((nt_ulp_partial == 1)); then + set_linkprop $nt_name _tx_ipv4_cksum on + fi -create_vnic ipft_client0 ipft_nic0 0 $nt_client -create_vnic ipft_client_r0 ipft_nic1 0 $nt_router -create_vnic ipft_server_r0 ipft_nic1 5 $nt_router -create_vnic ipft_server0 ipft_nic1 5 $nt_server + if ((nt_tcp_lso == 1)); then + set_linkprop $nt_name _lso on + fi + + if ((nt_rx_ip_cksum == 1)); then + set_linkprop $nt_name _rx_ipv4_cksum on + fi +done + +if ((nt_loopback == 0)); then + create_vnic ipft_client0 ipft_client_nic0 0 $nt_client + create_vnic ipft_client_r0 ipft_router_nic0 0 $nt_router + create_vnic ipft_server_r0 ipft_router_nic1 5 $nt_router + create_vnic ipft_server0 ipft_server_nic0 5 $nt_server +else + create_vnic ipft_client0 ipft_nic0 0 $nt_client + create_vnic ipft_client_r0 ipft_nic1 0 $nt_router + create_vnic ipft_server_r0 ipft_nic1 5 $nt_router + create_vnic ipft_server0 ipft_nic1 5 $nt_server +fi ip_fwd_enable $nt_router @@ -434,11 +483,5 @@ if ((nt_udp == 1)); then ping_udp $nt_server $nt_server_ip6 $nt_client_ip6 $((1024 * 16)) 3 fi -if ((nt_cleanup == 0)); then - dbg "skipping cleanup" - echo "PASS [$nt_tname]" - exit 0 -fi - cleanup echo "PASS [$nt_tname]" diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_no_cksum.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_001.ksh index ad593568d0..9f6c98d1b3 100644 --- a/usr/src/test/net-tests/tests/forwarding/ip_fwd_no_cksum.ksh +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_001.ksh @@ -18,21 +18,5 @@ if [[ -z $NET_TESTS ]]; then exit 1 fi -. $NET_TESTS/tests/net_common -. $NET_TESTS/config/ip_forwarding.config - -if [[ -z "$NT_CLIENT" ]]; then - fail "NT_CLIENT must be set" -fi - -if [[ -z "$NT_ROUTER" ]]; then - fail "NT_ROUTER must be set" -fi - -if [[ -z "$NT_SERVER" ]]; then - fail "NT_SERVER must be set" -fi - -export NT_TNAME=$(basename $0) -$NET_TESTS/tests/forwarding/ip_forwarding -uv $NT_CLIENT $NT_ROUTER $NT_SERVER +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 001 exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_full_cksum.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_002.ksh index 57c9e2d271..06e5ec53ed 100644 --- a/usr/src/test/net-tests/tests/forwarding/ip_fwd_full_cksum.ksh +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_002.ksh @@ -18,21 +18,5 @@ if [[ -z $NET_TESTS ]]; then exit 1 fi -. $NET_TESTS/tests/net_common -. $NET_TESTS/config/ip_forwarding.config - -if [[ -z "$NT_CLIENT" ]]; then - fail "NT_CLIENT must be set" -fi - -if [[ -z "$NT_ROUTER" ]]; then - fail "NT_ROUTER must be set" -fi - -if [[ -z "$NT_SERVER" ]]; then - fail "NT_SERVER must be set" -fi - -export NT_TNAME=$(basename $0) -$NET_TESTS/tests/forwarding/ip_forwarding -fuv $NT_CLIENT $NT_ROUTER $NT_SERVER +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 002 exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_partial_cksum.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_003.ksh index b7d51ab224..ce84bc0866 100644 --- a/usr/src/test/net-tests/tests/forwarding/ip_fwd_partial_cksum.ksh +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_003.ksh @@ -18,21 +18,5 @@ if [[ -z $NET_TESTS ]]; then exit 1 fi -. $NET_TESTS/tests/net_common -. $NET_TESTS/config/ip_forwarding.config - -if [[ -z "$NT_CLIENT" ]]; then - fail "NT_CLIENT must be set" -fi - -if [[ -z "$NT_ROUTER" ]]; then - fail "NT_ROUTER must be set" -fi - -if [[ -z "$NT_SERVER" ]]; then - fail "NT_SERVER must be set" -fi - -export NT_TNAME=$(basename $0) -$NET_TESTS/tests/forwarding/ip_forwarding -puv $NT_CLIENT $NT_ROUTER $NT_SERVER +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 003 exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_full_cksum_lso.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_004.ksh index a9b6f98a46..b5fa65ccd1 100644 --- a/usr/src/test/net-tests/tests/forwarding/ip_fwd_full_cksum_lso.ksh +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_004.ksh @@ -18,21 +18,5 @@ if [[ -z $NET_TESTS ]]; then exit 1 fi -. $NET_TESTS/tests/net_common -. $NET_TESTS/config/ip_forwarding.config - -if [[ -z "$NT_CLIENT" ]]; then - fail "NT_CLIENT must be set" -fi - -if [[ -z "$NT_ROUTER" ]]; then - fail "NT_ROUTER must be set" -fi - -if [[ -z "$NT_SERVER" ]]; then - fail "NT_SERVER must be set" -fi - -export NT_TNAME=$(basename $0) -$NET_TESTS/tests/forwarding/ip_forwarding -fluv $NT_CLIENT $NT_ROUTER $NT_SERVER +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 004 exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_005.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_005.ksh new file mode 100644 index 0000000000..9bbd536e19 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_005.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 005 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_006.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_006.ksh new file mode 100644 index 0000000000..2267072a3d --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_006.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 006 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_007.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_007.ksh new file mode 100644 index 0000000000..a0380eb92e --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_007.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 007 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_008.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_008.ksh new file mode 100644 index 0000000000..aed5438f63 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_008.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 008 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_009.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_009.ksh new file mode 100644 index 0000000000..8a0fa9674c --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_009.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 009 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_010.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_010.ksh new file mode 100644 index 0000000000..3c45225597 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_010.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 010 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_011.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_011.ksh new file mode 100644 index 0000000000..62785ff33e --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_011.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 011 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_012.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_012.ksh new file mode 100644 index 0000000000..c09cd77258 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_012.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 012 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_013.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_013.ksh new file mode 100644 index 0000000000..e3cc833f53 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_013.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 013 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_014.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_014.ksh new file mode 100644 index 0000000000..6bd76de190 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_014.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 014 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_015.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_015.ksh new file mode 100644 index 0000000000..d3b1e2fe1d --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_015.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 015 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_016.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_016.ksh new file mode 100644 index 0000000000..aa5903cbe4 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_016.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 016 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_017.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_017.ksh new file mode 100644 index 0000000000..38615b9f94 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_017.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 017 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_018.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_018.ksh new file mode 100644 index 0000000000..e010141458 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_018.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 018 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_019.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_019.ksh new file mode 100644 index 0000000000..e3b16bad43 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_019.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 019 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_020.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_020.ksh new file mode 100644 index 0000000000..9710bae3c1 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_020.ksh @@ -0,0 +1,22 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +$NET_TESTS/tests/forwarding/ip_fwd_suite -n 020 +exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_partial_cksum_lso.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_partial_cksum_lso.ksh deleted file mode 100644 index 426c6d3614..0000000000 --- a/usr/src/test/net-tests/tests/forwarding/ip_fwd_partial_cksum_lso.ksh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/ksh -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. - -# -# Copyright 2019 Joyent, Inc. -# - -if [[ -z $NET_TESTS ]]; then - echo "NET_TESTS not set" >&2 - exit 1 -fi - -. $NET_TESTS/tests/net_common -. $NET_TESTS/config/ip_forwarding.config - -if [[ -z "$NT_CLIENT" ]]; then - fail "NT_CLIENT must be set" -fi - -if [[ -z "$NT_ROUTER" ]]; then - fail "NT_ROUTER must be set" -fi - -if [[ -z "$NT_SERVER" ]]; then - fail "NT_SERVER must be set" -fi - -export NT_TNAME=$(basename $0) -$NET_TESTS/tests/forwarding/ip_forwarding -pluv $NT_CLIENT $NT_ROUTER $NT_SERVER -exit $? diff --git a/usr/src/test/net-tests/tests/forwarding/ip_fwd_suite.ksh b/usr/src/test/net-tests/tests/forwarding/ip_fwd_suite.ksh new file mode 100644 index 0000000000..a1fdc444e3 --- /dev/null +++ b/usr/src/test/net-tests/tests/forwarding/ip_fwd_suite.ksh @@ -0,0 +1,115 @@ +#!/usr/bin/ksh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# +# Copyright 2019 Joyent, Inc. +# + +# +# Run the IP forwarding test suite. +# +# Usage +# +# ip_fwd_suite [-n <name>] [-a <args>] +# +# To run all tests: +# +# NET_TESTS=/opt/net-tests ip_fwd_suite +# +# To run one test: +# +# NET_TESTS=/opt/net-tests ip_fwd_suite -n 001 +# +# To run one test with additional arguments passed to 'ip_forwarding': +# +# NET_TESTS=/opt/net-tests ip_fwd_suite -n 001 -a n +# + +if [[ -z $NET_TESTS ]]; then + echo "NET_TESTS not set" >&2 + exit 1 +fi + +. $NET_TESTS/tests/net_common +. $NET_TESTS/config/ip_forwarding.config + +if [[ -z "$NT_CLIENT" ]]; then + fail "NT_CLIENT must be set" +fi + +if [[ -z "$NT_ROUTER" ]]; then + fail "NT_ROUTER must be set" +fi + +if [[ -z "$NT_SERVER" ]]; then + fail "NT_SERVER must be set" +fi + +while getopts "a:n:" opt; do + case $opt in + a) + nt_args=$OPTARG + ;; + n) + nt_name=$OPTARG + ;; + esac +done + +shift $((OPTIND - 1)) + +nt_script=$NET_TESTS/tests/forwarding/ip_forwarding + +# +# See the "Test Matrix" section of the README for a description of +# each test. +# +typeset -A nt_name_args +nt_name_args["001"]="uv" +nt_name_args["002"]="puv" +nt_name_args["003"]="lpuv" +nt_name_args["004"]="fuv" +nt_name_args["005"]="fluv" +nt_name_args["006"]="ruv" +nt_name_args["007"]="pruv" +nt_name_args["008"]="lpruv" +nt_name_args["009"]="fruv" +nt_name_args["010"]="flruv" + +nt_name_args["011"]="buv" +nt_name_args["012"]="bpuv" +nt_name_args["013"]="blpuv" +nt_name_args["014"]="bfuv" +nt_name_args["015"]="bfluv" +nt_name_args["016"]="bruv" +nt_name_args["017"]="bpruv" +nt_name_args["018"]="blpruv" +nt_name_args["019"]="bfruv" +nt_name_args["020"]="bflruv" + +if [[ -n $nt_name ]]; then + if [[ -z ${nt_name_args[$nt_name]} ]]; then + fail "invalid test name: $nt_name" + fi + + export NT_TNAME="ip_fwd_$nt_name" + nt_args="-${nt_name_args[$nt_name]}${nt_args}" + $nt_script $nt_args $NT_CLIENT $NT_ROUTER $NT_SERVER + exit $? +fi + +for nt_name in ${!nt_name_args[@]}; do + export NT_TNAME="ip_fwd_$nt_name" + nt_args="-${nt_name_args[$nt_name]}${nt_args}" + $nt_script $nt_args $NT_CLIENT $NT_ROUTER $NT_SERVER || exit $? +done + +exit 0 diff --git a/usr/src/test/net-tests/tests/net_common.ksh b/usr/src/test/net-tests/tests/net_common.ksh index 8465ead088..0742775193 100644 --- a/usr/src/test/net-tests/tests/net_common.ksh +++ b/usr/src/test/net-tests/tests/net_common.ksh @@ -224,22 +224,16 @@ function create_vnic function delete_vnic { typeset name=$1 - typeset over=$2 - typeset vid=$3 - typeset zone=$4 - typeset vnic_info="$name, vid: $vid, over: $over, zone: $zone" + typeset vid=$2 + typeset zone=$3 + typeset vnic_info="$name, vid: $vid, zone: $zone" typeset err1="failed to assign VNIC $name from $zone to GZ" typeset err2="failed to delete VNIC: $vnic_info" - if (($# != 4)); then + if (($# != 3)); then fail "$0: incorrect number of args provided" fi - if ! vnic_exists $name $vid $over $zone; then - dbg "VNIC doesn't exist: $vnic_info" - return 0 - fi - dbg "assigning VNIC $name from $zone to GZ" if ! dladm set-linkprop -t -z $zone -p zone=global $name; then maybe_fail "$err1" diff --git a/usr/src/uts/common/inet/ip/ip_input.c b/usr/src/uts/common/inet/ip/ip_input.c index 728f79b46f..dd6f329ebe 100644 --- a/usr/src/uts/common/inet/ip/ip_input.c +++ b/usr/src/uts/common/inet/ip/ip_input.c @@ -1155,17 +1155,22 @@ ip_forward_xmit_v4(nce_t *nce, ill_t *ill, mblk_t *mp, ipha_t *ipha, icmp_time_exceeded(mp, ICMP_TTL_EXCEEDED, ira); return; } + + /* + * Count the forward as a hop and update the checksum + * accordingly. + */ ipha->ipha_ttl--; + sum = (int)ipha->ipha_hdr_checksum + IP_HDR_CSUM_TTL_ADJUST; + ipha->ipha_hdr_checksum = (uint16_t)(sum + (sum >> 16)); + /* - * Adjust the checksum to reflect the TTL decrement unless - * the packet expects IP header checksum offload; in which - * case we delay its calculation until later. Such a packet - * occurs when it travels via MAC-loopback over a link - * exposing HCKSUM_IPHDRCKSUM. + * Zero the IP header checksum if this is a mac-loopback + * packet which has requested IP header checksum offload. */ - if ((DB_CKSUMFLAGS(mp) & HCK_IPV4_HDRCKSUM) == 0) { - sum = (int)ipha->ipha_hdr_checksum + IP_HDR_CSUM_TTL_ADJUST; - ipha->ipha_hdr_checksum = (uint16_t)(sum + (sum >> 16)); + if (((DB_CKSUMFLAGS(mp) & HW_LOCAL_MAC) != 0) && + (DB_CKSUMFLAGS(mp) & HCK_IPV4_HDRCKSUM) != 0) { + ipha->ipha_hdr_checksum = 0; } /* Check if there are options to update */ diff --git a/usr/src/uts/common/io/simnet/simnet.c b/usr/src/uts/common/io/simnet/simnet.c index 3653ed12f0..7fb48c90e4 100644 --- a/usr/src/uts/common/io/simnet/simnet.c +++ b/usr/src/uts/common/io/simnet/simnet.c @@ -678,7 +678,6 @@ simnet_thread_unref(simnet_dev_t *sdev) /* * TODO: Add properties to set Rx checksum flag behavior. * - * o HCK_IPV4_HDRCKSUM_OK. * o HCK_PARTIALCKSUM. * o HCK_FULLCKSUM_OK. */ @@ -723,6 +722,16 @@ simnet_rx(void *arg) } } + /* + * We don't actually calculate and verify the IP header + * checksum because the nature of simnet makes it redundant to + * do so. The point is to test the presence of the flags. The + * Tx side will have already populated the checksum field. + */ + if ((sdev->sd_rx_cksum & HCKSUM_IPHDRCKSUM) != 0) { + mac_hcksum_set(mp, 0, 0, 0, 0, HCK_IPV4_HDRCKSUM_OK); + } + sdev->sd_stats.recv_count++; sdev->sd_stats.rbytes += msgdsize(mp); mac_rx(sdev->sd_mh, NULL, mp); @@ -730,6 +739,8 @@ rx_done: simnet_thread_unref(sdev); } +#define SIMNET_ULP_CKSUM (HCKSUM_INET_FULL_V4 | HCKSUM_INET_PARTIAL) + static mblk_t * simnet_m_tx(void *arg, mblk_t *mp_chain) { @@ -737,6 +748,7 @@ simnet_m_tx(void *arg, mblk_t *mp_chain) simnet_dev_t *sdev_rx; mblk_t *mpnext = mp_chain; mblk_t *mp, *nmp; + mac_emul_t emul = 0; rw_enter(&simnet_dev_lock, RW_READER); if ((sdev_rx = sdev->sd_peer_dev) == NULL) { @@ -817,8 +829,16 @@ simnet_m_tx(void *arg, mblk_t *mp_chain) break; } - mac_hw_emul(&mp, NULL, NULL, - MAC_IPCKSUM_EMUL | MAC_HWCKSUM_EMUL | MAC_LSO_EMUL); + if ((sdev->sd_tx_cksum & HCKSUM_IPHDRCKSUM) != 0) + emul |= MAC_IPCKSUM_EMUL; + if ((sdev->sd_tx_cksum & SIMNET_ULP_CKSUM) != 0) + emul |= MAC_HWCKSUM_EMUL; + if (sdev->sd_lso) + emul |= MAC_LSO_EMUL; + + if (emul != 0) + mac_hw_emul(&mp, NULL, NULL, emul); + if (mp == NULL) { sdev->sd_stats.xmit_errors++; continue; @@ -1236,7 +1256,20 @@ static int simnet_set_priv_prop_ether(simnet_dev_t *sdev, const char *name, const uint_t len, const void *val) { - if (strcmp(name, SD_PROP_TX_ULP_CKSUM) == 0) { + if (strcmp(name, SD_PROP_RX_IP_CKSUM) == 0) { + if (val == NULL) + return (EINVAL); + + if (strcmp(val, "off") == 0) { + sdev->sd_rx_cksum &= ~HCKSUM_IPHDRCKSUM; + } else if (strcmp(val, "on") == 0) { + sdev->sd_rx_cksum |= HCKSUM_IPHDRCKSUM; + } else { + return (EINVAL); + } + + return (0); + } else if (strcmp(name, SD_PROP_TX_ULP_CKSUM) == 0) { if (val == NULL) return (EINVAL); @@ -1425,7 +1458,13 @@ simnet_get_priv_prop_ether(const simnet_dev_t *sdev, const char *name, int ret; char *value; - if (strcmp(name, SD_PROP_TX_ULP_CKSUM) == 0) { + if (strcmp(name, SD_PROP_RX_IP_CKSUM) == 0) { + if ((sdev->sd_rx_cksum & HCKSUM_IPHDRCKSUM) != 0) { + value = "on"; + } else { + value = "off"; + } + } else if (strcmp(name, SD_PROP_TX_ULP_CKSUM) == 0) { if ((sdev->sd_tx_cksum & HCKSUM_INET_FULL_V4) != 0) { value = "fullv4"; } else if ((sdev->sd_tx_cksum & HCKSUM_INET_PARTIAL) != 0) { @@ -1586,7 +1625,8 @@ simnet_propinfo_wifi(const char *name, const mac_prop_id_t num, static void simnet_priv_propinfo_ether(const char *name, mac_prop_info_handle_t prh) { - if (strcmp(name, SD_PROP_TX_ULP_CKSUM) == 0 || + if (strcmp(name, SD_PROP_RX_IP_CKSUM) == 0 || + strcmp(name, SD_PROP_TX_ULP_CKSUM) == 0 || strcmp(name, SD_PROP_TX_IP_CKSUM) == 0 || strcmp(name, SD_PROP_LSO) == 0) { mac_prop_info_set_perm(prh, MAC_PROP_PERM_RW); @@ -1596,7 +1636,8 @@ simnet_priv_propinfo_ether(const char *name, mac_prop_info_handle_t prh) mac_prop_info_set_default_str(prh, "none"); } - if (strcmp(name, SD_PROP_TX_IP_CKSUM) == 0 || + if (strcmp(name, SD_PROP_RX_IP_CKSUM) == 0 || + strcmp(name, SD_PROP_TX_IP_CKSUM) == 0 || strcmp(name, SD_PROP_LSO) == 0) { mac_prop_info_set_default_str(prh, "off"); } diff --git a/usr/src/uts/common/io/simnet/simnet_impl.h b/usr/src/uts/common/io/simnet/simnet_impl.h index c804a416eb..50f611697f 100644 --- a/usr/src/uts/common/io/simnet/simnet_impl.h +++ b/usr/src/uts/common/io/simnet/simnet_impl.h @@ -89,11 +89,13 @@ typedef struct simnet_dev { simnet_stats_t sd_stats; /* Capabilities */ + uint_t sd_rx_cksum; uint_t sd_tx_cksum; boolean_t sd_lso; } simnet_dev_t; /* Simnet dladm private properties. */ +#define SD_PROP_RX_IP_CKSUM "_rx_ipv4_cksum" #define SD_PROP_TX_ULP_CKSUM "_tx_ulp_cksum" #define SD_PROP_TX_IP_CKSUM "_tx_ipv4_cksum" #define SD_PROP_LSO "_lso" |