From 90835e16354acc9a53e1c15c13b9439739f40e38 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Mar 04 2022 22:31:30 +0000 Subject: Import openvswitch2.15-2.15.0-79 from Fast DataPath --- diff --git a/SOURCES/openvswitch-2.15.0.patch b/SOURCES/openvswitch-2.15.0.patch index 11993e1..620dfd0 100644 --- a/SOURCES/openvswitch-2.15.0.patch +++ b/SOURCES/openvswitch-2.15.0.patch @@ -670,7 +670,7 @@ index bc901efdb1..d491703571 100644 --------------------- - OVSDB: diff --git a/acinclude.m4 b/acinclude.m4 -index 435685c93d..15a54d636f 100644 +index 435685c93d..44ee2a7f82 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -209,10 +209,10 @@ dnl Configure Linux tc compat. @@ -687,6 +687,20 @@ index 435685c93d..15a54d636f 100644 AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include ]) +@@ -250,6 +250,13 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [ + ])], + [AC_DEFINE([HAVE_TCA_SKBEDIT_FLAGS], [1], + [Define to 1 if TCA_SKBEDIT_FLAGS is available.])]) ++ ++ AC_COMPILE_IFELSE([ ++ AC_LANG_PROGRAM([#include ], [ ++ int x = TCA_STATS_PKT64; ++ ])], ++ [AC_DEFINE([HAVE_TCA_STATS_PKT64], [1], ++ [Define to 1 if TCA_STATS_PKT64 is available.])]) + ]) + + dnl OVS_CHECK_LINUX_SCTP_CT diff --git a/configure.ac b/configure.ac index fd82d7d270..ccfbc06639 100644 --- a/configure.ac @@ -19164,6 +19178,105 @@ index c2ede3d4df..98bd1b7e4d 100755 def check_modules(): +diff --git a/include/linux/automake.mk b/include/linux/automake.mk +index 8f063f482e..f857c7e088 100644 +--- a/include/linux/automake.mk ++++ b/include/linux/automake.mk +@@ -2,6 +2,7 @@ noinst_HEADERS += \ + include/linux/netlink.h \ + include/linux/netfilter/nf_conntrack_sctp.h \ + include/linux/pkt_cls.h \ ++ include/linux/gen_stats.h \ + include/linux/tc_act/tc_mpls.h \ + include/linux/tc_act/tc_pedit.h \ + include/linux/tc_act/tc_skbedit.h \ +diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h +new file mode 100644 +index 0000000000..6fae6f727c +--- /dev/null ++++ b/include/linux/gen_stats.h +@@ -0,0 +1,81 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef __LINUX_GEN_STATS_WRAPPER_H ++#define __LINUX_GEN_STATS_WRAPPER_H 1 ++ ++#if defined(__KERNEL__) || defined(HAVE_TCA_STATS_PKT64) ++#include_next ++#else ++#include ++ ++enum { ++ TCA_STATS_UNSPEC, ++ TCA_STATS_BASIC, ++ TCA_STATS_RATE_EST, ++ TCA_STATS_QUEUE, ++ TCA_STATS_APP, ++ TCA_STATS_RATE_EST64, ++ TCA_STATS_PAD, ++ TCA_STATS_BASIC_HW, ++ TCA_STATS_PKT64, ++ __TCA_STATS_MAX, ++}; ++#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) ++ ++/** ++ * struct gnet_stats_basic - byte/packet throughput statistics ++ * @bytes: number of seen bytes ++ * @packets: number of seen packets ++ */ ++struct gnet_stats_basic { ++ __u64 bytes; ++ __u32 packets; ++}; ++ ++/** ++ * struct gnet_stats_rate_est - rate estimator ++ * @bps: current byte rate ++ * @pps: current packet rate ++ */ ++struct gnet_stats_rate_est { ++ __u32 bps; ++ __u32 pps; ++}; ++ ++/** ++ * struct gnet_stats_rate_est64 - rate estimator ++ * @bps: current byte rate ++ * @pps: current packet rate ++ */ ++struct gnet_stats_rate_est64 { ++ __u64 bps; ++ __u64 pps; ++}; ++ ++/** ++ * struct gnet_stats_queue - queuing statistics ++ * @qlen: queue length ++ * @backlog: backlog size of queue ++ * @drops: number of dropped packets ++ * @requeues: number of requeues ++ * @overlimits: number of enqueues over the limit ++ */ ++struct gnet_stats_queue { ++ __u32 qlen; ++ __u32 backlog; ++ __u32 drops; ++ __u32 requeues; ++ __u32 overlimits; ++}; ++ ++/** ++ * struct gnet_estimator - rate estimator configuration ++ * @interval: sampling period ++ * @ewma_log: the log of measurement window weight ++ */ ++struct gnet_estimator { ++ signed char interval; ++ unsigned char ewma_log; ++}; ++ ++#endif /* __KERNEL__ || !HAVE_TCA_STATS_PKT64 */ ++#endif /* __LINUX_GEN_STATS_WRAPPER_H */ diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index b0a5ce8bec..bc51a5767f 100644 --- a/include/linux/pkt_cls.h @@ -20918,7 +21031,7 @@ index f2413f5be6..0e4119c0a6 100644 } ds_put_cstr(s, "/ "); diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c -index 72b7915052..32f52b46f2 100644 +index 72b7915052..0dd29b66d7 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); @@ -20929,7 +21042,20 @@ index 72b7915052..32f52b46f2 100644 struct netlink_field { int offset; -@@ -676,6 +677,27 @@ parse_tc_flower_to_match(struct tc_flower *flower, +@@ -515,8 +516,10 @@ parse_tc_flower_to_stats(struct tc_flower *flower, + } + + memset(stats, 0, sizeof *stats); +- stats->n_packets = get_32aligned_u64(&flower->stats.n_packets); +- stats->n_bytes = get_32aligned_u64(&flower->stats.n_bytes); ++ stats->n_packets = get_32aligned_u64(&flower->stats_sw.n_packets); ++ stats->n_packets += get_32aligned_u64(&flower->stats_hw.n_packets); ++ stats->n_bytes = get_32aligned_u64(&flower->stats_sw.n_bytes); ++ stats->n_bytes += get_32aligned_u64(&flower->stats_hw.n_bytes); + stats->used = flower->lastused; + } + +@@ -676,6 +679,27 @@ parse_tc_flower_to_match(struct tc_flower *flower, ct_statem |= OVS_CS_F_TRACKED; } @@ -20957,7 +21083,7 @@ index 72b7915052..32f52b46f2 100644 match_set_ct_state_masked(match, ct_statev, ct_statem); } -@@ -820,8 +842,7 @@ parse_tc_flower_to_match(struct tc_flower *flower, +@@ -820,8 +844,7 @@ parse_tc_flower_to_match(struct tc_flower *flower, action->encap.tp_dst); } if (!action->encap.no_csum) { @@ -20967,7 +21093,7 @@ index 72b7915052..32f52b46f2 100644 } parse_tc_flower_geneve_opts(action, buf); -@@ -1406,6 +1427,90 @@ flower_match_to_tun_opt(struct tc_flower *flower, const struct flow_tnl *tnl, +@@ -1406,6 +1429,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; } @@ -21058,7 +21184,7 @@ index 72b7915052..32f52b46f2 100644 static int netdev_tc_flow_put(struct netdev *netdev, struct match *match, struct nlattr *actions, size_t actions_len, -@@ -1650,54 +1755,7 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, +@@ -1650,54 +1757,7 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, } } @@ -21114,7 +21240,7 @@ index 72b7915052..32f52b46f2 100644 /* ignore exact match on skb_mark of 0. */ if (mask->pkt_mark == UINT32_MAX && !key->pkt_mark) { -@@ -1779,6 +1837,10 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, +@@ -1779,6 +1839,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); @@ -21125,6 +21251,17 @@ index 72b7915052..32f52b46f2 100644 err = parse_put_flow_ct_action(&flower, action, ct, ct_len); if (err) { return err; +@@ -1894,9 +1958,7 @@ netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED, + if (stats) { + memset(stats, 0, sizeof *stats); + if (!tc_get_flower(&id, &flower)) { +- stats->n_packets = get_32aligned_u64(&flower.stats.n_packets); +- stats->n_bytes = get_32aligned_u64(&flower.stats.n_bytes); +- stats->used = flower.lastused; ++ parse_tc_flower_to_stats(&flower, stats); + } + } + @@ -1971,6 +2033,96 @@ out: tc_add_del_qdisc(ifindex, false, block_id, TC_INGRESS); } @@ -22066,10 +22203,65 @@ index 809b405a52..a869b5f390 100644 goto out; } diff --git a/lib/tc.c b/lib/tc.c -index 3192207984..d88198a138 100644 +index 3192207984..57c30ed290 100644 --- a/lib/tc.c +++ b/lib/tc.c -@@ -2464,6 +2464,17 @@ nl_msg_put_flower_rewrite_pedits(struct ofpbuf *request, +@@ -1652,6 +1652,9 @@ static const struct nl_policy stats_policy[] = { + [TCA_STATS_BASIC] = { .type = NL_A_UNSPEC, + .min_len = sizeof(struct gnet_stats_basic), + .optional = false, }, ++ [TCA_STATS_BASIC_HW] = { .type = NL_A_UNSPEC, ++ .min_len = sizeof(struct gnet_stats_basic), ++ .optional = true, }, + }; + + static int +@@ -1664,8 +1667,11 @@ nl_parse_single_action(struct nlattr *action, struct tc_flower *flower, + const char *act_kind; + struct nlattr *action_attrs[ARRAY_SIZE(act_policy)]; + struct nlattr *stats_attrs[ARRAY_SIZE(stats_policy)]; +- struct ovs_flow_stats *stats = &flower->stats; +- const struct gnet_stats_basic *bs; ++ struct ovs_flow_stats *stats_sw = &flower->stats_sw; ++ struct ovs_flow_stats *stats_hw = &flower->stats_hw; ++ const struct gnet_stats_basic *bs_all = NULL; ++ const struct gnet_stats_basic *bs_hw = NULL; ++ struct gnet_stats_basic bs_sw = { .packets = 0, .bytes = 0, }; + int err = 0; + + if (!nl_parse_nested(action, act_policy, action_attrs, +@@ -1721,10 +1727,26 @@ nl_parse_single_action(struct nlattr *action, struct tc_flower *flower, + return EPROTO; + } + +- bs = nl_attr_get_unspec(stats_attrs[TCA_STATS_BASIC], sizeof *bs); +- if (bs->packets) { +- put_32aligned_u64(&stats->n_packets, bs->packets); +- put_32aligned_u64(&stats->n_bytes, bs->bytes); ++ bs_all = nl_attr_get_unspec(stats_attrs[TCA_STATS_BASIC], sizeof *bs_all); ++ if (stats_attrs[TCA_STATS_BASIC_HW]) { ++ bs_hw = nl_attr_get_unspec(stats_attrs[TCA_STATS_BASIC_HW], ++ sizeof *bs_hw); ++ ++ bs_sw.packets = bs_all->packets - bs_hw->packets; ++ bs_sw.bytes = bs_all->bytes - bs_hw->bytes; ++ } else { ++ bs_sw.packets = bs_all->packets; ++ bs_sw.bytes = bs_all->bytes; ++ } ++ ++ if (bs_sw.packets > get_32aligned_u64(&stats_sw->n_packets)) { ++ put_32aligned_u64(&stats_sw->n_packets, bs_sw.packets); ++ put_32aligned_u64(&stats_sw->n_bytes, bs_sw.bytes); ++ } ++ ++ if (bs_hw && bs_hw->packets > get_32aligned_u64(&stats_hw->n_packets)) { ++ put_32aligned_u64(&stats_hw->n_packets, bs_hw->packets); ++ put_32aligned_u64(&stats_hw->n_bytes, bs_hw->bytes); + } + + return 0; +@@ -2464,6 +2486,17 @@ nl_msg_put_flower_rewrite_pedits(struct ofpbuf *request, return 0; } @@ -22087,7 +22279,7 @@ index 3192207984..d88198a138 100644 static int nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) { -@@ -2498,6 +2509,11 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) +@@ -2498,6 +2531,11 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) } break; case TC_ACT_ENCAP: { @@ -22099,7 +22291,7 @@ index 3192207984..d88198a138 100644 act_offset = nl_msg_start_nested(request, act_index++); nl_msg_put_act_tunnel_key_set(request, action->encap.id_present, action->encap.id, -@@ -2555,9 +2571,7 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) +@@ -2555,9 +2593,7 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) break; case TC_ACT_OUTPUT: { if (!released && flower->tunnel) { @@ -22110,7 +22302,7 @@ index 3192207984..d88198a138 100644 released = true; } -@@ -2892,6 +2906,50 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower) +@@ -2892,6 +2928,50 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower) return 0; } @@ -22161,7 +22353,7 @@ index 3192207984..d88198a138 100644 int tc_replace_flower(struct tcf_id *id, struct tc_flower *flower) { -@@ -2923,6 +2981,21 @@ tc_replace_flower(struct tcf_id *id, struct tc_flower *flower) +@@ -2923,6 +3003,21 @@ tc_replace_flower(struct tcf_id *id, struct tc_flower *flower) id->prio = tc_get_major(tc->tcm_info); id->handle = tc->tcm_handle; @@ -22183,6 +22375,20 @@ index 3192207984..d88198a138 100644 ofpbuf_delete(reply); } +diff --git a/lib/tc.h b/lib/tc.h +index 281231c0d3..7b833186eb 100644 +--- a/lib/tc.h ++++ b/lib/tc.h +@@ -327,7 +327,8 @@ struct tc_flower { + int action_count; + struct tc_action actions[TCA_ACT_MAX_NUM]; + +- struct ovs_flow_stats stats; ++ struct ovs_flow_stats stats_sw; ++ struct ovs_flow_stats stats_hw; + uint64_t lastused; + + struct { diff --git a/lib/tnl-neigh-cache.c b/lib/tnl-neigh-cache.c index 5bda4af7e0..995c88bf17 100644 --- a/lib/tnl-neigh-cache.c diff --git a/SPECS/openvswitch2.15.spec b/SPECS/openvswitch2.15.spec index 960cf16..515ffc4 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: 78%{?dist} +Release: 79%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -702,6 +702,13 @@ exit 0 %endif %changelog +* Fri Mar 04 2022 Open vSwitch CI - 2.15.0-79 +- Merging upstream branch-2.15 [RH git: 82cbd329f0] + Commit list: + e05105f1e6 tc: Fix stats byte count on fragmented packets. + 81aa8c8073 compat: Add gen_stats include to define tc hw stats. + + * Tue Mar 01 2022 Timothy Redaelli - 2.15.0-78 - Change RTE_ETH_MAXPORTS to 1024 [RH git: cbe02d895f] (#2048601) Resolves: #2048601