Replaced macro definitions for OpenFlow table numbers with runtime variables to allow dynamic configuration.
This change enables future dynamic adjustment of table numbering. Signed-off-by: Alexandra Rukomoinikova <arukomoinikova@k2.cloud> --- controller/lflow.h | 45 -------------------------------- controller/mac-cache.c | 1 + controller/statctrl.c | 1 + include/ovn/actions.h | 1 + lib/automake.mk | 4 ++- lib/oftable.c | 55 +++++++++++++++++++++++++++++++++++++++ lib/oftable.h | 58 ++++++++++++++++++++++++++++++++++++++++++ lib/ovn-util.c | 3 +++ lib/ovn-util.h | 4 +-- utilities/ovn-debug.c | 1 + 10 files changed, 125 insertions(+), 48 deletions(-) create mode 100644 lib/oftable.c create mode 100644 lib/oftable.h diff --git a/controller/lflow.h b/controller/lflow.h index c8a87c886..f4ab70d6c 100644 --- a/controller/lflow.h +++ b/controller/lflow.h @@ -59,51 +59,6 @@ struct simap; struct sset; struct uuid; -/* OpenFlow table numbers. - * - * These are heavily documented in ovn-architecture(7), please update it if - * you make any changes. */ -#define OFTABLE_PHY_TO_LOG 0 - -/* Start of LOG_PIPELINE_LEN tables. */ -#define OFTABLE_LOG_INGRESS_PIPELINE 8 -#define OFTABLE_OUTPUT_LARGE_PKT_DETECT 41 -#define OFTABLE_OUTPUT_LARGE_PKT_PROCESS 42 -#define OFTABLE_REMOTE_OUTPUT 43 -#define OFTABLE_REMOTE_VTEP_OUTPUT 44 -#define OFTABLE_LOCAL_OUTPUT 45 -#define OFTABLE_CHECK_LOOPBACK 46 - -/* Start of the OUTPUT section of the pipeline. */ -#define OFTABLE_OUTPUT_INIT OFTABLE_OUTPUT_LARGE_PKT_DETECT - -/* Start of LOG_PIPELINE_LEN tables. */ -#define OFTABLE_LOG_EGRESS_PIPELINE 47 -#define OFTABLE_SAVE_INPORT 64 -#define OFTABLE_LOG_TO_PHY 65 -#define OFTABLE_MAC_BINDING 66 -#define OFTABLE_MAC_LOOKUP 67 -#define OFTABLE_CHK_LB_HAIRPIN 68 -#define OFTABLE_CHK_LB_HAIRPIN_REPLY 69 -#define OFTABLE_CT_SNAT_HAIRPIN 70 -#define OFTABLE_GET_FDB 71 -#define OFTABLE_LOOKUP_FDB 72 -#define OFTABLE_CHK_IN_PORT_SEC 73 -#define OFTABLE_CHK_IN_PORT_SEC_ND 74 -#define OFTABLE_CHK_OUT_PORT_SEC 75 -#define OFTABLE_ECMP_NH_MAC 76 -#define OFTABLE_ECMP_NH 77 -#define OFTABLE_CHK_LB_AFFINITY 78 -#define OFTABLE_MAC_CACHE_USE 79 -#define OFTABLE_CT_ZONE_LOOKUP 80 -#define OFTABLE_CT_ORIG_NW_DST_LOAD 81 -#define OFTABLE_CT_ORIG_IP6_DST_LOAD 82 -#define OFTABLE_CT_ORIG_TP_DST_LOAD 83 -#define OFTABLE_FLOOD_REMOTE_CHASSIS 84 -#define OFTABLE_CT_STATE_SAVE 85 -#define OFTABLE_CT_ORIG_PROTO_LOAD 86 -#define OFTABLE_GET_REMOTE_FDB 87 - /* Common defines shared between some controller components. */ #define CHASSIS_FLOOD_INDEX_START 0x8000 diff --git a/controller/mac-cache.c b/controller/mac-cache.c index fcf5fa7d4..0fea70333 100644 --- a/controller/mac-cache.c +++ b/controller/mac-cache.c @@ -19,6 +19,7 @@ #include "lflow.h" #include "lib/mac-binding-index.h" #include "lib/vec.h" +#include "lib/oftable.h" #include "local_data.h" #include "lport.h" #include "mac-cache.h" diff --git a/controller/statctrl.c b/controller/statctrl.c index 454314dda..d84274834 100644 --- a/controller/statctrl.c +++ b/controller/statctrl.c @@ -20,6 +20,7 @@ #include "latch.h" #include "lflow.h" #include "lib/vec.h" +#include "lib/oftable.h" #include "mac-cache.h" #include "openvswitch/ofp-errors.h" #include "openvswitch/ofp-flow.h" diff --git a/include/ovn/actions.h b/include/ovn/actions.h index 0eaef9112..82d128f33 100644 --- a/include/ovn/actions.h +++ b/include/ovn/actions.h @@ -27,6 +27,7 @@ #include "openvswitch/uuid.h" #include "util.h" #include "ovn/features.h" +#include "oftable.h" struct expr; struct lexer; diff --git a/lib/automake.mk b/lib/automake.mk index a59c722d6..16baeb157 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -10,6 +10,8 @@ lib_libovn_la_LDFLAGS += $(VIF_PLUG_PROVIDER_LDFLAGS) endif lib_libovn_la_SOURCES = \ + lib/oftable.c \ + lib/oftable.h \ lib/acl-log.c \ lib/acl-log.h \ lib/actions.c \ @@ -22,8 +24,8 @@ lib_libovn_la_SOURCES = \ lib/extend-table.h \ lib/extend-table.c \ lib/features.c \ - lib/ovn-parallel-hmap.h \ lib/ovn-parallel-hmap.c \ + lib/ovn-parallel-hmap.h \ lib/ip-mcast-index.c \ lib/ip-mcast-index.h \ lib/mac-binding-index.c \ diff --git a/lib/oftable.c b/lib/oftable.c new file mode 100644 index 000000000..721b3ad49 --- /dev/null +++ b/lib/oftable.c @@ -0,0 +1,55 @@ +/* Copyright (c) 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include <config.h> + +#include "lib/oftable.h" + +int OFTABLE_PHY_TO_LOG = 0; + +/* Start of LOG_PIPELINE_LEN tables. */ +int OFTABLE_LOG_INGRESS_PIPELINE = 8; +int OFTABLE_OUTPUT_LARGE_PKT_DETECT = 41, OFTABLE_OUTPUT_INIT = 41; +int OFTABLE_OUTPUT_LARGE_PKT_PROCESS = 42; +int OFTABLE_REMOTE_OUTPUT = 43; +int OFTABLE_REMOTE_VTEP_OUTPUT = 44; +int OFTABLE_LOCAL_OUTPUT = 45; +int OFTABLE_CHECK_LOOPBACK = 46; + +/* Start of LOG_PIPELINE_LEN tables. */ +int OFTABLE_LOG_EGRESS_PIPELINE = 47; +int OFTABLE_SAVE_INPORT = 64; +int OFTABLE_LOG_TO_PHY = 65; +int OFTABLE_MAC_BINDING = 66; +int OFTABLE_MAC_LOOKUP = 67; +int OFTABLE_CHK_LB_HAIRPIN = 68; +int OFTABLE_CHK_LB_HAIRPIN_REPLY = 69; +int OFTABLE_CT_SNAT_HAIRPIN = 70; +int OFTABLE_GET_FDB = 71; +int OFTABLE_LOOKUP_FDB = 72; +int OFTABLE_CHK_IN_PORT_SEC = 73; +int OFTABLE_CHK_IN_PORT_SEC_ND = 74; +int OFTABLE_CHK_OUT_PORT_SEC = 75; +int OFTABLE_ECMP_NH_MAC = 76; +int OFTABLE_ECMP_NH = 77; +int OFTABLE_CHK_LB_AFFINITY = 78; +int OFTABLE_MAC_CACHE_USE = 79; +int OFTABLE_CT_ZONE_LOOKUP = 80; +int OFTABLE_CT_ORIG_NW_DST_LOAD = 81; +int OFTABLE_CT_ORIG_IP6_DST_LOAD = 82; +int OFTABLE_CT_ORIG_TP_DST_LOAD = 83; +int OFTABLE_FLOOD_REMOTE_CHASSIS = 84; +int OFTABLE_CT_STATE_SAVE = 85; +int OFTABLE_CT_ORIG_PROTO_LOAD = 86; +int OFTABLE_GET_REMOTE_FDB = 87; diff --git a/lib/oftable.h b/lib/oftable.h new file mode 100644 index 000000000..54425964d --- /dev/null +++ b/lib/oftable.h @@ -0,0 +1,58 @@ +/* Copyright (c) 2015, 2016 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include <stdint.h> + +/* OpenFlow table numbers. + * + * These are heavily documented in ovn-architecture(7), please update it if + * you make any changes. */ +extern int OFTABLE_PHY_TO_LOG; + +/* Start of LOG_PIPELINE_LEN tables. */ +extern int OFTABLE_LOG_INGRESS_PIPELINE; +extern int OFTABLE_OUTPUT_LARGE_PKT_DETECT; +extern int OFTABLE_OUTPUT_INIT; +extern int OFTABLE_OUTPUT_LARGE_PKT_PROCESS; +extern int OFTABLE_REMOTE_OUTPUT; +extern int OFTABLE_REMOTE_VTEP_OUTPUT; +extern int OFTABLE_LOCAL_OUTPUT; +extern int OFTABLE_CHECK_LOOPBACK; + +/* Start of LOG_PIPELINE_LEN tables. */ +extern int OFTABLE_LOG_EGRESS_PIPELINE; +extern int OFTABLE_SAVE_INPORT; +extern int OFTABLE_LOG_TO_PHY; +extern int OFTABLE_MAC_BINDING; +extern int OFTABLE_MAC_LOOKUP; +extern int OFTABLE_CHK_LB_HAIRPIN; +extern int OFTABLE_CHK_LB_HAIRPIN_REPLY; +extern int OFTABLE_CT_SNAT_HAIRPIN; +extern int OFTABLE_GET_FDB; +extern int OFTABLE_LOOKUP_FDB; +extern int OFTABLE_CHK_IN_PORT_SEC; +extern int OFTABLE_CHK_IN_PORT_SEC_ND; +extern int OFTABLE_CHK_OUT_PORT_SEC; +extern int OFTABLE_ECMP_NH_MAC; +extern int OFTABLE_ECMP_NH; +extern int OFTABLE_CHK_LB_AFFINITY; +extern int OFTABLE_MAC_CACHE_USE; +extern int OFTABLE_CT_ZONE_LOOKUP; +extern int OFTABLE_CT_ORIG_NW_DST_LOAD; +extern int OFTABLE_CT_ORIG_IP6_DST_LOAD; +extern int OFTABLE_CT_ORIG_TP_DST_LOAD; +extern int OFTABLE_FLOOD_REMOTE_CHASSIS; +extern int OFTABLE_CT_STATE_SAVE; +extern int OFTABLE_CT_ORIG_PROTO_LOAD; +extern int OFTABLE_GET_REMOTE_FDB; diff --git a/lib/ovn-util.c b/lib/ovn-util.c index 8b583fa6d..47922276e 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -39,6 +39,9 @@ VLOG_DEFINE_THIS_MODULE(ovn_util); #define DEFAULT_PROBE_INTERVAL_MSEC 5000 +int LOG_PIPELINE_INGRESS_LEN = 32; +int LOG_PIPELINE_EGRESS_LEN = 14; + void ovn_conn_show(struct unixctl_conn *conn, int argc OVS_UNUSED, const char *argv[] OVS_UNUSED, void *idl_) { diff --git a/lib/ovn-util.h b/lib/ovn-util.h index 63beae3e5..abda66963 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -320,8 +320,8 @@ BUILD_ASSERT_DECL( #define SCTP_ABORT_CHUNK_FLAG_T (1 << 0) /* The number of tables for the ingress and egress pipelines. */ -#define LOG_PIPELINE_INGRESS_LEN 32 -#define LOG_PIPELINE_EGRESS_LEN 14 +extern int LOG_PIPELINE_INGRESS_LEN; +extern int LOG_PIPELINE_EGRESS_LEN; static inline uint32_t hash_add_in6_addr(uint32_t hash, const struct in6_addr *addr) diff --git a/utilities/ovn-debug.c b/utilities/ovn-debug.c index 0a0d2202b..64d2b8bab 100644 --- a/utilities/ovn-debug.c +++ b/utilities/ovn-debug.c @@ -21,6 +21,7 @@ #include "controller/lflow.h" #include "northd/northd.h" #include "ovn-util.h" +#include "lib/oftable.h" struct ovn_lflow_stage { const char *name; -- 2.48.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev