From 6cf6aba88566df5f43c988371e63ccf6481f3279 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Sep 08 2021 23:23:18 +0000 Subject: Import openvswitch2.15-2.15.0-37 from Fast DataPath --- diff --git a/SOURCES/openvswitch-2.15.0.patch b/SOURCES/openvswitch-2.15.0.patch index ff5606e..225a9ec 100644 --- a/SOURCES/openvswitch-2.15.0.patch +++ b/SOURCES/openvswitch-2.15.0.patch @@ -18597,10 +18597,37 @@ index ae59ecf2c2..34d45b82a1 100644 } else if (retval < 0) { VLOG_FATAL("waitpid failed (%s)", ovs_strerror(errno)); diff --git a/lib/dp-packet.h b/lib/dp-packet.h -index 9e2d06b3dd..cb3f30e5b6 100644 +index 9e2d06b3dd..4e02425f7c 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h -@@ -726,7 +726,6 @@ enum { NETDEV_MAX_BURST = 32 }; /* Maximum number packets in a batch. */ +@@ -199,6 +199,7 @@ struct dp_packet *dp_packet_clone_data_with_headroom(const void *, size_t, + void dp_packet_resize(struct dp_packet *b, size_t new_headroom, + size_t new_tailroom); + static inline void dp_packet_delete(struct dp_packet *); ++static inline void dp_packet_swap(struct dp_packet *, struct dp_packet *); + + static inline void *dp_packet_at(const struct dp_packet *, size_t offset, + size_t size); +@@ -256,6 +257,18 @@ dp_packet_delete(struct dp_packet *b) + } + } + ++/* Swaps content of two packets. */ ++static inline void ++dp_packet_swap(struct dp_packet *a, struct dp_packet *b) ++{ ++ ovs_assert(a->source == DPBUF_MALLOC || a->source == DPBUF_STUB); ++ ovs_assert(b->source == DPBUF_MALLOC || b->source == DPBUF_STUB); ++ struct dp_packet c = *a; ++ ++ *a = *b; ++ *b = c; ++} ++ + /* If 'b' contains at least 'offset + size' bytes of data, returns a pointer to + * byte 'offset'. Otherwise, returns a null pointer. */ + static inline void * +@@ -726,7 +739,6 @@ enum { NETDEV_MAX_BURST = 32 }; /* Maximum number packets in a batch. */ struct dp_packet_batch { size_t count; bool trunc; /* true if the batch needs truncate. */ @@ -18608,7 +18635,7 @@ index 9e2d06b3dd..cb3f30e5b6 100644 struct dp_packet *packets[NETDEV_MAX_BURST]; }; -@@ -735,7 +734,6 @@ dp_packet_batch_init(struct dp_packet_batch *batch) +@@ -735,7 +747,6 @@ dp_packet_batch_init(struct dp_packet_batch *batch) { batch->count = 0; batch->trunc = false; @@ -18617,7 +18644,7 @@ index 9e2d06b3dd..cb3f30e5b6 100644 static inline void diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c -index 4381c618f1..916b7917fa 100644 +index 4381c618f1..3026a0619f 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -279,8 +279,9 @@ static bool dpcls_lookup(struct dpcls *cls, @@ -18851,15 +18878,35 @@ index 4381c618f1..916b7917fa 100644 if (put->ufid) { ufid = *put->ufid; } else { -@@ -4159,7 +4140,6 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) +@@ -4158,8 +4139,10 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) + flow_hash_5tuple(execute->flow, 0)); } - dp_packet_batch_init_packet(&pp, execute->packet); +- dp_packet_batch_init_packet(&pp, execute->packet); - pp.do_not_steal = true; ++ /* Making a copy because the packet might be stolen during the execution ++ * and caller might still need it. */ ++ struct dp_packet *packet_clone = dp_packet_clone(execute->packet); ++ dp_packet_batch_init_packet(&pp, packet_clone); dp_netdev_execute_actions(pmd, &pp, false, execute->flow, execute->actions, execute->actions_len); dp_netdev_pmd_flush_output_packets(pmd, true); -@@ -4878,6 +4858,12 @@ struct rr_numa { +@@ -4169,6 +4152,14 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) + dp_netdev_pmd_unref(pmd); + } + ++ if (dp_packet_batch_size(&pp)) { ++ /* Packet wasn't dropped during the execution. Swapping content with ++ * the original packet, because the caller might expect actions to ++ * modify it. */ ++ dp_packet_swap(execute->packet, packet_clone); ++ dp_packet_delete_batch(&pp, true); ++ } ++ + return 0; + } + +@@ -4878,6 +4869,12 @@ struct rr_numa { bool idx_inc; }; @@ -18872,7 +18919,7 @@ index 4381c618f1..916b7917fa 100644 static struct rr_numa * rr_numa_list_lookup(struct rr_numa_list *rr, int numa_id) { -@@ -5149,7 +5135,6 @@ reload_affected_pmds(struct dp_netdev *dp) +@@ -5149,7 +5146,6 @@ reload_affected_pmds(struct dp_netdev *dp) CMAP_FOR_EACH (pmd, node, &dp->poll_threads) { if (pmd->need_reload) { @@ -18880,7 +18927,7 @@ index 4381c618f1..916b7917fa 100644 dp_netdev_reload_pmd__(pmd); } } -@@ -5590,10 +5575,17 @@ get_dry_run_variance(struct dp_netdev *dp, uint32_t *core_list, +@@ -5590,10 +5586,17 @@ get_dry_run_variance(struct dp_netdev *dp, uint32_t *core_list, for (int i = 0; i < n_rxqs; i++) { int numa_id = netdev_get_numa_id(rxqs[i]->port->netdev); numa = rr_numa_list_lookup(&rr, numa_id); @@ -18901,7 +18948,7 @@ index 4381c618f1..916b7917fa 100644 goto cleanup; } -@@ -6203,12 +6195,14 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, +@@ -6203,12 +6206,14 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, /* Update all bands and find the one hit with the highest rate for each * packet (if any). */ for (int m = 0; m < meter->n_bands; ++m) { @@ -18920,7 +18967,7 @@ index 4381c618f1..916b7917fa 100644 } /* Drain the bucket for all the packets, if possible. */ -@@ -6226,8 +6220,8 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, +@@ -6226,8 +6231,8 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, * (Only one band will be fired by a packet, and that * can be different for each packet.) */ for (int i = band_exceeded_pkt; i < cnt; i++) { @@ -18931,7 +18978,7 @@ index 4381c618f1..916b7917fa 100644 exceeded_band[i] = m; } } -@@ -6246,8 +6240,8 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, +@@ -6246,8 +6251,8 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, /* Update the exceeding band for the exceeding packet. * (Only one band will be fired by a packet, and that * can be different for each packet.) */ @@ -18942,7 +18989,7 @@ index 4381c618f1..916b7917fa 100644 exceeded_band[i] = m; } } -@@ -6329,16 +6323,14 @@ dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id meter_id, +@@ -6329,16 +6334,14 @@ dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id meter_id, config->bands[i].burst_size = config->bands[i].rate; } @@ -18964,7 +19011,7 @@ index 4381c618f1..916b7917fa 100644 if (band_max_delta_t > meter->max_delta_t) { meter->max_delta_t = band_max_delta_t; } -@@ -8493,6 +8485,7 @@ const struct dpif_class dpif_netdev_class = { +@@ -8493,6 +8496,7 @@ const struct dpif_class dpif_netdev_class = { NULL, /* ct_timeout_policy_dump_next */ NULL, /* ct_timeout_policy_dump_done */ dpif_netdev_ct_get_timeout_policy_name, @@ -21540,7 +21587,7 @@ index 199db8ed0f..59093c03c9 100644 bad_action 'fin_timeout(foo=bar)' "invalid key 'foo' in 'fin_timeout' argument" diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at -index 31064ed95e..5567eed115 100644 +index 31064ed95e..da9dcd37ca 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -342,6 +342,22 @@ AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3]) @@ -21675,6 +21722,33 @@ index 31064ed95e..5567eed115 100644 # Makes sure recirculation does not change the way packet is handled. AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ]) OVS_VSWITCHD_START( +@@ -9520,6 +9596,26 @@ OFPST_TABLE reply (OF1.3) (xid=0x2): + OVS_VSWITCHD_STOP + AT_CLEANUP + ++AT_SETUP([ofproto-dpif packet-out table meter drop]) ++OVS_VSWITCHD_START ++add_of_ports br0 1 2 ++ ++AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps bands=type=drop rate=1']) ++AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=1 action=meter:1,output:2']) ++ ++ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000400080000 actions=resubmit(,0)" ++ovs-ofctl -O OpenFlow13 packet-out br0 "in_port=1 packet=50540000000a50540000000908004500001c000000000011a4cd0a0101010a0101020001000400080000 actions=resubmit(,0)" ++ ++# Check that vswitchd hasn't crashed by dumping the meter added above ++AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0 | ofctl_strip], [0], [dnl ++OFPST_METER_CONFIG reply (OF1.3): ++meter=1 pktps bands= ++type=drop rate=1 ++]) ++ ++OVS_VSWITCHD_STOP ++AT_CLEANUP ++ + AT_SETUP([ofproto-dpif - ICMPv6]) + OVS_VSWITCHD_START + add_of_ports br0 1 diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 5ddca67e71..604f15c2d1 100644 --- a/tests/ovs-ofctl.at @@ -23898,6 +23972,73 @@ index f0ad9f9793..cea48eb527 100644 import errno import sys +diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at +index 48c5de9d19..12fc1ef910 100644 +--- a/tests/tunnel-push-pop.at ++++ b/tests/tunnel-push-pop.at +@@ -595,6 +595,62 @@ OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep 50540000000a5054000000091235 | wc + OVS_VSWITCHD_STOP + AT_CLEANUP + ++AT_SETUP([tunnel_push_pop - packet_out debug_slow]) ++ ++OVS_VSWITCHD_START( ++ [add-port br0 p0 dnl ++ -- set Interface p0 type=dummy ofport_request=1 dnl ++ other-config:hwaddr=aa:55:aa:55:00:00]) ++AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg]) ++AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy]) ++AT_CHECK([ovs-vsctl add-port int-br t2 dnl ++ -- set Interface t2 type=geneve options:remote_ip=1.1.2.92 dnl ++ options:key=123 ofport_request=2]) ++ ++dnl First setup dummy interface IP address, then add the route ++dnl so that tnl-port table can get valid IP address for the device. ++AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK ++]) ++AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK ++]) ++AT_CHECK([ovs-ofctl add-flow br0 action=normal]) ++ ++dnl This ARP reply from p0 has two effects: ++dnl 1. The ARP cache will learn that 1.1.2.92 is at f8:bc:12:44:34:b6. ++dnl 2. The br0 mac learning will learn that f8:bc:12:44:34:b6 is on p0. ++AT_CHECK([ ++ ovs-appctl netdev-dummy/receive p0 dnl ++ 'recirc_id(0),in_port(2),dnl ++ eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),dnl ++ arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)' ++]) ++ ++AT_CHECK([ovs-vsctl -- set Interface p0 options:tx_pcap=p0.pcap]) ++ ++packet=50540000000a505400000009123 ++encap=f8bc124434b6aa55aa5500000800450000320000400040113406010102580101025c83a917c1001e00000000655800007b00 ++ ++dnl Output to tunnel from a int-br internal port. ++dnl Checking that the packet arrived and it was correctly encapsulated. ++AT_CHECK([ovs-ofctl add-flow int-br "in_port=LOCAL,actions=debug_slow,output:2"]) ++AT_CHECK([ovs-appctl netdev-dummy/receive int-br "${packet}4"]) ++OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep "${encap}${packet}4" | wc -l` -ge 1]) ++dnl Sending again to exercise the non-miss upcall path. ++AT_CHECK([ovs-appctl netdev-dummy/receive int-br "${packet}4"]) ++OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep "${encap}${packet}4" | wc -l` -ge 2]) ++ ++dnl Output to tunnel from the controller. ++AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out int-br CONTROLLER "debug_slow,output:2" "${packet}5"]) ++OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep "${encap}${packet}5" | wc -l` -ge 1]) ++ ++dnl Datapath actions should not have tunnel push action. ++AT_CHECK([ovs-appctl dpctl/dump-flows | grep -q tnl_push], [1]) ++dnl There should be slow_path action instead. ++AT_CHECK([ovs-appctl dpctl/dump-flows | grep -q 'slow_path(action)'], [0]) ++ ++OVS_VSWITCHD_STOP ++AT_CLEANUP ++ + AT_SETUP([tunnel_push_pop - underlay bridge match]) + + OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00]) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index bc6bfae15a..ac14da29b1 100755 --- a/utilities/checkpatch.py diff --git a/SPECS/openvswitch2.15.spec b/SPECS/openvswitch2.15.spec index 89f32cb..4636a95 100644 --- a/SPECS/openvswitch2.15.spec +++ b/SPECS/openvswitch2.15.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.15.0 -Release: 35%{?dist} +Release: 37%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -697,6 +697,17 @@ exit 0 %endif %changelog +* Wed Sep 08 2021 Open vSwitch CI - 2.15.0-37 +- Merging upstream branch-2.15 [RH git: b36eb7e529] + Commit list: + ef8ca3e190 dpif-netdev: Fix crash when PACKET_OUT is metered. + + +* Tue Aug 17 2021 Michael Santana - 2.15.0-36 +- Migrate openvswitch to gitlab [RH git: 93147e2cda] + Signed-off-by: Michael Santana + + * Mon Aug 16 2021 Open vSwitch CI - 2.15.0-35 - Merging upstream branch-2.15 [RH git: 11bcf52d03] Commit list: