Skip to content

Commit

Permalink
ovn: Rename Pipeline table to Logical_Flow table.
Browse files Browse the repository at this point in the history
The OVN pipeline is being split into two phases, which are most naturally
called "pipelines".  I kept getting very confused trying to call them
anything else, and in the end it seems to make more sense to just rename
the Pipeline table.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
  • Loading branch information
blp committed Aug 3, 2015
1 parent dcda6e0 commit 4860555
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 158 deletions.
2 changes: 1 addition & 1 deletion ovn/TODO
Expand Up @@ -48,7 +48,7 @@
Currently, clients monitor the entire contents of a table. It
might make sense to allow clients to monitor only rows that
satisfy specific criteria, e.g. to allow an ovn-controller to
receive only Pipeline rows for logical networks on its hypervisor.
receive only Logical_Flow rows for logical networks on its hypervisor.

*** Reducing redundant data and code within ovsdb-server.

Expand Down
4 changes: 2 additions & 2 deletions ovn/controller/automake.mk
Expand Up @@ -6,12 +6,12 @@ ovn_controller_ovn_controller_SOURCES = \
ovn/controller/chassis.h \
ovn/controller/encaps.c \
ovn/controller/encaps.h \
ovn/controller/lflow.c \
ovn/controller/lflow.h \
ovn/controller/ofctrl.c \
ovn/controller/ofctrl.h \
ovn/controller/ovn-controller.c \
ovn/controller/ovn-controller.h \
ovn/controller/pipeline.c \
ovn/controller/pipeline.h \
ovn/controller/physical.c \
ovn/controller/physical.h
ovn_controller_ovn_controller_LDADD = ovn/lib/libovn.la lib/libopenvswitch.la
Expand Down
48 changes: 24 additions & 24 deletions ovn/controller/pipeline.c → ovn/controller/lflow.c
Expand Up @@ -14,7 +14,7 @@
*/

#include <config.h>
#include "pipeline.h"
#include "lflow.h"
#include "dynamic-string.h"
#include "ofctrl.h"
#include "ofp-actions.h"
Expand All @@ -26,11 +26,11 @@
#include "ovn/lib/ovn-sb-idl.h"
#include "simap.h"

VLOG_DEFINE_THIS_MODULE(pipeline);
VLOG_DEFINE_THIS_MODULE(lflow);

/* Symbol table. */

/* Contains "struct expr_symbol"s for fields supported by OVN pipeline. */
/* Contains "struct expr_symbol"s for fields supported by OVN lflows. */
static struct shash symtab;

static void
Expand Down Expand Up @@ -244,31 +244,31 @@ ldp_destroy(void)
}

void
pipeline_init(void)
lflow_init(void)
{
symtab_init();
}

/* Translates logical flows in the Pipeline table in the OVN_SB database
/* Translates logical flows in the Logical_Flow table in the OVN_SB database
* into OpenFlow flows, adding the OpenFlow flows to 'flow_table'.
*
* We put the Pipeline flows into OpenFlow tables 16 through 47 (inclusive). */
* We put the logical flows into OpenFlow tables 16 through 47 (inclusive). */
void
pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
lflow_run(struct controller_ctx *ctx, struct hmap *flow_table)
{
struct hmap flows = HMAP_INITIALIZER(&flows);
uint32_t conj_id_ofs = 1;

ldp_run(ctx);

const struct sbrec_pipeline *pipeline;
SBREC_PIPELINE_FOR_EACH (pipeline, ctx->ovnsb_idl) {
/* Find the "struct logical_datapath" asssociated with this Pipeline
* row. If there's no such struct, that must be because no logical
* ports are bound to that logical datapath, so there's no point in
* maintaining any flows for it anyway, so skip it. */
const struct sbrec_logical_flow *lflow;
SBREC_LOGICAL_FLOW_FOR_EACH (lflow, ctx->ovnsb_idl) {
/* Find the "struct logical_datapath" asssociated with this
* Logical_Flow row. If there's no such struct, that must be because
* no logical ports are bound to that logical datapath, so there's no
* point in maintaining any flows for it anyway, so skip it. */
const struct logical_datapath *ldp;
ldp = ldp_lookup(&pipeline->logical_datapath);
ldp = ldp_lookup(&lflow->logical_datapath);
if (!ldp) {
continue;
}
Expand All @@ -281,13 +281,13 @@ pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
char *error;

ofpbuf_use_stub(&ofpacts, ofpacts_stub, sizeof ofpacts_stub);
next_table_id = pipeline->table_id < 31 ? pipeline->table_id + 17 : 0;
error = actions_parse_string(pipeline->actions, &symtab, &ldp->ports,
next_table_id = lflow->table_id < 31 ? lflow->table_id + 17 : 0;
error = actions_parse_string(lflow->actions, &symtab, &ldp->ports,
next_table_id, &ofpacts, &prereqs);
if (error) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_WARN_RL(&rl, "error parsing actions \"%s\": %s",
pipeline->actions, error);
lflow->actions, error);
free(error);
continue;
}
Expand All @@ -296,7 +296,7 @@ pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
struct hmap matches;
struct expr *expr;

expr = expr_parse_string(pipeline->match, &symtab, &error);
expr = expr_parse_string(lflow->match, &symtab, &error);
if (!error) {
if (prereqs) {
expr = expr_combine(EXPR_T_AND, expr, prereqs);
Expand All @@ -307,7 +307,7 @@ pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
if (error) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_WARN_RL(&rl, "error parsing match \"%s\": %s",
pipeline->match, error);
lflow->match, error);
expr_destroy(prereqs);
ofpbuf_uninit(&ofpacts);
free(error);
Expand All @@ -327,8 +327,8 @@ pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
m->match.flow.conj_id += conj_id_ofs;
}
if (!m->n) {
ofctrl_add_flow(flow_table, pipeline->table_id + 16,
pipeline->priority, &m->match, &ofpacts);
ofctrl_add_flow(flow_table, lflow->table_id + 16,
lflow->priority, &m->match, &ofpacts);
} else {
uint64_t conj_stubs[64 / 8];
struct ofpbuf conj;
Expand All @@ -343,8 +343,8 @@ pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
dst->clause = src->clause;
dst->n_clauses = src->n_clauses;
}
ofctrl_add_flow(flow_table, pipeline->table_id + 16,
pipeline->priority, &m->match, &conj);
ofctrl_add_flow(flow_table, lflow->table_id + 16,
lflow->priority, &m->match, &conj);
ofpbuf_uninit(&conj);
}
}
Expand All @@ -357,7 +357,7 @@ pipeline_run(struct controller_ctx *ctx, struct hmap *flow_table)
}

