|
|
5f9769 |
From 2d71cf47fdb194287719a97ee81dbb0dd9fab9d8 Mon Sep 17 00:00:00 2001
|
|
|
5f9769 |
Message-Id: <2d71cf47fdb194287719a97ee81dbb0dd9fab9d8.1610458802.git.lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
In-Reply-To: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
References: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
Date: Fri, 8 Jan 2021 17:36:21 +0100
|
|
|
5f9769 |
Subject: [PATCH 13/16] action: introduce handle_bfd_msg() action.
|
|
|
5f9769 |
|
|
|
5f9769 |
Add handle_bfd_msg() action to parse BFD packets received by the
|
|
|
5f9769 |
controller. handle_bfd_msg() logic is currently empty and it will be
|
|
|
5f9769 |
implemented adding BFD state machine in the following patches.
|
|
|
5f9769 |
|
|
|
5f9769 |
Acked-by: Mark Michelson <mmichels@redhat.com>
|
|
|
5f9769 |
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
Signed-off-by: Numan Siddique <numans@ovn.org>
|
|
|
5f9769 |
---
|
|
|
5f9769 |
controller/pinctrl.c | 15 +++++++++++++++
|
|
|
5f9769 |
include/ovn/actions.h | 7 +++++++
|
|
|
5f9769 |
lib/actions.c | 27 +++++++++++++++++++++++++++
|
|
|
5f9769 |
tests/ovn.at | 4 ++++
|
|
|
5f9769 |
utilities/ovn-trace.c | 2 ++
|
|
|
5f9769 |
5 files changed, 55 insertions(+)
|
|
|
5f9769 |
|
|
|
5f9769 |
diff --git a/controller/pinctrl.c b/controller/pinctrl.c
|
|
|
5f9769 |
index 9df6533a1..deeae7479 100644
|
|
|
5f9769 |
--- a/controller/pinctrl.c
|
|
|
5f9769 |
+++ b/controller/pinctrl.c
|
|
|
5f9769 |
@@ -329,6 +329,9 @@ static void bfd_monitor_init(void);
|
|
|
5f9769 |
static void bfd_monitor_destroy(void);
|
|
|
5f9769 |
static void bfd_monitor_send_msg(struct rconn *swconn, long long int *bfd_time)
|
|
|
5f9769 |
OVS_REQUIRES(pinctrl_mutex);
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+pinctrl_handle_bfd_msg(void)
|
|
|
5f9769 |
+ OVS_REQUIRES(pinctrl_mutex);
|
|
|
5f9769 |
static void bfd_monitor_run(const struct sbrec_bfd_table *bfd_table,
|
|
|
5f9769 |
struct ovsdb_idl_index *sbrec_port_binding_by_name,
|
|
|
5f9769 |
const struct sbrec_chassis *chassis,
|
|
|
5f9769 |
@@ -2975,6 +2978,12 @@ process_packet_in(struct rconn *swconn, const struct ofp_header *msg)
|
|
|
5f9769 |
ovs_mutex_unlock(&pinctrl_mutex);
|
|
|
5f9769 |
break;
|
|
|
5f9769 |
|
|
|
5f9769 |
+ case ACTION_OPCODE_BFD_MSG:
|
|
|
5f9769 |
+ ovs_mutex_lock(&pinctrl_mutex);
|
|
|
5f9769 |
+ pinctrl_handle_bfd_msg();
|
|
|
5f9769 |
+ ovs_mutex_unlock(&pinctrl_mutex);
|
|
|
5f9769 |
+ break;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
default:
|
|
|
5f9769 |
VLOG_WARN_RL(&rl, "unrecognized packet-in opcode %"PRIu32,
|
|
|
5f9769 |
ntohl(ah->opcode));
|
|
|
5f9769 |
@@ -6503,6 +6512,12 @@ next:
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+pinctrl_handle_bfd_msg(void)
|
|
|
5f9769 |
+ OVS_REQUIRES(pinctrl_mutex)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
static void
|
|
|
5f9769 |
bfd_monitor_run(const struct sbrec_bfd_table *bfd_table,
|
|
|
5f9769 |
struct ovsdb_idl_index *sbrec_port_binding_by_name,
|
|
|
5f9769 |
diff --git a/include/ovn/actions.h b/include/ovn/actions.h
|
|
|
5f9769 |
index 9c1ebf4aa..d104d4d64 100644
|
|
|
5f9769 |
--- a/include/ovn/actions.h
|
|
|
5f9769 |
+++ b/include/ovn/actions.h
|
|
|
5f9769 |
@@ -105,6 +105,7 @@ struct ovn_extend_table;
|
|
|
5f9769 |
OVNACT(CHK_LB_HAIRPIN, ovnact_result) \
|
|
|
5f9769 |
OVNACT(CHK_LB_HAIRPIN_REPLY, ovnact_result) \
|
|
|
5f9769 |
OVNACT(CT_SNAT_TO_VIP, ovnact_null) \
|
|
|
5f9769 |
+ OVNACT(BFD_MSG, ovnact_null) \
|
|
|
5f9769 |
|
|
|
5f9769 |
/* enum ovnact_type, with a member OVNACT_<ENUM> for each action. */
|
|
|
5f9769 |
enum OVS_PACKED_ENUM ovnact_type {
|
|
|
5f9769 |
@@ -627,6 +628,12 @@ enum action_opcode {
|
|
|
5f9769 |
* The actions, in OpenFlow 1.3 format, follow the action_header.
|
|
|
5f9769 |
*/
|
|
|
5f9769 |
ACTION_OPCODE_REJECT,
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ /* handle_bfd_msg { ...actions ...}."
|
|
|
5f9769 |
+ *
|
|
|
5f9769 |
+ * The actions, in OpenFlow 1.3 format, follow the action_header.
|
|
|
5f9769 |
+ */
|
|
|
5f9769 |
+ ACTION_OPCODE_BFD_MSG,
|
|
|
5f9769 |
};
|
|
|
5f9769 |
|
|
|
5f9769 |
/* Header. */
|
|
|
5f9769 |
diff --git a/lib/actions.c b/lib/actions.c
|
|
|
5f9769 |
index fbaeb34bc..86be97f44 100644
|
|
|
5f9769 |
--- a/lib/actions.c
|
|
|
5f9769 |
+++ b/lib/actions.c
|
|
|
5f9769 |
@@ -2742,6 +2742,31 @@ encode_DHCP6_REPLY(const struct ovnact_null *a OVS_UNUSED,
|
|
|
5f9769 |
encode_controller_op(ACTION_OPCODE_DHCP6_SERVER, ofpacts);
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+format_BFD_MSG(const struct ovnact_null *a OVS_UNUSED, struct ds *s)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ ds_put_cstr(s, "handle_bfd_msg();");
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+encode_BFD_MSG(const struct ovnact_null *a OVS_UNUSED,
|
|
|
5f9769 |
+ const struct ovnact_encode_params *ep OVS_UNUSED,
|
|
|
5f9769 |
+ struct ofpbuf *ofpacts)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ encode_controller_op(ACTION_OPCODE_BFD_MSG, ofpacts);
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+parse_handle_bfd_msg(struct action_context *ctx OVS_UNUSED)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ if (!lexer_force_match(ctx->lexer, LEX_T_LPAREN)) {
|
|
|
5f9769 |
+ return;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ ovnact_put_BFD_MSG(ctx->ovnacts);
|
|
|
5f9769 |
+ lexer_force_match(ctx->lexer, LEX_T_RPAREN);
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
static void
|
|
|
5f9769 |
parse_SET_QUEUE(struct action_context *ctx)
|
|
|
5f9769 |
{
|
|
|
5f9769 |
@@ -3842,6 +3867,8 @@ parse_action(struct action_context *ctx)
|
|
|
5f9769 |
parse_fwd_group_action(ctx);
|
|
|
5f9769 |
} else if (lexer_match_id(ctx->lexer, "handle_dhcpv6_reply")) {
|
|
|
5f9769 |
ovnact_put_DHCP6_REPLY(ctx->ovnacts);
|
|
|
5f9769 |
+ } else if (lexer_match_id(ctx->lexer, "handle_bfd_msg")) {
|
|
|
5f9769 |
+ parse_handle_bfd_msg(ctx);
|
|
|
5f9769 |
} else if (lexer_match_id(ctx->lexer, "reject")) {
|
|
|
5f9769 |
parse_REJECT(ctx);
|
|
|
5f9769 |
} else if (lexer_match_id(ctx->lexer, "ct_snat_to_vip")) {
|
|
|
5f9769 |
diff --git a/tests/ovn.at b/tests/ovn.at
|
|
|
5f9769 |
index ce6db8677..27cb2e410 100644
|
|
|
5f9769 |
--- a/tests/ovn.at
|
|
|
5f9769 |
+++ b/tests/ovn.at
|
|
|
5f9769 |
@@ -1807,6 +1807,10 @@ ct_snat_to_vip;
|
|
|
5f9769 |
ct_snat_to_vip(foo);
|
|
|
5f9769 |
Syntax error at `(' expecting `;'.
|
|
|
5f9769 |
|
|
|
5f9769 |
+# bfd packets
|
|
|
5f9769 |
+handle_bfd_msg();
|
|
|
5f9769 |
+ encodes as controller(userdata=00.00.00.17.00.00.00.00)
|
|
|
5f9769 |
+
|
|
|
5f9769 |
# Miscellaneous negative tests.
|
|
|
5f9769 |
;
|
|
|
5f9769 |
Syntax error at `;'.
|
|
|
5f9769 |
diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
|
|
|
5f9769 |
index 465049d34..e3aa73fb7 100644
|
|
|
5f9769 |
--- a/utilities/ovn-trace.c
|
|
|
5f9769 |
+++ b/utilities/ovn-trace.c
|
|
|
5f9769 |
@@ -2544,6 +2544,8 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len,
|
|
|
5f9769 |
break;
|
|
|
5f9769 |
case OVNACT_DHCP6_REPLY:
|
|
|
5f9769 |
break;
|
|
|
5f9769 |
+ case OVNACT_BFD_MSG:
|
|
|
5f9769 |
+ break;
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
ds_destroy(&s);
|
|
|
5f9769 |
--
|
|
|
5f9769 |
2.29.2
|
|
|
5f9769 |
|