Skip to content

Commit

Permalink
controller: Turn OFTABLE_OUTPUT_INIT into an alias.
Browse files Browse the repository at this point in the history
Make it alias OFTABLE_OUTPUT_LARGE_PKT_DETECT in order to avoid always
doing an extra resubmit in slow path.  The OFTABLE_OUTPUT_INIT table
didn't have more than the "advance to the next table" default rule.

Fixes: 2d6e586 ("Implement MTU Path Discovery for multichassis ports")
Fixes: 740f23c ("Add new egress tables to accommodate for too-big packets handling")
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihrachys@redhat.com>
(cherry picked from commit 9305e78)
  • Loading branch information
dceara committed Jun 8, 2023
1 parent 4af89ed commit 1b8c7f6
Show file tree
Hide file tree
Showing 7 changed files with 368 additions and 372 deletions.
16 changes: 9 additions & 7 deletions controller/lflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ struct uuid;

/* Start of LOG_PIPELINE_LEN tables. */
#define OFTABLE_LOG_INGRESS_PIPELINE 8
#define OFTABLE_OUTPUT_INIT 37
#define OFTABLE_OUTPUT_LARGE_PKT_DETECT 38
#define OFTABLE_OUTPUT_LARGE_PKT_PROCESS 39
#define OFTABLE_REMOTE_OUTPUT 40
#define OFTABLE_LOCAL_OUTPUT 41
#define OFTABLE_CHECK_LOOPBACK 42
#define OFTABLE_OUTPUT_LARGE_PKT_DETECT 37
#define OFTABLE_OUTPUT_LARGE_PKT_PROCESS 38
#define OFTABLE_REMOTE_OUTPUT 39
#define OFTABLE_LOCAL_OUTPUT 40
#define OFTABLE_CHECK_LOOPBACK 41

/* 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 43
#define OFTABLE_LOG_EGRESS_PIPELINE 42
#define OFTABLE_SAVE_INPORT 64
#define OFTABLE_LOG_TO_PHY 65
#define OFTABLE_MAC_BINDING 66
Expand Down
58 changes: 26 additions & 32 deletions controller/physical.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,12 +878,12 @@ put_local_common_flows(uint32_t dp_key,

uint32_t port_key = pb->tunnel_key;

/* Table 41, priority 100.
/* Table 40, priority 100.
* =======================
*
* Implements output to local hypervisor. Each flow matches a
* logical output port on the local hypervisor, and resubmits to
* table 42.
* table 41.
*/

ofpbuf_clear(ofpacts_p);
Expand All @@ -893,13 +893,13 @@ put_local_common_flows(uint32_t dp_key,

put_zones_ofpacts(zone_ids, ofpacts_p);

/* Resubmit to table 42. */
/* Resubmit to table 41. */
put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts_p);
ofctrl_add_flow(flow_table, OFTABLE_LOCAL_OUTPUT, 100,
pb->header_.uuid.parts[0], &match, ofpacts_p,
&pb->header_.uuid);

/* Table 42, Priority 100.
/* Table 41, Priority 100.
* =======================
*
* Drop packets whose logical inport and outport are the same
Expand Down Expand Up @@ -1473,12 +1473,12 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
|| ha_chassis_group_is_active(binding->ha_chassis_group,
active_tunnels, chassis))) {

/* Table 41, priority 100.
/* Table 40, priority 100.
* =======================
*
* Implements output to local hypervisor. Each flow matches a
* logical output port on the local hypervisor, and resubmits to
* table 42. For ports of type "chassisredirect", the logical
* table 41. For ports of type "chassisredirect", the logical
* output port is changed from the "chassisredirect" port to the
* underlying distributed port. */

Expand Down Expand Up @@ -1515,7 +1515,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
ct_zones);
put_zones_ofpacts(&zone_ids, ofpacts_p);

/* Resubmit to table 42. */
/* Resubmit to table 41. */
put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts_p);
}

Expand Down Expand Up @@ -1731,7 +1731,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
ofport, flow_table);
}

