diff --git a/SOURCES/openvswitch-3.1.0.patch b/SOURCES/openvswitch-3.1.0.patch index ae6d1ad..6c2f7a9 100644 --- a/SOURCES/openvswitch-3.1.0.patch +++ b/SOURCES/openvswitch-3.1.0.patch @@ -5594,6 +5594,29 @@ index 80da20d9f0..5cb1fc89ae 100644 retval = get_socket_rcvbuf(sock->fd); if (retval < 0) { retval = -retval; +diff --git a/lib/odp-execute-avx512.c b/lib/odp-execute-avx512.c +index c28461ec1a..0bf8cdf259 100644 +--- a/lib/odp-execute-avx512.c ++++ b/lib/odp-execute-avx512.c +@@ -357,6 +357,8 @@ avx512_get_delta(__m256i old_header, __m256i new_header) + 0xF, 0xF, 0xF, 0xF); + v_delta = _mm256_permutexvar_epi32(v_swap32a, v_delta); + ++ v_delta = _mm256_hadd_epi32(v_delta, v_zeros); ++ v_delta = _mm256_shuffle_epi8(v_delta, v_swap16a); + v_delta = _mm256_hadd_epi32(v_delta, v_zeros); + v_delta = _mm256_hadd_epi16(v_delta, v_zeros); + +@@ -554,6 +556,9 @@ avx512_ipv6_sum_header(__m512i ip6_header) + 0xF, 0xF, 0xF, 0xF); + + v_delta = _mm256_permutexvar_epi32(v_swap32a, v_delta); ++ ++ v_delta = _mm256_hadd_epi32(v_delta, v_zeros); ++ v_delta = _mm256_shuffle_epi8(v_delta, v_swap16a); + v_delta = _mm256_hadd_epi32(v_delta, v_zeros); + v_delta = _mm256_hadd_epi16(v_delta, v_zeros); + diff --git a/lib/odp-util.c b/lib/odp-util.c index 5fc312f8c0..fa353eab5c 100644 --- a/lib/odp-util.c @@ -10563,6 +10586,77 @@ index 7454a51ec6..d2f1046f8b 100644 +OVS_VSWITCHD_STOP +AT_CLEANUP \ No newline at end of file +diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at +index 9af70a68d7..086259a473 100644 +--- a/tests/dpif-netdev.at ++++ b/tests/dpif-netdev.at +@@ -716,3 +716,66 @@ AT_CHECK([test `ovs-vsctl get Interface p2 statistics:tx_q0_packets` -gt 0 -a dn + + OVS_VSWITCHD_STOP + AT_CLEANUP ++ ++AT_SETUP([datapath - Actions Autovalidator Checksum]) ++ ++OVS_VSWITCHD_START(add-port br0 p0 -- set Interface p0 type=dummy \ ++ -- add-port br0 p1 -- set Interface p1 type=dummy) ++ ++AT_CHECK([ovs-appctl odp-execute/action-impl-set autovalidator], [0], [dnl ++Action implementation set to autovalidator. ++]) ++ ++dnl Add flows to trigger checksum calculation. ++AT_DATA([flows.txt], [dnl ++ in_port=p0,ip,actions=mod_nw_src=10.1.1.1,p1 ++ in_port=p0,ipv6,actions=set_field:fc00::100->ipv6_src,p1 ++]) ++AT_CHECK([ovs-ofctl del-flows br0]) ++AT_CHECK([ovs-ofctl -Oopenflow13 add-flows br0 flows.txt]) ++ ++dnl Make sure checksum won't be offloaded. ++AT_CHECK([ovs-vsctl set Interface p0 options:ol_ip_csum=false]) ++AT_CHECK([ovs-vsctl set Interface p0 options:ol_ip_csum_set_good=false]) ++ ++AT_CHECK([ovs-vsctl set Interface p1 options:pcap=p1.pcap]) ++ ++dnl IPv4 packet with values that will trigger carry-over addition for checksum. ++flow_s_v4=" ++ eth_src=47:42:86:08:17:50,eth_dst=3e:55:b5:9e:3a:fb,dl_type=0x0800, ++ nw_src=229.167.36.90,nw_dst=130.161.64.186,nw_proto=6,nw_ttl=64,nw_frag=no, ++ tp_src=54392,tp_dst=5201,tcp_flags=ack" ++ ++good_frame=$(ovs-ofctl compose-packet --bare "${flow_s_v4}") ++AT_CHECK([ovs-appctl netdev-dummy/receive p0 ${good_frame}]) ++ ++dnl Checksum should change to 0xAC33 with ip_src changed to 10.1.1.1 ++dnl by the datapath while processing the packet. ++flow_expected=$(echo "${flow_s_v4}" | sed 's/229.167.36.90/10.1.1.1/g') ++good_expected=$(ovs-ofctl compose-packet --bare "${flow_expected}") ++AT_CHECK([ovs-pcap p1.pcap > p1.pcap.txt 2>&1]) ++AT_CHECK_UNQUOTED([tail -n 1 p1.pcap.txt], [0], [${good_expected} ++]) ++ ++dnl Repeat similar test for IPv6. ++flow_s_v6=" ++ eth_src=8a:bf:7e:2f:05:84,eth_dst=0a:8f:39:4f:e0:73,dl_type=0x86dd, ++ ipv6_src=2f8a:2076:3926:9e7:2d47:4bc9:9c7:17f3, ++ ipv6_dst=7287:10dd:2fb9:41d5:3eb2:2c7a:11b0:6258, ++ ipv6_label=0x51ac,nw_proto=6,nw_ttl=142,nw_frag=no, ++ tp_src=20405,tp_dst=20662,tcp_flags=ack" ++ ++good_frame_v6=$(ovs-ofctl compose-packet --bare "${flow_s_v6}") ++AT_CHECK([ovs-appctl netdev-dummy/receive p0 ${good_frame_v6}]) ++ ++dnl Checksum should change to 0x59FD with ipv6_src changed to fc00::100 ++dnl by the datapath while processing the packet. ++flow_expected_v6=$(echo "${flow_s_v6}" | \ ++ sed 's/2f8a:2076:3926:9e7:2d47:4bc9:9c7:17f3/fc00::100/g') ++good_expected_v6=$(ovs-ofctl compose-packet --bare "${flow_expected_v6}") ++AT_CHECK([ovs-pcap p1.pcap > p1.pcap.txt 2>&1]) ++AT_CHECK_UNQUOTED([tail -n 1 p1.pcap.txt], [0], [${good_expected_v6} ++]) ++ ++OVS_VSWITCHD_STOP ++AT_CLEANUP diff --git a/tests/learn.at b/tests/learn.at index d127fed348..d0bcc83633 100644 --- a/tests/learn.at @@ -16221,10 +16315,28 @@ index 4384be8ae1..0a9af1a18f 100644 myPS1="$(sed 's/Begin prompt/\\Begin prompt/; s/End prompt/\\End prompt/' <<< "$PS1")" diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c -index eabec18a36..38b221b7a7 100644 +index eabec18a36..75fbd53260 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c -@@ -3089,6 +3089,10 @@ ofctl_ct_flush(struct ovs_cmdl_context *ctx) +@@ -154,6 +154,9 @@ static int show_stats = 1; + /* --pcap: Makes "compose-packet" print a pcap on stdout. */ + static int print_pcap = 0; + ++/* --bare: Makes "compose-packet" print a bare hexified payload. */ ++static int print_bare = 0; ++ + /* --raw: Makes "ofp-print" read binary data from stdin. */ + static int raw = 0; + +@@ -243,6 +246,7 @@ parse_options(int argc, char *argv[]) + {"color", optional_argument, NULL, OPT_COLOR}, + {"may-create", no_argument, NULL, OPT_MAY_CREATE}, + {"pcap", no_argument, &print_pcap, 1}, ++ {"bare", no_argument, &print_bare, 1}, + {"raw", no_argument, &raw, 1}, + {"read-only", no_argument, NULL, OPT_READ_ONLY}, + DAEMON_LONG_OPTIONS, +@@ -3089,6 +3093,10 @@ ofctl_ct_flush(struct ovs_cmdl_context *ctx) args--; } @@ -16235,7 +16347,63 @@ index eabec18a36..38b221b7a7 100644 open_vconn(ctx->argv[1], &vconn); enum ofp_version version = vconn_get_version(vconn); struct ofpbuf *msg = ofp_ct_match_encode(&match, pzone, version); -@@ -5109,10 +5113,10 @@ static const struct ovs_cmdl_command all_commands[] = { +@@ -4944,20 +4952,31 @@ ofctl_parse_key_value(struct ovs_cmdl_context *ctx) + } + } + +-/* "compose-packet [--pcap] FLOW [L7]": Converts the OpenFlow flow +- * specification FLOW to a packet with flow_compose() and prints the hex bytes +- * in the packet on stdout. Also verifies that the flow extracted from that +- * packet matches the original FLOW. ++/* "compose-packet [--pcap|--bare] FLOW [L7]": Converts the ++ * OpenFlow flow specification FLOW to a packet with flow_compose() and prints ++ * the hex bytes of the packet, with offsets, to stdout. ++ * ++ * With --pcap, prints the packet in pcap format, so that you can do something ++ * like "ovs-ofctl --pcap compose-packet udp | tcpdump -vvvv -r-" to use ++ * another tool to dump the packet contents. ++ * ++ * With --bare, prints the packet as a single bare hex string with no ++ * spaces or offsets, so that you can pass the result directly to e.g. ++ * "ovs-appctl netdev-dummy/receive vif $(ovs-ofctl compose-packet --bare ++ * FLOW)" + * +- * With --pcap, prints the packet to stdout instead as a pcap file, so that you +- * can do something like "ovs-ofctl --pcap compose-packet udp | tcpdump -vvvv +- * -r-" to use another tool to dump the packet contents. ++ * Regardless of the mode, the command also verifies that the flow extracted ++ * from that packet matches the original FLOW. + * + * If L7 is specified, draws the L7 payload data from it, otherwise defaults to + * 64 bytes of payload. */ + static void + ofctl_compose_packet(struct ovs_cmdl_context *ctx) + { ++ if (print_pcap && print_bare) { ++ ovs_fatal(1, "--bare and --pcap are mutually exclusive"); ++ } ++ + if (print_pcap && isatty(STDOUT_FILENO)) { + ovs_fatal(1, "not writing pcap data to stdout; redirect to a file " + "or pipe to tcpdump instead"); +@@ -4993,6 +5012,16 @@ ofctl_compose_packet(struct ovs_cmdl_context *ctx) + ovs_pcap_write_header(p_file); + ovs_pcap_write(p_file, &p); + ovs_pcap_close(p_file); ++ } else if (print_bare) { ++ /* Binary to a bare hex string. */ ++ for (int i = 0; i < dp_packet_size(&p); i++) { ++ uint8_t val = ((uint8_t *) dp_packet_data(&p))[i]; ++ /* Don't use ds_put_hex because it adds 0x prefix as well as ++ * it doesn't guarantee an even number of payload characters, which ++ * may be important elsewhere (e.g. in netdev-dummy/receive). */ ++ printf("%02" PRIx8, val); ++ } ++ + } else { + ovs_hex_dump(stdout, dp_packet_data(&p), dp_packet_size(&p), 0, false); + } +@@ -5109,10 +5138,10 @@ static const struct ovs_cmdl_command all_commands[] = { 1, 1, ofctl_dump_ipfix_flow, OVS_RO }, { "ct-flush-zone", "switch zone", diff --git a/SPECS/openvswitch3.1.spec b/SPECS/openvswitch3.1.spec index 1bf476f..4492ba1 100644 --- a/SPECS/openvswitch3.1.spec +++ b/SPECS/openvswitch3.1.spec @@ -63,7 +63,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 3.1.0 -Release: 121%{?dist} +Release: 122%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -757,6 +757,13 @@ exit 0 %endif %changelog +* Mon Jun 03 2024 Open vSwitch CI - 3.1.0-122 +- Merging upstream branch-3.1 [RH git: 37c97dd8d1] + Commit list: + 456a1b19ac odp-execute: Fix AVX checksum calculation. + 851e12f564 ovs-ofctl: Implement compose-packet --bare. + + * Thu May 30 2024 Open vSwitch CI - 3.1.0-121 - Merging upstream branch-3.1 [RH git: 456d22059a] Commit list: