From a6bda3c880c07f7f904596b664d674d8fc3b9d64 Mon Sep 17 00:00:00 2001 From: Nobuhiro MIKI Date: Fri, 15 Sep 2023 12:02:12 +0900 Subject: [PATCH] flow: Add list node for the conjunctive flow. In subsequent patches, flows need to be grouped in a list and treated as a conjunctive flow. Signed-off-by: Nobuhiro MIKI Signed-off-by: 0-day Robot --- include/openvswitch/flow.h | 9 ++++++--- lib/dpif-netdev-extract-avx512.c | 2 +- lib/flow.c | 20 ++++++++++---------- lib/flow.h | 2 +- lib/match.c | 2 +- lib/nx-match.c | 2 +- lib/odp-util.c | 6 +++--- lib/odp-util.h | 2 +- lib/ofp-match.c | 2 +- ofproto/ofproto-dpif-rid.h | 2 +- ofproto/ofproto-dpif-xlate.c | 2 +- 11 files changed, 27 insertions(+), 24 deletions(-) diff --git a/include/openvswitch/flow.h b/include/openvswitch/flow.h index df10cf579e2..dc0cf500bb9 100644 --- a/include/openvswitch/flow.h +++ b/include/openvswitch/flow.h @@ -19,6 +19,7 @@ #include "openflow/nicira-ext.h" #include "openvswitch/packets.h" #include "openvswitch/util.h" +#include "openvswitch/list.h" #ifdef __cplusplus extern "C" { @@ -27,7 +28,7 @@ extern "C" { /* This sequence number should be incremented whenever anything involving flows * or the wildcarding of flows changes. This will cause build assertion * failures in places which likely need to be updated. */ -#define FLOW_WC_SEQ 42 +#define FLOW_WC_SEQ 43 /* Number of Open vSwitch extension 32-bit registers. */ #define FLOW_N_REGS 16 @@ -116,6 +117,7 @@ struct flow { ovs_u128 ct_label; /* Connection label. */ uint32_t conj_id; /* Conjunction ID. */ ofp_port_t actset_output; /* Output port in action set. */ + struct ovs_list list_node; /* In struct xlate_out's "conj_flows" list. */ /* L2, Order the same as in the Ethernet header! (64-bit aligned) */ struct eth_addr dl_dst; /* Ethernet destination address. */ @@ -166,8 +168,9 @@ BUILD_ASSERT_DECL(sizeof(struct ovs_key_nsh) % sizeof(uint64_t) == 0); /* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */ BUILD_ASSERT_DECL(offsetof(struct flow, igmp_group_ip4) + sizeof(uint32_t) - == sizeof(struct flow_tnl) + sizeof(struct ovs_key_nsh) + 300 - && FLOW_WC_SEQ == 42); + == sizeof(struct flow_tnl) + sizeof(struct ovs_key_nsh) + + sizeof(struct ovs_list) + 300 + && FLOW_WC_SEQ == 43); /* Incremental points at which flow classification may be performed in * segments. diff --git a/lib/dpif-netdev-extract-avx512.c b/lib/dpif-netdev-extract-avx512.c index 1bc7e8d0e08..4e2f8d0dbcb 100644 --- a/lib/dpif-netdev-extract-avx512.c +++ b/lib/dpif-netdev-extract-avx512.c @@ -421,7 +421,7 @@ BUILD_ASSERT_DECL((OFFSETOFEND(struct dp_packet, l4_ofs) BUILD_ASSERT_DECL(FLOWMAP_UNITS == 2); /* Ensure the miniflow-struct ABI is the expected version. */ -BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); +BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); /* If the above build assert happens, this means that you might need to make * some modifications to the AVX512 miniflow extractor code. In general, the diff --git a/lib/flow.c b/lib/flow.c index fe226cf0fe5..45480bca42a 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -136,7 +136,7 @@ struct mf_ctx { * away. Some GCC versions gave warnings on ALWAYS_INLINE, so these are * defined as macros. */ -#if (FLOW_WC_SEQ != 42) +#if (FLOW_WC_SEQ != 43) #define MINIFLOW_ASSERT(X) ovs_assert(X) BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have runtime " "assertions enabled. Consider updating FLOW_WC_SEQ after " @@ -789,7 +789,7 @@ void miniflow_extract(struct dp_packet *packet, struct miniflow *dst) { /* Add code to this function (or its callees) to extract new fields. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); const struct pkt_metadata *md = &packet->md; const void *data = dp_packet_data(packet); @@ -1309,7 +1309,7 @@ flow_get_metadata(const struct flow *flow, struct match *flow_metadata) { int i; - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); match_init_catchall(flow_metadata); if (flow->tunnel.tun_id != htonll(0)) { @@ -1895,7 +1895,7 @@ flow_wildcards_init_for_packet(struct flow_wildcards *wc, memset(&wc->masks, 0x0, sizeof wc->masks); /* Update this function whenever struct flow changes. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); if (flow_tnl_dst_is_set(&flow->tunnel)) { if (flow->tunnel.flags & FLOW_TNL_F_KEY) { @@ -2048,7 +2048,7 @@ void flow_wc_map(const struct flow *flow, struct flowmap *map) { /* Update this function whenever struct flow changes. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); flowmap_init(map); @@ -2151,7 +2151,7 @@ void flow_wildcards_clear_non_packet_fields(struct flow_wildcards *wc) { /* Update this function whenever struct flow changes. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); memset(&wc->masks.metadata, 0, sizeof wc->masks.metadata); memset(&wc->masks.regs, 0, sizeof wc->masks.regs); @@ -2295,7 +2295,7 @@ flow_wildcards_set_xxreg_mask(struct flow_wildcards *wc, int idx, uint32_t miniflow_hash_5tuple(const struct miniflow *flow, uint32_t basis) { - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); uint32_t hash = basis; if (flow) { @@ -2342,7 +2342,7 @@ ASSERT_SEQUENTIAL(ipv6_src, ipv6_dst); uint32_t flow_hash_5tuple(const struct flow *flow, uint32_t basis) { - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); uint32_t hash = basis; if (flow) { @@ -3020,7 +3020,7 @@ flow_push_mpls(struct flow *flow, int n, ovs_be16 mpls_eth_type, if (clear_flow_L3) { /* Clear all L3 and L4 fields and dp_hash. */ - BUILD_ASSERT(FLOW_WC_SEQ == 42); + BUILD_ASSERT(FLOW_WC_SEQ == 43); memset((char *) flow + FLOW_SEGMENT_2_ENDS_AT, 0, sizeof(struct flow) - FLOW_SEGMENT_2_ENDS_AT); flow->dp_hash = 0; @@ -3323,7 +3323,7 @@ flow_compose(struct dp_packet *p, const struct flow *flow, /* Add code to this function (or its callees) for emitting new fields or * protocols. (This isn't essential, so it can be skipped for initial * testing.) */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); uint32_t pseudo_hdr_csum; size_t l4_len; diff --git a/lib/flow.h b/lib/flow.h index a9d026e1ce3..e3194d94d3d 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -966,7 +966,7 @@ static inline void pkt_metadata_from_flow(struct pkt_metadata *md, const struct flow *flow) { /* Update this function whenever struct flow changes. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); md->recirc_id = flow->recirc_id; md->dp_hash = flow->dp_hash; diff --git a/lib/match.c b/lib/match.c index 0b9dc4278c1..f3834752ef7 100644 --- a/lib/match.c +++ b/lib/match.c @@ -1462,7 +1462,7 @@ match_format(const struct match *match, bool is_megaflow = false; int i; - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); if (priority != OFP_DEFAULT_PRIORITY) { ds_put_format(s, "%spriority=%s%d,", diff --git a/lib/nx-match.c b/lib/nx-match.c index 440f5f7630c..f96f835636f 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -1051,7 +1051,7 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match, ovs_be32 spi_mask; int match_len; - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); struct nxm_put_ctx ctx = { .output = b, .implied_ethernet = false }; diff --git a/lib/odp-util.c b/lib/odp-util.c index 3eb2c3cb98c..c5f5da98a98 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -6253,7 +6253,7 @@ odp_flow_key_from_flow__(const struct odp_flow_key_parms *parms, /* New "struct flow" fields that are visible to the datapath (including all * data fields) should be translated into equivalent datapath flow fields * here (you will have to add a OVS_KEY_ATTR_* for them). */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); struct ovs_key_ethernet *eth_key; size_t encap[FLOW_MAX_VLAN_HEADERS] = {0}; @@ -7367,7 +7367,7 @@ odp_flow_key_to_flow__(const struct nlattr *key, size_t key_len, /* New "struct flow" fields that are visible to the datapath (including all * data fields) should be translated from equivalent datapath flow fields * here (you will have to add a OVS_KEY_ATTR_* for them). */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); enum odp_key_fitness fitness = ODP_FIT_ERROR; if (errorp) { @@ -8807,7 +8807,7 @@ commit_odp_actions(const struct flow *flow, struct flow *base, /* If you add a field that OpenFlow actions can change, and that is visible * to the datapath (including all data fields), then you should also add * code here to commit changes to the field. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); enum slow_path_reason slow1, slow2; bool mpls_done = false; diff --git a/lib/odp-util.h b/lib/odp-util.h index 8c7baa680dd..65c33272779 100644 --- a/lib/odp-util.h +++ b/lib/odp-util.h @@ -147,7 +147,7 @@ void odp_portno_name_format(const struct hmap *portno_names, * add another field and forget to adjust this value. */ #define ODPUTIL_FLOW_KEY_BYTES 640 -BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); +BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); /* A buffer with sufficient size and alignment to hold an nlattr-formatted flow * key. An array of "struct nlattr" might not, in theory, be sufficiently diff --git a/lib/ofp-match.c b/lib/ofp-match.c index 86a082dde14..6525922ef8e 100644 --- a/lib/ofp-match.c +++ b/lib/ofp-match.c @@ -65,7 +65,7 @@ ofputil_netmask_to_wcbits(ovs_be32 netmask) void ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct flow_wildcards *wc) { - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); /* Initialize most of wc. */ flow_wildcards_init_catchall(wc); diff --git a/ofproto/ofproto-dpif-rid.h b/ofproto/ofproto-dpif-rid.h index 4df630c62bd..21f32b93574 100644 --- a/ofproto/ofproto-dpif-rid.h +++ b/ofproto/ofproto-dpif-rid.h @@ -100,7 +100,7 @@ struct rule; /* Metadata for restoring pipeline context after recirculation. Helpers * are inlined below to keep them together with the definition for easier * updates. */ -BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); +BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); struct frozen_metadata { /* Metadata in struct flow. */ diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index be4bd665768..9cdddb1ff8c 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4343,7 +4343,7 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, /* If 'struct flow' gets additional metadata, we'll need to zero it out * before traversing a patch port. */ - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 42); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 43); if (!check_output_prerequisites(ctx, xport, flow, check_stp)) { return;