static enum ofp_packet_in_reason
wire_reason(struct ofconn *ofconn, const struct ofproto_packet_in *pin)
{
- if (pin->generated_by_table_miss && pin->up.reason == OFPR_ACTION) {
+ if (pin->miss_type == OFPROTO_PACKET_IN_MISS_FLOW
+ && pin->up.reason == OFPR_ACTION) {
enum ofputil_protocol protocol = ofconn_get_protocol(ofconn);
if (protocol != OFPUTIL_P_NONE
OAM_N_TYPES
};
+enum ofproto_packet_in_miss_type {
+ /* Not generated by a flow miss or table-miss flow. */
+ OFPROTO_PACKET_IN_NO_MISS,
+
+ /* The packet_in was generated directly by a table-miss flow, that is, a
+ * flow with priority 0 that wildcards all fields. See OF1.3.3 section
+ * 5.4.
+ *
+ * (Our interpretation of "directly" is "not via groups". Packet_ins
+ * generated by table-miss flows via groups use
+ * OFPROTO_PACKET_IN_NO_MISS.) */
+ OFPROTO_PACKET_IN_MISS_FLOW,
+
+ /* The packet-in was generated directly by a table-miss, but not a
+ * table-miss flow. That is, it was generated by the OpenFlow 1.0, 1.1, or
+ * 1.2 table-miss behavior. */
+ OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW,
+};
+
/* A packet_in, with extra members to assist in queuing and routing it. */
struct ofproto_packet_in {
struct ofputil_packet_in up;
struct list list_node; /* For queuing. */
uint16_t controller_id; /* Controller ID to send to. */
int send_len; /* Length that the action requested sending. */
-
- /* True if the packet_in was generated directly by a table-miss flow, that
- * is, a flow with priority 0 that wildcards all fields. (Our
- * interpretation of "directly" is "not via groups".) */
- bool generated_by_table_miss;
+ enum ofproto_packet_in_miss_type miss_type;
};
/* Basics. */
pin.up.reason = OFPR_NO_MATCH;
pin.up.fmd.in_port = OFPP_LOCAL;
pin.send_len = b.size;
- pin.generated_by_table_miss = false;
+ pin.miss_type = OFPROTO_PACKET_IN_NO_MISS;
connmgr_send_packet_in(fo->connmgr, &pin);
ofpbuf_uninit(&b);
pin->up.cookie = OVS_BE64_MAX;
flow_get_metadata(&miss->flow, &pin->up.fmd);
pin->send_len = 0; /* Not used for flow table misses. */
- pin->generated_by_table_miss = false;
+ pin->miss_type = OFPROTO_PACKET_IN_NO_MISS;
ofproto_dpif_send_packet_in(miss->ofproto, pin);
}
}
pin->controller_id = controller_id;
pin->send_len = len;
- pin->generated_by_table_miss = (ctx->rule
- && rule_dpif_is_table_miss(ctx->rule));
+ /* If a rule is a table-miss rule then this is
+ * a table-miss handled by a table-miss rule.
+ *
+ * Else, if rule is internal and has a controller action,
+ * the later being implied by the rule being processed here,
+ * then this is a table-miss handled without a table-miss rule.
+ *
+ * Otherwise this is not a table-miss. */
+ pin->miss_type = OFPROTO_PACKET_IN_NO_MISS;
+ if (ctx->rule) {
+ if (rule_dpif_is_table_miss(ctx->rule)) {
+ pin->miss_type = OFPROTO_PACKET_IN_MISS_FLOW;
+ } else if (rule_dpif_is_internal(ctx->rule)) {
+ pin->miss_type = OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW;
+ }
+ }
ofproto_dpif_send_packet_in(ctx->xbridge->ofproto, pin);
ofpbuf_delete(packet);
}
return rule_is_table_miss(&rule->up);
}
+bool
+rule_dpif_is_internal(const struct rule_dpif *rule)
+{
+ return rule_is_internal(&rule->up);
+}
+
ovs_be64
rule_dpif_get_flow_cookie(const struct rule_dpif *rule)
OVS_REQUIRES(rule->up.mutex)
unixctl_command_register("dpif/dump-flows", "[-m] bridge", 1, 2,
ofproto_unixctl_dpif_dump_flows, NULL);
}
+
+
+/* Returns true if 'rule' is an internal rule, false otherwise. */
+bool
+rule_is_internal(const struct rule *rule)
+{
+ return rule->table_id == TBL_INTERNAL;
+}
\f
/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
*
bool rule_dpif_is_fail_open(const struct rule_dpif *);
bool rule_dpif_is_table_miss(const struct rule_dpif *);
+bool rule_dpif_is_internal(const struct rule_dpif *);
struct rule_actions *rule_dpif_get_actions(const struct rule_dpif *);
{
return rule->cr.priority == 0 && cls_rule_is_catchall(&rule->cr);
}
+bool rule_is_internal(const struct rule *);
/* A set of actions within a "struct rule".
*