From patchwork Mon Aug 29 11:34:32 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Babu Shanmugam
Ingress table 1 contains these logical flows: @@ -148,6 +148,25 @@
+ Ingress table 2 contains these logical flows: +
+ +For each element in the port security set having one or more IPv4 or IPv6 addresses (or both), @@ -195,10 +214,10 @@
- Ingress table 2 contains these logical flows: + Ingress table 3 contains these logical flows:
from-lport
Pre-ACLsfrom-lport
Pre-ACLs
This table prepares flows for possible stateful ACL processing in
@@ -252,7 +271,7 @@
before eventually advancing to ingress table ACLs
.
This table prepares flows for possible stateful load balancing processing
@@ -268,7 +287,7 @@
advancing to ingress table LB
.
This table prepares flows for all possible stateful processing
@@ -279,7 +298,7 @@
ct_next;
action.
from-lport
ACLsfrom-lport
ACLsLogical flows in this table closely reproduce those in the @@ -362,7 +381,7 @@ -
It contains a priority-0 flow that simply moves traffic to the next @@ -375,7 +394,7 @@ connection.)
-This table implements ARP/ND responder for known IPs. It contains these @@ -484,7 +503,7 @@ nd_na { -
This table adds the DHCPv4 options to a DHCPv4 packet from the @@ -544,7 +563,7 @@ next; -
This table implements DHCP responder for the DHCP replies generated by @@ -626,7 +645,7 @@ output; -
This table implements switching behavior. It contains these logical
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index d7d61bf..045a9a4 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -93,21 +93,22 @@ enum ovn_datapath_type {
* form the stage's full name, e.g. S_SWITCH_IN_PORT_SEC_L2,
* S_ROUTER_OUT_DELIVERY. */
enum ovn_stage {
-#define PIPELINE_STAGES \
- /* Logical switch ingress stages. */ \
- PIPELINE_STAGE(SWITCH, IN, PORT_SEC_L2, 0, "ls_in_port_sec_l2") \
- PIPELINE_STAGE(SWITCH, IN, PORT_SEC_IP, 1, "ls_in_port_sec_ip") \
- PIPELINE_STAGE(SWITCH, IN, PORT_SEC_ND, 2, "ls_in_port_sec_nd") \
- PIPELINE_STAGE(SWITCH, IN, PRE_ACL, 3, "ls_in_pre_acl") \
- PIPELINE_STAGE(SWITCH, IN, PRE_LB, 4, "ls_in_pre_lb") \
- PIPELINE_STAGE(SWITCH, IN, PRE_STATEFUL, 5, "ls_in_pre_stateful") \
- PIPELINE_STAGE(SWITCH, IN, ACL, 6, "ls_in_acl") \
- PIPELINE_STAGE(SWITCH, IN, LB, 7, "ls_in_lb") \
- PIPELINE_STAGE(SWITCH, IN, STATEFUL, 8, "ls_in_stateful") \
- PIPELINE_STAGE(SWITCH, IN, ARP_ND_RSP, 9, "ls_in_arp_rsp") \
- PIPELINE_STAGE(SWITCH, IN, DHCP_OPTIONS, 10, "ls_in_dhcp_options") \
- PIPELINE_STAGE(SWITCH, IN, DHCP_RESPONSE, 11, "ls_in_dhcp_response") \
- PIPELINE_STAGE(SWITCH, IN, L2_LKUP, 12, "ls_in_l2_lkup") \
+#define PIPELINE_STAGES \
+ /* Logical switch ingress stages. */ \
+ PIPELINE_STAGE(SWITCH, IN, PORT_SEC_L2, 0, "ls_in_port_sec_l2") \
+ PIPELINE_STAGE(SWITCH, IN, PORT_DSCP, 1, "ls_in_port_dscp") \
+ PIPELINE_STAGE(SWITCH, IN, PORT_SEC_IP, 2, "ls_in_port_sec_ip") \
+ PIPELINE_STAGE(SWITCH, IN, PORT_SEC_ND, 3, "ls_in_port_sec_nd") \
+ PIPELINE_STAGE(SWITCH, IN, PRE_ACL, 4, "ls_in_pre_acl") \
+ PIPELINE_STAGE(SWITCH, IN, PRE_LB, 5, "ls_in_pre_lb") \
+ PIPELINE_STAGE(SWITCH, IN, PRE_STATEFUL, 6, "ls_in_pre_stateful") \
+ PIPELINE_STAGE(SWITCH, IN, ACL, 7, "ls_in_acl") \
+ PIPELINE_STAGE(SWITCH, IN, LB, 8, "ls_in_lb") \
+ PIPELINE_STAGE(SWITCH, IN, STATEFUL, 9, "ls_in_stateful") \
+ PIPELINE_STAGE(SWITCH, IN, ARP_ND_RSP, 10, "ls_in_arp_rsp") \
+ PIPELINE_STAGE(SWITCH, IN, DHCP_OPTIONS, 11, "ls_in_dhcp_options") \
+ PIPELINE_STAGE(SWITCH, IN, DHCP_RESPONSE, 12, "ls_in_dhcp_response") \
+ PIPELINE_STAGE(SWITCH, IN, L2_LKUP, 13, "ls_in_l2_lkup") \
\
/* Logical switch egress stages. */ \
PIPELINE_STAGE(SWITCH, OUT, PRE_LB, 0, "ls_out_pre_lb") \
@@ -2599,7 +2600,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
struct ds actions = DS_EMPTY_INITIALIZER;
/* Build pre-ACL and ACL tables for both ingress and egress.
- * Ingress tables 3 and 4. Egress tables 0 and 1. */
+ * Ingress tables 4 and 5. Egress tables 0 and 1. */
struct ovn_datapath *od;
HMAP_FOR_EACH (od, key_node, datapaths) {
if (!od->nbs) {
@@ -2635,8 +2636,9 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
/* Logical switch ingress table 0: Ingress port security - L2
* (priority 50).
- * Ingress table 1: Ingress port security - IP (priority 90 and 80)
- * Ingress table 2: Ingress port security - ND (priority 90 and 80)
+ * Ingress table 1: Ingress port dscp - IP (priority 100)
+ * Ingress table 2: Ingress port security - IP (priority 90 and 80)
+ * Ingress table 3: Ingress port security - ND (priority 90 and 80)
*/
struct ovn_port *op;
HMAP_FOR_EACH (op, key_node, ports) {
@@ -2664,24 +2666,38 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
ovn_lflow_add(lflows, op->od, S_SWITCH_IN_PORT_SEC_L2, 50,
ds_cstr(&match), ds_cstr(&actions));
+ const char *dscp = smap_get(&op->sb->options, "qos_dscp");
+ if (dscp) {
+ struct ds dscp_actions = DS_EMPTY_INITIALIZER;
+ struct ds dscp_match = DS_EMPTY_INITIALIZER;
+
+ ds_put_format(&dscp_match, "inport == %s", op->json_key);
+ ds_put_format(&dscp_actions, "ip.dscp = %s; next;", dscp);
+ ovn_lflow_add(lflows, op->od, S_SWITCH_IN_PORT_DSCP, 100,
+ ds_cstr(&dscp_match), ds_cstr(&dscp_actions));
+ ds_destroy(&dscp_match);
+ ds_destroy(&dscp_actions);
+ }
+
if (op->nbsp->n_port_security) {
build_port_security_ip(P_IN, op, lflows);
build_port_security_nd(op, lflows);
}
}
- /* Ingress table 1 and 2: Port security - IP and ND, by default goto next.
- * (priority 0)*/
+ /* Ingress table 1, 2 and 3: Port dscp and security - IP and ND,
+ * by default goto next. (priority 0) */
HMAP_FOR_EACH (od, key_node, datapaths) {
if (!od->nbs) {
continue;
}
+ ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_DSCP, 0, "1", "next;");
ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_ND, 0, "1", "next;");
ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_IP, 0, "1", "next;");
}
- /* Ingress table 9: ARP/ND responder, skip requests coming from localnet
+ /* Ingress table 10: ARP/ND responder, skip requests coming from localnet
* ports. (priority 100). */
HMAP_FOR_EACH (op, key_node, ports) {
if (!op->nbsp) {
@@ -2696,7 +2712,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
}
}
- /* Ingress table 9: ARP/ND responder, reply for known IPs.
+ /* Ingress table 10: ARP/ND responder, reply for known IPs.
* (priority 50). */
HMAP_FOR_EACH (op, key_node, ports) {
if (!op->nbsp) {
@@ -2767,7 +2783,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
}
}
- /* Ingress table 9: ARP/ND responder, by default goto next.
+ /* Ingress table 10: ARP/ND responder, by default goto next.
* (priority 0)*/
HMAP_FOR_EACH (od, key_node, datapaths) {
if (!od->nbs) {
@@ -2777,7 +2793,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
ovn_lflow_add(lflows, od, S_SWITCH_IN_ARP_ND_RSP, 0, "1", "next;");
}
- /* Logical switch ingress table 10 and 11: DHCP options and response
+ /* Logical switch ingress table 11 and 12 DHCP options and response
* priority 100 flows. */
HMAP_FOR_EACH (op, key_node, ports) {
if (!op->nbsp) {
@@ -2856,7 +2872,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
}
}
- /* Ingress table 10 and 11: DHCP options and response, by default goto next.
+ /* Ingress table 11 and 12: DHCP options and response, by default goto next.
* (priority 0). */
HMAP_FOR_EACH (od, key_node, datapaths) {
@@ -2868,7 +2884,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_RESPONSE, 0, "1", "next;");
}
- /* Ingress table 12: Destination lookup, broadcast and multicast handling
+ /* Ingress table 13: Destination lookup, broadcast and multicast handling
* (priority 100). */
HMAP_FOR_EACH (op, key_node, ports) {
if (!op->nbsp) {
@@ -2888,7 +2904,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
"outport = \""MC_FLOOD"\"; output;");
}
- /* Ingress table 12: Destination lookup, unicast handling (priority 50), */
+ /* Ingress table 13: Destination lookup, unicast handling (priority 50), */
HMAP_FOR_EACH (op, key_node, ports) {
if (!op->nbsp) {
continue;
@@ -2935,7 +2951,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
}
}
- /* Ingress table 12: Destination lookup for unknown MACs (priority 0). */
+ /* Ingress table 13: Destination lookup for unknown MACs (priority 0). */
HMAP_FOR_EACH (od, key_node, datapaths) {
if (!od->nbs) {
continue;
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index 42dfa4f..9d7f71a 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -301,6 +301,12 @@
If set, indicates the maximum burst size for data sent from this
interface, in bits.
+
+