/* Table 42, priority 160.
/* Table 41, priority 160.
* =======================
*
* Do not forward local traffic from a localport to a localnet port.
Expand Down Expand Up @@ -1801,13 +1801,13 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
}
}

/* Table 40, priority 150.
/* Table 39, priority 150.
* =======================
*
* Handles packets received from ports of type "localport". These
* ports are present on every hypervisor. Traffic that originates at
* one should never go over a tunnel to a remote hypervisor,
* so resubmit them to table 41 for local delivery. */
* so resubmit them to table 40 for local delivery. */
if (!strcmp(binding->type, "localport")) {
ofpbuf_clear(ofpacts_p);
put_resubmit(OFTABLE_LOCAL_OUTPUT, ofpacts_p);
Expand All @@ -1821,7 +1821,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
}
} else if (access_type == PORT_LOCALNET) {
/* Remote port connected by localnet port */
/* Table 41, priority 100.
/* Table 40, priority 100.
* =======================
*
* Implements switching to localnet port. Each flow matches a
Expand All @@ -1836,7 +1836,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,

put_load(localnet_port->tunnel_key, MFF_LOG_OUTPORT, 0, 32, ofpacts_p);

/* Resubmit to table 41. */
/* Resubmit to table 40. */
put_resubmit(OFTABLE_LOCAL_OUTPUT, ofpacts_p);
ofctrl_add_flow(flow_table, OFTABLE_LOCAL_OUTPUT, 100,
binding->header_.uuid.parts[0],
Expand All @@ -1855,7 +1855,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
const char *redirect_type = smap_get(&binding->options,
"redirect-type");

/* Table 41, priority 100.
/* Table 40, priority 100.
* =======================
*
* Handles traffic that needs to be sent to a remote hypervisor. Each
Expand Down Expand Up @@ -2083,7 +2083,7 @@ consider_mc_group(struct ovsdb_idl_index *sbrec_port_binding_by_name,
}
}

/* Table 41, priority 100.
/* Table 40, priority 100.
* =======================
*
* Handle output to the local logical ports in the multicast group, if
Expand All @@ -2099,7 +2099,7 @@ consider_mc_group(struct ovsdb_idl_index *sbrec_port_binding_by_name,
&match, &ofpacts, &mc->header_.uuid);
}

/* Table 40, priority 100.
/* Table 39, priority 100.
* =======================
*
* Handle output to the remote chassis in the multicast group, if
Expand Down Expand Up @@ -2298,7 +2298,7 @@ physical_run(struct physical_ctx *p_ctx,
* encapsulations have metadata about the ingress and egress logical ports.
* VXLAN encapsulations have metadata about the egress logical port only.
* We set MFF_LOG_DATAPATH, MFF_LOG_INPORT, and MFF_LOG_OUTPORT from the
* tunnel key data where possible, then resubmit to table 41 to handle
* tunnel key data where possible, then resubmit to table 40 to handle
* packets to the local hypervisor. */
struct chassis_tunnel *tun;
HMAP_FOR_EACH (tun, hmap_node, p_ctx->chassis_tunnels) {
Expand Down Expand Up @@ -2400,18 +2400,12 @@ physical_run(struct physical_ctx *p_ctx,
*/
add_default_drop_flow(p_ctx, OFTABLE_PHY_TO_LOG, flow_table);

/* Table 34-36, priority 0.
/* Table 37-38, priority 0.
* ========================
*
* Default resubmit actions for OFTABLE_OUTPUT_LARGE_PKT_* tables.
*/
struct match match;
match_init_catchall(&match);
ofpbuf_clear(&ofpacts);
put_resubmit(OFTABLE_OUTPUT_LARGE_PKT_DETECT, &ofpacts);
ofctrl_add_flow(flow_table, OFTABLE_OUTPUT_INIT, 0, 0, &match,
&ofpacts, hc_uuid);

match_init_catchall(&match);
ofpbuf_clear(&ofpacts);
put_resubmit(OFTABLE_REMOTE_OUTPUT, &ofpacts);
Expand All @@ -2432,40 +2426,40 @@ physical_run(struct physical_ctx *p_ctx,
ofctrl_add_flow(flow_table, OFTABLE_OUTPUT_LARGE_PKT_PROCESS, 0, 0, &match,
&ofpacts, hc_uuid);

/* Table 40, priority 150.
/* Table 39, priority 150.
* =======================
*
* Handles packets received from a VXLAN tunnel which get resubmitted to
* OFTABLE_LOG_INGRESS_PIPELINE due to lack of needed metadata in VXLAN,
* explicitly skip sending back out any tunnels and resubmit to table 41
* explicitly skip sending back out any tunnels and resubmit to table 40
* for local delivery, except packets which have MLF_ALLOW_LOOPBACK bit
* set.
*/
match_init_catchall(&match);
match_set_reg_masked(&match, MFF_LOG_FLAGS - MFF_REG0, MLF_RCV_FROM_RAMP,
MLF_RCV_FROM_RAMP | MLF_ALLOW_LOOPBACK);

/* Resubmit to table 41. */
/* Resubmit to table 40. */
ofpbuf_clear(&ofpacts);
put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts);
ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 150, 0,
&match, &ofpacts, hc_uuid);

/* Table 40, priority 150.
/* Table 39, priority 150.
* =======================
*
* Packets that should not be sent to other hypervisors.
*/
match_init_catchall(&match);
match_set_reg_masked(&match, MFF_LOG_FLAGS - MFF_REG0,
MLF_LOCAL_ONLY, MLF_LOCAL_ONLY);
/* Resubmit to table 41. */
/* Resubmit to table 40. */
ofpbuf_clear(&ofpacts);
put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts);
ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 150, 0,
&match, &ofpacts, hc_uuid);

/* Table 40, Priority 0.
/* Table 39, Priority 0.
* =======================
*
* Resubmit packets that are not directed at tunnels or part of a
Expand All @@ -2476,18 +2470,18 @@ physical_run(struct physical_ctx *p_ctx,
ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 0, 0, &match,
&ofpacts, hc_uuid);

/* Table 41, priority 0.
/* Table 40, priority 0.
* ======================
*
* Drop packets that do not match previous flows.
*/
add_default_drop_flow(p_ctx, OFTABLE_LOCAL_OUTPUT, flow_table);

/* Table 42, Priority 0.
/* Table 41, Priority 0.
* =======================
*
* Resubmit packets that don't output to the ingress port (already checked
* in table 41) to the logical egress pipeline, clearing the logical
* in table 40) to the logical egress pipeline, clearing the logical
* registers (for consistent behavior with packets that get tunneled). */
match_init_catchall(&match);
ofpbuf_clear(&ofpacts);
Expand Down

0 comments on commit 1b8c7f6

Please sign in to comment.