Skip to content

Commit

Permalink
ovn-controller: Provide the option to configure inactivity probe inte…
Browse files Browse the repository at this point in the history
…rval for OpenFlow conn

If the ovn-controller main loop takes more than 5 seconds (if there are lots of logical
flows) before it calls poll_block(), it causes the poll_block to wake up immediately,
since rconn module has to send echo request. With the incremental processing, this is
not an issue as ovn-controller will not recompute again. But for older versions, this
is an issue as it causes flow recomputations and this would result in 100% cpu all the
time.

With this patch, CMS can configure a higher value depending the workload.

The main intention of this patch is to fix this recompuation issue for older versions
(there by requesting backport), it still would be beneficial with the
incremental processing engine.

Signed-off-by: Numan Siddique <[email protected]>
Tested-by: Dumitru Ceara <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
numansiddique authored and blp committed Jul 5, 2019
1 parent 7b34595 commit 0815fdb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
14 changes: 12 additions & 2 deletions ovn/controller/ofctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ static void ofctrl_recv(const struct ofp_header *, enum ofptype);

void
ofctrl_init(struct ovn_extend_table *group_table,
struct ovn_extend_table *meter_table)
struct ovn_extend_table *meter_table,
int inactivity_probe_interval)
{
swconn = rconn_create(5, 0, DSCP_DEFAULT, 1 << OFP13_VERSION);
swconn = rconn_create(inactivity_probe_interval, 0,
DSCP_DEFAULT, 1 << OFP13_VERSION);
tx_counter = rconn_packet_counter_create();
hmap_init(&installed_flows);
ovs_list_init(&flow_updates);
Expand Down Expand Up @@ -1381,3 +1383,11 @@ ofctrl_is_connected(void)
{
return rconn_is_connected(swconn);
}

void
ofctrl_set_probe_interval(int probe_interval)
{
if (swconn) {
rconn_set_probe_interval(swconn, probe_interval);
}
}
4 changes: 3 additions & 1 deletion ovn/controller/ofctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ struct ovn_desired_flow_table {

/* Interface for OVN main loop. */
void ofctrl_init(struct ovn_extend_table *group_table,
struct ovn_extend_table *meter_table);
struct ovn_extend_table *meter_table,
int inactivity_probe_interval);
void ofctrl_run(const struct ovsrec_bridge *br_int,
struct shash *pending_ct_zones);
enum mf_field_id ofctrl_get_mf_field_id(void);
Expand Down Expand Up @@ -81,5 +82,6 @@ void ofctrl_check_and_add_flow(struct ovn_desired_flow_table *,
const struct uuid *, bool log_duplicate_flow);

bool ofctrl_is_connected(void);
void ofctrl_set_probe_interval(int probe_interval);

#endif /* ovn/ofctrl.h */
14 changes: 14 additions & 0 deletions ovn/controller/ovn-controller.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@
</p>
</dd>

<dt><code>external_ids:ovn-openflow-probe-interval</code></dt>
<dd>
<p>
The inactivity probe interval of the OpenFlow connection to the
OpenvSwitch integration bridge, in seconds.
If the value is zero, it disables the connection keepalive feature.
</p>

<p>
If the value is nonzero, then it will be forced to a value of
at least 5s.
</p>
</dd>

<dt><code>external_ids:ovn-encap-type</code></dt>
<dd>
<p>
Expand Down
14 changes: 13 additions & 1 deletion ovn/controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static unixctl_cb_func ovn_controller_conn_show;

#define DEFAULT_BRIDGE_NAME "br-int"
#define DEFAULT_PROBE_INTERVAL_MSEC 5000
#define OFCTRL_DEFAULT_PROBE_INTERVAL_SEC 5

#define CONTROLLER_LOOP_STOPWATCH_NAME "ovn-controller-flow-generation"

Expand Down Expand Up @@ -390,6 +391,15 @@ update_ssl_config(const struct ovsrec_ssl_table *ssl_table)
}
}

static int
get_ofctrl_probe_interval(struct ovsdb_idl *ovs_idl)
{
const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ovs_idl);
return smap_get_int(&cfg->external_ids,
"ovn-openflow-probe-interval",
OFCTRL_DEFAULT_PROBE_INTERVAL_SEC);
}

/* Retrieves the pointer to the OVN Southbound database from 'ovs_idl' and
* updates 'sbdb_idl' with that pointer. */
static void
Expand Down Expand Up @@ -1817,7 +1827,8 @@ main(int argc, char *argv[])
engine_init(&en_flow_output);

ofctrl_init(&ed_flow_output.group_table,
&ed_flow_output.meter_table);
&ed_flow_output.meter_table,
get_ofctrl_probe_interval(ovs_idl_loop.idl));

unixctl_command_register("group-table-list", "", 0, 0,
group_table_list, &ed_flow_output.group_table);
Expand All @@ -1844,6 +1855,7 @@ main(int argc, char *argv[])
while (!exiting) {
update_sb_db(ovs_idl_loop.idl, ovnsb_idl_loop.idl);
update_ssl_config(ovsrec_ssl_table_get(ovs_idl_loop.idl));
ofctrl_set_probe_interval(get_ofctrl_probe_interval(ovs_idl_loop.idl));
old_engine_run_id = engine_run_id;

struct ovsdb_idl_txn *ovs_idl_txn = ovsdb_idl_loop_run(&ovs_idl_loop);
Expand Down

0 comments on commit 0815fdb

Please sign in to comment.