void
pipeline_destroy(void)
lflow_destroy(void)
{
expr_symtab_destroy(&symtab);
ldp_destroy();
Expand Down
27 changes: 14 additions & 13 deletions ovn/controller/pipeline.h → ovn/controller/lflow.h
Expand Up @@ -14,17 +14,18 @@
*/


#ifndef OVN_PIPELINE_H
#define OVN_PIPELINE_H 1
#ifndef OVN_LFLOW_H
#define OVN_LFLOW_H 1

/* Pipeline table translation to OpenFlow
* ======================================
/* Logical_Flow table translation to OpenFlow
* ==========================================
*
* The Pipeline table obtained from the OVN_Southbound database works in terms
* of logical entities, that is, logical flows among logical datapaths and
* logical ports. This code translates these logical flows into OpenFlow flows
* that, again, work in terms of logical entities implemented through OpenFlow
* extensions (e.g. registers represent the logical input and output ports).
* The Logical_Flow table obtained from the OVN_Southbound database works in
* terms of logical entities, that is, logical flows among logical datapaths
* and logical ports. This code translates these logical flows into OpenFlow
* flows that, again, work in terms of logical entities implemented through
* OpenFlow extensions (e.g. registers represent the logical input and output
* ports).
*
* Physical-to-logical and logical-to-physical translation are implemented in
* physical.[ch] as separate OpenFlow tables that run before and after,
Expand All @@ -41,10 +42,10 @@ struct uuid;
#define MFF_LOG_INPORT MFF_REG6 /* Logical input port. */
#define MFF_LOG_OUTPORT MFF_REG7 /* Logical output port. */

void pipeline_init(void);
void pipeline_run(struct controller_ctx *, struct hmap *flow_table);
void pipeline_destroy(void);
void lflow_init(void);
void lflow_run(struct controller_ctx *, struct hmap *flow_table);
void lflow_destroy(void);

uint32_t ldp_to_integer(const struct uuid *logical_datapath);

#endif /* ovn/pipeline.h */
#endif /* ovn/lflow.h */
8 changes: 4 additions & 4 deletions ovn/controller/ovn-controller.c
Expand Up @@ -44,7 +44,7 @@
#include "chassis.h"
#include "encaps.h"
#include "physical.h"
#include "pipeline.h"
#include "lflow.h"

VLOG_DEFINE_THIS_MODULE(main);

Expand Down Expand Up @@ -238,7 +238,7 @@ main(int argc, char *argv[])
sbrec_init();

ofctrl_init();
pipeline_init();
lflow_init();

/* Connect to OVS OVSDB instance. We do not monitor all tables by
* default, so modules must register their interest explicitly. */
Expand Down Expand Up @@ -280,7 +280,7 @@ main(int argc, char *argv[])

if (br_int) {
struct hmap flow_table = HMAP_INITIALIZER(&flow_table);
pipeline_run(&ctx, &flow_table);
lflow_run(&ctx, &flow_table);
if (chassis_id) {
physical_run(&ctx, br_int, chassis_id, &flow_table);
}
Expand Down Expand Up @@ -332,7 +332,7 @@ main(int argc, char *argv[])
}

unixctl_server_destroy(unixctl);
pipeline_destroy();
lflow_destroy();
ofctrl_destroy();

idl_loop_destroy(&ovs_idl_loop);
Expand Down
2 changes: 1 addition & 1 deletion ovn/controller/physical.c
Expand Up @@ -15,13 +15,13 @@

#include <config.h>
#include "physical.h"
#include "lflow.h"
#include "match.h"
#include "ofctrl.h"
#include "ofp-actions.h"
#include "ofpbuf.h"
#include "ovn-controller.h"
#include "ovn/lib/ovn-sb-idl.h"
#include "pipeline.h"
#include "simap.h"
#include "vswitch-idl.h"

Expand Down
4 changes: 2 additions & 2 deletions ovn/lib/actions.c
Expand Up @@ -176,8 +176,8 @@ parse_actions(struct action_context *ctx)
}

/* Parses OVN actions, in the format described for the "actions" column in the
* Pipeline table in ovn-sb(5), and appends the parsed versions of the actions
* to 'ofpacts' as "struct ofpact"s.
* Logical_Flow table in ovn-sb(5), and appends the parsed versions of the
* actions to 'ofpacts' as "struct ofpact"s.
*
* 'symtab' provides a table of "struct expr_symbol"s to support (as one would
* provide to expr_parse()).
Expand Down

0 comments on commit 4860555

Please sign in to comment.