@@ -329,6 +329,9 @@ static void bfd_monitor_init(void);
static void bfd_monitor_destroy(void);
static void bfd_monitor_send_msg(struct rconn *swconn, long long int *bfd_time)
OVS_REQUIRES(pinctrl_mutex);
+static void
+pinctrl_handle_bfd_msg(void)
+ OVS_REQUIRES(pinctrl_mutex);
static void bfd_monitor_run(const struct sbrec_bfd_table *bfd_table,
struct ovsdb_idl_index *sbrec_port_binding_by_name,
const struct sbrec_chassis *chassis,
@@ -2975,6 +2978,12 @@ process_packet_in(struct rconn *swconn, const struct ofp_header *msg)
ovs_mutex_unlock(&pinctrl_mutex);
break;
+ case ACTION_OPCODE_BFD_MSG:
+ ovs_mutex_lock(&pinctrl_mutex);
+ pinctrl_handle_bfd_msg();
+ ovs_mutex_unlock(&pinctrl_mutex);
+ break;
+
default:
VLOG_WARN_RL(&rl, "unrecognized packet-in opcode %"PRIu32,
ntohl(ah->opcode));
@@ -6536,6 +6545,12 @@ next:
}
}
+static void
+pinctrl_handle_bfd_msg(void)
+ OVS_REQUIRES(pinctrl_mutex)
+{
+}
+
static void
bfd_monitor_run(const struct sbrec_bfd_table *bfd_table,
struct ovsdb_idl_index *sbrec_port_binding_by_name,
@@ -105,6 +105,7 @@ struct ovn_extend_table;
OVNACT(CHK_LB_HAIRPIN, ovnact_result) \
OVNACT(CHK_LB_HAIRPIN_REPLY, ovnact_result) \
OVNACT(CT_SNAT_TO_VIP, ovnact_null) \
+ OVNACT(BFD_MSG, ovnact_null) \
/* enum ovnact_type, with a member OVNACT_<ENUM> for each action. */
enum OVS_PACKED_ENUM ovnact_type {
@@ -627,6 +628,12 @@ enum action_opcode {
* The actions, in OpenFlow 1.3 format, follow the action_header.
*/
ACTION_OPCODE_REJECT,
+
+ /* handle_bfd_msg { ...actions ...}."
+ *
+ * The actions, in OpenFlow 1.3 format, follow the action_header.
+ */
+ ACTION_OPCODE_BFD_MSG,
};
/* Header. */
@@ -2742,6 +2742,31 @@ encode_DHCP6_REPLY(const struct ovnact_null *a OVS_UNUSED,
encode_controller_op(ACTION_OPCODE_DHCP6_SERVER, ofpacts);
}
+static void
+format_BFD_MSG(const struct ovnact_null *a OVS_UNUSED, struct ds *s)
+{
+ ds_put_cstr(s, "handle_bfd_msg();");
+}
+
+static void
+encode_BFD_MSG(const struct ovnact_null *a OVS_UNUSED,
+ const struct ovnact_encode_params *ep OVS_UNUSED,
+ struct ofpbuf *ofpacts)
+{
+ encode_controller_op(ACTION_OPCODE_BFD_MSG, ofpacts);
+}
+
+static void
+parse_handle_bfd_msg(struct action_context *ctx OVS_UNUSED)
+{
+ if (!lexer_force_match(ctx->lexer, LEX_T_LPAREN)) {
+ return;
+ }
+
+ ovnact_put_BFD_MSG(ctx->ovnacts);
+ lexer_force_match(ctx->lexer, LEX_T_RPAREN);
+}
+
static void
parse_SET_QUEUE(struct action_context *ctx)
{
@@ -3842,6 +3867,8 @@ parse_action(struct action_context *ctx)
parse_fwd_group_action(ctx);
} else if (lexer_match_id(ctx->lexer, "handle_dhcpv6_reply")) {
ovnact_put_DHCP6_REPLY(ctx->ovnacts);
+ } else if (lexer_match_id(ctx->lexer, "handle_bfd_msg")) {
+ parse_handle_bfd_msg(ctx);
} else if (lexer_match_id(ctx->lexer, "reject")) {
parse_REJECT(ctx);
} else if (lexer_match_id(ctx->lexer, "ct_snat_to_vip")) {
@@ -1807,6 +1807,10 @@ ct_snat_to_vip;
ct_snat_to_vip(foo);
Syntax error at `(' expecting `;'.
+# bfd packets
+handle_bfd_msg();
+ encodes as controller(userdata=00.00.00.17.00.00.00.00)
+
# Miscellaneous negative tests.
;
Syntax error at `;'.
@@ -2544,6 +2544,8 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len,
break;
case OVNACT_DHCP6_REPLY:
break;
+ case OVNACT_BFD_MSG:
+ break;
}
}
ds_destroy(&s);
Add handle_bfd_msg() action to parse BFD packets received by the controller. handle_bfd_msg() logic is currently empty and it will be implemented adding BFD state machine in the following patches. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> --- controller/pinctrl.c | 15 +++++++++++++++ include/ovn/actions.h | 7 +++++++ lib/actions.c | 27 +++++++++++++++++++++++++++ tests/ovn.at | 4 ++++ utilities/ovn-trace.c | 2 ++ 5 files changed, 55 insertions(+)