From d251a9c82bc5f3c44b24a202ac5732d4ba339ea7 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Apr 21 2021 19:03:28 +0000 Subject: Import openvswitch2.15-2.15.0-15 from Fast DataPath --- diff --git a/SOURCES/openvswitch-2.15.0.patch b/SOURCES/openvswitch-2.15.0.patch index ac7509c..2670296 100644 --- a/SOURCES/openvswitch-2.15.0.patch +++ b/SOURCES/openvswitch-2.15.0.patch @@ -77,6 +77,24 @@ index bc901efdb1..036d4032c4 100644 v2.15.0 - 15 Feb 2021 --------------------- - OVSDB: +diff --git a/acinclude.m4 b/acinclude.m4 +index 435685c93d..15a54d636f 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -209,10 +209,10 @@ dnl Configure Linux tc compat. + AC_DEFUN([OVS_CHECK_LINUX_TC], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ +- int x = TCA_ACT_FLAGS; ++ int x = TCA_FLOWER_KEY_CT_FLAGS_REPLY; + ])], +- [AC_DEFINE([HAVE_TCA_ACT_FLAGS], [1], +- [Define to 1 if TCA_ACT_FLAGS is available.])]) ++ [AC_DEFINE([HAVE_TCA_FLOWER_KEY_CT_FLAGS_REPLY], [1], ++ [Define to 1 if TCA_FLOWER_KEY_CT_FLAGS_REPLY is available.])]) + + AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include ]) + diff --git a/configure.ac b/configure.ac index fd82d7d270..9299342960 100644 --- a/configure.ac @@ -104,6 +122,29 @@ index 1f2b7a3668..8b5d075840 100644 openvswitch (2.15.0-1) unstable; urgency=low * New upstream version +diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h +index b0a5ce8bec..bc51a5767f 100644 +--- a/include/linux/pkt_cls.h ++++ b/include/linux/pkt_cls.h +@@ -1,7 +1,7 @@ + #ifndef __LINUX_PKT_CLS_WRAPPER_H + #define __LINUX_PKT_CLS_WRAPPER_H 1 + +-#if defined(__KERNEL__) || defined(HAVE_TCA_ACT_FLAGS) ++#if defined(__KERNEL__) || defined(HAVE_TCA_FLOWER_KEY_CT_FLAGS_REPLY) + #include_next + #else + +@@ -255,6 +255,9 @@ enum { + TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1, /* Part of an existing connection. */ + TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2, /* Related to an established connection. */ + TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3, /* Conntrack has occurred. */ ++ TCA_FLOWER_KEY_CT_FLAGS_INVALID = 1 << 4, /* Conntrack is invalid. */ ++ TCA_FLOWER_KEY_CT_FLAGS_REPLY = 1 << 5, /* Packet is in the reply direction. */ ++ __TCA_FLOWER_KEY_CT_FLAGS_MAX, + }; + + enum { diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in index 64111768b3..668507fd37 100755 --- a/ipsec/ovs-monitor-ipsec.in @@ -324,6 +365,51 @@ index 4381c618f1..251788b049 100644 if (band_max_delta_t > meter->max_delta_t) { meter->max_delta_t = band_max_delta_t; } +diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c +index ceb56c6851..50520f8c06 100644 +--- a/lib/dpif-netlink.c ++++ b/lib/dpif-netlink.c +@@ -2061,6 +2061,7 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put) + uint8_t csum_on = false; + int err; + ++ info.tc_modify_flow_deleted = false; + if (put->flags & DPIF_FP_PROBE) { + return EOPNOTSUPP; + } +@@ -2105,7 +2106,6 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put) + info.tunnel_csum_on = csum_on; + info.recirc_id_shared_with_tc = (dpif->user_features + & OVS_DP_F_TC_RECIRC_SHARING); +- info.tc_modify_flow_deleted = false; + err = netdev_flow_put(dev, &match, + CONST_CAST(struct nlattr *, put->actions), + put->actions_len, +diff --git a/lib/dpif.c b/lib/dpif.c +index 56d0b4a654..26e8bfb7db 100644 +--- a/lib/dpif.c ++++ b/lib/dpif.c +@@ -1240,6 +1240,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_, + execute.needs_help = false; + execute.probe = false; + execute.mtu = 0; ++ execute.hash = 0; + aux->error = dpif_execute(aux->dpif, &execute); + log_execute_message(aux->dpif, &this_module, &execute, + true, aux->error); +diff --git a/lib/dpif.h b/lib/dpif.h +index ecda896c78..f9728e6739 100644 +--- a/lib/dpif.h ++++ b/lib/dpif.h +@@ -727,7 +727,7 @@ struct dpif_execute { + bool probe; /* Suppress error messages. */ + unsigned int mtu; /* Maximum transmission unit to fragment. + 0 if not a fragmented packet */ +- uint64_t hash; ++ uint64_t hash; /* Packet flow hash. 0 if not specified. */ + const struct flow *flow; /* Flow extracted from 'packet'. */ + + /* Input, but possibly modified as a side effect of execution. */ diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 6be23dbeed..f87a200756 100644 --- a/lib/netdev-linux.c @@ -373,6 +459,339 @@ index 6be23dbeed..f87a200756 100644 unsigned int bps = ((uint64_t) kbits_rate * 1000) / 8; struct tc_police police; struct tc_ratespec rate; +diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c +index 72b7915052..7656427845 100644 +--- a/lib/netdev-offload-tc.c ++++ b/lib/netdev-offload-tc.c +@@ -48,6 +48,7 @@ static struct hmap ufid_to_tc = HMAP_INITIALIZER(&ufid_to_tc); + static struct hmap tc_to_ufid = HMAP_INITIALIZER(&tc_to_ufid); + static bool multi_mask_per_prio = false; + static bool block_support = false; ++static uint16_t ct_state_support; + + struct netlink_field { + int offset; +@@ -676,6 +677,27 @@ parse_tc_flower_to_match(struct tc_flower *flower, + ct_statem |= OVS_CS_F_TRACKED; + } + ++ if (mask->ct_state & TCA_FLOWER_KEY_CT_FLAGS_REPLY) { ++ if (key->ct_state & TCA_FLOWER_KEY_CT_FLAGS_REPLY) { ++ ct_statev |= OVS_CS_F_REPLY_DIR; ++ } ++ ct_statem |= OVS_CS_F_REPLY_DIR; ++ } ++ ++ if (mask->ct_state & TCA_FLOWER_KEY_CT_FLAGS_INVALID) { ++ if (key->ct_state & TCA_FLOWER_KEY_CT_FLAGS_INVALID) { ++ ct_statev |= OVS_CS_F_INVALID; ++ } ++ ct_statem |= OVS_CS_F_INVALID; ++ } ++ ++ if (mask->ct_state & TCA_FLOWER_KEY_CT_FLAGS_RELATED) { ++ if (key->ct_state & TCA_FLOWER_KEY_CT_FLAGS_RELATED) { ++ ct_statev |= OVS_CS_F_RELATED; ++ } ++ ct_statem |= OVS_CS_F_RELATED; ++ } ++ + match_set_ct_state_masked(match, ct_statev, ct_statem); + } + +@@ -1406,6 +1428,90 @@ flower_match_to_tun_opt(struct tc_flower *flower, const struct flow_tnl *tnl, + flower->mask.tunnel.metadata.present.len = tnl->metadata.present.len; + } + ++static void ++parse_match_ct_state_to_flower(struct tc_flower *flower, struct match *match) ++{ ++ const struct flow *key = &match->flow; ++ struct flow *mask = &match->wc.masks; ++ ++ if (!ct_state_support) { ++ return; ++ } ++ ++ if ((ct_state_support & mask->ct_state) == mask->ct_state) { ++ if (mask->ct_state & OVS_CS_F_NEW) { ++ if (key->ct_state & OVS_CS_F_NEW) { ++ flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_NEW; ++ } ++ flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_NEW; ++ mask->ct_state &= ~OVS_CS_F_NEW; ++ } ++ ++ if (mask->ct_state & OVS_CS_F_ESTABLISHED) { ++ if (key->ct_state & OVS_CS_F_ESTABLISHED) { ++ flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED; ++ } ++ flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED; ++ mask->ct_state &= ~OVS_CS_F_ESTABLISHED; ++ } ++ ++ if (mask->ct_state & OVS_CS_F_TRACKED) { ++ if (key->ct_state & OVS_CS_F_TRACKED) { ++ flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_TRACKED; ++ } ++ flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_TRACKED; ++ mask->ct_state &= ~OVS_CS_F_TRACKED; ++ } ++ ++ if (mask->ct_state & OVS_CS_F_REPLY_DIR) { ++ if (key->ct_state & OVS_CS_F_REPLY_DIR) { ++ flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_REPLY; ++ } ++ flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_REPLY; ++ mask->ct_state &= ~OVS_CS_F_REPLY_DIR; ++ } ++ ++ if (mask->ct_state & OVS_CS_F_INVALID) { ++ if (key->ct_state & OVS_CS_F_INVALID) { ++ flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_INVALID; ++ } ++ flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_INVALID; ++ mask->ct_state &= ~OVS_CS_F_INVALID; ++ } ++ ++ if (mask->ct_state & OVS_CS_F_RELATED) { ++ if (key->ct_state & OVS_CS_F_RELATED) { ++ flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_RELATED; ++ } ++ flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_RELATED; ++ mask->ct_state &= ~OVS_CS_F_RELATED; ++ } ++ ++ if (flower->key.ct_state & TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED) { ++ flower->key.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW); ++ flower->mask.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW); ++ } ++ } ++ ++ if (mask->ct_zone) { ++ flower->key.ct_zone = key->ct_zone; ++ flower->mask.ct_zone = mask->ct_zone; ++ mask->ct_zone = 0; ++ } ++ ++ if (mask->ct_mark) { ++ flower->key.ct_mark = key->ct_mark; ++ flower->mask.ct_mark = mask->ct_mark; ++ mask->ct_mark = 0; ++ } ++ ++ if (!ovs_u128_is_zero(mask->ct_label)) { ++ flower->key.ct_label = key->ct_label; ++ flower->mask.ct_label = mask->ct_label; ++ mask->ct_label = OVS_U128_ZERO; ++ } ++} ++ + static int + netdev_tc_flow_put(struct netdev *netdev, struct match *match, + struct nlattr *actions, size_t actions_len, +@@ -1650,54 +1756,7 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, + } + } + +- if (mask->ct_state) { +- if (mask->ct_state & OVS_CS_F_NEW) { +- if (key->ct_state & OVS_CS_F_NEW) { +- flower.key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_NEW; +- } +- flower.mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_NEW; +- mask->ct_state &= ~OVS_CS_F_NEW; +- } +- +- if (mask->ct_state & OVS_CS_F_ESTABLISHED) { +- if (key->ct_state & OVS_CS_F_ESTABLISHED) { +- flower.key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED; +- } +- flower.mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED; +- mask->ct_state &= ~OVS_CS_F_ESTABLISHED; +- } +- +- if (mask->ct_state & OVS_CS_F_TRACKED) { +- if (key->ct_state & OVS_CS_F_TRACKED) { +- flower.key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_TRACKED; +- } +- flower.mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_TRACKED; +- mask->ct_state &= ~OVS_CS_F_TRACKED; +- } +- +- if (flower.key.ct_state & TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED) { +- flower.key.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW); +- flower.mask.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW); +- } +- } +- +- if (mask->ct_zone) { +- flower.key.ct_zone = key->ct_zone; +- flower.mask.ct_zone = mask->ct_zone; +- mask->ct_zone = 0; +- } +- +- if (mask->ct_mark) { +- flower.key.ct_mark = key->ct_mark; +- flower.mask.ct_mark = mask->ct_mark; +- mask->ct_mark = 0; +- } +- +- if (!ovs_u128_is_zero(mask->ct_label)) { +- flower.key.ct_label = key->ct_label; +- flower.mask.ct_label = mask->ct_label; +- mask->ct_label = OVS_U128_ZERO; +- } ++ parse_match_ct_state_to_flower(&flower, match); + + /* ignore exact match on skb_mark of 0. */ + if (mask->pkt_mark == UINT32_MAX && !key->pkt_mark) { +@@ -1779,6 +1838,10 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, + const struct nlattr *ct = nl_attr_get(nla); + const size_t ct_len = nl_attr_get_size(nla); + ++ if (!ct_state_support) { ++ return -EOPNOTSUPP; ++ } ++ + err = parse_put_flow_ct_action(&flower, action, ct, ct_len); + if (err) { + return err; +@@ -1971,6 +2034,96 @@ out: + tc_add_del_qdisc(ifindex, false, block_id, TC_INGRESS); + } + ++ ++static int ++probe_insert_ct_state_rule(int ifindex, uint16_t ct_state, struct tcf_id *id) ++{ ++ int prio = TC_RESERVED_PRIORITY_MAX + 1; ++ struct tc_flower flower; ++ ++ memset(&flower, 0, sizeof flower); ++ flower.key.ct_state = ct_state; ++ flower.mask.ct_state = ct_state; ++ flower.tc_policy = TC_POLICY_SKIP_HW; ++ flower.key.eth_type = htons(ETH_P_IP); ++ flower.mask.eth_type = OVS_BE16_MAX; ++ ++ *id = tc_make_tcf_id(ifindex, 0, prio, TC_INGRESS); ++ return tc_replace_flower(id, &flower); ++} ++ ++static void ++probe_ct_state_support(int ifindex) ++{ ++ struct tc_flower flower; ++ uint16_t ct_state; ++ struct tcf_id id; ++ int error; ++ ++ error = tc_add_del_qdisc(ifindex, true, 0, TC_INGRESS); ++ if (error) { ++ return; ++ } ++ ++ /* Test for base ct_state match support */ ++ ct_state = TCA_FLOWER_KEY_CT_FLAGS_NEW | TCA_FLOWER_KEY_CT_FLAGS_TRACKED; ++ error = probe_insert_ct_state_rule(ifindex, ct_state, &id); ++ if (error) { ++ goto out; ++ } ++ ++ error = tc_get_flower(&id, &flower); ++ if (error || flower.mask.ct_state != ct_state) { ++ goto out_del; ++ } ++ ++ tc_del_filter(&id); ++ ct_state_support = OVS_CS_F_NEW | ++ OVS_CS_F_ESTABLISHED | ++ OVS_CS_F_TRACKED | ++ OVS_CS_F_RELATED; ++ ++ /* Test for reject, ct_state >= MAX */ ++ ct_state = ~0; ++ error = probe_insert_ct_state_rule(ifindex, ct_state, &id); ++ if (!error) { ++ /* No reject, can't continue probing other flags */ ++ goto out_del; ++ } ++ ++ tc_del_filter(&id); ++ ++ /* Test for ct_state INVALID support */ ++ memset(&flower, 0, sizeof flower); ++ ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | ++ TCA_FLOWER_KEY_CT_FLAGS_INVALID; ++ error = probe_insert_ct_state_rule(ifindex, ct_state, &id); ++ if (error) { ++ goto out; ++ } ++ ++ tc_del_filter(&id); ++ ct_state_support |= OVS_CS_F_INVALID; ++ ++ /* Test for ct_state REPLY support */ ++ memset(&flower, 0, sizeof flower); ++ ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | ++ TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED | ++ TCA_FLOWER_KEY_CT_FLAGS_REPLY; ++ error = probe_insert_ct_state_rule(ifindex, ct_state, &id); ++ if (error) { ++ goto out; ++ } ++ ++ ct_state_support |= OVS_CS_F_REPLY_DIR; ++ ++out_del: ++ tc_del_filter(&id); ++out: ++ tc_add_del_qdisc(ifindex, false, 0, TC_INGRESS); ++ VLOG_INFO("probe tc: supported ovs ct_state bits: 0x%x", ct_state_support); ++} ++ + static void + probe_tc_block_support(int ifindex) + { +@@ -2038,6 +2191,7 @@ netdev_tc_init_flow_api(struct netdev *netdev) + block_id = get_block_id_from_netdev(netdev); + + probe_multi_mask_per_prio(ifindex); ++ probe_ct_state_support(ifindex); + ovsthread_once_done(&once); + } + +diff --git a/lib/odp-util.c b/lib/odp-util.c +index a8598d52af..e1199d1da6 100644 +--- a/lib/odp-util.c ++++ b/lib/odp-util.c +@@ -3189,17 +3189,17 @@ tun_key_to_attr(struct ofpbuf *a, const struct flow_tnl *tun_key, + if ((!tnl_type || !strcmp(tnl_type, "erspan") || + !strcmp(tnl_type, "ip6erspan")) && + (tun_key->erspan_ver == 1 || tun_key->erspan_ver == 2)) { +- struct erspan_metadata opts; ++ struct erspan_metadata *opts; + +- opts.version = tun_key->erspan_ver; +- if (opts.version == 1) { +- opts.u.index = htonl(tun_key->erspan_idx); ++ opts = nl_msg_put_unspec_zero(a, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, ++ sizeof *opts); ++ opts->version = tun_key->erspan_ver; ++ if (opts->version == 1) { ++ opts->u.index = htonl(tun_key->erspan_idx); + } else { +- opts.u.md2.dir = tun_key->erspan_dir; +- set_hwid(&opts.u.md2, tun_key->erspan_hwid); ++ opts->u.md2.dir = tun_key->erspan_dir; ++ set_hwid(&opts->u.md2, tun_key->erspan_hwid); + } +- nl_msg_put_unspec(a, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, +- &opts, sizeof(opts)); + } + + if ((!tnl_type || !strcmp(tnl_type, "gtpu")) && diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index e2e829772a..0342a228b7 100644 --- a/lib/ofp-actions.c @@ -735,6 +1154,23 @@ index 9c5c633b41..fa8f6cd0e8 100644 LIST_FOR_EACH (ofconn, connmgr_node, &mgr->conns) { struct rconn_packet_counter *counter = ofconn->monitor_counter; +diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c +index fdcb9eabbf..864c136b5d 100644 +--- a/ofproto/ofproto-dpif-sflow.c ++++ b/ofproto/ofproto-dpif-sflow.c +@@ -1292,10 +1292,10 @@ dpif_sflow_received(struct dpif_sflow *ds, const struct dp_packet *packet, + ovs_be16 vlan_tci; + + ovs_mutex_lock(&mutex); +- sampler = ds->sflow_agent->samplers; +- if (!sampler) { ++ if (!ds->sflow_agent || !ds->sflow_agent->samplers) { + goto out; + } ++ sampler = ds->sflow_agent->samplers; + + /* Build a flow sample. */ + memset(&fs, 0, sizeof fs); diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 5fae46adfc..ccf97266c0 100644 --- a/ofproto/ofproto-dpif-upcall.c diff --git a/SPECS/openvswitch2.15.spec b/SPECS/openvswitch2.15.spec index 35ca2f8..9847dfd 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: 11%{?dist} +Release: 15%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -697,6 +697,28 @@ exit 0 %endif %changelog +* Wed Apr 21 2021 Open vSwitch CI - 2.15.0-15 +- Merging upstream branch-2.15 [RH gerrit: 85f5aecb83] + Commit list: + f2c0744d2f ofproto/ofproto-dpif-sflow: Check sflow agent in case of race + + +* Tue Apr 20 2021 Aaron Conole - 2.15.0-14 +- Merging ct_state_fix [RH gerrit: f847e4fac1] + Commit list: + 09a2081067 netdev-offload-tc: Add support for ct_state flag rel. + 423048a34f netdev-offload-tc: Add support for ct_state flags inv and rpl + + +* Tue Apr 20 2021 Aaron Conole - 2.15.0-13 +- ab157ef34d dpif: Fix use of uninitialized execute hash. b1fded0208 odp-util: Fix use of uninitialized erspan metadata. f473ee5689 dpif-netlink: Fix using uninitialized info.tc_modify_flow_deleted in out label. 2721606bd4 netdev-offload-tc: Probe for support for any of the ct_state flags. 091bc48d9c compat: Add ct_state flags definitions. [RH gerrit: e4336ed96c] + + +* Tue Apr 20 2021 Timothy Redaelli - 2.15.0-12 +- Fix typo in rh-mock-srpm [RH gerrit: 85631264db] + Thanks fbl for reporting + + * Wed Apr 14 2021 Open vSwitch CI - 2.15.0-11 - Merging upstream branch-2.15 [RH gerrit: 71c33052b9] Commit list: